Changeset 4791
- Timestamp:
- 07/19/11 09:08:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.auth_ldap.inc.php
r3562 r4791 202 202 function change_password_user ($old_passwd, $new_passwd, $dn, $referrals=false) 203 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']); 204 if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) && 205 (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_dn'])) && 206 (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_pw'])) ) 207 { 208 $ds = $GLOBALS['phpgw']->common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_master_host'], 209 $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'], 210 $GLOBALS['phpgw_info']['server']['ldap_master_root_pw']); 211 } 212 else 213 { 214 $ds = $GLOBALS['phpgw']->common->ldapConnect(); 215 } 210 216 if (!$ds) 211 217 { 212 //system('echo "CP Nao conectou no ldap" >>/tmp/controle');213 218 $this->auth_reason = ldap_errno($ldap); 214 219 return False; … … 218 223 if ($referrals) 219 224 { 220 //system('echo "CP Entrou referrals" >>/tmp/controle');221 225 $this->passwd=$old_passwd; 222 226 $this->dn=$dn; … … 231 235 if (!@ldap_bind($ds,$dn,$old_passwd)) 232 236 { 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 $GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($new_passwd)); 248 return $new_passwd; 249 } 237 if (!@ldap_mod_replace($ds,$dn,$modify)) 238 { 239 $this->auth_reason = ldap_errno($ds); 240 return false; 241 } 242 else 243 { 244 $GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($new_passwd)); 245 return $new_passwd; 250 246 } 251 247 $this->auth_reason = ldap_errno($ds); … … 254 250 else 255 251 { 256 //system('echo "CP Conseguiu dar bind" >>/tmp/controle');257 252 if (!ldap_mod_replace($ds,$dn,$modify)) 258 253 { … … 262 257 else 263 258 { 264 265 259 $GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($new_passwd)); 260 return $new_passwd; 266 261 } 267 262 }
Note: See TracChangeset
for help on using the changeset viewer.