Changeset 99897b7 in github


Ignore:
Timestamp:
Feb 9, 2011 7:46:46 AM (2 years ago)
Author:
alecpl <alec@…>
Children:
57d261b
Parents:
dcc7900
Message:
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    rb46e5b74 r99897b7  
    44RELEASE 0.5.1 
    55------------- 
     6- Fix handling of attachments with invalid content type (#1487767) 
     7- Add workaround for DBMail's bug http://www.dbmail.org/mantis/view.php?id=881 (#1487766) 
     8- Use IMAP's ID extension (RFC2971) to print more info into debug log 
    69- Security: add optional referer check to prevent CSRF in GET requests 
    710- Fix email_dns_check setting not used for identities/contacts (#1487740) 
  • program/include/rcube_imap.php

    r98cb0f1 r99897b7  
    149149        $this->options['port'] = $port; 
    150150 
    151         if ($this->options['debug']) 
     151        if ($this->options['debug']) { 
    152152            $this->conn->setDebug(true, array($this, 'debug_handler')); 
     153 
     154            $this->options['ident'] = array( 
     155                'name' => 'Roundcube Webmail', 
     156                'version' => RCMAIL_VERSION, 
     157                'php' => PHP_VERSION, 
     158                'os' => PHP_OS, 
     159                'command' => $_SERVER['REQUEST_URI'], 
     160            ); 
     161        } 
    153162 
    154163        $attempt = 0; 
  • program/include/rcube_imap_generic.php

    rb46e5b74 r99897b7  
    760760        } 
    761761 
     762        // Send ID info 
     763        if (!empty($this->prefs['ident']) && $this->getCapability('ID')) { 
     764            $this->id($this->prefs['ident']); 
     765        } 
     766 
    762767        $auth_methods = array(); 
    763768        $result       = null; 
     
    11531158        if (is_array($index)) { 
    11541159            return (int) $index['COUNT']; 
     1160        } 
     1161 
     1162        return false; 
     1163    } 
     1164 
     1165    /** 
     1166     * Executes ID command (RFC2971) 
     1167     * 
     1168     * @param array $items Client identification information key/value hash 
     1169     * 
     1170     * @return array Server identification information key/value hash 
     1171     * @access public 
     1172     * @since 0.6 
     1173     */ 
     1174    function id($items=array()) 
     1175    { 
     1176        if (is_array($items) && !empty($items)) { 
     1177            foreach ($items as $key => $value) { 
     1178                $args[] = $this->escape($key); 
     1179                $args[] = $this->escape($value); 
     1180            } 
     1181        } 
     1182 
     1183        list($code, $response) = $this->execute('ID', array( 
     1184            !empty($args) ? '(' . implode(' ', (array) $args) . ')' : $this->escape(null) 
     1185        )); 
     1186 
     1187 
     1188        if ($code == self::ERROR_OK && preg_match('/\* ID /i', $response)) { 
     1189            $response = substr($response, 5); // remove prefix "* ID " 
     1190            $items    = $this->tokenizeResponse($response); 
     1191            $result   = null; 
     1192 
     1193            for ($i=0, $len=count($items); $i<$len; $i += 2) { 
     1194                $result[$items[$i]] = $items[$i+1]; 
     1195            } 
     1196 
     1197            return $result; 
    11551198        } 
    11561199 
     
    32853328            return '""'; 
    32863329        } 
     3330        // need quoted-string? find special chars: SP, CTL, (, ), {, %, *, ", \, ] 
     3331        // plus [ character as a workaround for DBMail's bug (#1487766) 
    32873332        else if ($force_quotes || 
    3288             preg_match('/([\x00-\x20\x28-\x29\x7B\x25\x2A\x22\x5C\x5D\x7F]+)/', $string) 
     3333            preg_match('/([\x00-\x20\x28-\x29\x7B\x25\x2A\x22\x5B\x5C\x5D\x7F]+)/', $string) 
    32893334        ) { 
    3290             // string: special chars: SP, CTL, (, ), {, %, *, ", \, ] 
    32913335            return '"' . strtr($string, array('"'=>'\\"', '\\' => '\\\\')) . '"'; 
    32923336        } 
  • program/include/rcube_message.php

    rb46e5b74 r99897b7  
    479479                            $this->attachments[] = $mail_part; 
    480480                    } 
    481                     // is a regular attachment (content-type name regexp according to RFC4288.4.2) 
     481                    // regular attachment with valid content type 
     482                    // (content-type name regexp according to RFC4288.4.2) 
    482483                    else if (preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) { 
    483484                        if (!$mail_part->filename) 
    484485                            $mail_part->filename = 'Part '.$mail_part->mime_id; 
     486 
     487                        $this->attachments[] = $mail_part; 
     488                    } 
     489                    // attachment with invalid content type 
     490                    // replace malformed content type with application/octet-stream (#1487767) 
     491                    else if ($mail_part->filename) { 
     492                        $mail_part->ctype_primary   = 'application'; 
     493                        $mail_part->ctype_secondary = 'octet-stream'; 
     494                        $mail_part->mimetype        = 'application/octet-stream'; 
     495 
    485496                        $this->attachments[] = $mail_part; 
    486497                    } 
Note: See TracChangeset for help on using the changeset viewer.