Changeset 719a257 in github


Ignore:
Timestamp:
Aug 10, 2007 4:27:40 AM (6 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
31d9efd
Parents:
4b9efbb
Message:

Some bugfixes, security issues + minor improvements

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r4b9efbb r719a257  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42007/08/09 (thomasb) 
     5---------- 
     6- Identify mailboxes case-sensitive 
     7- Sort mailbox list case-insensitive (closes #1484338) 
     8- Fix display of multipart messages from Apple Mail (closes #1484027) 
     9- Protect AJAX request from being fetched by a foreign site (XSS) 
     10- Make autocomplete for loginform configurable by the skin template 
     11 
    312 
    4132007/07/09 (richs) 
     
    1322- Increased "mailboxcontrols" mail.css width from 160 to 170px to fix non-english languages  
    1423- Fixed empty-message sending with TinyMCE plain-text mode, or if it's not installed 
     24 
    1525 
    16262007/07/03 (thomasb) 
  • index.php

    r6d969b4 r719a257  
    33 +-----------------------------------------------------------------------+ 
    44 | RoundCube Webmail IMAP Client                                         | 
    5  | Version 0.1-20070518                                                  | 
     5 | Version 0.1-20070809                                                  | 
    66 |                                                                       | 
    77 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 | 
     
    4242 
    4343// application constants 
    44 define('RCMAIL_VERSION', '0.1-20070517'); 
     44define('RCMAIL_VERSION', '0.1-20070809'); 
    4545define('RCMAIL_CHARSET', 'UTF-8'); 
    4646define('JS_OBJECT_NAME', 'rcmail'); 
     
    218218} 
    219219 
     220 
     221// check client X-header to verify request origin 
     222if ($OUTPUT->ajax_call) 
     223{ 
     224  $hdrs = getallheaders(); 
     225  if (empty($hdrs['X-RoundCube-Referer']) && empty($CONFIG['devel_mode'])) 
     226  { 
     227    header('HTTP/1.1 404 Not Found'); 
     228    die("Invalid Request"); 
     229  } 
     230} 
    220231 
    221232 
  • program/include/main.inc

    r6d969b4 r719a257  
    235235  if (!empty($CONFIG['session_lifetime']) && isset($SESS_CHANGED) && $SESS_CHANGED + $CONFIG['session_lifetime']*60 < time()) 
    236236    $valid = false; 
     237     
     238  if (!$valid) 
     239    write_log('timeouts', $_SESSION + array('SESS_CLIENT_IP' => $SESS_CLIENT_IP, 'SESS_CHANGED' => $SESS_CHANGED, 'COOKIE' => $_COOKIE)); 
    237240 
    238241  return $valid; 
  • program/include/rcmail_template.inc

    r6d969b4 r719a257  
    746746  $labels['host'] = rcube_label('server'); 
    747747   
    748   $input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30, 'autocomplete' => 'off')); 
    749   $input_pass = new passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'size' => 30)); 
     748  $input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30) + $attrib); 
     749  $input_pass = new passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'size' => 30) + $attrib); 
    750750  $input_action = new hiddenfield(array('name' => '_action', 'value' => 'login')); 
    751751     
  • program/include/rcube_imap.inc

    r6d969b4 r719a257  
    13751375    if (!in_array($to_mbox, $this->_list_mailboxes())) 
    13761376      { 
    1377       if (in_array(strtolower($to_mbox), $this->default_folders)) 
     1377      if (in_array($to_mbox, $this->default_folders)) 
    13781378        $this->create_mailbox($to_mbox, TRUE); 
    13791379      else 
     
    16591659    $a_mailbox_cache = $this->get_cache('mailboxes'); 
    16601660 
    1661     if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array_nocase($abs_name, $a_mailbox_cache))) 
     1661    if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array($abs_name, $a_mailbox_cache))) 
    16621662      $result = iil_C_CreateFolder($this->conn, $abs_name); 
    16631663 
    16641664    // try to subscribe it 
    1665     if ($subscribe) 
     1665    if ($result && $subscribe) 
    16661666      $this->subscribe($name); 
    16671667 
     
    17691769      { 
    17701770      $abs_name = $this->_mod_mailbox($folder); 
    1771       if (!in_array_nocase($abs_name, $a_subscribed)) 
    1772         { 
    1773         if (!in_array_nocase($abs_name, $a_folders)) 
    1774           $this->create_mailbox($folder, TRUE); 
    1775         else 
    1776           $this->subscribe($folder); 
    1777         } 
    1778       else if (!in_array_nocase($abs_name, $a_folders)) 
    1779         { 
    1780         $this->create_mailbox($folder, FALSE); 
    1781         } 
     1771      if (!in_array_nocase($abs_name, $a_folders)) 
     1772        $this->create_mailbox($folder, TRUE); 
     1773      else if (!in_array_nocase($abs_name, $a_subscribed)) 
     1774        $this->subscribe($folder); 
    17821775      } 
    17831776    } 
     
    24342427      } 
    24352428 
    2436     sort($a_out); 
     2429    natcasesort($a_out); 
    24372430    ksort($a_defaults); 
    24382431     
  • program/js/app.js

    r4b9efbb r719a257  
    464464 
    465465      case 'logout': 
    466         this.goto_url('logout'); 
     466        this.goto_url('logout', true); 
    467467        break;       
    468468 
     
    31963196  this.redirect = function(url, lock) 
    31973197    { 
    3198     if (lock || lock == NULL) 
     3198    if (lock || lock === null) 
    31993199      this.set_busy(true); 
    32003200 
     
    34993499      } 
    35003500 
    3501     var ref = this; 
     3501    var _ref = this; 
    35023502    this.url = url; 
    35033503    this.busy = true; 
    35043504 
    3505     this.xmlhttp.onreadystatechange = function(){ ref.xmlhttp_onreadystatechange(); }; 
     3505    this.xmlhttp.onreadystatechange = function(){ _ref.xmlhttp_onreadystatechange(); }; 
    35063506    this.xmlhttp.open('GET', url); 
     3507    this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('sessid')); 
    35073508    this.xmlhttp.send(null); 
    35083509    }; 
     
    35383539    this.xmlhttp.open('POST', url, true); 
    35393540    this.xmlhttp.setRequestHeader('Content-Type', contentType); 
     3541    this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('sessid')); 
    35403542    this.xmlhttp.send(req_body); 
    35413543    }; 
  • program/steps/mail/func.inc

    r93be5b7 r719a257  
    647647    foreach ($structure->parts as $p => $sub_part) 
    648648      { 
     649      $rel_parts = $attachmnts = null; 
    649650      $sub_ctype_primary = strtolower($sub_part->ctype_primary); 
    650651      $sub_ctype_secondary = strtolower($sub_part->ctype_secondary); 
     
    657658      else if ($sub_ctype_primary=='text' && $sub_ctype_secondary=='enriched') 
    658659        $enriched_part = $p; 
    659       else if ($sub_ctype_primary=='multipart' && $sub_ctype_secondary=='related') 
     660      else if ($sub_ctype_primary=='multipart' && ($sub_ctype_secondary=='related' || $sub_ctype_secondary=='mixed')) 
    660661        $related_part = $p; 
    661662      } 
    662  
     663       
    663664    // parse related part (alternative part could be in here) 
    664     if ($related_part!==NULL && $prefer_html) 
    665       { 
    666       list($parts, $attachmnts) = rcmail_parse_message($structure->parts[$related_part], $arg, TRUE); 
    667       $a_return_parts = array_merge($a_return_parts, $parts); 
     665    if ($related_part!==NULL) 
     666    { 
     667      list($rel_parts, $attachmnts) = rcmail_parse_message($structure->parts[$related_part], $arg, TRUE); 
    668668      $a_attachments = array_merge($a_attachments, $attachmnts); 
    669       } 
    670  
    671     // print html/plain part 
     669    } 
     670     
     671    // merge related parts if any 
     672    if ($rel_parts && $prefer_html && !$html_part) 
     673      $a_return_parts = array_merge($a_return_parts, $rel_parts); 
     674 
     675    // choose html/plain part to print 
    672676    else if ($html_part!==NULL && $prefer_html) 
    673677      $print_part = &$structure->parts[$html_part]; 
     
    684688      } 
    685689    // show plaintext warning 
    686     else if ($html_part!==NULL) 
     690    else if ($html_part!==NULL && empty($a_return_parts)) 
    687691      { 
    688692      $c = new stdClass; 
     
    914918   
    915919  // list images after mail body 
    916   if (get_boolean($attrib['showimages']) && $ctype_primary=='multipart' && $ctype_secondary=='mixed' && 
    917       sizeof($MESSAGE['attachments']) && !strstr($message_body, '<html') && strlen($GET_URL)) 
     920  if (get_boolean($attrib['showimages']) && $ctype_primary=='multipart' && 
     921      !empty($MESSAGE['attachments']) && !strstr($message_body, '<html') && strlen($GET_URL)) 
    918922    { 
    919923    foreach ($MESSAGE['attachments'] as $attach_prop) 
     
    12401244  $ctype_primary = strtolower($part->ctype_primary); 
    12411245 
    1242   $attrib['src'] = './?'.str_replace('_frame=', ($ctype_primary=='text' ? '_show=' : '_preload='), $_SERVER['QUERY_STRING']); 
     1246  $attrib['src'] = Q('./?'.str_replace('_frame=', ($ctype_primary=='text' ? '_show=' : '_preload='), $_SERVER['QUERY_STRING'])); 
    12431247 
    12441248  $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'src', 'width', 'height')); 
  • program/steps/mail/get.inc

    r5cc4b13 r719a257  
    3030 
    3131  print "<html>\n<head>\n" . 
    32         '<meta http-equiv="refresh" content="0; url='.htmlspecialchars($url).'">' . 
     32        '<meta http-equiv="refresh" content="0; url='.Q($url).'">' . 
    3333        "\n</head>\n<body>" . 
    3434        $message . 
     
    108108      { 
    109109      header(sprintf('Content-Disposition: %s; filename="%s";', 
    110                      $part->disposition ? $part->disposition : 'attachment', 
     110                     $_GET['_download'] ? 'attachment' : 'inline', 
    111111                     $part->filename ? $part->filename : "roundcube.$ctype_secondary")); 
    112112 
  • program/steps/mail/show.inc

    rf115416 r719a257  
    4949  if ((bool)get_input_value('_safe', RCUBE_INPUT_GET)) 
    5050    send_nocacheing_headers(); 
    51   else 
     51  else if (empty($CONFIG['devel_mode'])) 
    5252    send_modified_header($_SESSION['login_time'], $etag); 
    5353 
  • program/steps/settings/manage_folders.inc

    r8d07583 r719a257  
    2828  { 
    2929  if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    30     $IMAP->subscribe(array($mboxes)); 
     30    $IMAP->subscribe($mboxes); 
    3131 
    3232  if ($OUTPUT->ajax_call) 
     
    3838  { 
    3939  if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    40     $IMAP->unsubscribe(array($mboxes)); 
     40    $IMAP->unsubscribe($mboxes); 
    4141 
    4242  if ($OUTPUT->ajax_call) 
Note: See TracChangeset for help on using the changeset viewer.