php-LDAP-Ungültige Anmeldeinformationen

Mein code ist:

$user = 'test';
$password = 'testpass';
$host = '10.1.1.1';
$port = 389;
$basedn = 'dc=ci,dc=mycompany,dc=com';
$group = 'Users';
$ldaprdn = 'uid=test,dc=ci,dc=mycompany,dc=com';

$ad = ldap_connect("ldap://$host", $port);
if ($ad) {
    echo "Connected" . "<br/>";
} else {
    echo ldap_error($ad) . "<br/>";
}
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);

// $ldapBind = ldap_bind($ad, "{$user}@{$domain}", $password); //1.
// $ldapBind = ldap_bind($ad, $user, $password); //2.
    $ldapBind = ldap_bind($ad, $ldaprdn, $password); //3.
// $ldapBind = ldap_bind($ad, null, null); //4.

if ($ldapBind) {
    echo "Binded" . "<br/>";
} else {
    echo ldap_error($ad) . "<br/>";
}

Nun benutze ich die Kommentar Zeile "3", erhalten:

Connected
Invalid credentials

Wenn die Nutzung der Kommentar-Zeile, die mit "1" oder "2", erhalten:

Connected
Invalid DN syntax

Wenn die Nutzung der Kommentar-Zeile "4" (dies ist anonymouse), erhalten:

Connected
Binded

Dies ist die Entwicklung unter Ubuntu 12.

, Warum bekomme ich von Ungültigen Anmeldeinformationen Fehler von Kommentar-Zeile "3"? Wie binden Sie die Authentifizierung richtig?
Vielen Dank im Voraus!

  • Meine Umgebung ist Ubuntu 12
InformationsquelleAutor user2241859 | 2013-12-11
Schreibe einen Kommentar