imap: Added required mailbox check for FETCH and APPEND commands
This commit is contained in:
11
lib/imap.c
11
lib/imap.c
@@ -693,7 +693,7 @@ static CURLcode imap_select(struct connectdata *conn)
|
|||||||
Curl_safefree(imapc->mailbox_uidvalidity);
|
Curl_safefree(imapc->mailbox_uidvalidity);
|
||||||
|
|
||||||
/* Make sure the mailbox is in the correct atom format */
|
/* Make sure the mailbox is in the correct atom format */
|
||||||
mailbox = imap_atom(imap->mailbox ? imap->mailbox : "");
|
mailbox = imap_atom(imap->mailbox);
|
||||||
if(!mailbox)
|
if(!mailbox)
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
else
|
else
|
||||||
@@ -1867,6 +1867,7 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
|||||||
static CURLcode imap_do(struct connectdata *conn, bool *done)
|
static CURLcode imap_do(struct connectdata *conn, bool *done)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
|
struct IMAP *imap;
|
||||||
|
|
||||||
*done = FALSE; /* default to false */
|
*done = FALSE; /* default to false */
|
||||||
|
|
||||||
@@ -1879,6 +1880,8 @@ static CURLcode imap_do(struct connectdata *conn, bool *done)
|
|||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
imap = conn->data->state.proto.imap;
|
||||||
|
|
||||||
/* Parse the URL path */
|
/* Parse the URL path */
|
||||||
result = imap_parse_url_path(conn);
|
result = imap_parse_url_path(conn);
|
||||||
if(result)
|
if(result)
|
||||||
@@ -1889,6 +1892,12 @@ static CURLcode imap_do(struct connectdata *conn, bool *done)
|
|||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
/* Check we have a mailbox for FETCH and APPEND commands */
|
||||||
|
if(!imap->custom && !imap->mailbox) {
|
||||||
|
failf(conn->data, "FETCH and APPEND require a mailbox.");
|
||||||
|
return CURLE_URL_MALFORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
result = imap_regular_transfer(conn, done);
|
result = imap_regular_transfer(conn, done);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user