Mercurial > dovecot > core-2.2
changeset 20781:94ec056b78fb
imap-hibernate: Accept RFC DONE\IDLE
Change imap-hibernate to accept
DONE\r\n<tag> IDLE\r\n
as well, which is specified by RFC
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Wed, 28 Sep 2016 13:34:46 +0300 |
parents | 6fd8e7d2a497 |
children | f2f0495af580 |
files | src/imap-hibernate/imap-client.c |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap-hibernate/imap-client.c Tue Sep 27 13:28:15 2016 +0300 +++ b/src/imap-hibernate/imap-client.c Wed Sep 28 13:34:46 2016 +0300 @@ -26,8 +26,8 @@ #define IMAP_MASTER_SOCKET_NAME "imap-master" -/* we only need enough for "DONE\r\nIDLE\r\n" */ -#define IMAP_MAX_INBUF 12 +/* we only need enough for "DONE\r\n<tag> IDLE\r\n" */ +#define IMAP_MAX_INBUF 12 + 1 + 128 /* DONE\r\nIDLE\r\n + ' ' + <tag> */ /* If client has sent input and we can't recreate imap process in this many seconds, disconnect the client. */ @@ -267,6 +267,17 @@ return IMAP_CLIENT_INPUT_STATE_BAD; data++; size--; + /* skip over tag */ + while(size > 6 && + data[0] != ' ' && + data[0] != '\r' && + data[0] != '\t' ) { data++; size--; } + + if (size == 0) + return IMAP_CLIENT_INPUT_STATE_UNKNOWN; + if (data[0] != ' ') + return IMAP_CLIENT_INPUT_STATE_BAD; + /* skip over IDLE[\r]\n - checking this assumes that the DONE and IDLE are sent in the same IP packet, otherwise we'll unnecessarily recreate the imap process and immediately resume IDLE there. if this