From bc53a12ee4a6255921f7aafc168f837427cb4568 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 06:53:04 +0100 Subject: [PATCH] rebuilt in bindir applied patch set from Fedora [release 12.5-3mamba;Mon Apr 17 2023] --- ...onditionally-require-wordexp-support.patch | 108 +++++++++++ mailx-12.5-collect.patch | 13 ++ mailx-12.5-config.patch | 11 ++ mailx-12.5-empty-from.patch | 45 +++++ mailx-12.5-encsplit.patch | 174 ++++++++++++++++++ mailx-12.5-fname-null.patch | 12 ++ ...wordexp-with-WRDE_NOCMD-CVE-2004-277.patch | 25 +++ mailx-12.5-lzw.patch | 12 ++ mailx-12.5-man-page-fixes.patch | 28 +++ mailx-12.5-no-SSLv3.patch | 23 +++ mailx-12.5-nss-hostname-matching.patch | 25 +++ ...12.5-outof-Introduce-expandaddr-flag.patch | 64 +++++++ mailx-12.5-pager.patch | 12 ++ ...ption-processing-for-email-addresses.patch | 74 ++++++++ mailx-12.5-usage.patch | 12 ++ mailx.spec | 52 +++++- 16 files changed, 681 insertions(+), 9 deletions(-) create mode 100644 mailx-12.5-Unconditionally-require-wordexp-support.patch create mode 100644 mailx-12.5-collect.patch create mode 100644 mailx-12.5-config.patch create mode 100644 mailx-12.5-empty-from.patch create mode 100644 mailx-12.5-encsplit.patch create mode 100644 mailx-12.5-fname-null.patch create mode 100644 mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch create mode 100644 mailx-12.5-lzw.patch create mode 100644 mailx-12.5-man-page-fixes.patch create mode 100644 mailx-12.5-no-SSLv3.patch create mode 100644 mailx-12.5-nss-hostname-matching.patch create mode 100644 mailx-12.5-outof-Introduce-expandaddr-flag.patch create mode 100644 mailx-12.5-pager.patch create mode 100644 mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch create mode 100644 mailx-12.5-usage.patch diff --git a/mailx-12.5-Unconditionally-require-wordexp-support.patch b/mailx-12.5-Unconditionally-require-wordexp-support.patch new file mode 100644 index 0000000..7544ab2 --- /dev/null +++ b/mailx-12.5-Unconditionally-require-wordexp-support.patch @@ -0,0 +1,108 @@ +From 2bae8ecf04ec2ba6bb9f0af5b80485dd0edb427d Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Nov 2014 12:48:25 +0100 +Subject: [PATCH 3/4] fio.c: Unconditionally require wordexp support + +--- + fio.c | 67 +++++-------------------------------------------------------------- + 1 file changed, 5 insertions(+), 62 deletions(-) + +diff --git a/fio.c b/fio.c +index 65e8f10..1529236 100644 +--- a/fio.c ++++ b/fio.c +@@ -43,12 +43,15 @@ static char sccsid[] = "@(#)fio.c 2.76 (gritter) 9/16/09"; + #endif /* not lint */ + + #include "rcv.h" ++ ++#ifndef HAVE_WORDEXP ++#error wordexp support is required ++#endif ++ + #include + #include + #include +-#ifdef HAVE_WORDEXP + #include +-#endif /* HAVE_WORDEXP */ + #include + + #if defined (USE_NSS) +@@ -481,7 +484,6 @@ next: + static char * + globname(char *name) + { +-#ifdef HAVE_WORDEXP + wordexp_t we; + char *cp; + sigset_t nset; +@@ -527,65 +529,6 @@ globname(char *name) + } + wordfree(&we); + return cp; +-#else /* !HAVE_WORDEXP */ +- char xname[PATHSIZE]; +- char cmdbuf[PATHSIZE]; /* also used for file names */ +- int pid, l; +- char *cp, *shell; +- int pivec[2]; +- extern int wait_status; +- struct stat sbuf; +- +- if (pipe(pivec) < 0) { +- perror("pipe"); +- return name; +- } +- snprintf(cmdbuf, sizeof cmdbuf, "echo %s", name); +- if ((shell = value("SHELL")) == NULL) +- shell = SHELL; +- pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NULL); +- if (pid < 0) { +- close(pivec[0]); +- close(pivec[1]); +- return NULL; +- } +- close(pivec[1]); +-again: +- l = read(pivec[0], xname, sizeof xname); +- if (l < 0) { +- if (errno == EINTR) +- goto again; +- perror("read"); +- close(pivec[0]); +- return NULL; +- } +- close(pivec[0]); +- if (wait_child(pid) < 0 && WTERMSIG(wait_status) != SIGPIPE) { +- fprintf(stderr, catgets(catd, CATSET, 81, +- "\"%s\": Expansion failed.\n"), name); +- return NULL; +- } +- if (l == 0) { +- fprintf(stderr, catgets(catd, CATSET, 82, +- "\"%s\": No match.\n"), name); +- return NULL; +- } +- if (l == sizeof xname) { +- fprintf(stderr, catgets(catd, CATSET, 83, +- "\"%s\": Expansion buffer overflow.\n"), name); +- return NULL; +- } +- xname[l] = 0; +- for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--) +- ; +- cp[1] = '\0'; +- if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) { +- fprintf(stderr, catgets(catd, CATSET, 84, +- "\"%s\": Ambiguous.\n"), name); +- return NULL; +- } +- return savestr(xname); +-#endif /* !HAVE_WORDEXP */ + } + + /* +-- +1.9.3 + diff --git a/mailx-12.5-collect.patch b/mailx-12.5-collect.patch new file mode 100644 index 0000000..b84d2e8 --- /dev/null +++ b/mailx-12.5-collect.patch @@ -0,0 +1,13 @@ +--- mailx-12.4.orig/collect.c 2012-09-12 16:07:53.653103796 -0400 ++++ mailx-12.4/collect.c 2012-09-12 21:27:05.092259236 -0400 +@@ -905,7 +905,9 @@ err: + if (collf != NULL) { + Fclose(collf); + collf = NULL; +- } ++ } else { ++ exit(1); ++ } + out: + if (collf != NULL) { + if ((cp = value("MAILX_TAIL")) != NULL) { diff --git a/mailx-12.5-config.patch b/mailx-12.5-config.patch new file mode 100644 index 0000000..b1dd7e0 --- /dev/null +++ b/mailx-12.5-config.patch @@ -0,0 +1,11 @@ +diff -Nrbu nail-11.25/nail.rc nail-11.25-OK/nail.rc +--- nail-11.25/nail.rc 2005-01-15 17:33:16.000000000 +0300 ++++ nail-11.25-OK/nail.rc 2005-08-19 16:55:09.000000000 +0400 +@@ -60,3 +60,7 @@ + + # Only include selected header fields when forwarding messages. + fwdretain subject date from to ++ ++# For Linux and BSD, this should be set. ++set bsdcompat ++ diff --git a/mailx-12.5-empty-from.patch b/mailx-12.5-empty-from.patch new file mode 100644 index 0000000..140dc3b --- /dev/null +++ b/mailx-12.5-empty-from.patch @@ -0,0 +1,45 @@ +diff -uprN nail/sendout.c nail-patched/sendout.c +--- nail/sendout.c 2015-07-16 14:15:22.864905226 +0200 ++++ nail-patched/sendout.c 2015-07-17 09:41:06.778677181 +0200 +@@ -966,6 +966,19 @@ mail1(struct header *hp, int printheader + return STOP; + } + #endif ++ ++ /* ++ * Variable "from" is set but empty, let user know ++ * that something is wrong. ++ */ ++ if ((cp = value("from")) != NULL && !*cp) { ++ fprintf(stderr, "From address is empty. "); ++ fprintf(stderr, "Check your mail config "); ++ fprintf(stderr, "file for typos. E.g. no "); ++ fprintf(stderr, "whitespace after set from="); ++ fprintf(stderr, "\n"); ++ } ++ + if ((cp = value("autocc")) != NULL && *cp) + hp->h_cc = cat(hp->h_cc, checkaddrs(sextract(cp, GCC|GFULL))); + if ((cp = value("autobcc")) != NULL && *cp) +diff -uprN nail/smtp.c nail-patched/smtp.c +--- nail/smtp.c 2015-07-16 14:15:17.626914449 +0200 ++++ nail-patched/smtp.c 2015-07-17 09:17:43.412730513 +0200 +@@ -135,7 +135,7 @@ myaddrs(struct header *hp) + if (hp->h_from->n_name) + return savestr(hp->h_from->n_name); + } +- if ((cp = value("from")) != NULL) ++ if ((cp = value("from")) != NULL && *cp) + return cp; + /* + * When invoking sendmail directly, it's its task +@@ -177,6 +177,9 @@ smtp_auth_var(const char *type, const ch + char *var, *cp; + int len; + ++ if (type == NULL || addr == NULL) ++ return NULL; ++ + var = ac_alloc(len = strlen(type) + strlen(addr) + 7); + snprintf(var, len, "smtp-auth%s-%s", type, addr); + if ((cp = value(var)) != NULL) diff --git a/mailx-12.5-encsplit.patch b/mailx-12.5-encsplit.patch new file mode 100644 index 0000000..1859ca6 --- /dev/null +++ b/mailx-12.5-encsplit.patch @@ -0,0 +1,174 @@ +diff --git a/mime.c b/mime.c +index 45de80a..ecac85d 100644 +--- a/mime.c ++++ b/mime.c +@@ -1109,16 +1109,34 @@ fromhdr_end: + } + + /* ++ * return length of this UTF-8 codepoint in bytes ++ */ ++static size_t ++codepointsize(char tc) ++{ ++ int rv = 0; ++ if ( ! ( tc & 0x80 ) ) ++ return 1; ++ while ( tc & 0x80 ) ++ { ++ rv++; ++ tc = tc<<1; ++ } ++ return rv; ++} ++ ++/* + * Convert header fields to RFC 1522 format and write to the file fo. + */ + static size_t + mime_write_tohdr(struct str *in, FILE *fo) + { + char *upper, *wbeg, *wend, *charset, *lastwordend = NULL, *lastspc, b, +- *charset7; ++ *charset7, *cp; + struct str cin, cout; +- size_t sz = 0, col = 0, wr, charsetlen, charset7len; ++ size_t sz = 0, col = 0, wr, charsetlen, charset7len, cpsz; + int quoteany, mustquote, broken, ++ maxin, maxout, curin, cps, + maxcol = 65 /* there is the header field's name, too */; + + upper = in->s + in->l; +@@ -1134,41 +1152,75 @@ mime_write_tohdr(struct str *in, FILE *fo) + if (mustquote_hdr(wbeg, wbeg == in->s, wbeg == &upper[-1])) + quoteany++; + } ++ ++ /* ++ * rfc2047 says we cannot split multi-byte characters over ++ * encoded words, so we need to know if we're a multi-byte ++ * source stream (UTF-8 specifically) or just an 8 bit ++ * stream like ISO-8859-15 ++ * so test beginning of charset since it is valid to include ++ * language in charset "UTF-8*DE" etc as per rfc 2184/2231 ++ */ ++ char *thisset = b&0200 ? charset : charset7; ++ int is_utf8 = ( strncasecmp( thisset, "utf-8", 5 ) == 0 ); ++ + if (2 * quoteany > in->l) { + /* + * Print the entire field in base64. + */ +- for (wbeg = in->s; wbeg < upper; wbeg = wend) { ++ for (wbeg = in->s; wbeg < upper; ) { + wend = upper; + cin.s = wbeg; +- for (;;) { +- cin.l = wend - wbeg; +- if (cin.l * 4/3 + 7 + charsetlen +- < maxcol - col) { +- fprintf(fo, "=?%s?B?", +- b&0200 ? charset : charset7); +- wr = mime_write_tob64(&cin, fo, 1); +- fwrite("?=", sizeof (char), 2, fo); +- wr += 7 + charsetlen; +- sz += wr, col += wr; +- if (wend < upper) { +- fwrite("\n ", sizeof (char), +- 2, fo); +- sz += 2; +- col = 0; +- maxcol = 76; ++ /* ++ * we calculate the maximum number of bytes ++ * we can use on this output line, and then what ++ * this equates to as base64 encoded source bytes ++ */ ++ maxout = maxcol - col - 7 - charsetlen; ++ maxin = (maxout - (maxout & 0x03)) * 3/4; ++ ++ /* short enough to finish ? */ ++ if (maxin > upper - wbeg ) ++ { ++ curin = upper - wbeg; ++ wbeg += curin; ++ }else ++ { ++ if (is_utf8) ++ { ++ /* ++ * now scan the input from the beginning ++ * to see how many codepoints will fit ++ */ ++ curin = 0; ++ while (curin < maxin ++ && (cpsz = codepointsize(*wbeg)) <= (maxin - curin)) ++ { ++ curin += cpsz; ++ wbeg += cpsz; + } +- break; +- } else { +- if (col) { +- fprintf(fo, "\n "); +- sz += 2; +- col = 0; +- maxcol = 76; +- } else +- wend -= 4; ++ }else ++ { ++ curin = maxin; ++ wbeg += maxin; + } + } ++ cin.l = curin; ++ fprintf(fo, "%s=?%s?B?", (cin.s != in->s) ? " " : "", thisset ); ++ wr = mime_write_tob64(&cin, fo, 1); ++ ++ if (wbeg < upper) ++ { ++ wr += fwrite("?=\n ", sizeof (char), 4, fo) * sizeof (char); ++ }else ++ { ++ wr += fwrite("?=", sizeof (char), 2, fo) * sizeof (char); ++ } ++ ++ /* and shuffle pointers and counts */ ++ col = 1; ++ maxcol = 76; ++ sz += wr + 7 + charsetlen + ((cin.s != in->s) ? 1 : 0 ); + } + } else { + /* +@@ -1243,7 +1295,29 @@ mime_write_tohdr(struct str *in, FILE *fo) + maxcol -= wbeg - + lastspc; + } else { +- wend -= 4; ++ if (is_utf8) ++ { ++ /* ++ * make sure wend is not pointing to ++ * the middle of a codepoint ++ */ ++ cp = wend; ++ while (--cp > wbeg) ++ { ++ cps = codepointsize(*cp); ++ if (cps > 1) ++ { ++ if (wend - cp - cps > 4) ++ wend -= 4; ++ else ++ wend = cp; ++ break; ++ } ++ } ++ if (cp == wbeg) ++ wend -= 4; ++ } else ++ wend -= 4; + } + free(cout.s); + } diff --git a/mailx-12.5-fname-null.patch b/mailx-12.5-fname-null.patch new file mode 100644 index 0000000..056e97f --- /dev/null +++ b/mailx-12.5-fname-null.patch @@ -0,0 +1,12 @@ +diff -upr mailx-12.5.orig/names.c mailx-12.5/names.c +--- mailx-12.5.orig/names.c 2006-03-04 01:32:16.000000000 +0100 ++++ mailx-12.5/names.c 2012-11-01 15:28:43.883573793 +0100 +@@ -357,7 +357,7 @@ outof(struct name *names, FILE *fo, stru + free_child(pid); + } else { + int f; +- if ((fout = Zopen(fname, "a", NULL)) == NULL) { ++ if ((fname == NULL) || ((fout = Zopen(fname, "a", NULL)) == NULL)) { + perror(fname); + senderr++; + goto cant; diff --git a/mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch b/mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch new file mode 100644 index 0000000..a7fb9d3 --- /dev/null +++ b/mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch @@ -0,0 +1,25 @@ +From 73fefa0c1ac70043ec84f2d8b8f9f683213f168d Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Nov 2014 13:11:32 +0100 +Subject: [PATCH 4/4] globname: Invoke wordexp with WRDE_NOCMD (CVE-2004-2771) + +--- + fio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fio.c b/fio.c +index 1529236..774a204 100644 +--- a/fio.c ++++ b/fio.c +@@ -497,7 +497,7 @@ globname(char *name) + sigemptyset(&nset); + sigaddset(&nset, SIGCHLD); + sigprocmask(SIG_BLOCK, &nset, NULL); +- i = wordexp(name, &we, 0); ++ i = wordexp(name, &we, WRDE_NOCMD); + sigprocmask(SIG_UNBLOCK, &nset, NULL); + switch (i) { + case 0: +-- +1.9.3 + diff --git a/mailx-12.5-lzw.patch b/mailx-12.5-lzw.patch new file mode 100644 index 0000000..2dc1fbc --- /dev/null +++ b/mailx-12.5-lzw.patch @@ -0,0 +1,12 @@ +diff -Nrbu mailx-12.5/lzw.c mailx-12.5-OK/lzw.c +--- mailx-12.5/lzw.c 2006-03-04 03:32:16.000000000 +0300 ++++ mailx-12.5-OK/lzw.c 2011-08-17 16:30:01.000000000 +0400 +@@ -516,6 +516,8 @@ + + /* Generate output characters in reverse order. */ + while (code >= 256) { ++ if (stackp - de_stack >= HSIZE - 1) ++ return -1; + *stackp++ = tab_suffixof(code); + code = tab_prefixof(code); + } diff --git a/mailx-12.5-man-page-fixes.patch b/mailx-12.5-man-page-fixes.patch new file mode 100644 index 0000000..37f7629 --- /dev/null +++ b/mailx-12.5-man-page-fixes.patch @@ -0,0 +1,28 @@ +diff -ur mailx-12.5.orig/mailx.1 mailx-12.5/mailx.1 +--- mailx-12.5.orig/mailx.1 2014-06-13 16:28:18.272418000 +0200 ++++ mailx-12.5/mailx.1 2014-06-13 16:32:06.757714403 +0200 +@@ -219,6 +219,14 @@ + assigns + .I value + to it. ++Note, that when setting ++.I from ++variable, domain name of host is automatically added if value does not contain any. ++If you want to enter ++.I from ++address with owner's name, you can use, for example, following format: ++.B -S ++.I \(dqfrom=System User \(dq + .TP + .BI \-T \ name + Writes the `Message-Id:' and `Article-Id:' header fields +@@ -2189,7 +2197,8 @@ + as part of the environment + (this is not restricted to specific variables as in the POSIX standard). + A value given in a startup file overrides +-a value imported from the environment. ++a value imported from the environment, but it is not possible to unset ++an environment variable in a startup file. + Options may be either binary, + in which case it is only significant + to see whether they are set or not; diff --git a/mailx-12.5-no-SSLv3.patch b/mailx-12.5-no-SSLv3.patch new file mode 100644 index 0000000..775df6d --- /dev/null +++ b/mailx-12.5-no-SSLv3.patch @@ -0,0 +1,23 @@ +diff --git a/openssl.c b/openssl.c +index 9d1eaf4..b5db2a8 100644 +--- a/openssl.c ++++ b/openssl.c +@@ -229,9 +229,16 @@ ssl_select_method(const char *uhp) + "Unsupported SSL method \"%s\"\n"), cp); + method = SSLv23_client_method(); + #endif +- } else if (equal(cp, "ssl3")) ++ } else if (equal(cp, "ssl3")) { ++#ifndef OPENSSL_NO_SSL3_METHOD + method = SSLv3_client_method(); +- else if (equal(cp, "tls1")) ++#else ++ /* no SSLv3 support */ ++ fprintf(stderr, catgets(catd, CATSET, 244, ++ "Unsupported SSL method \"%s\"\n"), cp); ++ method = SSLv23_client_method(); ++#endif ++ } else if (equal(cp, "tls1")) + method = TLSv1_client_method(); + else { + fprintf(stderr, catgets(catd, CATSET, 244, diff --git a/mailx-12.5-nss-hostname-matching.patch b/mailx-12.5-nss-hostname-matching.patch new file mode 100644 index 0000000..6df2e71 --- /dev/null +++ b/mailx-12.5-nss-hostname-matching.patch @@ -0,0 +1,25 @@ +From 5b7f57844682339340333034be1b8f99acafde28 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= +Date: Thu, 7 Jan 2016 12:26:40 +0100 +Subject: [PATCH] Fix NSS hostname matching + +--- + nss.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nss.c b/nss.c +index 96b0ea3..2acbd5f 100644 +--- a/nss.c ++++ b/nss.c +@@ -189,7 +189,7 @@ nss_check_host(const char *server, struct sock *sp) + fprintf(stderr, + "Comparing DNS name: \"%s\"\n", + dn); +- if (rfc2595_hostname_match(server, dn) ++ if ((ok = rfc2595_hostname_match(server, dn)) + == OKAY) { + ac_free(dn); + goto out; +-- +2.4.3 + diff --git a/mailx-12.5-outof-Introduce-expandaddr-flag.patch b/mailx-12.5-outof-Introduce-expandaddr-flag.patch new file mode 100644 index 0000000..c3479e2 --- /dev/null +++ b/mailx-12.5-outof-Introduce-expandaddr-flag.patch @@ -0,0 +1,64 @@ +From 9984ae5cb0ea0d61df1612b06952a61323c083d9 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Nov 2014 11:13:38 +0100 +Subject: [PATCH 1/4] outof: Introduce expandaddr flag + +Document that address expansion is disabled unless the expandaddr +binary option is set. + +This has been assigned CVE-2014-7844 for BSD mailx, but it is not +a vulnerability in Heirloom mailx because this feature was documented. +--- + mailx.1 | 14 ++++++++++++++ + names.c | 3 +++ + 2 files changed, 17 insertions(+) + +diff --git a/mailx.1 b/mailx.1 +index 70a7859..22a171b 100644 +--- a/mailx.1 ++++ b/mailx.1 +@@ -656,6 +656,14 @@ but any reply returned to the machine + will have the system wide alias expanded + as all mail goes through sendmail. + .SS "Recipient address specifications" ++If the ++.I expandaddr ++option is not set (the default), recipient addresses must be names of ++local mailboxes or Internet mail addresses. ++.PP ++If the ++.I expandaddr ++option is set, the following rules apply: + When an address is used to name a recipient + (in any of To, Cc, or Bcc), + names of local mail folders +@@ -2391,6 +2399,12 @@ and exits immediately. + If this option is set, + \fImailx\fR starts even with an empty mailbox. + .TP ++.B expandaddr ++Causes ++.I mailx ++to expand message recipient addresses, as explained in the section, ++Recipient address specifications. ++.TP + .B flipr + Exchanges the + .I Respond +diff --git a/names.c b/names.c +index 66e976b..c69560f 100644 +--- a/names.c ++++ b/names.c +@@ -268,6 +268,9 @@ outof(struct name *names, FILE *fo, struct header *hp) + FILE *fout, *fin; + int ispipe; + ++ if (value("expandaddr") == NULL) ++ return names; ++ + top = names; + np = names; + time(&now); +-- +1.9.3 + diff --git a/mailx-12.5-pager.patch b/mailx-12.5-pager.patch new file mode 100644 index 0000000..d4b2439 --- /dev/null +++ b/mailx-12.5-pager.patch @@ -0,0 +1,12 @@ +diff -Nrbu mailx-12.3/cmd1.c mailx-12.3-OK/cmd1.c +--- mailx-12.3/cmd1.c 2007-06-16 16:48:39.000000000 +0400 ++++ mailx-12.3-OK/cmd1.c 2008-06-26 19:57:38.000000000 +0400 +@@ -78,7 +78,7 @@ + + cp = value("PAGER"); + if (cp == NULL || *cp == '\0') +- cp = value("bsdcompat") ? "more" : "pg"; ++ cp = value("bsdcompat") ? "more" : "less"; + return cp; + } + diff --git a/mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch b/mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch new file mode 100644 index 0000000..d20bb4a --- /dev/null +++ b/mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch @@ -0,0 +1,74 @@ +From e34e2ac67b80497080ebecccec40c3b61456167d Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Nov 2014 11:14:06 +0100 +Subject: [PATCH 2/4] unpack: Disable option processing for email addresses + when calling sendmail + +--- + extern.h | 2 +- + names.c | 8 ++++++-- + sendout.c | 2 +- + 3 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/extern.h b/extern.h +index 6b85ba0..8873fe8 100644 +--- a/extern.h ++++ b/extern.h +@@ -396,7 +396,7 @@ struct name *outof(struct name *names, FILE *fo, struct header *hp); + int is_fileaddr(char *name); + struct name *usermap(struct name *names); + struct name *cat(struct name *n1, struct name *n2); +-char **unpack(struct name *np); ++char **unpack(struct name *smopts, struct name *np); + struct name *elide(struct name *names); + int count(struct name *np); + struct name *delete_alternates(struct name *np); +diff --git a/names.c b/names.c +index c69560f..45bbaed 100644 +--- a/names.c ++++ b/names.c +@@ -549,7 +549,7 @@ cat(struct name *n1, struct name *n2) + * Return an error if the name list won't fit. + */ + char ** +-unpack(struct name *np) ++unpack(struct name *smopts, struct name *np) + { + char **ap, **top; + struct name *n; +@@ -564,7 +564,7 @@ unpack(struct name *np) + * the terminating 0 pointer. Additional spots may be needed + * to pass along -f to the host mailer. + */ +- extra = 2; ++ extra = 3 + count(smopts); + extra++; + metoo = value("metoo") != NULL; + if (metoo) +@@ -581,6 +581,10 @@ unpack(struct name *np) + *ap++ = "-m"; + if (verbose) + *ap++ = "-v"; ++ for (; smopts != NULL; smopts = smopts->n_flink) ++ if ((smopts->n_type & GDEL) == 0) ++ *ap++ = smopts->n_name; ++ *ap++ = "--"; + for (; n != NULL; n = n->n_flink) + if ((n->n_type & GDEL) == 0) + *ap++ = n->n_name; +diff --git a/sendout.c b/sendout.c +index 7b7f2eb..c52f15d 100644 +--- a/sendout.c ++++ b/sendout.c +@@ -835,7 +835,7 @@ start_mta(struct name *to, struct name *mailargs, FILE *input, + #endif /* HAVE_SOCKETS */ + + if ((smtp = value("smtp")) == NULL) { +- args = unpack(cat(mailargs, to)); ++ args = unpack(mailargs, to); + if (debug || value("debug")) { + printf(catgets(catd, CATSET, 181, + "Sendmail arguments:")); +-- +1.9.3 + diff --git a/mailx-12.5-usage.patch b/mailx-12.5-usage.patch new file mode 100644 index 0000000..3c375ad --- /dev/null +++ b/mailx-12.5-usage.patch @@ -0,0 +1,12 @@ +diff -upr mailx-12.5.orig/main.c mailx-12.5/main.c +--- mailx-12.5.orig/main.c 2007-10-02 14:15:50.000000000 +0200 ++++ mailx-12.5/main.c 2013-07-22 16:06:56.960765683 +0200 +@@ -353,7 +353,7 @@ main(int argc, char *argv[]) + case '?': + usage: + fprintf(stderr, catgets(catd, CATSET, 135, +-"Usage: %s -eiIUdEFntBDNHRV~ -T FILE -u USER -h hops -r address -s SUBJECT -a FILE -q FILE -f FILE -A ACCOUNT -b USERS -c USERS -S OPTION users\n"), progname); ++"Usage: %s -eiIUdEFntBDNHRVv~ -T FILE -u USER -h hops -r address -s SUBJECT -a FILE -q FILE -f FILE -A ACCOUNT -b USERS -c USERS -S OPTION users\n"), progname); + exit(2); + } + } diff --git a/mailx.spec b/mailx.spec index b521661..ac07577 100644 --- a/mailx.spec +++ b/mailx.spec @@ -1,22 +1,36 @@ Name: mailx Version: 12.5 -Release: 2mamba +Release: 3mamba Summary: A simple mail user agent for Unix systems derived from Berkeley Mail Group: Applications/Networking Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco -URL: http://heirloom.sourceforge.net/mailx.html +URL: https://heirloom.sourceforge.net/mailx.html Source: http://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_%{version}.orig.tar.gz Patch0: mailx-12.5-openssl-1.1.patch +Patch1: mailx-12.5-config.patch +Patch2: mailx-12.5-pager.patch +Patch3: mailx-12.5-lzw.patch +Patch4: mailx-12.5-collect.patch +Patch5: mailx-12.5-usage.patch +Patch6: mailx-12.5-man-page-fixes.patch +Patch7: mailx-12.5-outof-Introduce-expandaddr-flag.patch +Patch8: mailx-12.5-Unconditionally-require-wordexp-support.patch +Patch9: mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch +Patch10: mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch +Patch11: mailx-12.5-fname-null.patch +Patch12: mailx-12.5-empty-from.patch +Patch13: mailx-12.5-nss-hostname-matching.patch +Patch14: mailx-12.5-encsplit.patch +Patch15: mailx-12.5-no-SSLv3.patch +License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel -BuildRequires: ldconfig BuildRequires: libgss-devel BuildRequires: libopenssl-devel ## AUTOBUILDREQ-END -License: GPL -BuildRoot: %{_tmppath}/%{name}-%{version}-root +Provides: /bin/mailx %description Heirloom mailx (previously known as nail) is a mail user agent for Unix systems. Highlights are: @@ -27,15 +41,31 @@ Heirloom mailx (previously known as nail) is a mail user agent for Unix systems. %prep %setup -q -n heirloom-mailx-%{version} -%patch0 -p1 +%define _default_patch_fuzz 2 +%patch 0 -p1 +%patch 1 -p1 -b .config +%patch 2 -p1 -b .pager +%patch 3 -p1 -b .lzw +%patch 4 -p1 -b .collect +%patch 5 -p1 -b .usage +%patch 6 -p1 -b .man-page-fixes +%patch 7 -p1 -b .outof-Introduce-expandaddr-flag +%patch 8 -p1 -b .Unconditionally-require-wordexp-support +%patch 9 -p1 -b .globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277 +%patch 10 -p1 -b .unpack-Disable-option-processing-for-email-addresses +%patch 11 -p1 -b .fname-null +%patch 12 -p1 -b .empty-from +%patch 13 -p1 -b .nss-hostname-matching +%patch 14 -p1 -b .encsplit +%patch 15 -p1 -b .no-SSLv3 %build -%make PREFIX=/ +%make PREFIX=%{_prefix} %install [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" %makeinstall \ - PREFIX=/ \ + PREFIX=%{_prefix} \ MANDIR=%{_mandir} \ UCBINSTALL=%{__install} \ DESTDIR=%{buildroot} \ @@ -47,10 +77,14 @@ Heirloom mailx (previously known as nail) is a mail user agent for Unix systems. %files %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/nail.rc -/bin/mailx +%{_bindir}/mailx %{_mandir}/man1/mailx.1* %changelog +* Mon Apr 17 2023 Silvan Calarco 12.5-3mamba +- rebuilt in bindir +- applied patch set from Fedora + * Tue Dec 15 2020 Silvan Calarco 12.5-2mamba - rebuilt with debug package and openssl 1.1 patch