diff options
Diffstat (limited to 'net-mail/fdm')
-rw-r--r-- | net-mail/fdm/Manifest | 4 | ||||
-rw-r--r-- | net-mail/fdm/fdm-2.2-r2.ebuild | 57 | ||||
-rw-r--r-- | net-mail/fdm/files/fdm-2.2-pcre2.patch | 79 | ||||
-rw-r--r-- | net-mail/fdm/files/fdm-2.2-pop3-utf8.patch | 50 | ||||
-rw-r--r-- | net-mail/fdm/files/fdm-2.2-uaf.patch | 26 |
5 files changed, 216 insertions, 0 deletions
diff --git a/net-mail/fdm/Manifest b/net-mail/fdm/Manifest index cf84cb0b460f..618dee2d2082 100644 --- a/net-mail/fdm/Manifest +++ b/net-mail/fdm/Manifest @@ -1,4 +1,8 @@ AUX fdm-2.2-configure-strlcpy.patch 655 BLAKE2B 2057b5866603a6ca6d5b9b5618e7c3e238accf5b061e341b23c9f22096a6e65aa7affd06694a37ccc114be1089495b6efa1fc851c2999e63b5ff71e53420e00d SHA512 937bb22f0cf4ae44972b9373cc5bfc4beced41afc20322993286594246c02a1ccdda5e3208c78c0ec7af3b1bc5e758e9d1d0a0ce8cbdf8467695587727015896 +AUX fdm-2.2-pcre2.patch 2210 BLAKE2B a8083ccffe594e4973773eb6339700eeb6cf2d349e409b1b72d93bda68e2c33c5c62b5eecdd8584b93f8d0c5e617d21b30c50fc2ee31dbbf1efbfdf881d14cff SHA512 9371601e8dd8e4357f62af735ac91e61023ceb5532671d42f4011bb24e51eb39d37888f69a09c69c35897edd2454936bc5a1e3a20b2bffd33685489cd29a415d +AUX fdm-2.2-pop3-utf8.patch 1643 BLAKE2B dd06d048b36cb239f56794ac82b4bf976239e108b77b2e73aa7dc71e907dfb03c2340e9986c227d7a5ef4e62260d49a9071a6de209190fca61fadc3cedd35891 SHA512 178f9ce11f15301943efd1787421cf9a0ae4abbc76244b6a749d8a89c418356650f4a63ede4809c1719b9b5986aff7ff4818e652c516c8bc7ff0d4a819e427f2 +AUX fdm-2.2-uaf.patch 757 BLAKE2B d87814d5e578af6d89cc5de7b6e48d7492cd961c0a7ca46187167b5f3beed29d65918ceb009ff606cebeb6c8382c5963d96a2baa6cdead89c64a3d2eea4e4439 SHA512 1c0f7a5119f6a6770289bc2862a60fbdf40090a7001a26357611edabfa88eac83050005341f609f86f79324f61ca866380233bc9e49969467f30ba8194935552 DIST fdm-2.2.tar.gz 319140 BLAKE2B dde9126aaf3183444123bb3b546f8997a5a25f5dc58bb7fc08818e491e2193543f4f06e758b479e61da7feaf752e3d3ddfd8103c616a49f0d65c41972bae7e12 SHA512 13efa0f272c5f6146b90e094602e8a9b52016af79ae0b6cd80dc9f36b2ba37f64cadae7313bd8db90bcb007dd07206a3614987f11bb82c3535e04f0511c9fc6d EBUILD fdm-2.2-r1.ebuild 852 BLAKE2B 9dad05555f02b521939150012dc81c819f1c12217a10e563ab28e27084c0918462d88974f27e6d733a994aa7baecd3edfe17b1c8f20605ffb18086ed506bec80 SHA512 af9df3fff6ff5f36c9dbffbe8cfd24590d6c150f5675ac660bde40b645e1eadb4ee6c0f03e2e5ae08811ecb98239aafea4ab20f8281781d33625e86a2a89654e +EBUILD fdm-2.2-r2.ebuild 952 BLAKE2B 963c711331d25feb3ffd2650964f9cd671ef6c56b092bbd5ae8ac535c9b4e4b24e0b3c34db345f1d6df045f867f48ed5414391e64ec11289079dd7b297085612 SHA512 6ea1e5b25aa62227fed2d734223948afd9bb0d88ca76363e84639abfe36e5dcf6f80becd914fa11144364e3cc334b3587e16c07cbc1039adad804d4866ac4a84 MISC metadata.xml 296 BLAKE2B 340645d0a215d131e992a64b54a2e45091542b92c60c29df762b2e75a7d3e081a83cf529959f2ce0e171f6c1b6412a83ab597c55c094aa9c08c93eaa53365934 SHA512 dc241981c679d9b7a57ebd104f4ebc54daaa8d7eb10e5b558bd7f8ff85512e8104a89cbcd876c13d1e6a1a3919186769ee103fd127e4cfe1afa89c5a1fea86fc diff --git a/net-mail/fdm/fdm-2.2-r2.ebuild b/net-mail/fdm/fdm-2.2-r2.ebuild new file mode 100644 index 000000000000..9acc390b1144 --- /dev/null +++ b/net-mail/fdm/fdm-2.2-r2.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools + +DESCRIPTION="Fetch, filter and deliver mail" +HOMEPAGE="https://github.com/nicm/fdm" +SRC_URI="https://github.com/nicm/fdm/releases/download/${PV}/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="examples pcre" + +DEPEND=" + dev-libs/openssl:= + sys-libs/tdb + pcre? ( dev-libs/libpcre2 ) +" +RDEPEND=" + ${DEPEND} + acct-group/fdm + acct-user/fdm +" + +DOCS=( CHANGES README TODO MANUAL ) + +PATCHES=( + "${FILESDIR}"/${PN}-2.2-configure-strlcpy.patch + "${FILESDIR}"/${P}-pcre2.patch + "${FILESDIR}"/${P}-uaf.patch + "${FILESDIR}"/${P}-pop3-utf8.patch +) + +src_prepare() { + default + + # Change user '_fdm' to 'fdm' + sed -e 's/_fdm/fdm/g' -i fdm.h || die + + eautoreconf +} + +src_configure() { + econf $(use_enable pcre pcre2) +} + +src_install() { + default + + if use examples ; then + docinto examples + dodoc examples/* + fi +} diff --git a/net-mail/fdm/files/fdm-2.2-pcre2.patch b/net-mail/fdm/files/fdm-2.2-pcre2.patch new file mode 100644 index 000000000000..b4d9c0623f71 --- /dev/null +++ b/net-mail/fdm/files/fdm-2.2-pcre2.patch @@ -0,0 +1,79 @@ +https://github.com/nicm/fdm/commit/f1ec1982725d60045c0d871f3e613f2880046c22 + +From f1ec1982725d60045c0d871f3e613f2880046c22 Mon Sep 17 00:00:00 2001 +From: Nicholas Marriott <nicholas.marriott@gmail.com> +Date: Wed, 1 Feb 2023 15:31:30 +0000 +Subject: [PATCH] Fix bugs in PCRE2 code - don't walk off the end of the match + list if NOMATCH is returned, and don't stop on empty matches. From Thomas + Hurst. + +--- + pcre.c | 45 ++++++++++++++++++++++++++------------------- + 1 file changed, 26 insertions(+), 19 deletions(-) + +diff --git a/pcre.c b/pcre.c +index e9a7f84..8d53532 100644 +--- a/pcre.c ++++ b/pcre.c +@@ -66,7 +66,7 @@ int + re_block(struct re *re, const void *buf, size_t len, struct rmlist *rml, + char **cause) + { +- int res; ++ int res, ret; + pcre2_match_data *pmd; + PCRE2_SIZE *ovector; + u_int i, j; +@@ -85,27 +85,34 @@ re_block(struct re *re, const void *buf, size_t len, struct rmlist *rml, + } + + pmd = pcre2_match_data_create_from_pattern(re->pcre2, NULL); +- res = pcre2_match(re->pcre2, buf, len, 0, 0, pmd, NULL); +- if (res < 0 && res != PCRE2_ERROR_NOMATCH) { +- xasprintf(cause, "%s: regexec failed", re->str); +- pcre2_match_data_free(pmd); +- return (-1); +- } ++ if (pmd == NULL) ++ fatalx("pcre2_match_data_create_from_pattern failed"); + +- if (rml != NULL) { +- ovector = pcre2_get_ovector_pointer(pmd); +- for (i = 0; i < res; i++) { +- j = i * 2; +- if (ovector[j + 1] <= ovector[j]) +- break; +- rml->list[i].valid = 1; +- rml->list[i].so = ovector[j]; +- rml->list[i].eo = ovector[j + 1]; ++ res = pcre2_match(re->pcre2, buf, len, 0, 0, pmd, NULL); ++ if (res > 0) { ++ if (rml != NULL) { ++ if (res > NPMATCH) ++ res = NPMATCH; ++ ovector = pcre2_get_ovector_pointer(pmd); ++ for (i = 0; i < res; i++) { ++ j = i * 2; ++ if (ovector[j + 1] < ovector[j]) ++ break; ++ rml->list[i].valid = 1; ++ rml->list[i].so = ovector[j]; ++ rml->list[i].eo = ovector[j + 1]; ++ } ++ rml->valid = 1; + } +- rml->valid = 1; ++ ret = 1; ++ } else if (res == PCRE2_ERROR_NOMATCH) ++ ret = 0; ++ else { ++ xasprintf(cause, "%s: regexec failed", re->str); ++ ret = -1; + } +- +- return (res != PCRE2_ERROR_NOMATCH); ++ pcre2_match_data_free(pmd); ++ return (ret); + } + + void diff --git a/net-mail/fdm/files/fdm-2.2-pop3-utf8.patch b/net-mail/fdm/files/fdm-2.2-pop3-utf8.patch new file mode 100644 index 000000000000..71cc08197ad7 --- /dev/null +++ b/net-mail/fdm/files/fdm-2.2-pop3-utf8.patch @@ -0,0 +1,50 @@ +https://github.com/nicm/fdm/commit/0918b78a82a789d63cebe44b7662f0a8dc603000 + +From 0918b78a82a789d63cebe44b7662f0a8dc603000 Mon Sep 17 00:00:00 2001 +From: Nicholas Marriott <nicholas.marriott@gmail.com> +Date: Mon, 4 Sep 2023 09:03:47 +0100 +Subject: [PATCH] Send UTF8 command to POP3 server (ignore the response), + because some servers don't like UTF-8 without it. + +--- + pop3-common.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/pop3-common.c b/pop3-common.c +index 0724887..e038172 100644 +--- a/pop3-common.c ++++ b/pop3-common.c +@@ -54,6 +54,7 @@ int pop3_invalid(struct account *, const char *); + int pop3_state_connect(struct account *, struct fetch_ctx *); + int pop3_state_starttls(struct account *, struct fetch_ctx *); + int pop3_state_connected(struct account *, struct fetch_ctx *); ++int pop3_state_utf8(struct account *, struct fetch_ctx *); + int pop3_state_user(struct account *, struct fetch_ctx *); + int pop3_state_cache1(struct account *, struct fetch_ctx *); + int pop3_state_cache2(struct account *, struct fetch_ctx *); +@@ -436,6 +437,24 @@ pop3_state_connected(struct account *a, struct fetch_ctx *fctx) + } + } + ++ if (pop3_putln(a, "UTF8") != 0) ++ return (FETCH_ERROR); ++ fctx->state = pop3_state_utf8; ++ return (FETCH_BLOCK); ++} ++ ++/* UTF8 state. */ ++int ++pop3_state_utf8(struct account *a, struct fetch_ctx *fctx) ++{ ++ struct fetch_pop3_data *data = a->data; ++ char *line; ++ ++ if (pop3_getln(a, fctx, &line) != 0) ++ return (FETCH_ERROR); ++ if (line == NULL) ++ return (FETCH_BLOCK); ++ + if (pop3_putln(a, "USER %s", data->user) != 0) + return (FETCH_ERROR); + fctx->state = pop3_state_user; + diff --git a/net-mail/fdm/files/fdm-2.2-uaf.patch b/net-mail/fdm/files/fdm-2.2-uaf.patch new file mode 100644 index 000000000000..a07865dfd047 --- /dev/null +++ b/net-mail/fdm/files/fdm-2.2-uaf.patch @@ -0,0 +1,26 @@ +https://github.com/nicm/fdm/commit/028f59bef0ea9435fb8fbe095b2939652ce63479 + +From 028f59bef0ea9435fb8fbe095b2939652ce63479 Mon Sep 17 00:00:00 2001 +From: Nicholas Marriott <nicholas.marriott@gmail.com> +Date: Mon, 3 Apr 2023 08:54:28 +0100 +Subject: [PATCH] Fix use-after-free, GitHub issue 126. + +--- + connect.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/connect.c b/connect.c +index 1dc5db9..da8013e 100644 +--- a/connect.c ++++ b/connect.c +@@ -550,8 +550,8 @@ httpproxy(struct server *srv, + if (strlen(line) < 12 || + strncmp(line, "HTTP/", 5) != 0 || + strncmp(line + 8, " 200", 4) != 0) { +- xfree(line); + xasprintf(cause, "unexpected data: %s", line); ++ xfree(line); + return (-1); + } + header = 1; + |