Permalink
Browse files

Compare the result of ldap_search_ext_s to LDAP_SUCCESS....

  • Loading branch information...
1 parent c870714 commit cad8e26a8f9a61f6d8a6dfa5127da98101181075 @Adam- Adam- committed Oct 11, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/modules/extra/m_ldapauth.cpp
@@ -211,15 +211,15 @@ class ModuleLDAPAuth : public Module
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);
}
}
// 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));

0 comments on commit cad8e26

Please sign in to comment.