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

Re: ACL Stuff and changing passwords




On Wed, 27 Sep 2000, Joseph Hoot wrote:

> 3) If I try to use ldappasswd with user "jhoot" , for example, the ldap
> server
> denies this user from changing his password.  The command I used is the
> following:
> # Allow the manager and user to change the user's password
> access to attrs=userpassword
>         by self write
>         by dn="cn=Manager,dc=nowcom,dc=com" write
>         by * search
add
          by anonymous auth


> 4) Is anyone using PHP's ldap_modify() to change passwords?  If so, would you
> mind posting an example?
> 

here you go.  make sure to add error checking code. 

    $li=ldap_connect($ldap_server_name,$ldap_server_port);
    $r=ldap_bind($li,$binddn,$bindpw);
    $dn=$binddn;  // can be any dn as long as $binddn has access to modify
    $buf['userpassword'] = "{CRYPT}".crypt($new_pass);
    ldap_modify($li, $dn, $buf));
    ldap_close($li);


-Igor