Commit graph

74 commits

Author SHA1 Message Date
Jeremy Sowden 0ad05f5d78 wmbiff: added support for TLS SNI.
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>
2019-07-23 15:38:49 +01:00
Jeremy Sowden 241ad5eae9 wmbiff: bumped to 0.4.34.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-22 23:08:13 +01:00
Jeremy Sowden 2ec13c2f6f wmbiff: use one for-loop when creating backing XPM.
Fixes static analysis warning about uninitialized value.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden 70ceed6e38 wmbiff: fixed possible null-pointer dereference.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden de97a44cb4 wmbiff: fixed leaks.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden e672c84d1c wmbiff: removed superfluous assignment.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden ecca3b3b45 wmbiff: replaced strncpy with memcpy.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden b055b12fa5 wmbiff: stop hiding pointers behind typedefs.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden dc66a3de45 wmbiff: added .gitignore.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden b4882f131f wmbiff: removed autoconf directory.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden a239028734 wmbiff: added autogen.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-07-14 17:35:21 +01:00
Jeremy Sowden 5c213e9e77 wmbiff: use size_t for password-lengths.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-06-28 16:26:47 +01:00
Jeremy Sowden 897886a68c wmbiff: fixed endianness problems parsing server-ports.
`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>
2019-06-28 16:26:47 +01:00
Jeremy Sowden d0345f1059 wmbiff: fixed endianness problems connecting to POP and IMAP servers.
`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>
2019-06-28 16:26:47 +01:00
Jeremy Sowden dfa571a21b wmbiff: addr.sin_port is in NBO, so we should use ntohs(3), not htons(3).
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-06-28 16:26:47 +01:00
Jeremy Sowden 5d9eb1eb11 wmbiff: tidy up socket connexions.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-06-28 16:26:47 +01:00
Jeremy Sowden 1d9d06f152 wmbiff: correct the address size passed to connect(2).
`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>
2019-06-28 16:26:47 +01:00
Jeremy Sowden 3c0016eb79 wmbiff: regulo_match modifies instructions[i].destination, so remove const.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-06-28 16:26:47 +01:00
Jeremy Sowden 759e9a363a wmbiff: use temporary variables and remove casts.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-06-28 16:26:47 +01:00
Torrance, Douglas b904bd01b0 wmbiff: Bump to version 0.4.33 2019-03-01 11:49:03 +00:00
Torrance, Douglas 9527870311 wmbiff: Remove unnecessary loop.
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
2019-03-01 11:49:03 +00:00
Torrance, Douglas e807986e6e wmbiff: Bump to version 0.4.32. 2019-02-13 02:32:15 +00:00
Torrance, Douglas 01cdccc241 wmbiff: handle EAGAIN or GNUTLS_E_AGAIN
From Debian bug #917467, reported by Nye Liu <nyet@nyet.org> [1]:

If gnutls_read() or read() report EAGAIN, tlscomm_expect() fails:

wmbiff/nyet  comm: wrote a000 CAPABILITY
wmbiff/nyet  comm: imap.***.***:993: expecting: * CAPABILITY
wmbiff/nyet  comm: imap.***.***:993: gnutls error reading: Resource temporarily unavailable, try again.
wmbiff/nyet  imap4: unable to query capability stringwmbiff/nyet  comm: wrote a002 LOGOUT
wmbiff/nyet  comm: imap.***.***:993: closing.

[1] https://bugs.debian.org/917467
2019-02-13 02:32:15 +00:00
Doug Torrance 219e04f6ad Update mailing list links to new Google Groups. 2018-05-14 23:34:53 +01:00
Doug Torrance ad780663d9 wmbiff: Bump to version 0.4.31. 2017-06-24 17:07:02 +01:00
Doug Torrance bba01f1b6a wmbiff: Remove #define _GNU_SOURCE; already defined in CFLAGS. 2017-06-24 17:07:02 +01:00
Doug Torrance 3b000774cc wmbiff: Manually copy mailbox path.
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.
2017-06-24 17:07:02 +01:00
Doug Torrance 4eadda20b1 wmbiff: Bump to verson 0.4.30. 2016-12-01 10:51:29 +00:00
Doug Torrance 08f8c13a77 wmbiff: Add #define _GNU_SOURCE to avoid "implicit declaration" warnings. 2016-12-01 10:51:29 +00:00
Doug Torrance 2bea3d42e0 wmbiff: Use unsigned data type for port number. 2016-12-01 10:51:29 +00:00
Doug Torrance 25353b9708 wmbiff: Fix typos. 2016-07-20 16:37:37 +01:00
Doug Torrance 464744a386 wmbiff: Bump to version 0.4.29. 2016-07-20 11:26:09 +01:00
Doug Torrance 3149adc321 wmbiff: Close mailbox before we call status on it.
Additional patch by Nye Liu <nyet@nyet.org> to fix Debian bug #830889 [1].

[1] https://bugs.debian.org/830889
2016-07-20 11:26:09 +01:00
Doug Torrance 1d84a1d8e4 wmbiff: EXAMINE before STATUS
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
2016-07-12 19:32:49 +01:00
Doug Torrance 0703ba0b82 wmbiff: Add missing command line options to documentation.
Closes Debian bug #770117 [1].

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770117
2015-10-26 09:44:23 -04:00
Rodolfo García Peñas (kix) 6957f3efdc wmbiff: FTBFS with initialize_gnutls
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>
2015-08-16 11:40:20 +01:00
Doug Torrance ccf80e0891 wmbiff: Release version 0.4.28. 2014-11-08 11:20:02 +00:00
Doug Torrance 00f05fb75a wmbiff: Update ChangeLog (used git2cl). 2014-11-08 11:20:02 +00:00
Doug Torrance 6960461477 wmbiff: Remove sourceforgeupload target from Makefile; no longer needed. 2014-11-08 11:20:02 +00:00
Doug Torrance f2d751486e wmbiff: Update email address. 2014-11-08 11:20:02 +00:00
Doug Torrance fbdfe22ddd wmbiff: Use PACKAGE_BUGREPORT instead of hardcoding address. 2014-11-08 11:20:02 +00:00
Doug Torrance c4fd282e12 wmbiff: Update FAQ. 2014-11-08 11:20:02 +00:00
Doug Torrance e2ad0cfece wmbiff: Fix cast to pointer from integer of different size compiler warning. 2014-11-08 11:20:02 +00:00
Doug Torrance 5280405ca6 wmbiff: Fix compiler warnings from deprecated gnutls types. 2014-11-08 11:20:02 +00:00
Doug Torrance ef5a71aa20 wmbiff: Fix manpages.
In particular, fix spelling-error-in-manpage, hyphen-used-as-minus-sign,
and manpage-has-errors-from-man Lintian warnings from the Debian package.
2014-11-08 11:20:02 +00:00
Doug Torrance acdd1c28f7 wmbiff: Remove arguments to AM_INIT_AUTOMAKE in configure.ac.
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.
2014-11-08 11:20:02 +00:00
Doug Torrance 4c22da9b04 wmbiff: Remove INSTALL; automatically generated by autotools. 2014-11-08 11:20:02 +00:00
Doug Torrance 535c1653ea wmbiff: Increase number of actions to 40.
Patch by Alberto Morales <amd77@gulic.org>.

For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=589408
2014-11-08 11:20:02 +00:00
Doug Torrance eeacc3014a wmbiff: Allow usernames with more than 32 characters.
Patch by Tommaso Parisi <tommasop.ml@libero.it>.

For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626393
2014-11-08 11:20:02 +00:00
Doug Torrance 1981a52fdf wmbiff: Fix connection leak.
Patch by Arnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>.

For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663876
2014-11-08 11:20:02 +00:00