]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ldapauth.cpp
not test compiled yet: sql modules werent working because someone chopped out the...
[user/henk/code/inspircd.git] / src / modules / extra / m_ldapauth.cpp
index ab56de6d7f6e786fc2582a98fcfb055989118792..603ea86385c2181ad6b1dceecd512f660a19abb7 100644 (file)
@@ -47,7 +47,7 @@ class ModuleLDAPAuth : public Module
 
 public:
        ModuleLDAPAuth(InspIRCd* Me)
-       : Module::Module(Me)
+       : Module(Me)
        {
                conn = NULL;
                Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRehash, I_OnUserRegister };
@@ -113,7 +113,7 @@ public:
 
        virtual int OnUserRegister(User* user)
        {
-               if ((!allowpattern.empty()) && (ServerInstance->MatchText(user->nick,allowpattern)))
+               if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
                {
                        user->Extend("ldapauthed");
                        return 0;
@@ -173,6 +173,13 @@ public:
                        ldap_msgfree(msg);
                        return false;
                }
+               if (user->password.empty())
+               {
+                       if (verbose)
+                               ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (No password provided)", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+                       user->Extend("ldapauth_failed");
+                       return false;
+               }
                cred.bv_val = (char*)user->password.data();
                cred.bv_len = user->password.length();
                if ((res = ldap_sasl_bind_s(conn, ldap_get_dn(conn, entry), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL)) == LDAP_SUCCESS)
@@ -205,7 +212,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version(1,2,0,0,VF_VENDOR,API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
 
 };