mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 17:31:46 -05:00
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
This commit is contained in:
parent
2825f46d95
commit
6987fcef65
@ -187,7 +187,10 @@ imap://user:password@mail.example.com/INBOX - Performs a folder list on the
|
|||||||
user's inbox
|
user's inbox
|
||||||
|
|
||||||
imap://user:password@mail.example.com/INBOX/;UID=1 - Selects the user's inbox
|
imap://user:password@mail.example.com/INBOX/;UID=1 - Selects the user's inbox
|
||||||
and fetches message 1
|
and fetches message with uid = 1
|
||||||
|
|
||||||
|
imap://user:password@mail.example.com/INBOX/;MAILINDEX=1 - Selects the user's inbox
|
||||||
|
and fetches the first message in the mail box
|
||||||
|
|
||||||
imap://user:password@mail.example.com/INBOX;UIDVALIDITY=50/;UID=2 - Selects
|
imap://user:password@mail.example.com/INBOX;UIDVALIDITY=50/;UID=2 - Selects
|
||||||
the user's inbox, checks the UIDVALIDITY of the mailbox is 50 and fetches
|
the user's inbox, checks the UIDVALIDITY of the mailbox is 50 and fetches
|
||||||
|
61
lib/imap.c
61
lib/imap.c
@ -421,7 +421,6 @@ static CURLcode imap_perform_capability(struct connectdata *conn)
|
|||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
struct imap_conn *imapc = &conn->proto.imapc;
|
struct imap_conn *imapc = &conn->proto.imapc;
|
||||||
|
|
||||||
imapc->sasl.authmechs = SASL_AUTH_NONE; /* No known auth. mechanisms yet */
|
imapc->sasl.authmechs = SASL_AUTH_NONE; /* No known auth. mechanisms yet */
|
||||||
imapc->sasl.authused = SASL_AUTH_NONE; /* Clear the auth. mechanism used */
|
imapc->sasl.authused = SASL_AUTH_NONE; /* Clear the auth. mechanism used */
|
||||||
imapc->tls_supported = FALSE; /* Clear the TLS capability */
|
imapc->tls_supported = FALSE; /* Clear the TLS capability */
|
||||||
@ -683,24 +682,37 @@ static CURLcode imap_perform_fetch(struct connectdata *conn)
|
|||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
struct IMAP *imap = conn->data->req.protop;
|
struct IMAP *imap = conn->data->req.protop;
|
||||||
|
|
||||||
/* Check we have a UID */
|
/* Check we have a UID */
|
||||||
if(!imap->uid) {
|
if(imap->uid) {
|
||||||
failf(conn->data, "Cannot FETCH without a UID.");
|
|
||||||
return CURLE_URL_MALFORMAT;
|
/* Send the FETCH command */
|
||||||
|
if(imap->partial)
|
||||||
|
result = imap_sendf(conn, "UID FETCH %s BODY[%s]<%s>",
|
||||||
|
imap->uid,
|
||||||
|
imap->section ? imap->section : "",
|
||||||
|
imap->partial);
|
||||||
|
else
|
||||||
|
result = imap_sendf(conn, "UID FETCH %s BODY[%s]",
|
||||||
|
imap->uid,
|
||||||
|
imap->section ? imap->section : "");
|
||||||
}
|
}
|
||||||
|
else if(imap->mindex) {
|
||||||
|
|
||||||
/* Send the FETCH command */
|
/* Send the FETCH command */
|
||||||
if(imap->partial)
|
if(imap->partial)
|
||||||
result = imap_sendf(conn, "FETCH %s BODY[%s]<%s>",
|
result = imap_sendf(conn, "FETCH %s BODY[%s]<%s>",
|
||||||
imap->uid,
|
imap->mindex,
|
||||||
imap->section ? imap->section : "",
|
imap->section ? imap->section : "",
|
||||||
imap->partial);
|
imap->partial);
|
||||||
else
|
else
|
||||||
result = imap_sendf(conn, "FETCH %s BODY[%s]",
|
result = imap_sendf(conn, "FETCH %s BODY[%s]",
|
||||||
imap->uid,
|
imap->mindex,
|
||||||
imap->section ? imap->section : "");
|
imap->section ? imap->section : "");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
failf(conn->data, "Cannot FETCH without a UID.");
|
||||||
|
return CURLE_URL_MALFORMAT;
|
||||||
|
}
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, IMAP_FETCH);
|
state(conn, IMAP_FETCH);
|
||||||
|
|
||||||
@ -1464,9 +1476,10 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
result = status; /* use the already set error code */
|
result = status; /* use the already set error code */
|
||||||
}
|
}
|
||||||
else if(!data->set.connect_only && !imap->custom &&
|
else if(!data->set.connect_only && !imap->custom &&
|
||||||
(imap->uid || data->set.upload ||
|
(imap->uid || imap->mindex || data->set.upload ||
|
||||||
data->set.mimepost.kind != MIMEKIND_NONE)) {
|
data->set.mimepost.kind != MIMEKIND_NONE)) {
|
||||||
/* Handle responses after FETCH or APPEND transfer has finished */
|
/* Handle responses after FETCH or APPEND transfer has finished */
|
||||||
|
|
||||||
if(!data->set.upload && data->set.mimepost.kind == MIMEKIND_NONE)
|
if(!data->set.upload && data->set.mimepost.kind == MIMEKIND_NONE)
|
||||||
state(conn, IMAP_FETCH_FINAL);
|
state(conn, IMAP_FETCH_FINAL);
|
||||||
else {
|
else {
|
||||||
@ -1490,6 +1503,7 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
Curl_safefree(imap->mailbox);
|
Curl_safefree(imap->mailbox);
|
||||||
Curl_safefree(imap->uidvalidity);
|
Curl_safefree(imap->uidvalidity);
|
||||||
Curl_safefree(imap->uid);
|
Curl_safefree(imap->uid);
|
||||||
|
Curl_safefree(imap->mindex);
|
||||||
Curl_safefree(imap->section);
|
Curl_safefree(imap->section);
|
||||||
Curl_safefree(imap->partial);
|
Curl_safefree(imap->partial);
|
||||||
Curl_safefree(imap->query);
|
Curl_safefree(imap->query);
|
||||||
@ -1543,14 +1557,14 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
|||||||
else if(imap->custom && (selected || !imap->mailbox))
|
else if(imap->custom && (selected || !imap->mailbox))
|
||||||
/* Custom command using the same mailbox or no mailbox */
|
/* Custom command using the same mailbox or no mailbox */
|
||||||
result = imap_perform_list(conn);
|
result = imap_perform_list(conn);
|
||||||
else if(!imap->custom && selected && imap->uid)
|
else if(!imap->custom && selected && (imap->uid || imap->mindex))
|
||||||
/* FETCH from the same mailbox */
|
/* FETCH from the same mailbox */
|
||||||
result = imap_perform_fetch(conn);
|
result = imap_perform_fetch(conn);
|
||||||
else if(!imap->custom && selected && imap->query)
|
else if(!imap->custom && selected && imap->query)
|
||||||
/* SEARCH the current mailbox */
|
/* SEARCH the current mailbox */
|
||||||
result = imap_perform_search(conn);
|
result = imap_perform_search(conn);
|
||||||
else if(imap->mailbox && !selected &&
|
else if(imap->mailbox && !selected &&
|
||||||
(imap->custom || imap->uid || imap->query))
|
(imap->custom || imap->uid || imap->mindex || imap->query))
|
||||||
/* SELECT the mailbox */
|
/* SELECT the mailbox */
|
||||||
result = imap_perform_select(conn);
|
result = imap_perform_select(conn);
|
||||||
else
|
else
|
||||||
@ -2016,6 +2030,13 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
|||||||
imap->uid = value;
|
imap->uid = value;
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
|
else if(strcasecompare(name, "MAILINDEX") && !imap->mindex) {
|
||||||
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
|
value[valuelen - 1] = '\0';
|
||||||
|
|
||||||
|
imap->mindex = value;
|
||||||
|
value = NULL;
|
||||||
|
}
|
||||||
else if(strcasecompare(name, "SECTION") && !imap->section) {
|
else if(strcasecompare(name, "SECTION") && !imap->section) {
|
||||||
if(valuelen > 0 && value[valuelen - 1] == '/')
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
value[valuelen - 1] = '\0';
|
value[valuelen - 1] = '\0';
|
||||||
@ -2043,7 +2064,7 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
|||||||
|
|
||||||
/* Does the URL contain a query parameter? Only valid when we have a mailbox
|
/* Does the URL contain a query parameter? Only valid when we have a mailbox
|
||||||
and no UID as per RFC-5092 */
|
and no UID as per RFC-5092 */
|
||||||
if(imap->mailbox && !imap->uid && *ptr == '?') {
|
if(imap->mailbox && !imap->uid && !imap->mindex && *ptr == '?') {
|
||||||
/* Find the length of the query parameter */
|
/* Find the length of the query parameter */
|
||||||
begin = ++ptr;
|
begin = ++ptr;
|
||||||
while(imap_is_bchar(*ptr))
|
while(imap_is_bchar(*ptr))
|
||||||
|
@ -58,6 +58,7 @@ struct IMAP {
|
|||||||
char *mailbox; /* Mailbox to select */
|
char *mailbox; /* Mailbox to select */
|
||||||
char *uidvalidity; /* UIDVALIDITY to check in select */
|
char *uidvalidity; /* UIDVALIDITY to check in select */
|
||||||
char *uid; /* Message UID to fetch */
|
char *uid; /* Message UID to fetch */
|
||||||
|
char *mindex; /* Index in mail box of mail to fetch */
|
||||||
char *section; /* Message SECTION to fetch */
|
char *section; /* Message SECTION to fetch */
|
||||||
char *partial; /* Message PARTIAL to fetch */
|
char *partial; /* Message PARTIAL to fetch */
|
||||||
char *query; /* Query to search for */
|
char *query; /* Query to search for */
|
||||||
|
@ -93,7 +93,7 @@ test809 test810 test811 test812 test813 test814 test815 test816 test817 \
|
|||||||
test818 test819 test820 test821 test822 test823 test824 test825 test826 \
|
test818 test819 test820 test821 test822 test823 test824 test825 test826 \
|
||||||
test827 test828 test829 test830 test831 test832 test833 test834 test835 \
|
test827 test828 test829 test830 test831 test832 test833 test834 test835 \
|
||||||
test836 test837 test838 test839 test840 test841 test842 test843 test844 \
|
test836 test837 test838 test839 test840 test841 test842 test843 test844 \
|
||||||
test845 test846 \
|
test845 test846 test847 \
|
||||||
\
|
\
|
||||||
test850 test851 test852 test853 test854 test855 test856 test857 test858 \
|
test850 test851 test852 test853 test854 test855 test856 test857 test858 \
|
||||||
test859 test860 test861 test862 test863 test864 test865 test866 test867 \
|
test859 test860 test861 test862 test863 test864 test865 test866 test867 \
|
||||||
|
@ -51,7 +51,7 @@ http
|
|||||||
IMAP FETCH tunneled through HTTP proxy
|
IMAP FETCH tunneled through HTTP proxy
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ imap
|
|||||||
SSL_CERT_FILE=
|
SSL_CERT_FILE=
|
||||||
</setenv>
|
</setenv>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
hnd = curl_easy_init();
|
hnd = curl_easy_init();
|
||||||
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
|
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_USERPWD, "user:secret");
|
||||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||||
|
@ -39,7 +39,7 @@ IMAP multi transfer error without curl_multi_remove_handle
|
|||||||
lib1552
|
lib1552
|
||||||
</tool>
|
</tool>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/1552/;UID=1'
|
'imap://%HOSTIP:%IMAPPORT/1552/;MAILINDEX=1'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ imap
|
|||||||
IMAP FETCH message
|
IMAP FETCH message
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/800/;UID=1' -u '"user:sec"ret{'
|
'imap://%HOSTIP:%IMAPPORT/800/;MAILINDEX=1' -u '"user:sec"ret{'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ body
|
|||||||
imap
|
imap
|
||||||
</server>
|
</server>
|
||||||
<name>
|
<name>
|
||||||
IMAP FETCH message by UID and SECTION
|
IMAP FETCH message by MAILINDEX and SECTION
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/801/;UID=123/;SECTION=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/801/;MAILINDEX=123/;SECTION=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ imap
|
|||||||
IMAP SELECT UIDVALIDITY Success
|
IMAP SELECT UIDVALIDITY Success
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ imap
|
|||||||
IMAP SELECT UIDVALIDITY Failure
|
IMAP SELECT UIDVALIDITY Failure
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/803;UIDVALIDITY=12345/;UID=123' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/803;UIDVALIDITY=12345/;MAILINDEX=123' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ imap
|
|||||||
IMAP doesn't perform SELECT if re-using the same mailbox
|
IMAP doesn't perform SELECT if re-using the same mailbox
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ imap
|
|||||||
IMAP plain authentication
|
IMAP plain authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/819/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/819/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ imap
|
|||||||
IMAP login authentication
|
IMAP login authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/820/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/820/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ crypto
|
|||||||
IMAP CRAM-MD5 authentication
|
IMAP CRAM-MD5 authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/821/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/821/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ CURL_GETHOSTNAME=curlhost
|
|||||||
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
||||||
</setenv>
|
</setenv>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/822/;UID=1' -u testuser:testpass
|
'imap://%HOSTIP:%IMAPPORT/822/;MAILINDEX=1' -u testuser:testpass
|
||||||
</command>
|
</command>
|
||||||
<precheck>
|
<precheck>
|
||||||
chkhostname curlhost
|
chkhostname curlhost
|
||||||
|
@ -43,7 +43,7 @@ crypto
|
|||||||
IMAP DIGEST-MD5 authentication
|
IMAP DIGEST-MD5 authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/823/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/823/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ imap
|
|||||||
IMAP OAuth 2.0 (XOAUTH2) authentication
|
IMAP OAuth 2.0 (XOAUTH2) authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ imap
|
|||||||
IMAP plain authentication with initial response
|
IMAP plain authentication with initial response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/825/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/825/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ imap
|
|||||||
IMAP login authentication with initial response
|
IMAP login authentication with initial response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/826/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/826/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ CURL_GETHOSTNAME=curlhost
|
|||||||
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
||||||
</setenv>
|
</setenv>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/827/;UID=1' -u testuser:testpass
|
'imap://%HOSTIP:%IMAPPORT/827/;MAILINDEX=1' -u testuser:testpass
|
||||||
</command>
|
</command>
|
||||||
<precheck>
|
<precheck>
|
||||||
chkhostname curlhost
|
chkhostname curlhost
|
||||||
|
@ -38,7 +38,7 @@ imap
|
|||||||
IMAP OAuth 2.0 (XOAUTH2) authentication with initial response
|
IMAP OAuth 2.0 (XOAUTH2) authentication with initial response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ crypto
|
|||||||
IMAP CRAM-MD5 graceful cancellation
|
IMAP CRAM-MD5 graceful cancellation
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/830/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/830/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ CURL_GETHOSTNAME=curlhost
|
|||||||
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
||||||
</setenv>
|
</setenv>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/831/;UID=1' -u testuser:testpass
|
'imap://%HOSTIP:%IMAPPORT/831/;MAILINDEX=1' -u testuser:testpass
|
||||||
</command>
|
</command>
|
||||||
<precheck>
|
<precheck>
|
||||||
chkhostname curlhost
|
chkhostname curlhost
|
||||||
|
@ -35,7 +35,7 @@ crypto
|
|||||||
IMAP DIGEST-MD5 graceful cancellation
|
IMAP DIGEST-MD5 graceful cancellation
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/832/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/832/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ crypto
|
|||||||
IMAP CRAM-MD5 authentication with SASL downgrade
|
IMAP CRAM-MD5 authentication with SASL downgrade
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/833/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/833/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ CURL_GETHOSTNAME=curlhost
|
|||||||
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
||||||
</setenv>
|
</setenv>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/834/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/834/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
<precheck>
|
<precheck>
|
||||||
chkhostname curlhost
|
chkhostname curlhost
|
||||||
|
@ -46,7 +46,7 @@ crypto
|
|||||||
IMAP DIGEST-MD5 authentication with SASL downgrade
|
IMAP DIGEST-MD5 authentication with SASL downgrade
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/835/;UID=1' -u user:secret
|
'imap://%HOSTIP:%IMAPPORT/835/;MAILINDEX=1' -u user:secret
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ imap
|
|||||||
IMAP multiple connection authentication
|
IMAP multiple connection authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ imap
|
|||||||
IMAP external authentication
|
IMAP external authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/837/;UID=1'
|
'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/837/;MAILINDEX=1'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ imap
|
|||||||
IMAP external authentication without credentials
|
IMAP external authentication without credentials
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/838/;UID=1'
|
'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/838/;MAILINDEX=1'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ imap
|
|||||||
IMAP external authentication with initial response
|
IMAP external authentication with initial response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/839/;UID=1'
|
'imap://user;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/839/;MAILINDEX=1'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ imap
|
|||||||
IMAP external authentication with initial response without credentials
|
IMAP external authentication with initial response without credentials
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/840/;UID=1'
|
'imap://;AUTH=EXTERNAL@%HOSTIP:%IMAPPORT/840/;MAILINDEX=1'
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ imap
|
|||||||
IMAP OAuth 2.0 (OAUTHBEARER) authentication
|
IMAP OAuth 2.0 (OAUTHBEARER) authentication
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
# The protocol section doesn't support ways of specifying the raw data in the
|
||||||
# base64 encoded message so we must assert this
|
# base64 encoded message so we must assert this
|
||||||
|
@ -39,7 +39,7 @@ imap
|
|||||||
IMAP OAuth 2.0 (OAUTHBEARER) authentication with initial response
|
IMAP OAuth 2.0 (OAUTHBEARER) authentication with initial response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
# The protocol section doesn't support ways of specifying the raw data in the
|
||||||
# base64 encoded message so we must assert this
|
# base64 encoded message so we must assert this
|
||||||
|
@ -30,7 +30,7 @@ imap
|
|||||||
IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation
|
IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
# The protocol section doesn't support ways of specifying the raw data in the
|
||||||
# base64 encoded message so we must assert this
|
# base64 encoded message so we must assert this
|
||||||
|
@ -31,7 +31,7 @@ imap
|
|||||||
IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation with initial response
|
IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation with initial response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
# The protocol section doesn't support ways of specifying the raw data in the
|
||||||
# base64 encoded message so we must assert this
|
# base64 encoded message so we must assert this
|
||||||
|
@ -33,7 +33,7 @@ imap
|
|||||||
IMAP PREAUTH response
|
IMAP PREAUTH response
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/846/;UID=1' -u notused:still-provided
|
'imap://%HOSTIP:%IMAPPORT/846/;MAILINDEX=1' -u notused:still-provided
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
49
tests/data/test847
Normal file
49
tests/data/test847
Normal file
@ -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>
|
@ -1560,7 +1560,13 @@ sub UID_imap {
|
|||||||
if ($selected eq "") {
|
if ($selected eq "") {
|
||||||
sendcontrol "$cmdid BAD Command received in Invalid state\r\n";
|
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")) {
|
($command ne "STORE") && ($command ne "SEARCH")) {
|
||||||
sendcontrol "$cmdid BAD Command Argument\r\n";
|
sendcontrol "$cmdid BAD Command Argument\r\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user