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

Re: userPassword in PHP


$entry['userpassword'] ="{md5}".base64_encode(pack("H*",md5($newpass)));

I always seem to have trouble with this myself.


Marlon Dutra wrote:
Hello peoples,

I'm trying to create a user in LDAP using ldap_add() of PHP 4, but I'm having a problem. I don't know how to store the userPassword using a MD5 hash.

I tried by some ways:

$ldapdata['userPassword'] = md5($password);
$ldapdata['userPassword'] = '{MD5}' . md5($password);
$ldapdata['userPassword'] = "{MD5}$password";

Nothing worked.

On the first two ways, the password goes encrypted to base, but when I try to authenticate, the password does not check.

Using ldap_add from shell, I always get success.

Any helps are welcome.

Merry christmas.

Kervin Pierre