0) { // we only care about the first dn $userDN = $allValues[0]["dn"]; // generate a bogus password to pass if the user doesn't give us one // this gets around systems that are anonymous search enabled if (empty($passwd)) $passwd = crypt(microtime()); // try to bind as the user with user suplied password if (ldap_bind($ldap,$userDN, $passwd)) return True; } // Turn error reporting back to normal error_reporting(7); // dn not found or password wrong return False; } function change_password($old_passwd, $new_passwd) { global $phpgw_info, $phpgw; $ldap = ldap_connect($phpgw_info["server"]["ldap_host"]); if (! @ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) { echo "
Error binding to LDAP server. Check your config"; $phpgw->common->phpgw_exit(); } $encrypted_passwd = $phpgw->common->encrypt_password($new_passwd); $entry["userpassword"] = $encrypted_passwd $entry["phpgw_lastpasswd_change"] = time(); $dn = $phpgw_info["user"]["account_dn"]; @ldap_modify($ldap, $dn, $entry); return $encrypted_passwd; } } ?>