On Tue, Jul 19, 2016 at 10:34:18AM -0400, Doug Torrance wrote: > I was wondering if you had any updates about this bug. > > Is violating RFC3501 a dealbreaker? Should wmbiff use search, or should we > go ahead and release a version with your original patch to fix the bug?
Naw, I don't think using status breaks anything, as long as we make sure the mailbox is closed before we call status on it. Attached is my latest patch.
--- a/wmbiff/Imap4Client.c +++ b/wmbiff/Imap4Client.c @@ -294,6 +294,7 @@ /* recover connection state from the cache */ struct connection_state *scs = state_for_pcu(pc); char buf[BUF_SIZE]; + char examine_expect[BUF_SIZE]; static int command_id; /* if it's not in the cache, try to open */ @@ -312,6 +313,22 @@ return -1; } + command_id++; + tlscomm_printf(scs, "a%03d EXAMINE %s\r\n", command_id, pc->path); + snprintf(examine_expect, BUF_SIZE, "a%03d OK", command_id); + if (tlscomm_expect(scs, examine_expect, buf, 127) == 0) { + tlscomm_close(unbind(scs)); + return -1; + } + + command_id++; + tlscomm_printf(scs, "a%03d CLOSE\r\n", command_id); + snprintf(examine_expect, BUF_SIZE, "a%03d OK", command_id); + if (tlscomm_expect(scs, examine_expect, buf, 127) == 0) { + tlscomm_close(unbind(scs)); + return -1; + } + /* if we've got it by now, try the status query */ command_id++; tlscomm_printf(scs, "a%03d STATUS %s (MESSAGES UNSEEN)\r\n",