imap: Added filtering of CAPABILITY and FETCH untagged responses
authorJiri Hruska <jirka@fud.cz>
Tue, 26 Feb 2013 18:22:42 +0000 (19:22 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Tue, 26 Feb 2013 20:35:41 +0000 (20:35 +0000)
Only responses that contain "CAPABILITY" and "FETCH", respectively,
will be sent to their response handler.

lib/imap.c

index 68f765a..1c4635f 100644 (file)
@@ -391,8 +391,13 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
     switch(imapc->state) {
       /* States which are interested in untagged responses */
       case IMAP_CAPABILITY:
+        if(!imap_matchresp(line, len, "CAPABILITY"))
+          return FALSE;
+        break;
+
       case IMAP_FETCH:
-        *resp = '*';
+        if(!imap_matchresp(line, len, "FETCH"))
+          return FALSE;
         break;
  
       /* Ignore other untagged responses */
@@ -400,6 +405,7 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
         return FALSE;
     }
 
+    *resp = '*';
     return TRUE;
   }