Changeset 4791


Ignore:
Timestamp:
07/19/11 09:08:45 (13 years ago)
Author:
roberto.santosjunior
Message:

Ticket #1820 - Erro quando usuario Troca a senha em Suas preferencias.r4643

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.auth_ldap.inc.php

    r3562 r4791  
    202202                function change_password_user ($old_passwd, $new_passwd, $dn, $referrals=false) 
    203203                { 
    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                        } 
    210216                        if (!$ds) 
    211217                                { 
    212                                 //system('echo "CP Nao conectou no ldap" >>/tmp/controle'); 
    213218                                $this->auth_reason = ldap_errno($ldap); 
    214219                                return False; 
     
    218223                                if ($referrals) 
    219224                                        { 
    220                                         //system('echo "CP Entrou referrals" >>/tmp/controle'); 
    221225                                        $this->passwd=$old_passwd; 
    222226                                        $this->dn=$dn; 
     
    231235                                if (!@ldap_bind($ds,$dn,$old_passwd)) 
    232236                                        { 
    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; 
    250246                                                } 
    251247                                        $this->auth_reason = ldap_errno($ds); 
     
    254250                                        else 
    255251                                        { 
    256                                         //system('echo "CP Conseguiu dar bind" >>/tmp/controle'); 
    257252                                        if (!ldap_mod_replace($ds,$dn,$modify)) 
    258253                                                { 
     
    262257                                                else 
    263258                                                { 
    264                                                 $GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($new_passwd)); 
    265                                                 return $new_passwd; 
     259                                                $GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($new_passwd)); 
     260                                                return $new_passwd; 
    266261                                                } 
    267262                                        } 
Note: See TracChangeset for help on using the changeset viewer.