Changeset 2910


Ignore:
Timestamp:
06/09/10 11:25:39 (14 years ago)
Author:
niltonneto
Message:

Ticket #1041 - Reativada configuração "Verificar endereço IP de todas sessões".

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/header.session.inc.php

    r2909 r2910  
    1919        $user_agent = array(); 
    2020        if (isset($GLOBALS['phpgw']) && !isset($_SESSION['connection_db_info'])){ 
     21                $_SESSION['phpgw_info']['admin']['server']['sessions_checkip'] = $GLOBALS['phpgw_info']['server']['sessions_checkip']; 
    2122                if($GLOBALS['phpgw_info']['server']['use_https'] == 1) { 
    2223                $new_ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR']."," : ""). $_SERVER['REMOTE_ADDR']; 
    2324                $GLOBALS['phpgw']->db->query("UPDATE phpgw_access_log SET ip='$new_ip' WHERE account_id <> 0 and lo = 0 and sessionid='{$GLOBALS['sessionid']}'",__LINE__,__FILE__); 
    2425                } 
    25                 $GLOBALS['phpgw']->db->query("select trim(sessionid), ip, browser from phpgw_access_log where account_id <> 0 and lo = 0 and sessionid='{$GLOBALS['sessionid']}' limit 1",__LINE__,__FILE__); 
     26                $GLOBALS['phpgw']->db->query("select trim(sessionid),".($_SESSION['phpgw_info']['admin']['server']['sessions_checkip'] ? "ip," : "")."browser from phpgw_access_log where account_id <> 0 and lo = 0 and sessionid='{$GLOBALS['sessionid']}' limit 1",__LINE__,__FILE__); 
    2627                $GLOBALS['phpgw']->db->next_record(); 
    2728                if($GLOBALS['phpgw']->db->row( )) 
     
    3233                $http_user_agent = substr($_SERVER[ 'HTTP_USER_AGENT' ],0,199); 
    3334                $user_ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? array($_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_X_FORWARDED_FOR']) : array($_SERVER['REMOTE_ADDR']); 
    34                 $user_agent[] = "{$sess['session_id']}{$user_ip[0]}".$http_user_agent; 
     35                $user_agent[] = ($_SESSION['phpgw_info']['admin']['server']['sessions_checkip'] ? "{$sess['session_id']}{$user_ip[0]}" : "{$sess['session_id']}").$http_user_agent; 
    3536                if(count($user_ip) == 2) { 
    3637                        $user_agent[] = "{$sess['session_id']}{$user_ip[1]}".$http_user_agent; 
  • trunk/phpgwapi/inc/class.sessions.inc.php

    r2855 r2910  
    343343                        } 
    344344 
    345                         /* ExpressoLivre 
    346                            Necessário comentar para que o redirecionamento de uma sessão 
    347                            https para uma http funcionasse atrás de um proxy 
    348                         */ 
    349  
    350                         /* 
    351                         if (@$GLOBALS['phpgw_info']['server']['sessions_checkip']) 
    352                         { 
    353                                 if((PHP_OS != 'Windows') && (PHP_OS != 'WINNT') && 
    354                                         (!$GLOBALS['phpgw_info']['user']['session_ip'] || $GLOBALS['phpgw_info']['user']['session_ip'] != $this->getuser_ip()) 
    355                                 ) 
    356                                 { 
    357                                         //echo "IP do cliente com https   ---->  ".$GLOBALS['phpgw_info']['user']['session_ip']; 
    358                                         //echo "<BR>IP do cliente com http ---->  ".$this->getuser_ip(); 
    359                                         if(is_object($GLOBALS['phpgw']->log)) 
    360                                         { 
    361                                                 // This needs some better wording 
    362                                                 $GLOBALS['phpgw']->log->message(array( 
    363                                                         'text' => 'W-VerifySession, IP %1 doesn\'t match IP %2 in session table', 
    364                                                         'p1'   => $this->getuser_ip(), 
    365                                                         'p2'   => $GLOBALS['phpgw_info']['user']['session_ip'], 
    366                                                         'line' => __LINE__, 
    367                                                         'file' => __FILE__ 
    368                                                 )); 
    369                                                 $GLOBALS['phpgw']->log->commit(); 
    370                                         } 
    371                                         return False; 
    372                                 } 
    373                         } 
    374                         */ 
    375  
    376345                        $GLOBALS['phpgw']->acl->acl($this->account_id); 
    377346                        $GLOBALS['phpgw']->accounts->accounts($this->account_id); 
Note: See TracChangeset for help on using the changeset viewer.