]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ldapauth.cpp
httpd connection close fixes (these need to be backported to 1.1 at some point?)...
[user/henk/code/inspircd.git] / src / modules / extra / m_ldapauth.cpp
index 7de157601fdd26ac0fea2ed98af1e168a8a18740..60f1e8978f3a76aac7966c745ecc125f25607b13 100644 (file)
@@ -42,6 +42,7 @@ class ModuleLDAPAuth : public Module
        std::string password;
        int searchscope;
        bool verbose;
+       bool useusername;
        LDAP *conn;
        
 public:
@@ -73,6 +74,7 @@ public:
                username                = Conf.ReadValue("ldapauth", "binddn", 0);
                password                = Conf.ReadValue("ldapauth", "bindauth", 0);
                verbose                 = Conf.ReadFlag("ldapauth", "verbose", 0);              /* Set to true if failed connects should be reported to operators */
+               useusername             = Conf.ReadFlag("ldapauth", "userfield", 0);
                
                if (scope == "base")
                        searchscope = LDAP_SCOPE_BASE;
@@ -119,7 +121,7 @@ public:
 
                if (!CheckCredentials(user))
                {
-                       User::QuitUser(ServerInstance,user,killreason);
+                       ServerInstance->Users->QuitUser(user, killreason);
                        return 1;
                }
                return 0;
@@ -150,7 +152,7 @@ public:
                free(authpass);
 
                LDAPMessage *msg, *entry;
-               std::string what = (attribute + "=" + user->nick);
+               std::string what = (attribute + "=" + (useusername ? user->ident : user->nick));
                if ((res = ldap_search_ext_s(conn, base.c_str(), searchscope, what.c_str(), NULL, 0, NULL, NULL, NULL, 0, &msg)) != LDAP_SUCCESS)
                {
                        if (verbose)