diff options
author | Nicklas Avén <nicklas.aven@jordogskog.no> | 2018-07-31 13:12:18 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-09-06 10:57:48 +0200 |
commit | 6987fcef657710f800b05dd79ff744087b15c73d (patch) | |
tree | 47fcd664dcf9f7ee1b274c88eaa75e1faccf0837 /tests | |
parent | 2825f46d950ca9b0e269ed8dc6a97c5238a17c30 (diff) |
imap: change from "FETCH" to "UID FETCH"
... and add "MAILINDEX".
As described in #2789, this is a suggested solution. Changing UID=xx to
actually get mail with UID xx and add "MAILINDEX" to get a mail with a
special index in the mail box (old behavior). So MAILINDEX=1 gives the
first non deleted mail in the mail box.
Fixes #2789
Closes #2815
Diffstat (limited to 'tests')
37 files changed, 93 insertions, 38 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 0980ff003..aa0b03e3c 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -93,7 +93,7 @@ test809 test810 test811 test812 test813 test814 test815 test816 test817 \ test818 test819 test820 test821 test822 test823 test824 test825 test826 \ test827 test828 test829 test830 test831 test832 test833 test834 test835 \ test836 test837 test838 test839 test840 test841 test842 test843 test844 \ -test845 test846 \ +test845 test846 test847 \ \ test850 test851 test852 test853 test854 test855 test856 test857 test858 \ test859 test860 test861 test862 test863 test864 test865 test866 test867 \ diff --git a/tests/data/test1321 b/tests/data/test1321 index ee1b47857..72a52c935 100644 --- a/tests/data/test1321 +++ b/tests/data/test1321 @@ -51,7 +51,7 @@ http IMAP FETCH tunneled through HTTP proxy </name> <command> -'imap://imap.1321:%IMAPPORT/1321/;UID=1' -u user:secret -p -x %HOSTIP:%PROXYPORT +'imap://imap.1321:%IMAPPORT/1321/;MAILINDEX=1' -u user:secret -p -x %HOSTIP:%PROXYPORT </command> </client> diff --git a/tests/data/test1420 b/tests/data/test1420 index a5e1c5214..081ac6bbb 100644 --- a/tests/data/test1420 +++ b/tests/data/test1420 @@ -36,7 +36,7 @@ imap SSL_CERT_FILE= </setenv> <command> -'imap://%HOSTIP:%IMAPPORT/1420/;UID=1' -u user:secret --libcurl log/test1420.c +'imap://%HOSTIP:%IMAPPORT/1420/;MAILINDEX=1' -u user:secret --libcurl log/test1420.c </command> </client> @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/1420/;UID=1"); + curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/1420/;MAILINDEX=1"); curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret"); curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); diff --git a/tests/data/test1552 b/tests/data/test1552 index c5b1b5728..48e55cb51 100644 --- a/tests/data/test1552 +++ b/tests/data/test1552 @@ -39,7 +39,7 @@ IMAP multi transfer error without curl_multi_remove_handle lib1552 </tool> <command> -'imap://%HOSTIP:%IMAPPORT/1552/;UID=1' +'imap://%HOSTIP:%IMAPPORT/1552/;MAILINDEX=1' </command> </client> diff --git a/tests/data/test800 b/tests/data/test800 index 360206b43..6b74da90f 100644 --- a/tests/data/test800 +++ b/tests/data/test800 @@ -31,7 +31,7 @@ imap IMAP FETCH message </name> <command> -'imap://%HOSTIP:%IMAPPORT/800/;UID=1' -u '"user:sec"ret{' +'imap://%HOSTIP:%IMAPPORT/800/;MAILINDEX=1' -u '"user:sec"ret{' </command> </client> diff --git a/tests/data/test801 b/tests/data/test801 index 0012d3e4d..90766f79f 100644 --- a/tests/data/test801 +++ b/tests/data/test801 @@ -25,10 +25,10 @@ body imap </server> <name> -IMAP FETCH message by UID and SECTION +IMAP FETCH message by MAILINDEX and SECTION </name> <command> -'imap://%HOSTIP:%IMAPPORT/801/;UID=123/;SECTION=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/801/;MAILINDEX=123/;SECTION=1' -u user:secret </command> </client> diff --git a/tests/data/test802 b/tests/data/test802 index 17349a89a..19206a75d 100644 --- a/tests/data/test802 +++ b/tests/data/test802 @@ -29,7 +29,7 @@ imap IMAP SELECT UIDVALIDITY Success </name> <command> -'imap://%HOSTIP:%IMAPPORT/802;UIDVALIDITY=3857529045/;UID=123/;SECTION=TEXT' -u user:secret +'imap://%HOSTIP:%IMAPPORT/802;UIDVALIDITY=3857529045/;MAILINDEX=123/;SECTION=TEXT' -u user:secret </command> </client> diff --git a/tests/data/test803 b/tests/data/test803 index 5b8cc9eb6..834e4211d 100644 --- a/tests/data/test803 +++ b/tests/data/test803 @@ -24,7 +24,7 @@ imap IMAP SELECT UIDVALIDITY Failure </name> <command> -'imap://%HOSTIP:%IMAPPORT/803;UIDVALIDITY=12345/;UID=123' -u user:secret +'imap://%HOSTIP:%IMAPPORT/803;UIDVALIDITY=12345/;MAILINDEX=123' -u user:secret </command> </client> diff --git a/tests/data/test804 b/tests/data/test804 index c6dfccf4a..90635c22c 100644 --- a/tests/data/test804 +++ b/tests/data/test804 @@ -28,7 +28,7 @@ imap IMAP doesn't perform SELECT if re-using the same mailbox </name> <command> -'imap://%HOSTIP:%IMAPPORT/804/;UID=123/;SECTION=1' 'imap://%HOSTIP:%IMAPPORT/804/;UID=456/;SECTION=2.3' -u user:secret +'imap://%HOSTIP:%IMAPPORT/804/;MAILINDEX=123/;SECTION=1' 'imap://%HOSTIP:%IMAPPORT/804/;MAILINDEX=456/;SECTION=2.3' -u user:secret </command> </client> diff --git a/tests/data/test819 b/tests/data/test819 index d0aa47ba5..b88e35055 100644 --- a/tests/data/test819 +++ b/tests/data/test819 @@ -37,7 +37,7 @@ imap IMAP plain authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/819/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/819/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test820 b/tests/data/test820 index f638f1cb6..0fe9bf2d6 100644 --- a/tests/data/test820 +++ b/tests/data/test820 @@ -37,7 +37,7 @@ imap IMAP login authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/820/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/820/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test821 b/tests/data/test821 index aee373b9a..6c511c1ef 100644 --- a/tests/data/test821 +++ b/tests/data/test821 @@ -40,7 +40,7 @@ crypto IMAP CRAM-MD5 authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/821/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/821/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test822 b/tests/data/test822 index a6c0407e6..60f0cf1d3 100644 --- a/tests/data/test822 +++ b/tests/data/test822 @@ -48,7 +48,7 @@ CURL_GETHOSTNAME=curlhost LD_PRELOAD=%PWD/libtest/.libs/libhostname.so </setenv> <command> -'imap://%HOSTIP:%IMAPPORT/822/;UID=1' -u testuser:testpass +'imap://%HOSTIP:%IMAPPORT/822/;MAILINDEX=1' -u testuser:testpass </command> <precheck> chkhostname curlhost diff --git a/tests/data/test823 b/tests/data/test823 index 25c59ec60..32bd9d189 100644 --- a/tests/data/test823 +++ b/tests/data/test823 @@ -43,7 +43,7 @@ crypto IMAP DIGEST-MD5 authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/823/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/823/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test824 b/tests/data/test824 index e646eec76..96c8e87b9 100644 --- a/tests/data/test824 +++ b/tests/data/test824 @@ -37,7 +37,7 @@ imap IMAP OAuth 2.0 (XOAUTH2) authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/824/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM +'imap://%HOSTIP:%IMAPPORT/824/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM </command> </client> diff --git a/tests/data/test825 b/tests/data/test825 index 6532b3ace..b489e95de 100644 --- a/tests/data/test825 +++ b/tests/data/test825 @@ -38,7 +38,7 @@ imap IMAP plain authentication with initial response </name> <command> -'imap://%HOSTIP:%IMAPPORT/825/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/825/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test826 b/tests/data/test826 index 0f9282945..a1125e2f4 100644 --- a/tests/data/test826 +++ b/tests/data/test826 @@ -38,7 +38,7 @@ imap IMAP login authentication with initial response </name> <command> -'imap://%HOSTIP:%IMAPPORT/826/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/826/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test827 b/tests/data/test827 index 5005271e1..1329ed237 100644 --- a/tests/data/test827 +++ b/tests/data/test827 @@ -49,7 +49,7 @@ CURL_GETHOSTNAME=curlhost LD_PRELOAD=%PWD/libtest/.libs/libhostname.so </setenv> <command> -'imap://%HOSTIP:%IMAPPORT/827/;UID=1' -u testuser:testpass +'imap://%HOSTIP:%IMAPPORT/827/;MAILINDEX=1' -u testuser:testpass </command> <precheck> chkhostname curlhost diff --git a/tests/data/test828 b/tests/data/test828 index c86516a60..912aeff3d 100644 --- a/tests/data/test828 +++ b/tests/data/test828 @@ -38,7 +38,7 @@ imap IMAP OAuth 2.0 (XOAUTH2) authentication with initial response </name> <command> -'imap://%HOSTIP:%IMAPPORT/828/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM +'imap://%HOSTIP:%IMAPPORT/828/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM </command> </client> diff --git a/tests/data/test830 b/tests/data/test830 index 5803bb11e..c7812b794 100644 --- a/tests/data/test830 +++ b/tests/data/test830 @@ -33,7 +33,7 @@ crypto IMAP CRAM-MD5 graceful cancellation </name> <command> -'imap://%HOSTIP:%IMAPPORT/830/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/830/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test831 b/tests/data/test831 index 8bff7eac0..fdcae29c1 100644 --- a/tests/data/test831 +++ b/tests/data/test831 @@ -40,7 +40,7 @@ CURL_GETHOSTNAME=curlhost LD_PRELOAD=%PWD/libtest/.libs/libhostname.so </setenv> <command> -'imap://%HOSTIP:%IMAPPORT/831/;UID=1' -u testuser:testpass +'imap://%HOSTIP:%IMAPPORT/831/;MAILINDEX=1' -u testuser:testpass </command> <precheck> chkhostname curlhost diff --git a/tests/data/test832 b/tests/data/test832 index 044edb192..360654ab0 100644 --- a/tests/data/test832 +++ b/tests/data/test832 @@ -35,7 +35,7 @@ crypto IMAP DIGEST-MD5 graceful cancellation </name> <command> -'imap://%HOSTIP:%IMAPPORT/832/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/832/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test833 b/tests/data/test833 index b5fa03f9e..dc8214b8e 100644 --- a/tests/data/test833 +++ b/tests/data/test833 @@ -44,7 +44,7 @@ crypto IMAP CRAM-MD5 authentication with SASL downgrade </name> <command> -'imap://%HOSTIP:%IMAPPORT/833/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/833/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test834 b/tests/data/test834 index 17101ddfc..fc131773b 100644 --- a/tests/data/test834 +++ b/tests/data/test834 @@ -51,7 +51,7 @@ CURL_GETHOSTNAME=curlhost LD_PRELOAD=%PWD/libtest/.libs/libhostname.so </setenv> <command> -'imap://%HOSTIP:%IMAPPORT/834/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/834/;MAILINDEX=1' -u user:secret </command> <precheck> chkhostname curlhost diff --git a/tests/data/test835 b/tests/data/test835 index 34f28b71b..400233c0c 100644 --- a/tests/data/test835 +++ b/tests/data/test835 @@ -46,7 +46,7 @@ crypto IMAP DIGEST-MD5 authentication with SASL downgrade </name> <command> -'imap://%HOSTIP:%IMAPPORT/835/;UID=1' -u user:secret +'imap://%HOSTIP:%IMAPPORT/835/;MAILINDEX=1' -u user:secret </command> </client> diff --git a/tests/data/test836 b/tests/data/test836 index 035d48ffe..9478042ed 100644 --- a/tests/data/test836 +++ b/tests/data/test836 @@ -36,7 +36,7 @@ imap IMAP multiple connection authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/836/;UID=1' -u user.one:secret -: 'imap://%HOSTIP:%IMAPPORT/836/;UID=2' -u user.two:secret +'imap://%HOSTIP:%IMAPPORT/836/;MAILINDEX=1' -u user.one:secret -: 'imap://%HOSTIP:%IMAPPORT/836/;UID=2' -u user.two:secret </command> </client> diff --git a/tests/data/test837 b/tests/data/test837 index d5974634e..032726681 100644 --- a/tests/data/test837 +++ b/tests/data/test837 @@ -37,7 +37,7 @@ imap IMAP external authentication </name> <command> -'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/837/;UID=1' +'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/837/;MAILINDEX=1' </command> </client> diff --git a/tests/data/test838 b/tests/data/test838 index da2d28d05..f5378fb40 100644 --- a/tests/data/test838 +++ b/tests/data/test838 @@ -37,7 +37,7 @@ imap IMAP external authentication without credentials </name> <command> -'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/838/;UID=1' +'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/838/;MAILINDEX=1' </command> </client> diff --git a/tests/data/test839 b/tests/data/test839 index 2a544c1cf..508fb8e57 100644 --- a/tests/data/test839 +++ b/tests/data/test839 @@ -38,7 +38,7 @@ imap IMAP external authentication with initial response </name> <command> -'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/839/;UID=1' +'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/839/;MAILINDEX=1' </command> </client> diff --git a/tests/data/test840 b/tests/data/test840 index eaf1aeea4..1e85af396 100644 --- a/tests/data/test840 +++ b/tests/data/test840 @@ -38,7 +38,7 @@ imap IMAP external authentication with initial response without credentials </name> <command> -'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/840/;UID=1' +'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/840/;MAILINDEX=1' </command> </client> diff --git a/tests/data/test842 b/tests/data/test842 index d5aabbca8..e86abd430 100644 --- a/tests/data/test842 +++ b/tests/data/test842 @@ -38,7 +38,7 @@ imap IMAP OAuth 2.0 (OAUTHBEARER) authentication </name> <command> -'imap://%HOSTIP:%IMAPPORT/842/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM +'imap://%HOSTIP:%IMAPPORT/842/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM </command> # The protocol section doesn't support ways of specifying the raw data in the # base64 encoded message so we must assert this diff --git a/tests/data/test843 b/tests/data/test843 index a1c31a454..e286fd93f 100644 --- a/tests/data/test843 +++ b/tests/data/test843 @@ -39,7 +39,7 @@ imap IMAP OAuth 2.0 (OAUTHBEARER) authentication with initial response </name> <command> -'imap://%HOSTIP:%IMAPPORT/843/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM +'imap://%HOSTIP:%IMAPPORT/843/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM </command> # The protocol section doesn't support ways of specifying the raw data in the # base64 encoded message so we must assert this diff --git a/tests/data/test844 b/tests/data/test844 index 055a9d2f4..2cdb265fa 100644 --- a/tests/data/test844 +++ b/tests/data/test844 @@ -30,7 +30,7 @@ imap IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation </name> <command> -'imap://%HOSTIP:%IMAPPORT/844/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM +'imap://%HOSTIP:%IMAPPORT/844/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM </command> # The protocol section doesn't support ways of specifying the raw data in the # base64 encoded message so we must assert this diff --git a/tests/data/test845 b/tests/data/test845 index e23b3d69e..d8b557488 100644 --- a/tests/data/test845 +++ b/tests/data/test845 @@ -31,7 +31,7 @@ imap IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation with initial response </name> <command> -'imap://%HOSTIP:%IMAPPORT/845/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM +'imap://%HOSTIP:%IMAPPORT/845/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM </command> # The protocol section doesn't support ways of specifying the raw data in the # base64 encoded message so we must assert this diff --git a/tests/data/test846 b/tests/data/test846 index b363ffd18..8d4d3c5fc 100644 --- a/tests/data/test846 +++ b/tests/data/test846 @@ -33,7 +33,7 @@ imap IMAP PREAUTH response </name> <command> -'imap://%HOSTIP:%IMAPPORT/846/;UID=1' -u notused:still-provided +'imap://%HOSTIP:%IMAPPORT/846/;MAILINDEX=1' -u notused:still-provided </command> </client> diff --git a/tests/data/test847 b/tests/data/test847 new file mode 100644 index 000000000..d4c104332 --- /dev/null +++ b/tests/data/test847 @@ -0,0 +1,49 @@ +<testcase> +<info> +<keywords> +IMAP +Clear Text +FETCH +</keywords> +</info> + +# +# Server-side +<reply> +<data> +From: me@somewhere
+To: fake@nowhere
+
+body
+
+--
+ yours sincerely
+</data> +</reply> + +# +# Client-side +<client> +<server> +imap +</server> + <name> +IMAP FETCH message + </name> + <command> +'imap://%HOSTIP:%IMAPPORT/847/;UID=1' -u '"user:sec"ret{' +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<protocol> +A001 CAPABILITY
+A002 LOGIN "\"user" "sec\"ret{"
+A003 SELECT 847
+A004 UID FETCH 1 BODY[]
+A005 LOGOUT
+</protocol> +</verify> +</testcase> diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 97f7b8ea5..d401be24c 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -1560,7 +1560,13 @@ sub UID_imap { if ($selected eq "") { sendcontrol "$cmdid BAD Command received in Invalid state\r\n"; } - elsif (($command ne "COPY") && ($command ne "FETCH") && + elsif (substr($command, 0, 5) eq "FETCH"){ + my $func = $commandfunc{"FETCH"}; + if($func) { + &$func($args, $command); + } + } + elsif (($command ne "COPY") && ($command ne "STORE") && ($command ne "SEARCH")) { sendcontrol "$cmdid BAD Command Argument\r\n"; } |