Changeset 1681 for trunk/phpgwapi/inc/class.auth_ldap.inc.php
- Timestamp:
- 11/19/09 13:59:58 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.auth_ldap.inc.php
r393 r1681 200 200 } 201 201 202 function change_password_user ($old_passwd, $new_passwd, $dn, $referrals=false) 203 { 204 //Use with RHDS 205 //system('echo "CP old_passwd: '.$old_passwd.'" >>/tmp/controle'); 206 //system('echo "CP new_passwd: '.$new_passwd.'" >>/tmp/controle'); 207 //system('echo "CP dn: '.$dn.'" >>/tmp/controle'); 208 //system('echo "CP referrals: '.$referrals.'" >>/tmp/controle'); 209 $ds=ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 210 if (!$ds) 211 { 212 //system('echo "CP Nao conectou no ldap" >>/tmp/controle'); 213 $this->auth_reason = ldap_errno($ldap); 214 return False; 215 } 216 else 217 { 218 if ($referrals) 219 { 220 //system('echo "CP Entrou referrals" >>/tmp/controle'); 221 $this->passwd=$old_passwd; 222 $this->dn=$dn; 223 ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); 224 ldap_set_option($ds, LDAP_OPT_REFERRALS, 1); 225 if($GLOBALS['phpgw_info']['server']['diretorioescravo']) 226 { 227 ldap_set_rebind_proc($ds, array($this, '_rebindProc')); 228 } 229 } 230 $modify["userpassword"]=$new_passwd; 231 if (!@ldap_bind($ds,$dn,$old_passwd)) 232 { 233 //system('echo "CP nao conseguiu dar bind" >>/tmp/controle'); 234 //Se a politica estiver no diretorio eh necessario tentar alterar a senha mesmo que nao haja um bind, pois a negacao de bind pode ser proveniente de uma expiracao 235 if($GLOBALS['phpgw_info']['server']['politicasenhas']=='diretorio') 236 { 237 //system('echo "CP politica eh no diretorio" >>/tmp/controle'); 238 if (!@ldap_mod_replace($ds,$dn,$modify)) 239 { 240 //system('echo "CP nao conseguiu fazer replace!" >>/tmp/controle'); 241 $this->auth_reason = ldap_errno($ds); 242 return false; 243 } 244 else 245 { 246 //system('echo "CP replace funcionou!" >>/tmp/controle'); 247 return $new_passwd; 248 } 249 } 250 $this->auth_reason = ldap_errno($ds); 251 return False; 252 } 253 else 254 { 255 //system('echo "CP Conseguiu dar bind" >>/tmp/controle'); 256 if (!ldap_mod_replace($ds,$dn,$modify)) 257 { 258 $this->auth_reason = ldap_errno($ds); 259 return False; 260 } 261 else 262 { 263 return $new_passwd; 264 } 265 } 266 } 267 } 268 269 202 270 function update_lastlogin($_account_id, $ip) 203 271 {
Note: See TracChangeset
for help on using the changeset viewer.