LDAP de php informations d'identification non valides

Mon code est:

$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/>";
}

Maintenant, j'utilise la ligne de commentaire "3", bénéficiez:

Connected
Invalid credentials

Si l'utilisation de la ligne de commentaire "1" ou "2", bénéficiez:

Connected
Invalid DN syntax

Si l'utilisation de la ligne de commentaire "4" (c'est anonymouse), bénéficiez de:

Connected
Binded

C'est un développement sous Ubuntu 12.

Pourquoi je reçois des informations d'identification non valides erreur de commenter la ligne "3"? Comment lier avec l'authentification correctement?
Merci à l'avance!

  • Mon environnement est Ubuntu 12
InformationsquelleAutor user2241859 | 2013-12-11