Hi.
I really had a hard time getting the authentication to my LDAP server to work.
After installing and configuring the ldap_integration module I was unable to log in using a LDAP-account.
The error message in the logs was:
LDAP-Login attempt failed for asmithee@server.com: Sorry. Unrecognized username or password. <a href="https://server.com/user/password">Have you forgotten your password?</a>.
After deep investigation I finally found the problem:
In LDAPInterface.php the function() sets a variable called $con which seems to be supposedly global. But that didn't work for me, after returning to the calling function connectAndBind() $con was empty again.
I fixed the problem by modifying establishConnection() to return $con.
Since the patch is so small, I think it's more useful to be able to see it right here rather than by downloading it. Sorry for any inconveniences.
- Christian
--- LDAPInterface.php.orig 2005-08-09 21:25:25.000000000 +0200
+++ LDAPInterface.php 2005-08-09 22:45:36.000000000 +0200
@@ -83,10 +83,11 @@
}
$this->connection = $con;
ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3);
+ return $con;
}
function connectAndBind($dn = '', $pass = '') {
- $this->establishConnection();
+ $con = $this->establishConnection();
//die('con: ' . $con . ', dn: ' . $dn . ', pass: ' . $pass . ', server: ' . $this->server . ', port: ' . $this->port);
// We don't want anonymous connections here
Comments
Comment #1
shredda commentedActually, it was Version 4.6.0. Sorry.
- Christian
Comment #2
shredda commentedHi and sorry again.
There is an even more straightforward solution to the problem:
And I discovered that the problem occurs only if a LDAP user logs in for the first time.
Once (s)he is in the database, everything works.
- Christian
Comment #3
pablobm commentedYou're right there. I left that one unnoticed.
However, the $con variable is needed for the debug and error messages at connectAndBind(), so I prefer the this solution, close to your second one:
Comment #4
pablobm commentedThis should've been closed, no marked as patched :P .
Comment #5
pablobm commentedSometimes, I really hate myself. Fixed it should've been. (Or, at least, so I think).
Comment #6
(not verified) commentedComment #7
pablobm commented