Auth::LDAP problem
| From: | markkjtu at evtek dot fi | Date: | Wed, 12 May 2004 09:37:29 +0000 |
| Subject: | Auth::LDAP problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12431@lists.php.net to get a copy of this message | ||
Hello all,
I need to implement an ldap-authentication and as it has to be as universal as
possible I'd like to use PEAR's Auth module for it. I wrote a simple test
script to test the authentication and the results weren't quite what I
expected... :)
Here's the script (directory info changed - naturally):
<?php
require_once 'DB.php';
require_once "Auth/Auth.php";
/* Login view function (passed to pear's auth) */
function loginFunction(){
echo "<form method=\"post\" action=\"" .
$_SERVER['PHP_SELF'] . "\">";
echo "user<input type=\"text\" name=\"username\"><br
/>";
echo "pass<input type=\"password\" name=\"password\"><br
/>";
echo "<input type=\"submit\">";
echo "</form>";
}
/* Set the ldap server params, debug on */
$params = array(
"host" => "somedir.foobar.foo",
"port" => "389",
"basedn" => "ou=people,dc=foobar,dc=foo",
"userattr" => "uid",
"binddn" => "cn=someuser,ou=people,dc=foobar,dc=foo",
"bindpw" => "PASSWORD",
"debug" => true
);
/* Create an instance of the auth class and start the authentication process */
$a = new Auth("LDAP", $params, "loginFunction");
$a->start();
if ($a->getAuth()) {
echo "<br/><b>User authenticated!</b>";
} else {
echo "<br/><b>User not authenticated!</b>";
}
?>
So I got the debug on. This is the result:
332: LDAP search function will be: ldap_search
186: Connecting with host:port
193: Successfully connected to server
So everything seems to be fine but the program just stops. No error message or
anything. I checked the PEAR code and the next thing it will try to do (after
connecting to server) is that it tries to change the version or something.
Could that be the cause of the problem? Version of our Auth module is 1.67 and
the version of the LDAP container is 1.14.
Anyone else having these kind of problems?
Oh. What's our ldap-server? Actually I don't know for sure but I think it is
novell... :)
Thanks in advance.
Markku