summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-06-11 21:19:28 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-06-11 21:19:28 +0000
commite19f84d7cc5f6eaad2e34fd370060900f76a170c (patch)
tree160dbe946b3d0d31805745d80ae2c3102491ed99
parentd185decae97752368d5cf62311cbc0d1a52aa22c (diff)
Dont even bother to do the ldap bind if the password given is empty (performance boost)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9889 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/extra/m_ldapauth.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index ab56de6d7..211880f05 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -173,6 +173,13 @@ public:
ldap_msgfree(msg);
return false;
}
+ if (user->password.empty())
+ {
+ if (verbose)
+ ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (No password provided)", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+ user->Extend("ldapauth_failed");
+ return false;
+ }
cred.bv_val = (char*)user->password.data();
cred.bv_len = user->password.length();
if ((res = ldap_sasl_bind_s(conn, ldap_get_dn(conn, entry), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL)) == LDAP_SUCCESS)