From e19f84d7cc5f6eaad2e34fd370060900f76a170c Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 11 Jun 2008 21:19:28 +0000 Subject: 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 --- src/modules/extra/m_ldapauth.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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) -- cgit v1.2.3