Changeset ec045b0 in github


Ignore:
Timestamp:
Mar 22, 2011 3:49: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:
4380ebe
Parents:
a8d7c65
Message:

Revert r4609 and use stateless request tokens; no need to save them in session and thus no keep-alive necessary; fixes #1487829

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r3e63a0b8 rec045b0  
    22=========================== 
    33 
     4- Stateless request tokens. No keep-alive necessary on login page (#1487829) 
    45- PEAR::Net_SMTP 1.5.1 
    56- Allow multiple concurrent compose sessions 
  • index.php

    r32b11d3 rec045b0  
    155155// not logged in -> show login page 
    156156if (empty($RCMAIL->user->ID)) { 
    157   if ($RCMAIL->action == 'keep-alive') 
    158     $OUTPUT->send(); 
    159   else if ($OUTPUT->ajax_call) 
     157  if ($OUTPUT->ajax_call) 
    160158    $OUTPUT->redirect(array(), 2000); 
    161159 
     
    185183  // check client X-header to verify request origin 
    186184  if ($OUTPUT->ajax_call) { 
    187     if (rc_request_header('X-Roundcube-Request') != $RCMAIL->get_request_token()) { 
     185    if (rc_request_header('X-Roundcube-Request') != $RCMAIL->get_request_token() && !$RCMAIL->config->get('devel_mode')) { 
    188186      header('HTTP/1.1 404 Not Found'); 
    189187      die("Invalid Request"); 
  • program/include/rcmail.php

    r4591de7 rec045b0  
    11071107  public function get_request_token() 
    11081108  { 
    1109     $key = $this->task; 
    1110  
    1111     if (!$_SESSION['request_tokens'][$key]) 
    1112       $_SESSION['request_tokens'][$key] = md5(uniqid($key . mt_rand(), true)); 
    1113  
    1114     return $_SESSION['request_tokens'][$key]; 
     1109    $sess_id = $_COOKIE[ini_get('session.name')]; 
     1110    return md5('RT' . $this->task . $this->config->get('des_key') . $sess_id); 
    11151111  } 
    11161112 
     
    11251121  { 
    11261122    $token = get_input_value('_token', $mode); 
    1127     return !empty($token) && $_SESSION['request_tokens'][$this->task] == $token; 
     1123    $sess_id = $_COOKIE[ini_get('session.name')]; 
     1124    return !empty($sess_id) && $token == $this->get_request_token(); 
    11281125  } 
    11291126 
  • program/js/app.js

    ra8317ef rec045b0  
    54325432    if (this.env.keep_alive && !this.env.framed && this.task == 'mail' && this.gui_objects.mailboxlist) 
    54335433      this._int = setInterval(function(){ ref.check_for_recent(false); }, this.env.keep_alive * 1000); 
    5434     else if (this.env.keep_alive && !this.env.framed && this.env.action != 'print') 
     5434    else if (this.env.keep_alive && !this.env.framed && this.task != 'login' && this.env.action != 'print') 
    54355435      this._int = setInterval(function(){ ref.send_keep_alive(); }, this.env.keep_alive * 1000); 
    54365436  }; 
Note: See TracChangeset for help on using the changeset viewer.