#1484467: fix problems with backslash as imap hierarchy delimiter

release-0.6
alecpl 16 years ago
parent 12bc8b6fa2
commit b7c1685b2d

@ -1,6 +1,10 @@
CHANGELOG RoundCube Webmail CHANGELOG RoundCube Webmail
--------------------------- ---------------------------
2009/01/18 (alec)
----------
- Fix problems with backslash as IMAP hierarchy delimiter (#1484467)
2009/01/15 (alec) 2009/01/15 (alec)
---------- ----------
- Allow absolute URLs to images in HTML messages/sigs (#1485666) - Allow absolute URLs to images in HTML messages/sigs (#1485666)

@ -1568,7 +1568,6 @@ class rcube_imap
*/ */
function save_message($mbox_name, &$message) function save_message($mbox_name, &$message)
{ {
$mbox_name = stripslashes($mbox_name);
$mailbox = $this->_mod_mailbox($mbox_name); $mailbox = $this->_mod_mailbox($mbox_name);
// make sure mailbox exists // make sure mailbox exists
@ -1595,9 +1594,7 @@ class rcube_imap
*/ */
function move_message($uids, $to_mbox, $from_mbox='') function move_message($uids, $to_mbox, $from_mbox='')
{ {
$to_mbox_in = stripslashes($to_mbox); $to_mbox = $this->_mod_mailbox($to_mbox);
$from_mbox = stripslashes($from_mbox);
$to_mbox = $this->_mod_mailbox($to_mbox_in);
$from_mbox = $from_mbox ? $this->_mod_mailbox($from_mbox) : $this->mailbox; $from_mbox = $from_mbox ? $this->_mod_mailbox($from_mbox) : $this->mailbox;
// make sure mailbox exists // make sure mailbox exists
@ -1672,7 +1669,6 @@ class rcube_imap
*/ */
function delete_message($uids, $mbox_name='') function delete_message($uids, $mbox_name='')
{ {
$mbox_name = stripslashes($mbox_name);
$mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
// convert the list of uids to array // convert the list of uids to array
@ -1729,7 +1725,6 @@ class rcube_imap
*/ */
function clear_mailbox($mbox_name=NULL) function clear_mailbox($mbox_name=NULL)
{ {
$mbox_name = stripslashes($mbox_name);
$mailbox = !empty($mbox_name) ? $this->_mod_mailbox($mbox_name) : $this->mailbox; $mailbox = !empty($mbox_name) ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
$msg_count = $this->_messagecount($mailbox, 'ALL'); $msg_count = $this->_messagecount($mailbox, 'ALL');
@ -1762,7 +1757,6 @@ class rcube_imap
*/ */
function expunge($mbox_name='', $clear_cache=TRUE) function expunge($mbox_name='', $clear_cache=TRUE)
{ {
$mbox_name = stripslashes($mbox_name);
$mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
return $this->_expunge($mailbox, $clear_cache); return $this->_expunge($mailbox, $clear_cache);
} }
@ -1881,9 +1875,6 @@ class rcube_imap
{ {
$result = FALSE; $result = FALSE;
// replace backslashes
$name = preg_replace('/[\\\]+/', '-', $name);
// reduce mailbox name to 100 chars // reduce mailbox name to 100 chars
$name = substr($name, 0, 100); $name = substr($name, 0, 100);
@ -1912,9 +1903,6 @@ class rcube_imap
{ {
$result = FALSE; $result = FALSE;
// replace backslashes
$name = preg_replace('/[\\\]+/', '-', $new_name);
// encode mailbox name and reduce it to 100 chars // encode mailbox name and reduce it to 100 chars
$name = substr($new_name, 0, 100); $name = substr($new_name, 0, 100);

@ -53,7 +53,7 @@
- Removed some debuggers (echo ...) - Removed some debuggers (echo ...)
File altered by Aleksander Machniak <alec@alec.pl> File altered by Aleksander Machniak <alec@alec.pl>
- trim(chop()) replaced by trim() - trim(chop()) replaced by trim()
- added iil_Escape() with support for " and \ in folder names - added iil_Escape()/iil_UnEscape() with support for " and \ in folder names
- support \ character in username in iil_C_Login() - support \ character in username in iil_C_Login()
- fixed iil_MultLine(): use iil_ReadBytes() instead of iil_ReadLine() - fixed iil_MultLine(): use iil_ReadBytes() instead of iil_ReadLine()
- fixed iil_C_FetchStructureString() to handle many literal strings in response - fixed iil_C_FetchStructureString() to handle many literal strings in response
@ -338,6 +338,11 @@ function iil_Escape($string)
return strtr($string, array('"'=>'\\"', '\\' => '\\\\')); return strtr($string, array('"'=>'\\"', '\\' => '\\\\'));
} }
function iil_UnEscape($string)
{
return strtr($string, array('\\"'=>'"', '\\\\' => '\\'));
}
function iil_C_GetCapability(&$conn, $name) function iil_C_GetCapability(&$conn, $name)
{ {
if (in_array($name, $conn->capability)) { if (in_array($name, $conn->capability)) {
@ -497,6 +502,7 @@ function iil_C_NameSpace(&$conn) {
$line = iil_ReadLine($conn->fp, 1024); $line = iil_ReadLine($conn->fp, 1024);
if (iil_StartsWith($line, '* NAMESPACE')) { if (iil_StartsWith($line, '* NAMESPACE')) {
$i = 0; $i = 0;
$line = iil_UnEscape($line);
$data = iil_ParseNamespace2(substr($line,11), $i, 0, 0); $data = iil_ParseNamespace2(substr($line,11), $i, 0, 0);
} }
} while (!iil_StartsWith($line, 'ns1', true)); } while (!iil_StartsWith($line, 'ns1', true));
@ -2199,7 +2205,7 @@ function iil_C_GetHierarchyDelimiter(&$conn) {
$line=iil_ReadLine($fp, 500); $line=iil_ReadLine($fp, 500);
if ($line[0] == '*') { if ($line[0] == '*') {
$line = rtrim($line); $line = rtrim($line);
$a=iil_ExplodeQuotedString(' ', $line); $a=iil_ExplodeQuotedString(' ', iil_UnEscape($line));
if ($a[0] == '*') { if ($a[0] == '*') {
$delimiter = str_replace('"', '', $a[count($a)-2]); $delimiter = str_replace('"', '', $a[count($a)-2]);
} }
@ -2217,6 +2223,7 @@ function iil_C_GetHierarchyDelimiter(&$conn) {
$line = iil_ReadLine($conn->fp, 1024); $line = iil_ReadLine($conn->fp, 1024);
if (iil_StartsWith($line, '* NAMESPACE')) { if (iil_StartsWith($line, '* NAMESPACE')) {
$i = 0; $i = 0;
$line = iil_UnEscape($line);
$data = iil_ParseNamespace2(substr($line,11), $i, 0, 0); $data = iil_ParseNamespace2(substr($line,11), $i, 0, 0);
} }
} while (!iil_StartsWith($line, 'ns1', true)); } while (!iil_StartsWith($line, 'ns1', true));

Loading…
Cancel
Save