Package: wmbiff Version: 0.4.28-2 Severity: important Tags: upstream patch Dear Maintainer,
Outlook Office365 IMAP servers now expect a client to issue at least one EXAMINE before STATUS, or UNSEEN is always zero: "unsub" folder has two messages, one unseen. Broken: 56:04.84 > CJFK1 LOGIN "nyet@xxx" "xxx" 56:21.99 < CJFK1 OK LOGIN completed. 56:21.99 > CJFK2 STATUS unsub (MESSAGES UNSEEN) 56:22.20 < * STATUS unsub (MESSAGES 2 UNSEEN 0) 56:22.20 < CJFK2 OK STATUS completed. Works: 56:46.04 > BPEB1 LOGIN "nyet@xxx" "xxx" 56:51.43 < BPEB1 OK LOGIN completed. 56:51.43 > BPEB2 EXAMINE unsub 56:51.67 < * 2 EXISTS 56:51.67 < * 0 RECENT 56:51.67 < * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent) 56:51.67 < * OK [PERMANENTFLAGS ()] Permanent flags 56:51.67 < * OK [UNSEEN 2] Is the first unseen message 56:51.67 < * OK [UIDVALIDITY 164] UIDVALIDITY value 56:51.67 < * OK [UIDNEXT 16] The next unique identifier value 56:51.67 < BPEB2 OK [READ-ONLY] EXAMINE completed. 56:51.67 > BPEB3 STATUS unsub (MESSAGES UNSEEN) 56:51.89 < * STATUS unsub (MESSAGES 2 UNSEEN 1) 56:51.89 < BPEB3 OK STATUS completed. Attached is a patch to always issue EXAMINE before a STATUS. It doesn't seem like it has to be done before every STATUS, just at least once. Is only a proof of concept. I don't presume to know the best way to handle optimizing it. -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.5.0-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages wmbiff depends on: ii libc6 2.23-1 ii libgcrypt20 1.7.0-2 ii libgnutls-deb0-28 3.3.18-1 ii libx11-6 2:1.6.3-1 ii libxext6 2:1.3.3-1 ii libxpm4 1:3.5.11-1+b1 ii zlib1g 1:1.2.8.dfsg-2+b1 wmbiff recommends no packages. Versions of packages wmbiff suggests: ii ruby 1:2.3.0+4 ii ssh-askpass 1:1.2.4.1-9 -- no debconf information
--- a/wmbiff/Imap4Client.c +++ b/wmbiff/Imap4Client.c @@ -312,6 +312,13 @@ return -1; } + command_id++; + tlscomm_printf(scs, "a%03d EXAMINE %s\r\n", command_id, pc->path); + if (tlscomm_expect(scs, "* OK", buf, 127) == 0) { + tlscomm_close(unbind(scs)); + return; + } + /* if we've got it by now, try the status query */ command_id++; tlscomm_printf(scs, "a%03d STATUS %s (MESSAGES UNSEEN)\r\n",