Changeset bac7d17 in github


Ignore:
Timestamp:
Jul 18, 2006 5:02:43 PM (7 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
66e2bfa
Parents:
321302e
Message:

Fixed bugs #1364122, #1468895, ticket #1483811 and other minor bugs

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • .htaccess

    ra8b87f6 rbac7d17  
    11# AddDefaultCharset     UTF-8 
    22php_flag        display_errors  Off 
     3php_flag        log_errors      On 
     4php_value       error_log       logs/errors 
    35php_value       upload_max_filesize     2M 
    46 
  • CHANGELOG

    r321302e rbac7d17  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42006/07/18 
     5---------- 
     6- Fixed password with spaces issue (Bug #1364122) 
     7- Replaced _auth hash with second cookie (Ticket #1483811) 
     8- Don't use get_input_value() for passwords (Bug #1468895) 
     9- Made password encryption key configurable 
     10- Minor bugfixes with charset encoding 
     11 
    312 
    4132006/07/07 
  • config/main.inc.php.dist

    rb4b0817 rbac7d17  
    9999// check client IP in session athorization 
    100100$rcmail_config['ip_check'] = TRUE; 
     101 
     102// this key is used to encrypt the users imap password which is stored 
     103// in the session record (and the client cookie if remember password is enabled). 
     104// please provide a string of exactly 24 chars. 
     105$rcmail_config['des_key'] = 'rcmail-!24ByteDESkey*Str'; 
    101106 
    102107// the default locale setting 
  • index.php

    r321302e rbac7d17  
    33 +-----------------------------------------------------------------------+ 
    44 | RoundCube Webmail IMAP Client                                         | 
    5  | Version 0.1-20060505                                                  | 
     5 | Version 0.1-20060718                                                  | 
    66 |                                                                       | 
    77 | Copyright (C) 2005, RoundCube Dev. - Switzerland                      | 
     
    4141*/ 
    4242 
    43 define('RCMAIL_VERSION', '0.1-20060707'); 
     43define('RCMAIL_VERSION', '0.1-20060718'); 
    4444 
    4545// define global vars 
     
    5454else 
    5555  $INSTALL_PATH .= '/'; 
    56          
     56 
     57 
     58// make sure path_separator is defined 
     59if (!defined('PATH_SEPARATOR')) 
     60  define('PATH_SEPARATOR', (eregi('win', PHP_OS) ? ';' : ':')); 
     61 
     62 
    5763// RC include folders MUST be included FIRST to avoid other 
    5864// possible not compatible libraries (i.e PEAR) to be included 
     
    9096 
    9197// catch some url/post parameters 
    92 $_auth = get_input_value('_auth', RCUBE_INPUT_GPC); 
     98//$_auth = get_input_value('_auth', RCUBE_INPUT_GPC); 
    9399$_task = get_input_value('_task', RCUBE_INPUT_GPC); 
    94100$_action = get_input_value('_action', RCUBE_INPUT_GPC); 
     
    105111 
    106112// set session related variables 
    107 $COMM_PATH = sprintf('./?_auth=%s&_task=%s', $sess_auth, $_task); 
    108 $SESS_HIDDEN_FIELD = sprintf('<input type="hidden" name="_auth" value="%s" />', $sess_auth); 
     113$COMM_PATH = sprintf('./?_task=%s', $_task); 
     114$SESS_HIDDEN_FIELD = ''; 
    109115 
    110116 
     
    147153    } 
    148154  else if (isset($_POST['_user']) && isset($_POST['_pass']) && 
    149            rcmail_login(get_input_value('_user', RCUBE_INPUT_POST), 
    150                         get_input_value('_pass', RCUBE_INPUT_POST), 
    151                         $host)) 
     155           rcmail_login(get_input_value('_user', RCUBE_INPUT_POST), $_POST['_pass'], $host)) 
    152156    { 
    153157    // send redirect 
     
    169173  } 
    170174 
    171 // check session cookie and auth string 
    172 else if ($_action!='login' && $sess_auth && $_SESSION['user_id']) 
    173   { 
    174   if ($_auth !== $sess_auth || $_auth != rcmail_auth_hash($_SESSION['client_id'], $_SESSION['auth_time']) || 
     175// check session and auth cookie 
     176else if ($_action!='login' && $_SESSION['user_id']) 
     177  { 
     178  if (!rcmail_authenticate_session() || 
    175179      ($CONFIG['session_lifetime'] && isset($SESS_CHANGED) && $SESS_CHANGED + $CONFIG['session_lifetime']*60 < mktime())) 
    176180    { 
  • program/include/main.inc

    rc8c1e0ef rbac7d17  
    4747  rcmail_load_host_config($CONFIG); 
    4848   
    49   $CONFIG['skin_path'] = $CONFIG['skin_path'] ? preg_replace('/\/$/', '', $CONFIG['skin_path']) : 'skins/default'; 
     49  $CONFIG['skin_path'] = $CONFIG['skin_path'] ? unslashify($CONFIG['skin_path']) : 'skins/default'; 
    5050 
    5151  // load db conf 
     
    5656    $CONFIG['log_dir'] = $INSTALL_PATH.'logs'; 
    5757  else 
    58     $CONFIG['log_dir'] = ereg_replace('\/$', '', $CONFIG['log_dir']); 
     58    $CONFIG['log_dir'] = unslashify($CONFIG['log_dir']); 
    5959 
    6060  // set PHP error logging according to config 
     
    6868  else 
    6969    ini_set('display_errors', 0); 
    70    
     70 
     71 
    7172  // set session garbage collecting time according to session_lifetime 
    7273  if (!empty($CONFIG['session_lifetime'])) 
     
    8283     
    8384  // we can use the database for storing session data 
    84   // session queries do not work with MDB2 
    8585  if (!$DB->is_error()) 
    8686    include_once('include/session.inc'); 
     
    9191 
    9292  // create session and set session vars 
    93   if (!$_SESSION['client_id']) 
    94     { 
    95     $_SESSION['client_id'] = $sess_id; 
     93  if (!isset($_SESSION['auth_time'])) 
     94    { 
    9695    $_SESSION['user_lang'] = rcube_language_prop($CONFIG['locale_string']); 
    9796    $_SESSION['auth_time'] = mktime(); 
    98     $_SESSION['auth'] = rcmail_auth_hash($sess_id, $_SESSION['auth_time']); 
    99     unset($GLOBALS['_auth']); 
     97    setcookie('sessauth', rcmail_auth_hash($sess_id, $_SESSION['auth_time'])); 
    10098    } 
    10199 
    102100  // set session vars global 
    103   $sess_auth = $_SESSION['auth']; 
    104101  $sess_user_lang = rcube_language_prop($_SESSION['user_lang']); 
    105102 
     
    149146     } 
    150147  } 
    151    
     148 
    152149 
    153150// create authorization hash 
     
    168165  } 
    169166 
     167 
     168// compare the auth hash sent by the client with the local session credentials 
     169function rcmail_authenticate_session() 
     170  { 
     171  $now = mktime(); 
     172  $valid = ($_COOKIE['sessauth'] == rcmail_auth_hash(session_id(), $_SESSION['auth_time'])); 
     173   
     174  // renew auth cookie every 5 minutes 
     175  if (!$valid || ($now-$_SESSION['auth_time'] > 300)) 
     176    { 
     177    $_SESSION['auth_time'] = $now; 
     178    setcookie('sessauth', rcmail_auth_hash(session_id(), $now)); 
     179    } 
     180     
     181  return $valid; 
     182  } 
    170183 
    171184 
     
    719732 
    720733 
     734// encrypt IMAP password using DES encryption 
    721735function encrypt_passwd($pass) 
    722736  { 
    723   $cypher = des('rcmail?24BitPwDkeyF**ECB', $pass, 1, 0, NULL); 
     737  $cypher = des(get_des_key(), $pass, 1, 0, NULL); 
    724738  return base64_encode($cypher); 
    725739  } 
    726740 
    727741 
     742// decrypt IMAP password using DES encryption 
    728743function decrypt_passwd($cypher) 
    729744  { 
    730   $pass = des('rcmail?24BitPwDkeyF**ECB', base64_decode($cypher), 0, 0, NULL); 
    731   return trim($pass); 
     745  $pass = des(get_des_key(), base64_decode($cypher), 0, 0, NULL); 
     746  return preg_replace('/\x00/', '', $pass); 
     747  } 
     748 
     749 
     750// return a 24 byte key for the DES encryption 
     751function get_des_key() 
     752  { 
     753  $key = !empty($GLOBALS['CONFIG']['des_key']) ? $GLOBALS['CONFIG']['des_key'] : 'rcmail?24BitPwDkeyF**ECB'; 
     754  $len = strlen($key); 
     755   
     756  // make sure the key is exactly 24 chars long 
     757  if ($len<24) 
     758    $key .= str_repeat('_', 24-$len); 
     759  else if ($len>24) 
     760    substr($key, 0, 24); 
     761   
     762  return $key; 
    732763  } 
    733764 
     
    803834  global $CONFIG; 
    804835 
    805   $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : ''); 
     836  $temp_dir = slashify($CONFIG['temp_dir']); 
    806837  $cache_dir = $temp_dir.$sess_id; 
    807838 
  • program/include/rcube_imap.inc

    r25d8ba6 rbac7d17  
    17331733   * @access static 
    17341734   */ 
    1735   function decode_mime_string($input) 
     1735  function decode_mime_string($input, $recursive=false) 
    17361736    { 
    17371737    $out = ''; 
     
    17541754      return $out; 
    17551755      } 
    1756      
     1756       
    17571757    // no encoding information, defaults to what is specified in the class header 
    17581758    return rcube_charset_convert($input, 'ISO-8859-1'); 
  • program/include/rcube_shared.inc

    rdd53e2b rbac7d17  
    13351335 
    13361336 
    1337  
     1337// replace the middle part of a string with ... 
     1338// if it is longer than the allowed length 
    13381339function abbrevate_string($str, $maxlength, $place_holder='...') 
    13391340  { 
     
    13501351  } 
    13511352 
     1353 
     1354// make sure the string ends with a slash 
     1355function slashify($str) 
     1356  { 
     1357  return unslashify($str).'/'; 
     1358  } 
     1359 
     1360 
     1361// remove slash at the end of the string 
     1362function unslashify($str) 
     1363  { 
     1364  return preg_replace('/\/$/', '', $str); 
     1365  } 
     1366   
    13521367 
    13531368// delete all files within a folder 
  • program/steps/mail/func.inc

    r5f383dc rbac7d17  
    215215      $class_name = 'junk'; 
    216216 
    217     $out .= sprintf('<li id="rcmbx%s" class="mailbox %s %s%s%s"><a href="%s&_mbox=%s"'. 
     217    $out .= sprintf('<li id="rcmbx%s" class="mailbox %s %s%s%s"><a href="%s&amp;_mbox=%s"'. 
    218218                    ' onclick="return %s.command(\'list\',\'%s\')"'. 
    219219                    ' onmouseup="return %s.mbox_mouse_up(\'%s\')"%s>%s</a>', 
     
    438438        $cont = rep_specialchars_output($IMAP->decode_header($header->$col), 'html', 'all'); 
    439439        // firefox/mozilla temporary workaround to pad subject with content so that whitespace in rows responds to drag+drop 
    440         $cont .= sprintf('<img src="%s%s" height="11" width="1000">', $skin_path, "/images/cleardot.png"); 
     440        $cont .= '<img src="./program/blank.gif" height="5" width="1000" alt="" />'; 
    441441        } 
    442442      else if ($col=='size') 
     
    10181018      $header_value = format_date(strtotime($headers[$hkey])); 
    10191019    else if (in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to'))) 
    1020       $header_value = rep_specialchars_output(rcmail_address_string($IMAP->decode_header($headers[$hkey]), NULL, $attrib['addicon'])); 
     1020      $header_value = rep_specialchars_output(rcmail_address_string($headers[$hkey], NULL, $attrib['addicon'])); 
    10211021    else 
    10221022      $header_value = rep_specialchars_output($IMAP->decode_header($headers[$hkey]), '', 'all'); 
Note: See TracChangeset for help on using the changeset viewer.