]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1370: squid_ldap_auth -U does not work
authorserassio <>
Wed, 14 Sep 2005 01:38:30 +0000 (01:38 +0000)
committerserassio <>
Wed, 14 Sep 2005 01:38:30 +0000 (01:38 +0000)
by peter stamfest <peter@stamfest.at>

Forward port of 2.5 change

helpers/basic_auth/LDAP/squid_ldap_auth.c

index 8e1a32aebb285c50186136e6be37117e495c79d4..cd366d4da0eb214a39128d1db590fc041e57de65 100644 (file)
@@ -724,14 +724,16 @@ checkLDAP(LDAP * persistent_ld, const char *userid, const char *password, const
     }
 
     if (debug)
-       fprintf(stderr, "attempting to bind to user '%s'\n", dn);
+       fprintf(stderr, "attempting to authenticate user '%s'\n", dn);
     if (!bind_ld && !bind_once)
        bind_ld = persistent_ld;
     if (!bind_ld)
        bind_ld = open_ldap_connection(ldapServer, port);
-    if (passwdattr && ldap_compare_s(bind_ld, dn, passwdattr, password) != LDAP_COMPARE_TRUE)
-       ret = 1;
-    else if (ldap_simple_bind_s(bind_ld, dn, password) != LDAP_SUCCESS)
+    if (passwdattr) {
+       if (ldap_compare_s(bind_ld, dn, passwdattr, password) != LDAP_COMPARE_TRUE) {
+           ret = 1;
+       }
+    } else if (ldap_simple_bind_s(bind_ld, dn, password) != LDAP_SUCCESS)
        ret = 1;
     if (bind_ld != persistent_ld) {
        ldap_unbind(bind_ld);