commit 39142eb0e1589200f44775002f75a13f603a6b8e
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sun Mar 20 13:45:42 2011 +0100

    always use return value from get_cmd_result()
    
    once we have callback-based error reporting, this will ensure that we
    don't operate on invalidated data structures.

 src/drv_imap.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 138c9a6..fad6eb7 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -503,7 +503,8 @@ v_submit_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd,
        char buf[1024];
 
        while (ctx->literal_pending)
-               get_cmd_result( ctx, 0 );
+               if (get_cmd_result( ctx, 0 ) == RESP_BAD)
+                       goto bail;
 
        if (!cmd)
                cmd = new_imap_cmd();
@@ -625,12 +626,14 @@ drain_imap_replies( imap_store_t *ctx )
 }
 */
 
-static void
+static int
 process_imap_replies( imap_store_t *ctx )
 {
        while (ctx->num_in_progress > max_in_progress ||
               socket_pending( &ctx->buf.sock ))
-               get_cmd_result( ctx, 0 );
+               if (get_cmd_result( ctx, 0 ) == RESP_BAD)
+                       return RESP_BAD;
+       return RESP_OK;
 }
 
 static int
@@ -1616,8 +1619,7 @@ imap_flags_helper( imap_store_t *ctx, int uid, char what, 
int flags)
        buf[imap_make_flags( flags, buf )] = 0;
        if (!submit_imap_cmd( ctx, 0, "UID STORE %d %cFLAGS.SILENT %s", uid, 
what, buf ))
                return DRV_STORE_BAD;
-       process_imap_replies( ctx );
-       return DRV_OK;
+       return process_imap_replies( ctx ) == RESP_BAD ? DRV_STORE_BAD : DRV_OK;
 }
 
 static int

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to