]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sasl.cpp
Allow the maximum length of a chanfilter message to be configured.
[user/henk/code/inspircd.git] / src / modules / m_sasl.cpp
index fe1438ccffe7c59a8c1d747a58d72a8f8f476693..2fc0725a98a4e1007fa7bef2d499d370b0c74844 100644 (file)
@@ -23,7 +23,7 @@
 #include "modules/account.h"
 #include "modules/sasl.h"
 #include "modules/ssl.h"
-#include "modules/spanningtree.h"
+#include "modules/server.h"
 
 enum
 {
@@ -37,7 +37,7 @@ enum
 
 static std::string sasl_target;
 
-class ServerTracker : public SpanningTreeEventListener
+class ServerTracker : public ServerEventListener
 {
        bool online;
 
@@ -65,7 +65,7 @@ class ServerTracker : public SpanningTreeEventListener
 
  public:
        ServerTracker(Module* mod)
-               : SpanningTreeEventListener(mod)
+               : ServerEventListener(mod)
        {
                Reset();
        }
@@ -172,8 +172,9 @@ class SaslAuthenticator
        void SendHostIP()
        {
                parameterlist params;
-               params.push_back(user->host);
+               params.push_back(user->GetRealHost());
                params.push_back(user->GetIPString());
+               params.push_back(SSLIOHook::IsSSL(&user->eh) ? "S" : "P");
 
                SendSASL(user, "*", 'H', params);
        }
@@ -303,7 +304,7 @@ class CommandAuthenticate : public SplitCommand
                allow_empty_last_param = false;
        }
 
-       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user)
+       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user) CXX11_OVERRIDE
        {
                {
                        if (!cap.get(user))
@@ -340,7 +341,7 @@ class CommandSASL : public Command
                this->flags_needed = FLAG_SERVERONLY; // should not be called by users
        }
 
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user)
+       CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE
        {
                User* target = ServerInstance->FindUUID(parameters[1]);
                if (!target)
@@ -362,7 +363,7 @@ class CommandSASL : public Command
                return CMD_SUCCESS;
        }
 
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE
        {
                return ROUTE_BROADCAST;
        }
@@ -397,7 +398,11 @@ class ModuleSASL : public Module
 
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
-               sasl_target = ServerInstance->Config->ConfValue("sasl")->getString("target", "*");
+               std::string target = ServerInstance->Config->ConfValue("sasl")->getString("target");
+               if (target.empty())
+                       throw ModuleException("<sasl:target> must be set to the name of your services server!");
+
+               sasl_target = target;
                servertracker.Reset();
        }