[Date Prev][Date Next] [Chronological] [Thread] [Top]

Crypt problem



- I've create some entries in my ldap directory like

dn: cn=LEROYER Benoit, o=mydomain, c=com
cn: LEROYER Benoit
mail: benoit@gide.net
telephonenumber: 0404040404
userpassword: {crypt}hXftnFjtDk4Y2 --> encrypted password ( example : Mypasswd )


objectclass: person


- I would like to use with PHP page like

<?
$server = "ldap://benzecri"; ;
$racine = "o=gide, c=net" ;
$rootdn = "cn=ldap_admin, o=gide, c=net" ;
$rootpw = secret;

$ds=ldap_connect($server);
if($ds==1)
 {
  $r=ldap_bind($ds,$rootdn,$rootpw);

  $dn = "cn=LEROYER benoit, o=gide, c=net";

$value = ; <-- ( I don't know what i have to put here , crypt password, plain text password ...? )

  $attr = "userPassword";

  $result=ldap_compare($ds, $dn, $attr, $value);
  if ($result === -1) {
      echo "Error:".ldap_error($ds)."<br/>";
  }
  elseif ($result === TRUE) {
      echo "ok password <br/>";
  }
  else  {
      echo "wrong password <br/>";
  }
  ldap_close($ds);
 }
 else {
  echo "Impossible de se connecter au serveur LDAP";
 }
?>




Which syntax for $value = ?


Thanks


-- ------------------------------------------ Benoit LEROYER - G.I.D.E (benoit@gide.net) Tél : 02.40.89.92.87 Web : http://www.gide.net ------------------------------------------