Show
Ignore:
Timestamp:
10/22/07 15:06:20 (5 years ago)
Author:
benoitg
Message:
  • Major security fix: Fix the authenticator for a security breach where a user could get Internet access using an empty username. LocalUser? and LDAP were definitely vulnerable, RADIUS may have been.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1289 r1304  
    121121     * This should NOT be called by anything except the Authenticators 
    122122     * 
    123      * @param object $user User a user object 
     123     * @param object $user User a user object, or null 
    124124     * 
    125125     * @return bool True if everything went well setting the session 
    126126 
    127127     */ 
    128     public static function setCurrentUser(User $user) { 
     128    public static function setCurrentUser($user) { 
     129 
     130        if (get_class($user) == 'User'){ 
     131            $userId = $user->getId(); 
     132            $passwordHash = $user->getPasswordHash(); 
     133        } 
     134        else { 
     135            $userId = null; 
     136            $passwordHash = null; 
     137        } 
     138 
    129139        try { 
    130140            $session = Session::getObject(); 
    131             $session->set(SESS_USER_ID_VAR, $user->getId()); 
    132             $session->set(SESS_PASSWORD_HASH_VAR, $user->getPasswordHash()); 
     141            $session->set(SESS_USER_ID_VAR, $userId); 
     142            $session->set(SESS_PASSWORD_HASH_VAR, $passwordHash); 
    133143            return true; 
    134144        } catch (Exception $e) { 
     
    330340        return $this->_row['open_id_url']; 
    331341    } 
    332      
     342 
    333343    function getUsername() { 
    334344        return $this->_row['username']; 
     
    936946            'title' => _("Import NoCat user database"), 
    937947            'url' => BASE_URL_PATH."admin/import_user_database.php" 
    938                 ); 
    939         } 
    940             if(Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_EDIT_ANY_USER'))) 
     948            ); 
     949        } 
     950        if(Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_EDIT_ANY_USER'))) 
    941951        { 
    942952            $items[] = array('path' => 'users/user_manager', 
    943953            'title' => _("User manager"), 
    944954            'url' => BASE_URL_PATH."admin/user_log.php" 
    945                 ); 
    946         } 
    947             if(Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_VIEW_STATISTICS'))) 
     955            ); 
     956        } 
     957        if(Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_VIEW_STATISTICS'))) 
    948958        { 
    949959            $items[] = array('path' => 'users/statistics', 
    950960            'title' => _("Statistics"), 
    951961            'url' => BASE_URL_PATH."admin/stats.php" 
    952                 ); 
     962            ); 
    953963        } 
    954964        $items[] = array('path' => 'users',