From: Adam Date: Thu, 11 Oct 2012 01:32:11 +0000 (-0400) Subject: Compare the result of ldap_search_ext_s to LDAP_SUCCESS.... X-Git-Tag: v2.0.23~518 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=cad8e26a8f9a61f6d8a6dfa5127da98101181075;hp=c8707149b2a9a1b9774457c2d1629d37920b9f74;p=user%2Fhenk%2Fcode%2Finspircd.git Compare the result of ldap_search_ext_s to LDAP_SUCCESS.... --- diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 1b6a3a0d9..5d71e7389 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -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));