From 51bbe8fab8731eb498cf0aecefd21f957aec6413 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sun, 1 Feb 2009 02:24:32 +0000 Subject: [PATCH] Add compatibility with Dovecot's bigint UIDs git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13399 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + functions/imap_messages.php | 5 ++++- functions/mailbox_display.php | 5 +++++ plugins/message_details/message_details_bottom.php | 2 +- plugins/message_details/message_details_main.php | 2 +- plugins/message_details/message_details_top.php | 2 +- plugins/spamcop/functions.php | 2 +- plugins/spamcop/spamcop.php | 2 +- src/compose.php | 2 +- src/download.php | 4 +--- src/image.php | 4 +--- src/read_body.php | 4 +--- src/vcard.php | 2 +- src/view_header.php | 4 +--- src/view_html.php | 4 +--- src/view_text.php | 4 +--- 16 files changed, 23 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 480a4d03..c861340e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -269,6 +269,7 @@ Version 1.5.2 - SVN - Add password type option widget - Make all submit button names unique on compose screen - Make address book file permissions 0600 - same as preference files + - Added compatibility with Dovecot's bigint UIDs Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/functions/imap_messages.php b/functions/imap_messages.php index af49b576..8a89940a 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -895,7 +895,10 @@ function sqimap_parse_address($read, &$i) { */ function sqimap_get_message($imap_stream, $id, $mailbox, $hide=0) { // typecast to int to prohibit 1:* msgs sets - $id = (int) $id; + // Update: $id should always be sanitized into a BIGINT so this + // is being removed; leaving this code here in case something goes + // wrong, however + //$id = (int) $id; $flags = array(); $read = sqimap_run_command($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, TRUE); if ($read) { diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 1468e80f..9fb3725c 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1334,6 +1334,11 @@ function handleMessageListForm($imapConnection, &$aMailbox, $sButton='', /* retrieve the check boxes */ $aUid = (isset($msg) && is_array($msg)) ? array_values($msg) : $aUid; if (count($aUid) && $sButton != 'expunge') { + + // make sure message UIDs are sanitized (BIGINT) + foreach ($aUid as $i => $uid) + $aUid[$i] = (preg_match('/^[0-9]+$/', $uid) ? $uid : '0'); + $aUpdatedMsgs = false; $bExpunge = false; switch ($sButton) { diff --git a/plugins/message_details/message_details_bottom.php b/plugins/message_details/message_details_bottom.php index b9cd0f6a..c4dcc8df 100644 --- a/plugins/message_details/message_details_bottom.php +++ b/plugins/message_details/message_details_bottom.php @@ -33,7 +33,7 @@ global $msgd_8bit_in_hex; $msgd_8bit_in_hex=false; if (!empty($md_action)) { - sqgetGlobalVar('passed_id', $passed_id, SQ_GET); + sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) $passed_ent_id = 0; sqgetGlobalVar('mailbox', $mailbox, SQ_GET); diff --git a/plugins/message_details/message_details_main.php b/plugins/message_details/message_details_main.php index 72f309e0..5abe46cc 100644 --- a/plugins/message_details/message_details_main.php +++ b/plugins/message_details/message_details_main.php @@ -22,7 +22,7 @@ require('../../include/init.php'); displayHtmlHeader( _("Message Details"), '', FALSE ); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); -sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) $passed_ent_id = 0; diff --git a/plugins/message_details/message_details_top.php b/plugins/message_details/message_details_top.php index 3263d258..9b8efd54 100644 --- a/plugins/message_details/message_details_top.php +++ b/plugins/message_details/message_details_top.php @@ -30,7 +30,7 @@ displayHtmlHeader( _("Message Details"), "-->\n". "\n", FALSE ); -sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) $passed_ent_id = 0; sqgetGlobalVar('mailbox', $mailbox, SQ_GET); diff --git a/plugins/spamcop/functions.php b/plugins/spamcop/functions.php index 590785c2..1a5ed9d5 100644 --- a/plugins/spamcop/functions.php +++ b/plugins/spamcop/functions.php @@ -66,7 +66,7 @@ function spamcop_show_link_function(&$links) { return; /* GLOBALS */ - sqgetGlobalVar('passed_id', $passed_id, SQ_FORM); + sqgetGlobalVar('passed_id', $passed_id, SQ_FORM, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('passed_ent_id',$passed_ent_id,SQ_FORM); sqgetGlobalVar('mailbox', $mailbox, SQ_FORM); if ( sqgetGlobalVar('startMessage', $startMessage, SQ_FORM) ) { diff --git a/plugins/spamcop/spamcop.php b/plugins/spamcop/spamcop.php index 75adadf0..9e9ee064 100644 --- a/plugins/spamcop/spamcop.php +++ b/plugins/spamcop/spamcop.php @@ -28,7 +28,7 @@ include_once(SM_PATH . 'functions/compose.php'); /* GLOBALS */ sqgetGlobalVar('mailbox', $mailbox, SQ_GET); -sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('js_web', $js_web, SQ_GET); if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET) ) { diff --git a/src/compose.php b/src/compose.php index ed6c0e6a..189b65a8 100644 --- a/src/compose.php +++ b/src/compose.php @@ -85,7 +85,7 @@ sqgetGlobalVar('request_mdn',$request_mdn, $SQ_GLOBAL); sqgetGlobalVar('request_dr',$request_dr, $SQ_GLOBAL); sqgetGlobalVar('html_addr_search',$html_addr_search, $SQ_GLOBAL); sqgetGlobalVar('mail_sent',$mail_sent, $SQ_GLOBAL); -sqgetGlobalVar('passed_id',$passed_id, $SQ_GLOBAL); +sqgetGlobalVar('passed_id',$passed_id, $SQ_GLOBAL, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('passed_ent_id',$passed_ent_id, $SQ_GLOBAL); sqgetGlobalVar('attach',$attach, SQ_POST); diff --git a/src/download.php b/src/download.php index 896e86be..65a56dd8 100644 --- a/src/download.php +++ b/src/download.php @@ -48,9 +48,7 @@ sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('absolute_dl',$absolute_dl, SQ_GET); sqgetGlobalVar('force_crlf', $force_crlf, SQ_GET); -if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) { - $passed_id = (int) $temp; -} +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); if (!sqgetGlobalVar('account', $account, SQ_GET) ) { $account = 0; } diff --git a/src/image.php b/src/image.php index a2ef223b..9dc8d897 100644 --- a/src/image.php +++ b/src/image.php @@ -22,9 +22,7 @@ require('../include/init.php'); displayPageHeader($color); /* globals */ -if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) { - $passed_id = (int) $temp; -} +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER); diff --git a/src/read_body.php b/src/read_body.php index b04b4738..fb93be43 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -781,12 +781,10 @@ if ( sqgetGlobalVar('account', $temp, SQ_GET) ) { } /** GET/POST VARS */ +sqgetGlobalVar('passed_id', $passed_id, SQ_INORDER, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('passed_ent_id', $passed_ent_id); sqgetGlobalVar('mailbox', $mailbox); -if ( sqgetGlobalVar('passed_id', $temp) ) { - $passed_id = (int) $temp; -} if ( sqgetGlobalVar('sort', $temp) ) { $sort = (int) $temp; } diff --git a/src/vcard.php b/src/vcard.php index a1f8005e..2a9de120 100644 --- a/src/vcard.php +++ b/src/vcard.php @@ -35,7 +35,7 @@ include_once(SM_PATH . 'functions/imap_messages.php'); /* globals */ -sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('startMessage', $startMessage, SQ_GET); diff --git a/src/view_header.php b/src/view_header.php index 0e0b2e21..aeebe577 100644 --- a/src/view_header.php +++ b/src/view_header.php @@ -83,9 +83,7 @@ function parse_viewheader($imapConnection,$id, $passed_ent_id) { } /* get global vars */ -if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) { - $passed_id = (int) $temp; -} +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); if ( sqgetGlobalVar('mailbox', $temp, SQ_GET) ) { $mailbox = $temp; } diff --git a/src/view_html.php b/src/view_html.php index c0d2932a..5a657d81 100644 --- a/src/view_html.php +++ b/src/view_html.php @@ -34,9 +34,7 @@ sqgetGlobalVar('messages', $messages, SQ_SESSION); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET); -if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) { - $passed_id = (int) $temp; -} +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); // TODO: add required var checks here. diff --git a/src/view_text.php b/src/view_text.php index dbdc16b8..89b25230 100644 --- a/src/view_text.php +++ b/src/view_text.php @@ -27,9 +27,7 @@ sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('ent_id', $ent_id, SQ_GET); sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET); sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER); -if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) { - $passed_id = (int) $temp; -} +sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT); $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox); -- 2.25.1