From Debian bug #917993:
From: Nye Liu <nyet@nyet.org>
Subject: wmbiff: gmail (and many other IMAP servers) now require SNI
Date: Tue, 01 Jan 2019 18:33:51 -0800
wmbiff/gmail imap4: Need new connection to ***@gmail.com@imap.gmail.com
wmbiff/gmail comm: certificate passed time check.
wmbiff/gmail comm: server's certificate (OU=No SNI provided\; please fix your client.,CN=invalid2.invalid) does not match its hostname (imap.gmail.com).
wmbiff/gmail comm: server's certificate does not match its hostname.
wmbiff/gmail comm: to ignore this error, run wmbiff with the -skip-certificate-check option
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
`regulo_atoi` expects a pointer-to-int and `PCU.serverPort` is a
`uint16_t`, so `&PCU.serverPort` is not compatible and we need to use an
`int` temporary variable to avoid endianness problems.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
`addr.sin_addr.s_addr` is a `uint32_t` in NBO, so assigning a
`struct in_addr` cast to `unsigned long` will break on 64-bit big-endian
architectures.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
`addr` is a `struct sockaddr_in`, not a `struct sockaddr`; using `sizeof
var` instead of `sizeof (type)` ensures that the right size is used.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
The last release of wmbiff included a patch by Nye Liu from Debian
bug #917467 [1]. However, the second part of that patch is not necessary.
From Andreas Metzler's comment
I am not sure about the second part of the patch. I understand wmbiff
breaking on GNUTLS_E_AGAIN from gnutls_read, because this only started
to happen recently (with TLS1.3) on blocking sockets.
What I do not get from my rudimentary understanding C programmimg is the
second part, this is in the else of "if (scs->tls_state)", so, afaiui for
non-encrypted connections. Is the change necessary there at all, is it
the right thing to retry read on EAGAIN then?
We revert the second part of the patch.
[1] https://bugs.debian.org/917467
Patch by Demi <m@tfiu.de> to fix Debian bug #621690.
From https://bugs.debian.org/621690:
> wmbiff change path of my mailboxes next nearest.
>
> For example wmbiff change 'gleb' to 'glil' for second and fourth mailboxes.
> However the 1st, 3rd and 5th mailboxes have correct path.
Well, the indices don't really enter. I'm actually surprised this
isn't more trouble.
The underlying reason is that in wmbiff.c:parse_mbox_path, the
program calls
mboxCreate((&mbox[item]), mbox[item].path);
which for maildirs calls
int maildirCreate(Pop3 pc, const char *str)
in maildirClient.c. str in this way is an alias for pc->path.
In maildirCreate, after some char acrobatics, the program eventually
does
strncpy(pc->path, str + 8 + i, BUF_BIG - 1);
to cut off the leading stuff from the maildir. The result of this
operation is not defined, as pc->path and str point to the same
memory and thus the arguments overlap, which strncpy outlaws.
A simple fix is to copy manually, like this:
DM(pc, DEBUG_ERROR, "maildir '%s' is too long.\n", str + 8 + i);
memset(pc->path, 0, BUF_BIG);
} else {
+ const char *sp = str + 8 + i;
+ char *dp = pc->path;
+
+ while (*sp && sp-str<BUF_BIG-1) {
+ *dp++ = *sp++;
+ }
+ *dp = 0;
- strncpy(pc->path, , BUF_BIG - 1); /* cut off ``maildir:'' */
}
-- it's what I'm doing now. But I give you that's a bit pedestrian.
Patch by Nye Liu <nyet@nyet.org> to fix Debian bug #830889 [1].
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.
[1] https://bugs.debian.org/830889
The first argument for the function initialize_gnutls is an intptr_t
so wmbiff fails to build from source. This patch changes the current
int to intptr_t.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch serves two purposes:
- Avoid a " AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated"
warning when running autoreconf.
- Fix "syntax error near unexpected token" when running configure.