commit ec17733b326833527338ca5b66cba4a0bcc6915a
Author: Oswald Buddenhagen <[email protected]>
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 6257174..5e22763 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
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel