]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sasl.cpp
m_sasl: send host/ip info
[user/henk/code/inspircd.git] / src / modules / m_sasl.cpp
index 16a15357f57e9eef8720a34d1a3caf01a723324a..db96f9dfaa0039439214d173e0549d987c4a8c0e 100644 (file)
@@ -51,10 +51,26 @@ class SaslAuthenticator
        SaslResult result;
        bool state_announced;
 
+       void SendHostIP()
+       {
+               parameterlist params;
+               params.push_back(sasl_target);
+               params.push_back("SASL");
+               params.push_back(user->uuid);
+               params.push_back("*");
+               params.push_back("H");
+               params.push_back(user->host);
+               params.push_back(user->GetIPString());
+
+               SendSASL(params);
+       }
+
  public:
        SaslAuthenticator(User* user_, const std::string& method)
                : user(user_), state(SASL_INIT), state_announced(false)
        {
+               SendHostIP();
+
                parameterlist params;
                params.push_back(sasl_target);
                params.push_back("SASL");
@@ -268,7 +284,7 @@ class ModuleSASL : public Module
        void init()
        {
                OnRehash(NULL);
-               Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnRehash };
+               Implementation eventlist[] = { I_OnEvent, I_OnUserConnect, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
 
                ServiceProvider* providelist[] = { &auth, &sasl, &authExt };
@@ -283,7 +299,7 @@ class ModuleSASL : public Module
                sasl_target = ServerInstance->Config->ConfValue("sasl")->getString("target", "*");
        }
 
-       ModResult OnUserRegister(LocalUser *user)
+       void OnUserConnect(LocalUser *user)
        {
                SaslAuthenticator *sasl_ = authExt.get(user);
                if (sasl_)
@@ -291,8 +307,6 @@ class ModuleSASL : public Module
                        sasl_->Abort();
                        authExt.unset(user);
                }
-
-               return MOD_RES_PASSTHRU;
        }
 
        Version GetVersion()