aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJiri Hruska <jirka@fud.cz>2013-03-03 11:37:10 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-03-03 16:39:50 +0000
commite6b7dae9471d5b2ddcdba9f5012aee82a50bf47f (patch)
treef74cd57aba4a8c6cf8576b017711c33a7d0e79e5 /lib
parentfa637c6cab7d3d945381e4b670b6919c51e48eea (diff)
imap: Added required mailbox check for FETCH and APPEND commands
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 6ed887abe..cf27d6084 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -693,7 +693,7 @@ static CURLcode imap_select(struct connectdata *conn)
Curl_safefree(imapc->mailbox_uidvalidity);
/* Make sure the mailbox is in the correct atom format */
- mailbox = imap_atom(imap->mailbox ? imap->mailbox : "");
+ mailbox = imap_atom(imap->mailbox);
if(!mailbox)
result = CURLE_OUT_OF_MEMORY;
else
@@ -1867,6 +1867,7 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
static CURLcode imap_do(struct connectdata *conn, bool *done)
{
CURLcode result = CURLE_OK;
+ struct IMAP *imap;
*done = FALSE; /* default to false */
@@ -1879,6 +1880,8 @@ static CURLcode imap_do(struct connectdata *conn, bool *done)
if(result)
return result;
+ imap = conn->data->state.proto.imap;
+
/* Parse the URL path */
result = imap_parse_url_path(conn);
if(result)
@@ -1889,6 +1892,12 @@ static CURLcode imap_do(struct connectdata *conn, bool *done)
if(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);
return result;