Update to fdm 2.0, from Stephen Gregoratto, thanks !

Enable PCRE while here, from sthen@
ok sthen@
This commit is contained in:
landry 2019-04-27 10:16:27 +00:00
parent 4da3d70e16
commit fba5fa4f2b
3 changed files with 8 additions and 71 deletions

View File

@ -1,9 +1,8 @@
# $OpenBSD: Makefile,v 1.21 2016/03/08 17:30:43 edd Exp $
# $OpenBSD: Makefile,v 1.22 2019/04/27 10:16:27 landry Exp $
COMMENT= fetch, filter and deliver mail
V= 1.9
REVISION = 0
V= 2.0
DISTNAME= fdm-$V
CATEGORIES= mail
@ -12,13 +11,15 @@ MAINTAINER= Nicholas Marriott <nicm@openbsd.org>
# BSD
PERMIT_PACKAGE_CDROM= Yes
WANTLIB= c crypto ssl z tdb>=3.0
WANTLIB= c crypto pcre ssl z tdb>=3.0
MASTER_SITES= https://github.com/nicm/fdm/releases/download/$V/
LIB_DEPENDS += databases/tdb>=1.2.7
LIB_DEPENDS += databases/tdb>=1.2.7 \
devel/pcre
CONFIGURE_STYLE = gnu
CONFIGURE_ARGS = --enable-pcre
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/fdm

View File

@ -1,2 +1,2 @@
SHA256 (fdm-1.9.tar.gz) = FkFsOKmn4y0YciDMWuYaUUY9Xk5HQZxcUT9CJSPTmRQ=
SIZE (fdm-1.9.tar.gz) = 299916
SHA256 (fdm-2.0.tar.gz) = BrKMtreSVwvGHX4psT0q9GuS/qd+BYsrF+Eej37QzqQ=
SIZE (fdm-2.0.tar.gz) = 313596

View File

@ -1,64 +0,0 @@
Fix a bug in mbox parser.
Some tools only escape "From " lines in mboxs if they follow a blank line. fdm
would split at lines beginning "From " unconditionally.
From upstream 91df796046ee2c36bccc9cfda27860b5bb9dd36d
$OpenBSD: patch-fetch-mbox_c,v 1.1 2016/03/08 17:30:43 edd Exp $
--- fetch-mbox.c.orig Fri Jun 5 19:30:34 2015
+++ fetch-mbox.c Thu Feb 18 15:30:05 2016
@@ -404,9 +404,9 @@ fetch_mbox_state_mail(struct account *a, struct fetch_
struct mail *m = fctx->mail;
struct fetch_mbox_mbox *fmbox;
struct fetch_mbox_mail *aux;
- char *line, *ptr, *lptr;
- size_t llen;
- int flushing;
+ char *line, *ptr, *last_line, *lptr;
+ size_t llen, n;
+ int flushing, from;
/* Find current mbox and check for EOF. */
fmbox = ARRAY_ITEM(&data->fmboxes, data->index);
@@ -443,7 +443,7 @@ fetch_mbox_state_mail(struct account *a, struct fetch_
* trimmed later with minimal penalty).
*/
flushing = 0;
- for (;;) {
+ for (last_line = NULL;; last_line = line) {
/* Check for EOF. */
if (data->off == fmbox->size) {
aux->size = data->off - aux->off;
@@ -459,10 +459,27 @@ fetch_mbox_state_mail(struct account *a, struct fetch_
} else
data->off += ptr - line + 1;
- /* Check if the line is "From ". */
- if (line > fmbox->base &&
- ptr - line >= 5 && strncmp(line, "From ", 5) == 0) {
- /* End of mail. */
+ /*
+ * Check if we have reached the end of this message at the next
+ * message's "From " line. To allow "From " inside message
+ * bodes, they can be escaped by prepending with '>'. Some
+ * tools escape all "From " lines; others only escape if they
+ * immediately follow a blank line. We accept only "From" lines
+ * which follow a blank line (\n or \r\n).
+ */
+ from = 1;
+ if (line == fmbox->base || last_line == NULL)
+ from = 0;
+ else {
+ n = line - last_line;
+ if (n != 1 && n != 2)
+ from = 0;
+ else if (n == 1 && *last_line != '\n')
+ from = 0;
+ else if (n == 2 && memcmp(last_line, "\r\n", 2) != 0)
+ from = 0;
+ }
+ if (from && ptr - line >= 5 && memcmp(line, "From ", 5) == 0) {
aux->size = (line - fmbox->base) - aux->off;
break;
}