LDAP LINUX

Problems with the Linux version of XAMPP, questions, comments, and anything related.

LDAP LINUX

Postby simonb » 28. November 2005 15:19

I am trying to authenticate against an LDAP server. I can connect anonimously ok, but when I issue ldap_start_tls in order to bind with a username and password then I get the following error.

Warning: ldap_start_tls(): Unable to start TLS: Connect error in /opt/lampp/htdocs/mambo/test/index.php on line 9

Anyone else had this problem??


Code: Select all
$ds = @ldap_connect($host, '389') or die("<b>[ERROR] ldap_plugin - Unable to connect to LDAP Server : " . $ldap_host . ":" . $ldap_port . "</b><hr>"); -- line 9
ldap_start_tls($ds);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$r = ldap_search($ds, 'ou=INFO,ou=INFOSERVS,o=BHT', "cn=simonb");
             if ($r) {
           // Attempt to bind as that user.
                        $result = @ldap_get_entries($ds, $r);
               echo($result[0]['dn']);
                        if (@ldap_bind($ds, $result[0]['dn'], $password)) {
                                // valid user. kick back the username.
                                         return $username;
                        } else {
                                // Nope, invalid password.
                                return false;
                        }
   }
 ?>
simonb
 
Posts: 3
Joined: 28. November 2005 14:46

Postby Wiedmann » 28. November 2005 17:02

Code: Select all
ldap_connect($host, '389');
ldap_start_tls($ds);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

Wrong sequence. You must use ldap_set_option() directly after ldap_connect().

BTW: You can try to use a newer XAMPP, too.

BTW: The LDAP port is an integer and not a string.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby simonb » 29. November 2005 09:40

still no joy. I have spent some time looking at the system I am running suse 8.2 it does have openldap installed as well as the xampp version.

Do we need to create a certificate?

Code: Select all
$ds = @ldap_connect($host, 389) or die("<b>[ERROR] ldap_plugin - Unable to connect to LDAP Server : " . $ldap_host . ":" . $ldap_port . "</b><hr>");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_start_tls($ds);
simonb
 
Posts: 3
Joined: 28. November 2005 14:46


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 6 guests