mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
imap: Added verification of UIDVALIDITY mailbox attribute
Added support for checking the UIDVALIDITY, and aborting the request, if it has been specified in the URL and the server response is different.
This commit is contained in:
parent
59c71c7fc7
commit
a8eb059203
@ -1216,6 +1216,7 @@ static CURLcode imap_state_select_resp(struct connectdata *conn,
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct IMAP *imap = conn->data->state.proto.imap;
|
||||
struct imap_conn *imapc = &conn->proto.imapc;
|
||||
const char *line = data->state.buffer;
|
||||
char tmp[20];
|
||||
@ -1233,8 +1234,16 @@ static CURLcode imap_state_select_resp(struct connectdata *conn,
|
||||
failf(data, "Select failed");
|
||||
result = CURLE_LOGIN_DENIED;
|
||||
}
|
||||
else {
|
||||
/* Check if the UIDVALIDITY has been specified and matches */
|
||||
if(imap->uidvalidity && imapc->mailbox_uidvalidity &&
|
||||
strcmp(imap->uidvalidity, imapc->mailbox_uidvalidity)) {
|
||||
failf(conn->data, "Mailbox UIDVALIDITY has changed");
|
||||
result = CURLE_REMOTE_FILE_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
result = imap_fetch(conn);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user