]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ldapauth.cpp
Remove spanningtree override of /LUSERS
[user/henk/code/inspircd.git] / src / modules / extra / m_ldapauth.cpp
index 013bdd1102ab5c5f0c43f6d9ef54358a0c35620a..af676de44d27bede5fcbc6dd60c567c902d1c52b 100644 (file)
@@ -111,7 +111,7 @@ public:
                return true;
        }
 
-       ModResult OnUserRegister(User* user)
+       ModResult OnUserRegister(LocalUser* user)
        {
                if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
                {
@@ -127,17 +127,16 @@ public:
                return MOD_RES_PASSTHRU;
        }
 
-       bool CheckCredentials(User* user)
+       bool CheckCredentials(LocalUser* user)
        {
                if (conn == NULL)
                        if (!Connect())
                                return false;
 
                int res;
-               char* authpass = strdup(password.c_str());
                // bind anonymously if no bind DN and authentication are given in the config
                struct berval cred;
-               cred.bv_val = authpass;
+               cred.bv_val = const_cast<char*>(password.c_str());
                cred.bv_len = password.length();
 
                if ((res = ldap_sasl_bind_s(conn, username.c_str(), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL)) != LDAP_SUCCESS)
@@ -155,13 +154,11 @@ public:
                        {
                                if (verbose)
                                        ServerInstance->SNO->WriteToSnoMask('c', "Forbidden connection from %s!%s@%s (LDAP bind failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res));
-                               free(authpass);
                                ldap_unbind_ext(conn, NULL, NULL);
                                conn = NULL;
                                return false;
                        }
                }
-               free(authpass);
 
                LDAPMessage *msg, *entry;
                std::string what = (attribute + "=" + (useusername ? user->ident : user->nick));
@@ -208,14 +205,14 @@ public:
                }
        }
 
-       ModResult OnCheckReady(User* user)
+       ModResult OnCheckReady(LocalUser* user)
        {
                return ldapAuthed.get(user) ? MOD_RES_PASSTHRU : MOD_RES_DENY;
        }
 
        Version GetVersion()
        {
-               return Version("Allow/Deny connections based upon answer from LDAP server", VF_VENDOR, API_VERSION);
+               return Version("Allow/Deny connections based upon answer from LDAP server", VF_VENDOR);
        }
 
 };