]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Compare the result of ldap_search_ext_s to LDAP_SUCCESS....
authorAdam <Adam@anope.org>
Thu, 11 Oct 2012 01:32:11 +0000 (21:32 -0400)
committerAdam <Adam@anope.org>
Thu, 11 Oct 2012 01:32:11 +0000 (21:32 -0400)
src/modules/extra/m_ldapauth.cpp

index 1b6a3a0d9aa591dd3560479287583a67ed6d509d..5d71e7389b6efb6b1c7619c6bd1c2cfbb5fc929e 100644 (file)
@@ -211,7 +211,7 @@ public:
                                std::string cutpassword = user->password.substr(0, pos);
                                res = ldap_search_ext_s(conn, base.c_str(), searchscope, cutpassword.c_str(), NULL, 0, NULL, NULL, NULL, 0, &msg);
 
-                               if (res)
+                               if (res == LDAP_SUCCESS)
                                {
                                        // Trim the user: prefix, leaving just 'pass' for later password check
                                        user->password = user->password.substr(pos + 1);
@@ -219,7 +219,7 @@ public:
                        }
 
                        // It may have found based on user:pass check above.
-                       if (!res)
+                       if (res != LDAP_SUCCESS)
                        {
                                if (verbose)
                                        ServerInstance->SNO->WriteToSnoMask('c', "Forbidden connection from %s!%s@%s (LDAP search failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res));