Changeset fb061aa in github


Ignore:
Timestamp:
Mar 8, 2011 3:07:43 AM (2 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
c294eaa
Parents:
6f6efa2
Message:

Use PHPs session_regenerte_id() instead of using (unreliable) mt_rand() function (#1486281)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r6a4bccb rfb061aa  
    22=========================== 
    33 
     4- Get around unreliable rand() and mt_rand() in session ID generation (#1486281) 
    45- Fix some emails are not shown using Cyrus IMAP (#1487820) 
    56- Fix handling of mime-encoded words with non-integral number of octets in a word (#1487801) 
  • program/include/rcube_session.php

    r784a425 rfb061aa  
    213213    $this->vars = false; 
    214214 
    215     $randval = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
    216  
    217     for ($random = '', $i=1; $i <= 32; $i++) { 
    218       $random .= substr($randval, mt_rand(0,(strlen($randval) - 1)), 1); 
    219     } 
    220  
    221     // use md5 value for id 
    222     $this->key = md5($random); 
    223     session_id($this->key); 
    224  
    225     $cookie   = session_get_cookie_params(); 
    226     $lifetime = $cookie['lifetime'] ? time() + $cookie['lifetime'] : 0; 
    227  
    228     rcmail::setcookie(session_name(), $this->key, $lifetime); 
     215    session_regenerate_id(false); 
     216    $this->key = session_id(); 
    229217 
    230218    return true; 
Note: See TracChangeset for help on using the changeset viewer.