[Samba] ldap_modify change password

Shem Pasamba shemgp at aiias.edu
Mon Feb 17 00:52:51 MST 2014


Hello,

I would like to change samba4 AD user's password using php.  Here's my code:

function UpdateLdapPassword($username, $newpassword)
{
                 global $ds;
                 global $rdn;


$entry["clearTextPassword"][0]=base64_encode(iconv('UTF-8','UTF-16LE',$newpassword));

                 $bReturn= ldap_modify ($ds, $rdn, $entry);

                 Debug ("msg:'".ldap_error($ds)."'<br><br>");

                 return $bReturn;
}

The logs display something like this:

[2014/02/17 15:38:04.542674, 10, pid=29998, effective(0, 0), real(0, 0), 
class=ldb] ../lib/ldb-samba/ldb_wrap.c:71(ldb_wrap_debug)
   ldb: start ldb transaction error: (null)
[2014/02/17 15:38:04.542810, 10, pid=29998, effective(0, 0), real(0, 0), 
class=ldb] ../lib/ldb-samba/ldb_wrap.c:71(ldb_wrap_debug)
   ldb: ldb_trace_request: MODIFY
   dn: CN=test1,OU=aiiasusers,DC=aiias,DC=edu
   changetype: modify
   replace: clearTextPassword
   clearTextPassword: SABhAHAAcAB5ADIAMAAxADQA
   -


    control: 1.3.6.1.4.1.7165.4.3.17  crit:0  data:no

But when I try to login to test1 using winbind in another machine it 
says Wrong password.  Is there anything wrong that I'm doing? Thanks for 
your help.

Shem G. Pasamba


More information about the samba mailing list