Sync from SUSE:ALP:Source:Standard:1.0 mailx revision 39f10d5331f03aa3510e2091d93a3755

This commit is contained in:
Adrian Schröter 2024-01-19 16:45:09 +01:00
commit 970507d24e
21 changed files with 3068 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,64 @@
From 9984ae5cb0ea0d61df1612b06952a61323c083d9 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
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

View File

@ -0,0 +1,74 @@
From e34e2ac67b80497080ebecccec40c3b61456167d Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
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

View File

@ -0,0 +1,105 @@
From 2bae8ecf04ec2ba6bb9f0af5b80485dd0edb427d Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
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 (
#endif /* not lint */
#include "rcv.h"
+
+#ifndef HAVE_WORDEXP
+#error wordexp support is required
+#endif
+
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/wait.h>
-#ifdef HAVE_WORDEXP
#include <wordexp.h>
-#endif /* HAVE_WORDEXP */
#include <unistd.h>
#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 */
}
/*

View File

@ -0,0 +1,25 @@
From 73fefa0c1ac70043ec84f2d8b8f9f683213f168d Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
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

12
fix-sendmail-name.patch Normal file
View File

@ -0,0 +1,12 @@
diff -urN mailx-12.5.old/names.c mailx-12.5/names.c
--- mailx-12.5.old/names.c 2006-03-04 01:32:16.000000000 +0100
+++ mailx-12.5/names.c 2020-12-25 11:49:29.656778902 +0100
@@ -572,7 +572,7 @@
/*LINTED*/
top = (char **)salloc((t + extra) * sizeof *top);
ap = top;
- *ap++ = "send-mail";
+ *ap++ = "sendmail";
*ap++ = "-i";
if (metoo)
*ap++ = "-m";

32
mailx-12.5-ipv6.dif Normal file
View File

@ -0,0 +1,32 @@
--- Makefile
+++ Makefile 2013-12-03 08:14:47.362446079 +0000
@@ -46,7 +67,7 @@ SHELL = /bin/sh
# If you know that the IPv6 functions work on your machine, you can enable
# them here.
-##IPv6 = -DHAVE_IPv6_FUNCS
+IPv6 = -DHAVE_IPv6_FUNCS
#
# Binaries are stripped with this command after installation.
--- fio.c
+++ fio.c 2013-12-04 07:46:41.302735482 +0000
@@ -1023,7 +1023,17 @@ sopen(const char *xserver, struct sock *
char *cp;
char *server = (char *)xserver;
- if ((cp = strchr(server, ':')) != NULL) {
+ if (*server == '[' && (cp = strchr(server, ']')) != NULL) {
+ if (cp[1] == ':') {
+ portstr = &cp[2];
+#ifndef HAVE_IPv6_FUNCS
+ port = strtol(portstr, NULL, 10);
+#endif /* HAVE_IPv6_FUNCS */
+ }
+ server = salloc(cp - xserver);
+ memcpy(server, xserver+1, cp - xserver - 1);
+ server[cp - xserver - 1] = '\0';
+ } else if ((cp = strchr(server, ':')) != NULL) {
portstr = &cp[1];
#ifndef HAVE_IPv6_FUNCS
port = strtol(portstr, NULL, 10);

336
mailx-12.5-mime.dif Normal file
View File

@ -0,0 +1,336 @@
---
def.h | 4 +
mime.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
sendout.c | 40 +++++++++++++----
3 files changed, 172 insertions(+), 16 deletions(-)
--- def.h
+++ def.h 2016-04-08 14:58:42.729798789 +0000
@@ -142,7 +142,9 @@ enum mimeclean {
MIME_LONGLINES = 002, /* has lines too long for RFC 2822 */
MIME_CTRLCHAR = 004, /* contains control characters */
MIME_HASNUL = 010, /* contains \0 characters */
- MIME_NOTERMNL = 020 /* lacks a terminating newline */
+ MIME_NOTERMNL = 020, /* lacks a terminating newline */
+ MIME_UTF8 = 040, /* UTF-8 high bit multi byte characters */
+ MIME_LATIN = 0100 /* Latin high bit single byte characters */
};
enum tdflags {
--- mime.c
+++ mime.c 2016-04-08 15:00:05.808259514 +0000
@@ -302,13 +302,78 @@ gettcharset(void)
return t;
}
+#define F 0 /* character never appears in mail text */
+#define T 1 /* character appears in plain ASCII text */
+#define I 2 /* character appears in ISO-8859 text */
+#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */
+
+static char text_chars[256] = {
+ /* NUL BEL BS HT LF FF CR */
+ F, F, F, F, F, F, F, F, T, T, T, F, T, T, F, F, /* 0x0X */
+ /* ESC */
+ F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */
+ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */
+ /* NEL */
+ X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x8X */
+ X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */
+ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */
+};
+
+static int encflags;
+static void
+test_enc(const char *s)
+{
+ int c = *s;
+ if (c & 0100) {
+ int n, follow;
+
+ if ((c & 040) == 0) /* 110xxxxx */
+ follow = 1;
+ else if ((c & 020) == 0) /* 1110xxxx */
+ follow = 2;
+ else if ((c & 010) == 0) /* 11110xxx */
+ follow = 3;
+ else if ((c & 004) == 0) /* 111110xx */
+ follow = 4;
+ else if ((c & 002) == 0) /* 1111110x */
+ follow = 5;
+ else
+ return;
+
+ for (n = 1; n <= follow; n++) {
+ if ((c = *(s+n)) == '\0')
+ goto latin;
+ if ((c & 0200) == 0 || (c & 0100))
+ goto latin;
+ }
+ encflags = MIME_UTF8;
+ return;
+ }
+latin:
+ c = *s;
+ if (text_chars[c & 0377] == I)
+ encflags = MIME_LATIN;
+}
+
static int
has_highbit(const char *s)
{
if (s) {
do
- if (*s & 0200)
+ if (*s & 0200) {
+ test_enc(s);
return 1;
+ }
while (*s++ != '\0');
}
return 0;
@@ -328,6 +393,7 @@ name_highbit(struct name *np)
char *
need_hdrconv(struct header *hp, enum gfield w)
{
+ encflags = 0;
if (w & GIDENT) {
if (hp->h_from && name_highbit(hp->h_from))
goto needs;
@@ -355,7 +421,7 @@ need_hdrconv(struct header *hp, enum gfi
if (w & GSUBJECT && has_highbit(hp->h_subject))
goto needs;
return NULL;
-needs: return getcharset(MIME_HIGHBIT);
+needs: return getcharset(MIME_HIGHBIT|encflags);
}
#ifdef HAVE_ICONV
@@ -441,7 +507,7 @@ iconv_open_ft(const char *tocode, const
* be used to check the validity of the input even with
* identical encoding names.
*/
- if (strcmp(t, f) == 0)
+ if (asccasecmp(t, f) == 0)
errno = 0;
return (iconv_t)-1;
}
@@ -665,7 +731,7 @@ mime_tline(char *x, char *l)
l++;
if (*l != '\0')
*l++ = '\0';
- if (strcmp(x, n) == 0) {
+ if (asccasecmp(x, n) == 0) {
match = 1;
break;
}
@@ -748,14 +814,62 @@ mime_isclean(FILE *f)
maxlen = curlen;
curlen = 1;
} else if (c & 0200) {
+ int i = c;
isclean |= MIME_HIGHBIT;
+ if (c & 0100) {
+ int n, follow;
+
+ if ((c & 040) == 0) /* 110xxxxx */
+ follow = 1;
+ else if ((c & 020) == 0) /* 1110xxxx */
+ follow = 2;
+ else if ((c & 010) == 0) /* 11110xxx */
+ follow = 3;
+ else if ((c & 004) == 0) /* 111110xx */
+ follow = 4;
+ else if ((c & 002) == 0) /* 1111110x */
+ follow = 5;
+ else
+ continue;
+
+ for (n = 0; n < follow; n++) {
+ lastc = c;
+ c = getc(f);
+ curlen++;
+
+ if (c == '\0') {
+ isclean |= MIME_HASNUL;
+ goto latin;
+ }
+ if ((c & 0200) == 0 || (c & 0100))
+ goto latin;
+ if ((c == '\n') || (c == EOF)) {
+ if (curlen > maxlen)
+ maxlen = curlen;
+ curlen = 1;
+ goto latin;
+ }
+ }
+ isclean |= MIME_UTF8;
+ continue;
+ }
+ latin:
+ if (text_chars[i & 0377] == I)
+ isclean |= MIME_LATIN;
+ if (text_chars[i & 0377] == X) {
+ isclean |= MIME_CTRLCHAR;
+ break;
+ }
} else if (c == '\0') {
isclean |= MIME_HASNUL;
break;
- } else if ((c < 040 && (c != '\t' && c != '\f')) || c == 0177) {
+ } else if (text_chars[c & 0377] == F) {
isclean |= MIME_CTRLCHAR;
+ break;
}
} while (c != EOF);
+ if (isclean & (MIME_CTRLCHAR|MIME_HASNUL))
+ isclean &= (MIME_CTRLCHAR|MIME_HASNUL);
if (lastc != '\n')
isclean |= MIME_NOTERMNL;
clearerr(f);
@@ -826,11 +940,16 @@ get_mime_convert(FILE *fp, char **conten
* ^I or ^L in text/plain bodies. However, some
* obscure character sets actually contain these
* characters, so the content type can be set.
+ * Beside ^I or ^L from RFC 2046 we accept also
+ * backspace ^H often used in enhanced text.
*/
if ((*contenttype = value("contenttype-cntrl")) == NULL)
*contenttype = "application/octet-stream";
} else if (*contenttype == NULL)
*contenttype = "text/plain";
+ } else if (ascncasecmp(*contenttype, "text/", 5) == 0)
+ {
+ *charset = getcharset(*isclean);
}
return convert;
}
@@ -989,8 +1108,14 @@ mime_fromhdr(struct str *in, struct str
#ifdef HAVE_ICONV
iconv_t fhicd = (iconv_t)-1;
#endif
+ enum mimeclean isclean = 0;
tcs = gettcharset();
+
+ encflags = 0;
+ if (has_highbit(in->s))
+ isclean |= (MIME_HIGHBIT|encflags);
+
maxstor = in->l;
out->s = smalloc(maxstor + 1);
out->l = 0;
@@ -1010,7 +1135,7 @@ mime_fromhdr(struct str *in, struct str
#ifdef HAVE_ICONV
if (fhicd != (iconv_t)-1)
iconv_close(fhicd);
- if (strcmp(cs, tcs))
+ if (asccasecmp(cs, tcs))
fhicd = iconv_open_ft(tcs, cs);
else
fhicd = (iconv_t)-1;
@@ -1105,12 +1230,17 @@ notmime:
}
fromhdr_end:
*q = '\0';
- if (flags & TD_ISPR) {
+ if ((flags & TD_ISPR) && (isclean & MIME_HIGHBIT)) {
struct str new;
+ if ((isclean & MIME_UTF8) && asccasecmp("utf-8", tcs) == 0)
+ goto skip;
+ if ((isclean & MIME_LATIN) && ascncasecmp("iso-8859-", tcs, 9) == 0)
+ goto skip;
makeprint(out, &new);
free(out->s);
*out = new;
}
+skip:
if (flags & TD_DELCTRL)
out->l = delctrl(out->s, out->l);
#ifdef HAVE_ICONV
--- sendout.c
+++ sendout.c 2016-04-08 14:58:42.729798789 +0000
@@ -226,6 +226,23 @@ attach_file1(struct attachment *ap, FILE
charset = ap->a_charset;
convert = get_mime_convert(fi, &contenttype, &charset, &isclean,
dosign);
+#ifdef HAVE_ICONV
+ tcs = gettcharset();
+ if (isclean & MIME_UTF8)
+ {
+ tcs = "utf-8";
+ }
+ if (isclean & MIME_LATIN) {
+ tcs = value("charset");
+ if (tcs == NULL && wantcharset && wantcharset != (char *)-1)
+ tcs = wantcharset;
+ }
+ if (tcs == NULL) {
+ contenttype = "application/octet-stream";
+ charset = NULL;
+ convert = CONV_TOB64;
+ }
+#endif
fprintf(fo,
"\n--%s\n"
"Content-Type: %s",
@@ -255,11 +272,10 @@ attach_file1(struct attachment *ap, FILE
iconv_close(iconvd);
iconvd = (iconv_t)-1;
}
- tcs = gettcharset();
if ((isclean & (MIME_HASNUL|MIME_CTRLCHAR)) == 0 &&
ascncasecmp(contenttype, "text/", 5) == 0 &&
- isclean & MIME_HIGHBIT &&
- charset != NULL) {
+ (isclean & MIME_HIGHBIT) &&
+ charset != NULL && tcs != NULL) {
if ((iconvd = iconv_open_ft(charset, tcs)) == (iconv_t)-1 &&
errno != 0) {
if (errno == EINVAL)
@@ -467,11 +483,12 @@ infix(struct header *hp, FILE *fi, int d
}
rm(tempMail);
Ftfree(&tempMail);
- convert = get_mime_convert(fi, &contenttype, &charset,
- &isclean, dosign);
+ convert = get_mime_convert(fi, &contenttype, &charset, &isclean,
+ dosign);
#ifdef HAVE_ICONV
tcs = gettcharset();
- if ((convhdr = need_hdrconv(hp, GTO|GSUBJECT|GCC|GBCC|GIDENT)) != 0) {
+ if ((convhdr = need_hdrconv(hp, GTO|GSUBJECT|GCC|GBCC|GIDENT)) != 0 &&
+ tcs != NULL) {
if (iconvd != (iconv_t)-1)
iconv_close(iconvd);
if ((iconvd = iconv_open_ft(convhdr, tcs)) == (iconv_t)-1
@@ -505,10 +522,17 @@ infix(struct header *hp, FILE *fi, int d
iconv_close(iconvd);
iconvd = (iconv_t)-1;
}
+ if (isclean & MIME_UTF8)
+ tcs = "utf-8";
+ if (isclean & MIME_LATIN) {
+ tcs = value("charset");
+ if (tcs == NULL && wantcharset && wantcharset != (char *)-1)
+ tcs = wantcharset;
+ }
if ((isclean & (MIME_HASNUL|MIME_CTRLCHAR)) == 0 &&
ascncasecmp(contenttype, "text/", 5) == 0 &&
- isclean & MIME_HIGHBIT &&
- charset != NULL) {
+ (isclean & MIME_HIGHBIT) &&
+ charset != NULL && tcs != NULL) {
if (iconvd != (iconv_t)-1)
iconv_close(iconvd);
if ((iconvd = iconv_open_ft(charset, tcs)) == (iconv_t)-1

View File

@ -0,0 +1,129 @@
---
mailx.1 | 5 +++++
openssl.c | 29 ++++++++++++++++++++++++++---
2 files changed, 31 insertions(+), 3 deletions(-)
Index: mailx.1
===================================================================
--- mailx.1.orig
+++ mailx.1
@@ -2723,6 +2723,8 @@ Only applicable if SSL/TLS support is bu
Accept SSLv2 connections.
These are normally not allowed
because this protocol version is insecure.
+.br
+.B WARNING: on modern systems SSLv2 as well as SSLv3 are unavailable!
.TP
.B stealthmua
Inhibits the generation of
@@ -3599,6 +3601,8 @@ Selects a SSL/TLS protocol version;
valid values are `ssl2', `ssl3', and `tls1'.
If unset, the method is selected automatically,
if possible.
+.br
+.B WARNING: Do not use this option. 'ssl2', 'ssl3' are no longer available and 'tls1' forces use of TLS 1.0
.TP
\fBssl-method-\fIuser\fB@\fIhost\fR
Overrides
@@ -3609,6 +3613,8 @@ for a specific account.
Gives the pathname to an entropy daemon socket,
see
.IR RAND_egd (3).
+.br
+.B WARNING: On Linux this API is unavailable.
.TP
.B ssl-rand-file
Gives the pathname to a file with entropy data,
@@ -3617,6 +3623,8 @@ see
If the file is a regular file writable by the invoking user,
new data is written to it after it has been loaded.
Only applicable if SSL/TLS support is built using OpenSSL.
+.br
+.B WARNING: On linux the CSPRNG is seeded automatically and this option has no effect.
.TP
.B ssl-verify
Sets the action to be performed if an error occurs
Index: openssl.c
===================================================================
--- openssl.c.orig
+++ openssl.c
@@ -135,10 +135,18 @@ ssl_rand_init(void)
{
char *cp;
int state = 0;
+
+ if(RAND_status())
+ return 1;
if ((cp = value("ssl-rand-egd")) != NULL) {
cp = expand(cp);
- if (RAND_egd(cp) == -1) {
+#ifndef OPENSSL_NO_EGD
+ if (RAND_egd(cp) == -1)
+#else
+ if (1)
+#endif
+ {
fprintf(stderr, catgets(catd, CATSET, 245,
"entropy daemon at \"%s\" not available\n"),
cp);
@@ -221,12 +229,13 @@ ssl_select_method(const char *uhp)
cp = ssl_method_string(uhp);
if (cp != NULL) {
+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
#ifndef OPENSSL_NO_SSL2
if (equal(cp, "ssl2"))
method = SSLv2_client_method();
else
-#endif
- if (equal(cp, "ssl3"))
+#endif
+ if (equal(cp, "ssl3"))
method = SSLv3_client_method();
else if (equal(cp, "tls1"))
method = TLSv1_client_method();
@@ -235,8 +244,25 @@ ssl_select_method(const char *uhp)
"Invalid SSL method \"%s\"\n"), cp);
method = SSLv23_client_method();
}
+#else
+ method = NULL;
+ if (equal(cp, "tls"))
+ method = TLS_client_method();
+ else if (equal(cp, "dtls"))
+ method = DTLS_client_method();
+
+ if (!method) {
+ fprintf(stderr, catgets(catd, CATSET, 244,
+ "Invalid SSL method \"%s\"\n"), cp);
+ method = TLS_client_method();
+ }
+#endif
} else
+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
method = SSLv23_client_method();
+#else
+ method = TLS_client_method();
+#endif
return method;
}
@@ -307,6 +333,8 @@ ssl_certificate(struct sock *sp, const c
"cannot load private key from file %s\n"),
key);
ac_free(keyvar);
+ if(SSL_CTX_check_private_key(sp->s_ctx) != 1)
+ fprintf(stderr, "certificate/key mismatch");
} else
fprintf(stderr, catgets(catd, CATSET, 239,
"cannot load certificate from file %s\n"),
@@ -383,7 +411,7 @@ ssl_open(const char *server, struct sock
/* available with OpenSSL 0.9.6 or later */
SSL_CTX_set_mode(sp->s_ctx, SSL_MODE_AUTO_RETRY);
#endif /* SSL_MODE_AUTO_RETRY */
- options = SSL_OP_ALL;
+ options = SSL_OP_ALL|SSL_OP_NO_TICKET;
if (value("ssl-v2-allow") == NULL)
options |= SSL_OP_NO_SSLv2;
SSL_CTX_set_options(sp->s_ctx, options);

391
mailx-12.5-parentheses.dif Normal file
View File

@ -0,0 +1,391 @@
---
cmd1.c | 20 ++++++++++----------
collect.c | 8 ++++----
def.h | 2 +-
fio.c | 4 ++--
imap.c | 8 ++++----
junk.c | 30 +++++++++++++++---------------
macro.c | 2 +-
md5.c | 38 +++++++++++++++++++-------------------
mime.c | 24 ++++++++++++------------
sendout.c | 8 ++++----
tty.c | 2 +-
11 files changed, 73 insertions(+), 73 deletions(-)
--- cmd1.c
+++ cmd1.c 2016-04-08 14:08:47.753310695 +0000
@@ -112,14 +112,14 @@ headers(void *v)
lastg = g;
lastmq = mq;
}
- if (n>0 && mp==&message[n-1] ||
- n==0 && g==k ||
- n==-2 && g==k+size && lastmq ||
- n<0 && g>=k && mp->m_flag&fl)
+ if ((n>0 && mp==&message[n-1]) ||
+ (n==0 && g==k) ||
+ (n==-2 && g==k+size && lastmq) ||
+ (n<0 && g>=k && mp->m_flag&fl))
break;
g++;
}
- if (lastmq && (n==-2 || n==-1 && mp==&message[msgCount])) {
+ if (lastmq && (n==-2 || (n==-1 && mp==&message[msgCount]))) {
g = lastg;
mq = lastmq;
}
@@ -155,14 +155,14 @@ headers(void *v)
lastg = g;
lastmq = mq;
}
- if (n>0 && mp==&message[n-1] ||
- n==0 && g==k ||
- n==-2 && g==k+size && lastmq ||
- n<0 && g>=k && mp->m_flag&fl)
+ if ((n>0 && mp==&message[n-1]) ||
+ (n==0 && g==k) ||
+ (n==-2 && g==k+size && lastmq) ||
+ (n<0 && g>=k && mp->m_flag&fl))
break;
g++;
}
- if (lastmq && (n==-2 || n==-1 && mp==&message[msgCount])) {
+ if (lastmq && (n==-2 || (n==-1 && mp==&message[msgCount]))) {
g = lastg;
mq = lastmq;
}
--- collect.c
+++ collect.c 2016-04-08 14:14:42.838735568 +0000
@@ -279,8 +279,8 @@ read_attachment_data(struct attachment *
perror(ap->a_name);
}
if (ap->a_name && (value("attachment-ask-charset") ||
- (cp = value("sendcharsets")) != NULL &&
- strchr(cp, ',') != NULL)) {
+ ((cp = value("sendcharsets")) != NULL &&
+ strchr(cp, ',') != NULL))) {
snprintf(prefix, sizeof prefix, "#%u\tcharset: ", number);
ap->a_charset = readtty(prefix, ap->a_charset);
}
@@ -648,8 +648,8 @@ cont:
value("interactive") != NULL &&
(value("dot") != NULL || value("ignoreeof") != NULL))
break;
- if (linebuf[0] != escape || (value("interactive") == NULL &&
- tildeflag == 0 ||
+ if (linebuf[0] != escape || ((value("interactive") == NULL &&
+ tildeflag == 0) ||
tildeflag < 0)) {
if (putline(collf, linebuf, count) < 0)
goto err;
--- def.h
+++ def.h 2016-04-08 14:21:12.939513915 +0000
@@ -408,7 +408,7 @@ enum gfield {
#define GMASK (GTO|GSUBJECT|GCC|GBCC|GREPLYTO) /* Mask of places from whence */
#define visible(mp) (((mp)->m_flag&(MDELETED|MHIDDEN|MKILL))==0|| \
- dot==(mp) && (mp)->m_flag&MKILL)
+ (dot==(mp) && (mp)->m_flag&MKILL))
/*
* Structure used to pass about the current
--- fio.c
+++ fio.c 2016-04-08 14:17:14.651924938 +0000
@@ -543,8 +543,8 @@ getfold(char *name, int size)
if ((folder = value("folder")) == NULL)
return (-1);
- if (*folder == '/' || (p = which_protocol(folder)) != PROTO_FILE &&
- p != PROTO_MAILDIR) {
+ if (*folder == '/' || ((p = which_protocol(folder)) != PROTO_FILE &&
+ p != PROTO_MAILDIR)) {
strncpy(name, folder, size);
name[size-1]='\0';
} else {
--- imap.c
+++ imap.c 2016-04-08 14:20:47.983975844 +0000
@@ -1868,11 +1868,11 @@ imap_update(struct mailbox *mp)
stored++;
gotcha++;
} else if (mp->mb_type != MB_CACHE ||
- !edit && (!(m->m_flag&(MBOXED|MSAVED|MDELETED))
+ (!edit && (!(m->m_flag&(MBOXED|MSAVED|MDELETED))
|| (m->m_flag &
(MBOXED|MPRESERVE|MTOUCH)) ==
- (MPRESERVE|MTOUCH)) ||
- edit && !(m->m_flag & MDELETED))
+ (MPRESERVE|MTOUCH))) ||
+ (edit && !(m->m_flag & MDELETED)))
held++;
if (m->m_flag & MNEW) {
m->m_flag &= ~MNEW;
@@ -2779,7 +2779,7 @@ imap_appenduid(struct mailbox *mp, FILE
xmb.mb_otf = xmb.mb_itf = fp;
initcache(&xmb);
memset(&xm, 0, sizeof xm);
- xm.m_flag = flag&MREAD | MNEW;
+ xm.m_flag = (flag&MREAD) | MNEW;
xm.m_time = t;
xm.m_block = mailx_blockof(off1);
xm.m_offset = mailx_offsetof(off1);
--- junk.c
+++ junk.c 2016-04-08 14:32:27.147010580 +0000
@@ -345,11 +345,11 @@ putdb(void)
void *zp;
int scomp, ncomp;
- if (!super_mmapped && (sfp = dbfp(SUPER, O_WRONLY, &scomp, &sname))
- == NULL || sfp == (FILE *)-1)
+ if ((!super_mmapped && (sfp = dbfp(SUPER, O_WRONLY, &scomp, &sname))
+ == NULL) || sfp == (FILE *)-1)
return;
- if (!nodes_mmapped && (nfp = dbfp(NODES, O_WRONLY, &ncomp, &nname))
- == NULL || nfp == (FILE *)-1)
+ if ((!nodes_mmapped && (nfp = dbfp(NODES, O_WRONLY, &ncomp, &nname))
+ == NULL) || nfp == (FILE *)-1)
return;
if (super_mmapped == 0 || nodes_mmapped == 0)
holdint();
@@ -696,8 +696,8 @@ loop: *stop = 0;
}
SAVE(c)
} else if (constituent(c, *buf, i+j, sp->price, sp->hadamp) ||
- sp->loc == HEADER && c == '.' &&
- asccasecmp(sp->field, "subject*")) {
+ (sp->loc == HEADER && c == '.' &&
+ asccasecmp(sp->field, "subject*"))) {
if (c == '&')
sp->hadamp = 1;
SAVE(c)
@@ -775,9 +775,9 @@ out: if (i > 0) {
ascncasecmp(sp->field, "x-spam", 6) == 0 ||
ascncasecmp(sp->field, "x-pstn", 6) == 0 ||
ascncasecmp(sp->field, "x-scanned", 9) == 0 ||
- asccasecmp(sp->field, "received*") == 0 &&
+ (asccasecmp(sp->field, "received*") == 0 &&
((2*c > i) || i < 4 ||
- asccasestr(*buf, "localhost") != NULL)))
+ asccasestr(*buf, "localhost") != NULL))))
goto loop;
return *buf;
}
@@ -816,14 +816,14 @@ add(const char *word, enum entry entry,
switch (entry) {
case GOOD:
c = get(&n[OF_node_good]);
- if (incr>0 && c<MAX3-incr || incr<0 && c>=-incr) {
+ if ((incr>0 && c<MAX3-incr) || (incr<0 && c>=-incr)) {
c += incr;
put(&n[OF_node_good], c);
}
break;
case BAD:
c = get(&n[OF_node_bad]);
- if (incr>0 && c<MAX3-incr || incr<0 && c>=-incr) {
+ if ((incr>0 && c<MAX3-incr) || (incr<0 && c>=-incr)) {
c += incr;
put(&n[OF_node_bad], c);
}
@@ -958,7 +958,7 @@ insert(int *msgvec, enum entry entry, in
break;
}
u += incr;
- if (entry == GOOD && incr > 0 || entry == BAD && incr < 0)
+ if ((entry == GOOD && incr > 0) || (entry == BAD && incr < 0))
message[*ip-1].m_flag &= ~MJUNK;
else
message[*ip-1].m_flag |= MJUNK;
@@ -1109,10 +1109,10 @@ rate(const char *word, enum entry entry,
* gives the most interesting verbose output.
*/
if (d > best[i].dist ||
- d == best[i].dist &&
- p < best[i].prob ||
- best[i].loc == HEADER &&
- d == best[i].dist) {
+ (d == best[i].dist &&
+ p < best[i].prob) ||
+ (best[i].loc == HEADER &&
+ d == best[i].dist)) {
for (j = BEST-2; j >= i; j--)
best[j+1] = best[j];
best[i].dist = d;
--- macro.c
+++ macro.c 2016-04-08 14:34:50.856343786 +0000
@@ -195,7 +195,7 @@ ccall(void *v)
char **args = v;
struct macro *mp;
- if (args[0] == NULL || args[1] != NULL && args[2] != NULL) {
+ if (args[0] == NULL || (args[1] != NULL && args[2] != NULL)) {
fprintf(stderr, "Syntax is: call <name>\n");
return 1;
}
--- md5.c
+++ md5.c 2016-04-08 13:55:12.292417526 +0000
@@ -70,42 +70,42 @@ static unsigned char PADDING[64] = {
/*
* F, G, H and I are basic MD5 functions.
*/
-#define F(x, y, z) ((x) & (y) | ~(x) & (z))
-#define G(x, y, z) ((x) & (z) | (y) & ~(z))
+#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | ~(z)&0xffffffff))
+#define I(x, y, z) ((y) ^ ((x) | (~(z)&0xffffffff)))
/*
* ROTATE_LEFT rotates x left n bits.
*/
-#define ROTATE_LEFT(x, n) ((x)<<(n) & 0xffffffff | (x) >> 32-(n))
+#define ROTATE_LEFT(x, n) (((x)<<(n) & 0xffffffff) | (x) >> (32-(n)))
/*
* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
* Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
- (a) = (a) + F((b), (c), (d)) + (x) + ((ac)&0xffffffff) & 0xffffffff; \
+ (a) = ((a) + F((b), (c), (d)) + (x) + ((ac)&0xffffffff)) & 0xffffffff; \
(a) = ROTATE_LEFT((a), (s)); \
- (a) = (a) + (b) & 0xffffffff; \
+ (a) = ((a) + (b)) & 0xffffffff; \
}
#define GG(a, b, c, d, x, s, ac) { \
- (a) = (a) + G((b), (c), (d)) + (x) + ((ac)&0xffffffff) & 0xffffffff; \
+ (a) = ((a) + G((b), (c), (d)) + (x) + ((ac)&0xffffffff)) & 0xffffffff; \
(a) = ROTATE_LEFT((a), (s)); \
- (a) = (a) + (b) & 0xffffffff; \
+ (a) = ((a) + (b)) & 0xffffffff; \
}
#define HH(a, b, c, d, x, s, ac) { \
- (a) = (a) + H((b), (c), (d)) + (x) + ((ac)&0xffffffff) & 0xffffffff; \
+ (a) = ((a) + H((b), (c), (d)) + (x) + ((ac)&0xffffffff)) & 0xffffffff; \
(a) = ROTATE_LEFT((a), (s)); \
- (a) = (a) + (b) & 0xffffffff; \
+ (a) = ((a) + (b)) & 0xffffffff; \
}
#define II(a, b, c, d, x, s, ac) { \
- (a) = (a) + I((b), (c), (d)) + (x) + ((ac)&0xffffffff) & 0xffffffff; \
+ (a) = ((a) + I((b), (c), (d)) + (x) + ((ac)&0xffffffff)) & 0xffffffff; \
(a) = ROTATE_LEFT((a), (s)); \
- (a) = (a) + (b) & 0xffffffff; \
+ (a) = ((a) + (b)) & 0xffffffff; \
}
/*
@@ -144,10 +144,10 @@ MD5Update (
index = context->count[0]>>3 & 0x3F;
/* Update number of bits */
- if ((context->count[0] = context->count[0] + (inputLen<<3) & 0xffffffff)
+ if ((context->count[0] = (context->count[0] + (inputLen<<3)) & 0xffffffff)
< (inputLen<<3 & 0xffffffff))
- context->count[1] = context->count[1] + 1 & 0xffffffff;
- context->count[1] = context->count[1] + (inputLen>>29) & 0xffffffff;
+ context->count[1] = (context->count[1] + 1) & 0xffffffff;
+ context->count[1] = (context->count[1] + (inputLen>>29)) & 0xffffffff;
partLen = 64 - index;
@@ -285,10 +285,10 @@ MD5Transform(md5_type state[4], unsigned
II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II(b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
- state[0] = state[0] + a & 0xffffffff;
- state[1] = state[1] + b & 0xffffffff;
- state[2] = state[2] + c & 0xffffffff;
- state[3] = state[3] + d & 0xffffffff;
+ state[0] = (state[0] + a) & 0xffffffff;
+ state[1] = (state[1] + b) & 0xffffffff;
+ state[2] = (state[2] + c) & 0xffffffff;
+ state[3] = (state[3] + d) & 0xffffffff;
/*
* Zeroize sensitive information.
--- mime.c
+++ mime.c 2016-04-08 14:52:21.924855005 +0000
@@ -916,8 +916,8 @@ get_mime_convert(FILE *fp, char **conten
int convert;
*isclean = mime_isclean(fp);
- if (*isclean & MIME_HASNUL ||
- *contenttype && ascncasecmp(*contenttype, "text/", 5)) {
+ if ((*isclean & MIME_HASNUL) ||
+ (*contenttype && ascncasecmp(*contenttype, "text/", 5))) {
convert = CONV_TOB64;
if (*contenttype == NULL ||
ascncasecmp(*contenttype, "text/", 5) == 0)
@@ -990,13 +990,13 @@ mime_write_toqp(struct str *in, FILE *fo
upper = in->s + in->l;
for (p = in->s, l = 0; p < upper; p++) {
if (mustquote(*p&0377) ||
- p < upper-1 && p[1] == '\n' &&
- blankchar(p[0]&0377) ||
- p < upper-4 && l == 0 &&
+ (p < upper-1 && p[1] == '\n' &&
+ blankchar(p[0]&0377)) ||
+ (p < upper-4 && l == 0 &&
p[0] == 'F' && p[1] == 'r' &&
- p[2] == 'o' && p[3] == 'm' ||
- *p == '.' && l == 0 && p < upper-1 &&
- p[1] == '\n') {
+ p[2] == 'o' && p[3] == 'm') ||
+ (*p == '.' && l == 0 && p < upper-1 &&
+ p[1] == '\n')) {
if (l >= 69) {
sz += 2;
fwrite("=\n", sizeof (char), 2, fo);
@@ -1036,8 +1036,8 @@ mime_str_toqp(struct str *in, struct str
out->l = in->l;
upper = in->s + in->l;
for (p = in->s; p < upper; p++) {
- if (mustquote(*p&0377) || p+1 < upper && *(p + 1) == '\n' &&
- blankchar(*p & 0377)) {
+ if (mustquote(*p&0377) || (p+1 < upper && *(p + 1) == '\n' &&
+ blankchar(*p & 0377))) {
if (inhdr && *p == ' ') {
*q++ = '_';
} else {
@@ -1347,8 +1347,8 @@ mime_write_tohdr(struct str *in, FILE *f
wbeg == &upper[-1]))
mustquote++;
}
- if (mustquote || broken || (wend - wbeg) >= 74 &&
- quoteany) {
+ if (mustquote || broken || ((wend - wbeg) >= 74 &&
+ quoteany)) {
for (;;) {
cin.s = lastwordend ? lastwordend :
wbeg;
--- sendout.c
+++ sendout.c 2016-04-08 14:46:47.127059692 +0000
@@ -1372,10 +1372,10 @@ fmt(char *str, struct name *np, FILE *fo
if (col) {
fwrite(str, sizeof *str, strlen(str), fo);
if ((flags&GFILES) == 0 &&
- col == 3 && asccasecmp(str, "to:") == 0 ||
- col == 3 && asccasecmp(str, "cc:") == 0 ||
- col == 4 && asccasecmp(str, "bcc:") == 0 ||
- col == 10 && asccasecmp(str, "Resent-To:") == 0)
+ ((col == 3 && asccasecmp(str, "to:") == 0) ||
+ (col == 3 && asccasecmp(str, "cc:") == 0) ||
+ (col == 4 && asccasecmp(str, "bcc:") == 0) ||
+ (col == 10 && asccasecmp(str, "Resent-To:") == 0)))
is_to = 1;
}
for (; np != NULL; np = np->n_flink) {
--- tty.c
+++ tty.c 2016-04-08 14:47:33.838193954 +0000
@@ -438,6 +438,6 @@ yorn(char *msg)
do
cp = readtty(msg, NULL);
while (cp == NULL ||
- *cp != 'y' && *cp != 'Y' && *cp != 'n' && *cp != 'N');
+ (*cp != 'y' && *cp != 'Y' && *cp != 'n' && *cp != 'N'));
return *cp == 'y' || *cp == 'Y';
}

212
mailx-12.5-replyto.patch Normal file
View File

@ -0,0 +1,212 @@
--- collect.c
+++ collect.c 2006-07-20 11:21:32.000000000 +0000
@@ -720,7 +720,7 @@ cont:
* Grab a bunch of headers.
*/
do
- grabh(hp, GTO|GSUBJECT|GCC|GBCC,
+ grabh(hp, GTO|GSUBJECT|GCC|GBCC|GREPLYTO,
value("bsdcompat") != NULL &&
value("bsdorder") != NULL);
while (hp->h_to == NULL);
@@ -743,13 +743,21 @@ cont:
break;
case 's':
/*
- * Set the Subject list.
+ * Set the Subject line.
*/
cp = &linebuf[2];
while (whitechar(*cp & 0377))
cp++;
hp->h_subject = savestr(cp);
break;
+ case 'R':
+ /*
+ * Add to the Reply-To list.
+ */
+ cp = &linebuf[2];
+ while ((hp->h_replyto = checkaddrs(cat(hp->h_replyto,
+ sextract(&linebuf[2], GREPLYTO|GFULL))))
+ == NULL);
case '@':
/*
* Edit the attachment list.
--- def.h
+++ def.h 2006-07-20 11:21:32.000000000 +0000
@@ -393,7 +393,7 @@ enum gfield {
GUA = 128, /* User-Agent field */
GMIME = 256, /* MIME 1.0 fields */
GMSGID = 512, /* a Message-ID */
- /* 1024 */ /* unused */
+ GREPLYTO= 1024, /* a Reply-To field */
GIDENT = 2048, /* From:, Reply-To: and Organization: field */
GREF = 4096, /* References: field */
GDATE = 8192, /* Date: field */
@@ -403,7 +403,7 @@ enum gfield {
GFILES = 131072 /* include filename addresses */
};
-#define GMASK (GTO|GSUBJECT|GCC|GBCC) /* Mask of places from whence */
+#define GMASK (GTO|GSUBJECT|GCC|GBCC|GREPLYTO) /* Mask of places from whence */
#define visible(mp) (((mp)->m_flag&(MDELETED|MHIDDEN|MKILL))==0|| \
dot==(mp) && (mp)->m_flag&MKILL)
--- extern.h
+++ extern.h 2011-05-13 09:07:33.891926124 +0000
@@ -457,7 +457,7 @@ int send(struct message *mp, FILE *obuf,
char *prefix, enum sendaction action, off_t *stats);
/* sendout.c */
char *makeboundary(void);
-int mail(struct name *to, struct name *cc, struct name *bcc,
+int mail(struct name *to, struct name *cc, struct name *bcc, struct name *replyto,
struct name *smopts, char *subject, struct attachment *attach,
char *quotefile, int recipient_record, int tflag, int Eflag);
int sendmail(void *v);
--- mailx.1
+++ mailx.1 2011-05-13 09:11:27.640426515 +0000
@@ -43,7 +43,7 @@ mailx \- send and receive Internet mail
.PD 0
.HP
.ad l
-\fBmailx\fR [\fB\-BDdEFintv~\fR]
+\fBmailx\fR [\fB\-BDdEFintv~\fR] [\fB\-R\fR [\fIaddress\fR]]
[\fB\-s\fI\ subject\fR] [\fB\-a\fI\ attachment\fR ]
[\fB\-c\fI\ cc-addr\fR] [\fB\-b\fI\ bcc-addr\fR] [\fB\-r\fI\ from-addr\fR]
[\fB\-h\fI\ hops\fR]
@@ -203,8 +203,12 @@ it is recommended to set the
.I from
variable directly instead.
.TP
+.BI \-R\ \fR|\fB\ \-R \ address
+Without any argument any folders will be opened read-only.
+With argument an reply-to adress is specifed on command line.
+Only the first argument after the
.B \-R
-Opens any folders read-only.
+flag is used as the address.
.TP
.BI \-s \ subject
Specify subject on command line (only the first argument after the
@@ -2131,6 +2135,9 @@ copying the message to
`dead.letter' in the user's home directory
if save is set.
.TP
+.BI ~R string
+Use string as the Reply-To field.
+.TP
.BI ~r filename
Read the named file into the message.
.TP
--- main.c
+++ main.c 2011-05-13 09:18:29.747926305 +0000
@@ -52,6 +52,11 @@ static char sccsid[] = "@(#)main.c 2.51
* Note: We set egid to realgid ... and only if we need the egid we will
* switch back temporary. Nevertheless, I do not like seg faults.
* Werner Fink, <werner@suse.de>
+ * ---
+ * We want to set reply-to on the command line to deal with antispam rules
+ * and adresses behind firewalls.
+ * 2000-07-19, poc@pocnet.net
+ * Changes by werner@suse.de (move Option r to R, make ~R work)
*/
@@ -87,9 +92,9 @@ static void setscreensize(int dummy);
int
main(int argc, char *argv[])
{
- const char optstr[] = "A:BHEFINVT:RS:a:b:c:dDefh:inqr:s:tu:v~";
+ const char optstr[] = "A:BHEFINVT:R::S:a:b:c:dDefh:inqr:s:tu:v~";
int i, existonly = 0, headersonly = 0, sendflag = 0;
- struct name *to, *cc, *bcc, *smopts;
+ struct name *to, *cc, *bcc, *replyto, *smopts;
struct attachment *attach;
char *subject, *cp, *ef, *qf = NULL, *fromaddr = NULL, *Aflag = NULL;
char nosrc = 0;
@@ -179,6 +184,8 @@ main(int argc, char *argv[])
attach = NULL;
smopts = NULL;
subject = NULL;
+ replyto = NULL;
+
while ((i = getopt(argc, argv, optstr)) != EOF) {
switch (i) {
case 'V':
@@ -348,12 +355,18 @@ main(int argc, char *argv[])
Aflag = optarg;
break;
case 'R':
- Rflag = 1;
+ /*
+ * Set the Reply-to Address (as who we send mail)
+ */
+ if (optarg && *optarg)
+ replyto = checkaddrs(cat(replyto, extract(optarg, GREPLYTO|GFULL)));
+ else
+ Rflag = 1;
break;
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 -eiIUdEFntBDNHV~ [-R [reply-address]] -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);
}
}
@@ -387,6 +400,10 @@ usage:
fprintf(stderr, "The -R option is meaningless in send mode.\n");
goto usage;
}
+ if (replyto && to == NULL) {
+ fprintf(stderr, "The reply-to is meaningless not in send mode.\n");
+ goto usage;
+ }
if (Iflag && ef == NULL) {
fprintf(stderr, catgets(catd, CATSET, 204,
"Need -f with -I.\n"));
@@ -441,8 +458,8 @@ usage:
if (fromaddr)
assign("from", fromaddr);
if (!rcvmode) {
- mail(to, cc, bcc, smopts, subject, attach, qf, Fflag, tflag,
- Eflag);
+ mail(to, cc, bcc, replyto, smopts, subject, attach, qf,
+ Fflag, tflag, Eflag);
/*
* why wait?
*/
--- sendout.c
+++ sendout.c 2011-05-13 09:19:01.288426393 +0000
@@ -712,7 +712,7 @@ savemail(char *name, FILE *fi)
* which does all the dirty work.
*/
int
-mail(struct name *to, struct name *cc, struct name *bcc,
+mail(struct name *to, struct name *cc, struct name *bcc, struct name *replyto,
struct name *smopts, char *subject, struct attachment *attach,
char *quotefile, int recipient_record, int tflag, int Eflag)
{
@@ -731,6 +731,7 @@ mail(struct name *to, struct name *cc, s
head.h_to = to;
head.h_cc = cc;
head.h_bcc = bcc;
+ head.h_replyto = replyto;
}
head.h_attach = attach;
head.h_smopts = smopts;
--- tty.c
+++ tty.c 2006-07-20 11:21:39.000000000 +0000
@@ -338,6 +338,12 @@ grabh(struct header *hp, enum gfield gfl
hp->h_organization = rtty_internal("Organization: ",
hp->h_organization);
}
+ if (gflags & GREPLYTO) {
+ TTYSET_CHECK(hp->h_replyto)
+ hp->h_replyto = checkaddrs(sextract(rtty_internal("Reply-To: ",
+ detract(hp->h_replyto, comma)),
+ GREPLYTO|GFULL));
+ }
if (!subjfirst)
GRAB_SUBJECT
out:

29
mailx-12.5-systemd.patch Normal file
View File

@ -0,0 +1,29 @@
To avoid trouble as descbried in boo#1192916
---
mailx.1 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- mailx.1
+++ mailx.1 2021-11-23 12:33:48.788947209 +0000
@@ -4793,6 +4793,20 @@ mailaddr(7),
sendmail(8)
.SH NOTES
.PP
+If used in systemd unit files not using
+.B Type=forking
+it is required to set the option
+.I sendwait
+on the command line of
+.BR mailx (1)
+with
+.I \-S sendwait=yes
+as otherwise it might happen that the
+.BR systemd (1)
+service manager will terminate the asynchronously
+started SMTP transfer as described at the option
+.IR smtp.
+.PP
Variables in the environment passed to
.I mailx
cannot be unset.

535
mailx-12.5.dif Normal file
View File

@ -0,0 +1,535 @@
---
mailx-12.5/Makefile | 3 +-
mailx-12.5/aux.c | 1
mailx-12.5/base64.c | 1
mailx-12.5/catd/en_US | 7 ++++-
mailx-12.5/cmd1.c | 1
mailx-12.5/cmd2.c | 1
mailx-12.5/cmd3.c | 1
mailx-12.5/cmdtab.c | 1
mailx-12.5/collect.c | 1
mailx-12.5/dotlock.c | 1
mailx-12.5/edit.c | 1
mailx-12.5/fio.c | 1
mailx-12.5/getname.c | 1
mailx-12.5/head.c | 1
mailx-12.5/hmac.c | 1
mailx-12.5/imap.c | 2 -
mailx-12.5/imap_gssapi.c | 2 +
mailx-12.5/lex.c | 1
mailx-12.5/list.c | 1
mailx-12.5/mail.rc | 2 +
mailx-12.5/mailx.1 | 6 ++--
mailx-12.5/main.c | 15 +++++++----
mailx-12.5/makeconfig | 60 +++++++++++++++++++++++++++++++++--------------
mailx-12.5/md5.c | 1
mailx-12.5/mime.c | 1
mailx-12.5/names.c | 1
mailx-12.5/nsserr.c | 1
mailx-12.5/popen.c | 1
mailx-12.5/quit.c | 1
mailx-12.5/send.c | 1
mailx-12.5/sendout.c | 1
mailx-12.5/smtp.c | 1
mailx-12.5/strings.c | 1
mailx-12.5/temp.c | 1
mailx-12.5/tty.c | 1
mailx-12.5/v7.local.c | 1
mailx-12.5/vars.c | 1
37 files changed, 98 insertions(+), 28 deletions(-)
--- mailx-12.5/Makefile
+++ mailx-12.5/Makefile 2017-06-12 11:07:30.560182707 +0000
@@ -10,6 +10,7 @@ PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
SYSCONFDIR = /etc
+MAILRC = /etc/mail.rc
DESTDIR =
@@ -51,7 +52,7 @@ IPv6 = -DHAVE_IPv6_FUNCS
#
# Binaries are stripped with this command after installation.
#
-STRIP = strip
+STRIP = true
###########################################################################
###########################################################################
--- mailx-12.5/aux.c
+++ mailx-12.5/aux.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)aux.c 2.83 (
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <sys/stat.h>
--- mailx-12.5/base64.c
+++ mailx-12.5/base64.c 2017-06-12 11:07:30.560182707 +0000
@@ -33,6 +33,7 @@ static char sccsid[] = "@(#)base64.c 2.1
* base64 functions
*/
+#include "config.h"
#include "rcv.h"
#include "extern.h"
--- mailx-12.5/catd/en_US
+++ mailx-12.5/catd/en_US 2017-06-12 11:07:30.568182567 +0000
@@ -180,7 +180,10 @@ The following ~ escapes are defined:\n\
132 No applicable messages\n
133 %d: Inappropriate message\n
134 Unknown metachar (%c)\n
-135 Usage: %s -eiIUdFntBNHV~ -T FILE -u USER -h hops -r address -s SUBJECT -a FILE -q FILE -f FILE -b USERS -c USERS users\n
+135 $Usage: %s [-BDFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr]\n\
+ [-r from-addr] [-h hops] [-A account] [-R reply-addr] [-S option] to-addr ...\n\
+ %s [-BDeHiInNRv~] [-T name] [-A account] -f [name] [-S option]\n\
+ %s [-BDeinNRv~] [-A account] [-u user] [-S option]\n
136 --- DELETED ---
137 Cannot give -f and people to send to.\n
138 Send options without primary recipient specified.\n
@@ -314,3 +317,5 @@ The following ~ escapes are defined:\n\
266 Ignoring header field "%s"\n
267 Restoring deleted header lines\n
268 Pipe to: "%s"\n
+269 The -R option is meaningless in send mode.\n
+270 The reply-to is meaningless not in send mode.\n
--- mailx-12.5/cmd1.c
+++ mailx-12.5/cmd1.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)cmd1.c 2.97
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#ifdef HAVE_WCWIDTH
--- mailx-12.5/cmd2.c
+++ mailx-12.5/cmd2.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)cmd2.c 2.47
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <sys/wait.h>
--- mailx-12.5/cmd3.c
+++ mailx-12.5/cmd3.c 2017-06-12 11:07:30.560182707 +0000
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)cmd3.c 2.87
#include <math.h>
#include <float.h>
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <unistd.h>
--- mailx-12.5/cmdtab.c
+++ mailx-12.5/cmdtab.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)cmdtab.c 2.5
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
--- mailx-12.5/collect.c
+++ mailx-12.5/collect.c 2017-06-12 11:07:30.560182707 +0000
@@ -49,6 +49,7 @@ static char sccsid[] = "@(#)collect.c 2.
* ~ escapes.
*/
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <unistd.h>
--- mailx-12.5/dotlock.c
+++ mailx-12.5/dotlock.c 2017-06-12 11:07:30.560182707 +0000
@@ -38,6 +38,7 @@ static char sccsid[] = "@(#)dotlock.c 2.
#endif
#endif
+#include "config.h"
#include "rcv.h"
#include <sys/stat.h>
#include <unistd.h>
--- mailx-12.5/edit.c
+++ mailx-12.5/edit.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)edit.c 2.24
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <sys/stat.h>
--- mailx-12.5/fio.c
+++ mailx-12.5/fio.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)fio.c 2.76 (
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#ifndef HAVE_WORDEXP
--- mailx-12.5/getname.c
+++ mailx-12.5/getname.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)getname.c 2.
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include <pwd.h>
#include "extern.h"
--- mailx-12.5/head.c
+++ mailx-12.5/head.c 2017-06-12 11:07:30.560182707 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)head.c 2.17
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <time.h>
--- mailx-12.5/hmac.c
+++ mailx-12.5/hmac.c 2017-06-12 11:07:30.564182637 +0000
@@ -32,6 +32,7 @@ Appendix -- Sample Code
/* Sccsid @(#)hmac.c 1.8 (gritter) 3/4/06 */
+#include "config.h"
#include "rcv.h"
#include "md5.h"
--- mailx-12.5/imap.c
+++ mailx-12.5/imap.c 2017-06-12 11:07:56.295730796 +0000
@@ -3541,7 +3541,7 @@ imap_read_date(const char *cp)
const char *
imap_make_date_time(time_t t)
{
- static char s[30];
+ static char s[64];
struct tm *tmptr;
int tzdiff, tzdiff_hour, tzdiff_min;
--- mailx-12.5/imap_gssapi.c
+++ mailx-12.5/imap_gssapi.c 2017-06-12 11:07:30.564182637 +0000
@@ -73,6 +73,8 @@ static char sccsid[] = "@(#)imap_gssapi.
#endif
#endif /* not lint */
+#include "config.h"
+
/*
* Implementation of IMAP GSSAPI authentication according to RFC 1731.
*/
--- mailx-12.5/lex.c
+++ mailx-12.5/lex.c 2017-06-12 11:07:30.564182637 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)lex.c 2.86 (
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <errno.h>
--- mailx-12.5/list.c
+++ mailx-12.5/list.c 2017-06-12 11:07:30.564182637 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)list.c 2.62
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include <ctype.h>
#include "extern.h"
--- mailx-12.5/mail.rc
+++ mailx-12.5/mail.rc 2017-06-12 11:07:30.564182637 +0000
@@ -0,0 +1,2 @@
+set asksub append dot save crt=20
+ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via
--- mailx-12.5/mailx.1
+++ mailx-12.5/mailx.1 2017-06-12 11:07:30.564182637 +0000
@@ -175,7 +175,7 @@ Only applicable in combination with
.IR \-f .
.TP
.B \-n
-Inhibits reading /etc/nail.rc upon startup.
+Inhibits reading /etc/mail.rc upon startup.
This option should be activated for
.I mailx
scripts that are invoked on more than one machine,
@@ -3113,7 +3113,7 @@ in the user's home directory.
The name of an optional startup file
to be read after ~/.mailrc.
This variable is ignored if it is imported from the environment;
-it has an effect only if it is set in /etc/nail.rc or ~/.mailrc
+it has an effect only if it is set in /etc/mail.rc or ~/.mailrc
to allow bypassing the configuration with e. g. `MAILRC=/dev/null'.
Use this file for commands
that are not understood by other mailx implementations.
@@ -3696,7 +3696,7 @@ Used as directory for temporary files in
~/.mailrc
File giving initial commands.
.TP
-/etc/nail.rc
+/etc/mail.rc
System wide initialization file.
.TP
~/.mime.types
--- mailx-12.5/main.c
+++ mailx-12.5/main.c 2017-06-12 11:07:30.564182637 +0000
@@ -93,7 +93,7 @@ int
main(int argc, char *argv[])
{
const char optstr[] = "A:BHEFINVT:R::S:a:b:c:dDefh:inqr:s:tu:v~";
- int i, existonly = 0, headersonly = 0, sendflag = 0;
+ int i, existonly = 0, headersonly = 0, sendflag = 0, err = 1;
struct name *to, *cc, *bcc, *replyto, *smopts;
struct attachment *attach;
char *subject, *cp, *ef, *qf = NULL, *fromaddr = NULL, *Aflag = NULL;
@@ -385,8 +385,11 @@ main(int argc, char *argv[])
case '?':
usage:
fprintf(stderr, catgets(catd, CATSET, 135,
-"Usage: %s -eiIUdEFntBDNHV~ [-R [reply-address]] -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);
+"Usage: %s [-BDFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr]\n\
+ [-r from-addr] [-h hops] [-A account] [-R reply-addr] [-S option] to-addr ...\n\
+ %s [-BDeHiInNRv~] [-T name] [-A account] -f [name] [-S option]\n\
+ %s [-BDeinNRv~] [-A account] [-u user] [-S option]\n"), progname, progname, progname);
+ exit(err);
}
}
if (ef != NULL) {
@@ -427,11 +430,13 @@ usage:
goto usage;
}
if (Rflag && to != NULL) {
- fprintf(stderr, "The -R option is meaningless in send mode.\n");
+ fprintf(stderr, catgets(catd, CATSET, 269,
+ "The -R option is meaningless in send mode.\n"));
goto usage;
}
if (replyto && to == NULL) {
- fprintf(stderr, "The reply-to is meaningless not in send mode.\n");
+ fprintf(stderr, catgets(catd, CATSET, 270,
+ "The reply-to is meaningless not in send mode.\n"));
goto usage;
}
if (Iflag && ef == NULL) {
--- mailx-12.5/makeconfig
+++ mailx-12.5/makeconfig 2017-06-12 11:07:30.564182637 +0000
@@ -304,23 +304,49 @@ int main(void)
'for socket functionality in libsocket and libnsl' \
'#define HAVE_SOCKETS' '-lsocket -lnsl'
-#link_check ipv6 'for IPv6 functionality' '#define HAVE_IPv6_FUNCS' <<\!
-##include "config.h"
-##include <sys/types.h>
-##include <sys/socket.h>
-##include <netdb.h>
-##include <netinet/in.h>
-##ifdef HAVE_ARPA_INET_H
-##include <arpa/inet.h>
-##endif /* HAVE_ARPA_INET_H */
-#
-#int main(void)
-#{
-# struct addrinfo a, *ap;
-# getaddrinfo("foo", "0", &a, &ap);
-# return 0;
-#}
-#!
+cat >$tmp1.c <<\!
+#include "config.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif /* HAVE_ARPA_INET_H */
+
+int main()
+{
+ struct addrinfo a, *ap;
+ getaddrinfo("foo", "0", &a, &ap);
+ return 0;
+}
+!
+
+cat >$tmp2.c <<\!
+#include "config.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif /* HAVE_ARPA_INET_H */
+
+int main()
+{
+ struct sockaddr a;
+ getnameinfo(&a, 0, "foo", 3, "bar", 3, NI_NUMERICHOST);
+ return 0;
+}
+!
+
+<$tmp1.c link_check ipv6 'for IPv6 functionality getaddrinfo' '#define HAVE_GETADDRINFO' &&
+ <$tmp2.c link_check ipv6 'for IPv6 functionality getnameinfo' '#define HAVE_GETNAMEINFO'
+echo \
+'#if defined(HAVE_GETADDRINFO) && defined(HAVE_GETNAMEINFO)
+# undef HAVE_IPv6_FUNCS
+# define HAVE_IPv6_FUNCS
+#endif' >>$out
link_check nss 'for Network Security Services (NSS)' '#define USE_SSL
#define USE_NSS' '-lsmime3 -lnss3 -lssl3 -lnspr4 -lplc4' <<\! || \
--- mailx-12.5/md5.c
+++ mailx-12.5/md5.c 2017-06-12 11:07:30.564182637 +0000
@@ -33,6 +33,7 @@ documentation and/or software.
/* Sccsid @(#)md5.c 1.8 (gritter) 3/4/06 */
+#include "config.h"
#include "rcv.h"
#include "md5.h"
--- mailx-12.5/mime.c
+++ mailx-12.5/mime.c 2017-06-12 11:07:30.564182637 +0000
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)mime.c 2.71
#endif /* DOSCCS */
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <ctype.h>
--- mailx-12.5/names.c
+++ mailx-12.5/names.c 2017-06-12 11:07:30.564182637 +0000
@@ -48,6 +48,7 @@ static char sccsid[] = "@(#)names.c 2.22
* Handle name lists.
*/
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <sys/stat.h>
--- mailx-12.5/nsserr.c
+++ mailx-12.5/nsserr.c 2017-06-12 11:07:30.564182637 +0000
@@ -29,6 +29,7 @@
/* "@(#)nsserr.c 1.3 (gritter) 3/4/06" */
+#include "config.h"
#include <sslerr.h>
#include <secerr.h>
--- mailx-12.5/popen.c
+++ mailx-12.5/popen.c 2017-06-12 11:07:30.564182637 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)popen.c 2.20
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <sys/stat.h>
--- mailx-12.5/quit.c
+++ mailx-12.5/quit.c 2017-06-12 11:07:30.564182637 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)quit.c 2.30
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <stdio.h>
--- mailx-12.5/send.c
+++ mailx-12.5/send.c 2017-06-12 11:07:30.564182637 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)send.c 2.86
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <time.h>
--- mailx-12.5/sendout.c
+++ mailx-12.5/sendout.c 2017-06-12 11:07:30.564182637 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)sendout.c 2.
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <errno.h>
--- mailx-12.5/smtp.c
+++ mailx-12.5/smtp.c 2017-06-12 11:07:30.568182567 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)smtp.c 2.43
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include <sys/utsname.h>
--- mailx-12.5/strings.c
+++ mailx-12.5/strings.c 2017-06-12 11:07:30.568182567 +0000
@@ -50,6 +50,7 @@ static char sccsid[] = "@(#)strings.c 2.
* loop each time, so they need not be freed.
*/
+#include "config.h"
#include "rcv.h"
#include "extern.h"
--- mailx-12.5/temp.c
+++ mailx-12.5/temp.c 2017-06-12 11:07:30.568182567 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)temp.c 2.8 (
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <errno.h>
--- mailx-12.5/tty.c
+++ mailx-12.5/tty.c 2017-06-12 11:07:30.568182567 +0000
@@ -48,6 +48,7 @@ static char sccsid[] = "@(#)tty.c 2.29 (
* Generally useful tty stuff.
*/
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <errno.h>
--- mailx-12.5/v7.local.c
+++ mailx-12.5/v7.local.c 2017-06-12 11:07:30.568182567 +0000
@@ -50,6 +50,7 @@ static char sccsid[] = "@(#)v7.local.c 2
* Local routines that are installation dependent.
*/
+#include "config.h"
#include "rcv.h"
#include "extern.h"
#include <sys/stat.h>
--- mailx-12.5/vars.c
+++ mailx-12.5/vars.c 2017-06-12 11:07:30.568182567 +0000
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)vars.c 2.12
#endif
#endif /* not lint */
+#include "config.h"
#include "rcv.h"
#include "extern.h"

BIN
mailx-12.5.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

35
mailx-fix-openssl.patch Normal file
View File

@ -0,0 +1,35 @@
--- openssl.c
+++ openssl.c 2011-05-13 00:00:00.000000000 +0000
@@ -63,6 +63,7 @@ static sigjmp_buf ssljmp;
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/rand.h>
+#include <openssl/engine.h>
#include "rcv.h"
#include <errno.h>
@@ -171,6 +172,10 @@ ssl_init(void)
verbose = value("verbose") != NULL;
if (initialized == 0) {
SSL_library_init();
+/* Load all bundled ENGINEs into memory and make them visible */
+ ENGINE_load_builtin_engines();
+ /* Register all of them for every algorithm they collectively implement */
+ ENGINE_register_all_complete();
initialized = 1;
}
if (rand_init == 0)
@@ -216,9 +221,12 @@ ssl_select_method(const char *uhp)
cp = ssl_method_string(uhp);
if (cp != NULL) {
+#ifndef OPENSSL_NO_SSL2
if (equal(cp, "ssl2"))
method = SSLv2_client_method();
- else if (equal(cp, "ssl3"))
+ else
+#endif
+ if (equal(cp, "ssl3"))
method = SSLv3_client_method();
else if (equal(cp, "tls1"))
method = TLSv1_client_method();

33
mailx-usr-etc.patch Normal file
View File

@ -0,0 +1,33 @@
diff -ur a/main.c b/main.c
--- a/main.c 2023-12-05 09:54:32.727382197 +0100
+++ b/main.c 2023-12-06 11:07:50.176112126 +0100
@@ -454,8 +454,15 @@
input = stdin;
rcvmode = !to && !tflag;
spreserve();
- if (!nosrc)
- load(PATH_MASTER_RC);
+ if (!nosrc) {
+#ifdef DISTCONFMAILRC
+ struct stat st;
+ if (stat(PATH_MASTER_RC, &st) < 0)
+ load(DISTCONFMAILRC);
+ else
+#endif
+ load(PATH_MASTER_RC);
+ }
/*
* Expand returns a savestr, but load only uses the file name
* for fopen, so it's safe to do this.
diff -ur a/Makefile b/Makefile
--- a/Makefile 2023-12-05 09:54:32.727382197 +0100
+++ b/Makefile 2023-12-06 11:08:00.418064025 +0100
@@ -60,7 +60,7 @@
###########################################################################
###########################################################################
-FEATURES = $(IPv6)
+FEATURES = $(IPv6) $(DISTCONF)
OBJ = aux.o base64.o cache.o cmd1.o cmd2.o cmd3.o cmdtab.o collect.o \
dotlock.o edit.o fio.o getname.o getopt.o head.o hmac.o \

445
mailx.changes Normal file
View File

@ -0,0 +1,445 @@
-------------------------------------------------------------------
Wed Dec 6 12:02:04 UTC 2023 - Stefan Schubert <schubi@suse.com>
- Moving /etc/mailrc to /usr/etc/mail.rc
* Add patch mailx-usr-etc.patch
-------------------------------------------------------------------
Tue Nov 7 09:10:38 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>
- Fix build with RPM 4.19: unnumbered patches are no longer
supported.
-------------------------------------------------------------------
Tue Dec 27 13:09:42 UTC 2022 - Ludwig Nussel <lnussel@suse.com>
- Replace transitional %usrmerged macro with regular version check (boo#1206798)
-------------------------------------------------------------------
Mon Mar 21 10:31:05 UTC 2022 - Dr. Werner Fink <werner@suse.de>
- Fix number check of test (builtin) in %pre scriptlet (boo#1197317)
-------------------------------------------------------------------
Thu Feb 17 21:22:49 UTC 2022 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
-------------------------------------------------------------------
Tue Nov 23 12:41:51 UTC 2021 - Dr. Werner Fink <werner@suse.de>
- Add patch mailx-12.5-systemd.patch to add description how to avoid
bugs like bsc#1192916 -- mailx does not send mails unless run via
strace or in verbose mode
-------------------------------------------------------------------
Wed Jan 27 12:27:13 UTC 2021 - Ludwig Nussel <lnussel@suse.de>
- update-alternatives call needs to be in postun rather than preun
-------------------------------------------------------------------
Fri Dec 25 10:51:08 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>
- fix-sendmail-name.patch: fix name argument when calling
/usr/sbin/sendmail [bsc#1180355].
-------------------------------------------------------------------
Fri Oct 16 10:12:58 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- prepare usrmerge (boo#1029961)
-------------------------------------------------------------------
Mon Nov 19 09:47:38 UTC 2018 - Dr. Werner Fink <werner@suse.de>
- Repair ghost links used by update-alternatives
-------------------------------------------------------------------
Wed Oct 31 18:30:32 UTC 2018 - Cristian Rodríguez <crrodriguez@opensuse.org>
- Updates to mailx-12.5-openssl-1.1.0f.patch
* If the openssl RNG is already
seeded (on linux it always is) skip snake-oil reeseeding from
file. Update man page accordingly.
* Update man page with information that ssl2 and ssl3 are
not only deprecated but currently unavailable and that
tls1 forces TLS 1.0 but not later versions.
* RAND_EGD is also unavailable, not just unused.
* set SSL_OP_NO_TICKET, many servers accept session
tickets, but almost never rotate them properly, TLS 1.3
session tickets are not affected by this flag.
* When using client certificates, check if the cert and key
match each other.
-------------------------------------------------------------------
Sun Jun 10 23:54:07 UTC 2018 - jengelh@inai.de
- Remove redundant %clean section.
- Replace old $RPM_* shell vars by macros.
-------------------------------------------------------------------
Thu Jun 7 09:35:26 UTC 2018 - werner@suse.de
- Use update-alternatives to allow an other package like mailutils
to provide /usr/bin/mail as well
-------------------------------------------------------------------
Mon Jun 12 11:11:38 UTC 2017 - werner@suse.de
- Add patch mailx-12.5-openssl-1.1.0f.patch
Avoid deprecated/unavailable openSSL client methods (boo#1042663)
-------------------------------------------------------------------
Sat Apr 29 18:56:02 UTC 2017 - bwiedemann@suse.com
- call gzip -n and drop CreationDate from manual.ps
to make build fully reproducible
-------------------------------------------------------------------
Fri Apr 8 15:02:17 UTC 2016 - werner@suse.de
- Correct parenthese expansion to fulfill natural order (bnc#974561)
-------------------------------------------------------------------
Tue Mar 17 10:05:20 UTC 2015 - werner@suse.de
- Modify patch mailx-12.5-mime.dif to allow Form Feed as valid
characters within mail messages (bsc#922543)
-------------------------------------------------------------------
Thu Dec 11 11:46:53 UTC 2014 - werner@suse.de
- Add patches
0001-outof-Introduce-expandaddr-flag.patch
0002-unpack-Disable-option-processing-for-email-addresses.patch
0003-fio.c-Unconditionally-require-wordexp-support.patch
0004-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch
to fix bsc#909208 -- CVE-2004-2771, CVE-2014-7844: mailx: shell
command injection via crafted email addresses
-------------------------------------------------------------------
Sat Apr 19 19:57:00 UTC 2014 - crrodriguez@opensuse.org
- Build with -DOPENSSL_NO_SSL_INTERN asserting that this
package does not (and should not) use openSSL internals
that are subject to binary incompatible changes.
-------------------------------------------------------------------
Fri Dec 6 12:48:27 UTC 2013 - werner@suse.de
- Correct comment in spec file
-------------------------------------------------------------------
Wed Dec 4 08:54:21 UTC 2013 - werner@suse.de
- Crop off the brackets of an ipv6 addresse if found (bnc#853246)
-------------------------------------------------------------------
Tue Dec 3 09:06:50 UTC 2013 - werner@suse.de
- Add patch mailx-12.5-ipv6.dif to enable mailx to parse IPv6 addresses
including a port. We do only support the [ipv6]:port syntax (bnc#853246)
-------------------------------------------------------------------
Tue Jul 2 10:29:35 UTC 2013 - werner@suse.de
- Do not pseudo detect Latin nor UTF-8 in binary attachments (bnc#827010)
- Add patch mailx-12.5-parentheses.dif, that is try to tranquilize
gcc due warning about parentheses (please check!)
-------------------------------------------------------------------
Tue Jun 25 11:58:06 UTC 2013 - coolo@suse.com
- buildrequire groff explicitly
-------------------------------------------------------------------
Tue Jun 11 07:51:37 UTC 2013 - cfarrell@suse.com
- license update: BSD-4-Clause and MPL-1.1
See COPYING. Fedora also uses this license designation
-------------------------------------------------------------------
Fri Sep 14 19:52:31 UTC 2012 - idonmez@suse.com
- Add BuildRequires on man to fix build for Factory
-------------------------------------------------------------------
Fri Mar 23 18:39:38 UTC 2012 - werner@suse.de
- Avoid header rewrite in case of specified ttycharset in wrong
locale but subject in ttycharset (bnc#753340)
-------------------------------------------------------------------
Fri Mar 23 14:01:02 UTC 2012 - werner@suse.de
- Try to support not only UTF-8 but also latin text encodings (bnc#753340)
-------------------------------------------------------------------
Fri May 13 13:29:52 CEST 2011 - werner@suse.de
- Update to heirloom mailx 12.5
* Better detection of base64 encoded text if acrossed a line
* A null pointer dereference that lead to a segmentation fault
when the user hit return at a yes/no question has been fixed
* When both standard input and standard output refer to a
terminal, ignore SIGPIPE
* With the "-E" command line option or if the "skipemptybody"
variable is set, outgoing messages that contain no text in
their first or only part are not sent but silently discarded.
* When an attachment that would have a "text/something" content
type contains illegal byte sequences, it is now reliably sent
out with the "application/octet-stream" content type instead
* Fixed a bug that caused messages to be truncated with IMAP servers that
use LF as line ending in message data, such as Google Mail (reported by
Matthew L. Shobe).
* Do not run filename expansion for IMAP or POP3 mailboxes names, making
it possible to select mailboxes that contain both brackets and spaces
in their names (reported by Matthew L. Shobe).
* Fixed the format of the timezone in "Date" header fields for zones in
the Western Hemisphere whose offsets are not an integral number of hours
(patch by Matthew Fischer).
* Fixed a message corruption that occurred when the "inc" command was used
with a mbox format mailbox after encrypted messages had been viewed
(reported by Martin Neitzel).
* Fixed a condition that caused mailx to hang when looking at a message,
copying that message, and issuing a "z" command evaluating an uncached
portion of an IMAP folder.
* Make it compile with OpenSSL 1.0.0-beta2
* For RFC 2047 MIME "encoded-word" parts in headers, assume that the end of
each word resets the conversion state (Yedidyah Bar-David).
* When the ORGANIZATION variable has an empty value, do not generate an
"Organization:" header field. Previously, this condition resulted in
mailx refusing to send mail
- Fix my Reply-To patch found by milli
------------------------------------------------------------------
Sat Apr 9 21:30:46 UTC 2011 - crrodriguez@opensuse.org
- Allow mailx to compile properly when openSSL is built without
SSLv2 support.
-------------------------------------------------------------------
Tue Feb 1 10:39:15 UTC 2011 - gber@opensuse.org
- only recommend smtp_daemon, mailx has builtin SMTP support
-------------------------------------------------------------------
Fri Jun 11 13:36:58 UTC 2010 - coolo@novell.com
- fix parallel make
-------------------------------------------------------------------
Mon Apr 19 16:55:31 CEST 2010 - meissner@suse.de
- fixed build issue with openssl 1.0
-------------------------------------------------------------------
Thu Dec 17 20:55:45 CET 2009 - jengelh@medozas.de
- enable parallel building
-------------------------------------------------------------------
Tue Nov 3 19:09:30 UTC 2009 - coolo@novell.com
- updated patches to apply with fuzz=0
-------------------------------------------------------------------
Tue Apr 17 15:25:22 CEST 2007 - werner@suse.de
- Update to heirloom mailx 12.2
- Add UTF-8 detection (bug #262658)
- Do not convert text attachments to terminal charset but send
character set (bug #262658)
- Improve the support of text/ MIME types other than text/plain
(bug #262658)
-------------------------------------------------------------------
Wed Nov 15 13:32:38 CET 2006 - werner@suse.de
- Do not send the mail to a reply-to address (bug #218447)
-------------------------------------------------------------------
Wed Sep 27 12:26:39 CEST 2006 - werner@suse.de
- Avoid to feed empty strings into mime if empty results leads
to an error like it does for an empty ORGANIZATION variable
-------------------------------------------------------------------
Thu Jul 20 17:59:06 CEST 2006 - werner@suse.de
- Update to mailx version 12.1 the successor of nail
* Better handling of base64 encoding
* Support for SendmailX
- Add a workaround for Ctrl-H used in kernel messages (#189974)
- Do not convert 8bit encodings to ASCII but use quoted printable
-------------------------------------------------------------------
Wed Jan 25 21:30:30 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Fri Jan 20 15:07:31 CET 2006 - schwab@suse.de
- Don't strip binaries.
-------------------------------------------------------------------
Mon Oct 17 14:46:35 CEST 2005 - werner@suse.de
- Update to nail 11.25
* Port all out patches to this version
* Use dummy option for the reply-to patch because the double
colon feature of the glibc's getopt does not work
* New: ssl and krb5 support
-------------------------------------------------------------------
Mon Aug 30 16:18:54 CEST 2004 - werner@suse.de
- Update to bugfix release 11.4
-------------------------------------------------------------------
Thu Aug 19 12:27:56 CEST 2004 - werner@suse.de
- Make it option compatible with old mail program
- Update to 11.3
-------------------------------------------------------------------
Tue Aug 17 15:53:10 CEST 2004 - werner@suse.de
- Update to 11.2
-------------------------------------------------------------------
Fri Mar 26 11:41:03 CET 2004 - mmj@suse.de
- Add postfix to # neededforbuild
-------------------------------------------------------------------
Sat Jan 10 21:14:48 CET 2004 - adrian@suse.de
- add %defattr
-------------------------------------------------------------------
Mon Dec 8 17:14:56 CET 2003 - werner@suse.de
- Update to version 10.6
-------------------------------------------------------------------
Tue Nov 11 17:25:33 CET 2003 - werner@suse.de
- Fix handling of multiword e-mail addresses (bug #32115)
-------------------------------------------------------------------
Wed Jul 30 12:27:08 CEST 2003 - werner@suse.de
- Use charset of locale as default encoding if not set
-------------------------------------------------------------------
Wed Jul 2 18:20:18 CEST 2003 - ro@suse.de
- added symlink /usr/bin/mail (again)
-------------------------------------------------------------------
Wed Jul 2 17:26:42 CEST 2003 - werner@suse.de
- Update to nail 10.5
-------------------------------------------------------------------
Thu Feb 27 17:34:59 CET 2003 - werner@suse.de
- Fix replyto patch for Replay and replay case
-------------------------------------------------------------------
Mon Feb 3 12:19:22 CET 2003 - werner@suse.de
- Don't eat option id `+' isn't used anymore
- Accept comma seperated `to' list on command line
-------------------------------------------------------------------
Mon Jan 27 18:29:28 CET 2003 - sf@suse.de
- removed '+' from optarg string to be able to mix
argument order
-------------------------------------------------------------------
Thu Dec 19 16:18:23 CET 2002 - werner@suse.de
- Move from mail-8.1.1 to nail-10.3 due of getting RFC 2046
- Port the reply-to patch to nail-10.3 in extension to replyto
variable of nail configuration
-------------------------------------------------------------------
Thu Mar 7 13:21:53 CET 2002 - werner@suse.de
- Include, enhance and test the reply-to patch from poc@pocnet.net.
Useful for system notify mails behind firewalls or from header
rewrite because those mails arn't uniq without reply address.
-------------------------------------------------------------------
Sat May 12 17:39:06 CEST 2001 - schwab@suse.de
- Fix missing declarations.
-------------------------------------------------------------------
Wed Nov 22 12:53:09 CET 2000 - werner@suse.de
- Allow `/' within valid mail addresses
- Strip leading + of file name on command line
-------------------------------------------------------------------
Fri Oct 6 18:12:25 CEST 2000 - kukuk@suse.de
- change group tag
-------------------------------------------------------------------
Wed May 24 19:06:57 MEST 2000 - uli@suse.de
- moved docs to /usr/share
-------------------------------------------------------------------
Sat Feb 26 23:30:02 CET 2000 - kukuk@suse.de
- Move /usr/man -> /usr/share/man
-------------------------------------------------------------------
Mon Sep 20 18:15:01 CEST 1999 - ro@suse.de
- added requires smtp_daemon
-------------------------------------------------------------------
Mon Sep 13 17:23:57 CEST 1999 - bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
----------------------------------------------------------------------------
Mon Mar 22 22:05:33 MET 1999 - werner@suse.de
- Add pine format for date
----------------------------------------------------------------------------
Mon Mar 22 12:47:29 MET 1999 - werner@suse.de
- Add a security fix
- Correct a old security fix to make it work
----------------------------------------------------------------------------
Thu Jun 25 16:23:11 MEST 1998 - werner@suse.de
- No gid mail and not sgid mail: we do not use them
----------------------------------------------------------------------------
Thu Jun 25 15:34:17 MET DST 1998 - werner@suse.de
- Even if we are safe by dropping edid we want no buffer overflow
- Use IOSAFE implementation for glibc instead of fpurge
----------------------------------------------------------------------------
Wed Jun 24 22:23:26 MEST 1998 - werner@suse.de
- Move from old debian version 8.5.5 (5.5-kw) to OpenBSD 8.1 release
plus some changes from debian, redhat, and some own.
----------------------------------------------------------------------------
Wed Feb 5 19:19:30 MET 1997 - werner@suse.de
- Using mailx-5.5-kw/8.5.5-debian for mail
- Some changes to get emacs date mark on work in mail folders
- Some clean up in code

248
mailx.spec Normal file
View File

@ -0,0 +1,248 @@
#
# spec file for package mailx
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
Name: mailx
BuildRequires: groff
BuildRequires: krb5-devel
BuildRequires: man
BuildRequires: pcre
BuildRequires: pkg-config
BuildRequires: postfix
BuildRequires: update-alternatives
BuildRequires: pkgconfig(openssl)
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun):update-alternatives
%endif
URL: http://heirloom.sourceforge.net/mailx.html
Provides: mail
Recommends: smtp_daemon
Version: 12.5
Release: 0
Summary: A MIME-Capable Implementation of the mailx Command
License: BSD-4-Clause AND MPL-1.1
Group: Productivity/Networking/Email/Utilities
Source: mailx-%{version}.tar.bz2
Patch0: mailx-%{version}.dif
Patch1: nail-11.25-path.dif
Patch2: mailx-%{version}-replyto.patch
Patch3: nail-11.25-ttychar.dif
Patch4: nail-11.25-toaddr.dif
Patch5: mailx-%{version}-mime.dif
Patch6: mailx-fix-openssl.patch
#PATCH-FIX-OPENSUSE: Try to tranquilize gcc warning about parentheses (please check!)
Patch7: mailx-12.5-parentheses.dif
#PATCH-FIX-SUSE: Fix IPv6 address handling
Patch8: mailx-12.5-ipv6.dif
#PATCH-FIX-SUSE: bsc#909208 -- CVE-2004-2771, CVE-2014-7844: mailx: shell command injection via crafted email addresses
Patch9: 0001-outof-Introduce-expandaddr-flag.patch
#PATCH-FIX-SUSE: bsc#909208 -- CVE-2004-2771, CVE-2014-7844: mailx: shell command injection via crafted email addresses
Patch10: 0002-unpack-Disable-option-processing-for-email-addresses.patch
#PATCH-FIX-SUSE: bsc#909208 -- CVE-2004-2771, CVE-2014-7844: mailx: shell command injection via crafted email addresses
Patch11: 0003-fio.c-Unconditionally-require-wordexp-support.patch
#PATCH-FIX-SUSE: bsc#909208 -- CVE-2004-2771, CVE-2014-7844: mailx: shell command injection via crafted email addresses
Patch12: 0004-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch
#PATCH-FIX-SUSE: bsc#1042663 -- mailx fails to build with openssl-1.1
Patch13: mailx-12.5-openssl-1.1.0f.patch
#PATCH-FIX-SUSE: bsc#1180355 -- mailx calls sendmail with wrong name
Patch14: fix-sendmail-name.patch
#PATCH-FIX-SUSE: bsc#1192916 - mailx does not send mails unless run via strace or in verbose mode
Patch15: mailx-12.5-systemd.patch
#Moving /etc/mailrc to /usr/etc/mail.rc
Patch16: mailx-usr-etc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Nail is a mail user agent derived from Berkeley Mail 8.1. It is
intended to provide the functionality of the POSIX.2 mailx command with
additional support for MIME messages, POP3, and SMTP. In recent system
environments, nail is Unicode/UTF-8 capable. Further, it contains some
minor enhancements like the ability to set a "From:" address.
%prep
%setup -q -n mailx-%{version}
%patch1 -p0 -b .path
%patch2 -p0 -b .rplyto
%patch3 -p0 -b .ttychr
%patch4 -p0 -b .toaddr
%patch5 -p0 -b .mime
%patch6 -p0 -b .ssl
%patch7 -p0 -b .par
%patch8 -p0 -b .ipv6
%patch9 -p1 -b .0001
%patch10 -p1 -b .0002
%patch11 -p1 -b .0003
%patch12 -p1 -b .0004
%patch13 -p0 -b .ssl11f
%patch14 -p1 -b .sendmail
%patch15 -p0 -b .systemd
%patch0 -p1 -b .0
%patch16 -p1 -b .usretc
%build
CC=gcc
CFLAGS="%{optflags} -pipe -D_GNU_SOURCE -DOPENSSL_NO_SSL_INTERN $(pkg-config --cflags openssl)"
export CC CFLAGS
$SHELL ./makeconfig
%if 0%{?suse_version} > 1500
make %{?_smp_mflags} PREFIX=/usr CC="$CC" CFLAGS="$CFLAGS" DISTCONF="-DDISTCONFMAILRC=\"\\\"/usr/etc/mail.rc\\\"\""
%else
make %{?_smp_mflags} PREFIX=/usr CC="$CC" CFLAGS="$CFLAGS"
%endif
tbl < mailx.1 | groff -mandocdb -Tps | grep -v %%%%CreationDate > manual.ps
gzip -9fn manual.ps
%install
%make_install PREFIX=/usr
rm -rf %{buildroot}/bin
mkdir %{buildroot}/bin
%if ! %{with libalternatives}
# create symlinks for update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
%if 0%{?suse_version} < 1550
ln -sf %{_sysconfdir}/alternatives/binmail %{buildroot}/bin/mail
%endif
ln -sf %{_sysconfdir}/alternatives/Mail %{buildroot}/usr/bin/Mail
ln -sf %{_sysconfdir}/alternatives/mail %{buildroot}/usr/bin/mail
ln -sf %{_sysconfdir}/alternatives/Mail.1%{?ext_man} %{buildroot}%{_mandir}/man1/Mail.1%{?ext_man}
ln -sf %{_sysconfdir}/alternatives/mail.1%{?ext_man} %{buildroot}%{_mandir}/man1/mail.1%{?ext_man}
#
%if 0%{?suse_version} < 1550
ln -sf %{_bindir}/mailx %{buildroot}%{_sysconfdir}/alternatives/binmail
%endif
ln -sf %{_bindir}/mailx %{buildroot}%{_sysconfdir}/alternatives/Mail
ln -sf %{_bindir}/mailx %{buildroot}%{_sysconfdir}/alternatives/mail
ln -sf %{_mandir}/man1/mailx.1%{?ext_man} %{buildroot}%{_sysconfdir}/alternatives/Mail.1%{?ext_man}
ln -sf %{_mandir}/man1/mailx.1%{?ext_man} %{buildroot}%{_sysconfdir}/alternatives/mail.1%{?ext_man}
%else
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/Mail
%if 0%{?suse_version} < 1550
ln -sf %{_bindir}/alts %{buildroot}/bin/Mail
%endif
mkdir -p %{buildroot}%{_datadir}/libalternatives/Mail
cat > %{buildroot}%{_datadir}/libalternatives/Mail/20.conf <<EOF
binary=%{_bindir}/mailx
man=mailx.1
group=mail, Mail
EOF
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mail
%if 0%{?suse_version} < 1550
ln -sf %{_bindir}/alts %{buildroot}/bin/mail
%endif
mkdir -p %{buildroot}%{_datadir}/libalternatives/mail
cat > %{buildroot}%{_datadir}/libalternatives/mail/20.conf <<EOF
binary=%{_bindir}/mailx
man=mailx.1
group=mail, Mail
EOF
%endif
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_distconfdir}
install -m 0644 mail.rc %{buildroot}%{_distconfdir}
rm %{buildroot}/etc/mail.rc
%else
install -m 0644 mail.rc %{buildroot}/etc
%endif
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
%if ! %{with libalternatives}
%post
%{_sbindir}/update-alternatives --quiet --force \
--install %{_bindir}/mail mail %{_bindir}/mailx 20 \
%if 0%{?suse_version} < 1550
--slave /bin/mail binmail %{_bindir}/mailx \
%endif
--slave %{_bindir}/Mail Mail %{_bindir}/mailx \
--slave %{_mandir}/man1/mail.1%{?ext_man} mail.1%{?ext_man} %{_mandir}/man1/mailx.1%{?ext_man} \
--slave %{_mandir}/man1/Mail.1%{?ext_man} Mail.1%{?ext_man} %{_mandir}/man1/mailx.1%{?ext_man}
%postun
if test ! -e %{_bindir}/mailx; then
%{_sbindir}/update-alternatives --quiet --force --remove mail %{_bindir}/mailx
fi
%endif
%pre
echo "Calling pre installation script"
%if %{with libalternatives}
# removing old update-alternatives entries
if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then
%{_sbindir}/update-alternatives --quiet --force --remove mail %{_bindir}/mailx
fi
%endif
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in mail.rc; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
%if 0%{?suse_version} > 1500
%posttrans
# Migration to /usr/etc, restore just created .rpmsave
for i in mail.rc; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
%files
%defattr(-,root,root)
%license COPYING
%doc README manual.ps.gz nail.rc
%if 0%{?suse_version} > 1500
%{_distconfdir}/mail.rc
%else
%config /etc/mail.rc
%endif
%if 0%{?suse_version} < 1550
/bin/mail
%endif
/usr/bin/Mail
/usr/bin/mail
%if ! 0%{with libalternatives}
%if 0%{?suse_version} < 1550
%ghost %config %{_sysconfdir}/alternatives/binmail
%endif
%ghost %config %{_sysconfdir}/alternatives/Mail
%ghost %config %{_sysconfdir}/alternatives/mail
%ghost %config %{_sysconfdir}/alternatives/Mail.1%{?ext_man}
%ghost %config %{_sysconfdir}/alternatives/mail.1%{?ext_man}
%doc %{_mandir}/man1/Mail.1.gz
%doc %{_mandir}/man1/mail.1.gz
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/mail
%dir %{_datadir}/libalternatives/Mail
%{_datadir}/libalternatives/Mail/20.conf
%{_datadir}/libalternatives/mail/20.conf
%endif
/usr/bin/mailx
%doc %{_mandir}/man1/mailx.1.gz
%changelog

264
nail-11.25-path.dif Normal file
View File

@ -0,0 +1,264 @@
--- Makefile
+++ Makefile 2005-10-14 13:44:09.000000000 +0000
@@ -11,13 +11,9 @@ BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
SYSCONFDIR = /etc
-MAILRC = $(SYSCONFDIR)/nail.rc
-MAILSPOOL = /var/mail
-SENDMAIL = /usr/lib/sendmail
-
DESTDIR =
-UCBINSTALL = /usr/ucb/install
+UCBINSTALL = install
# Define compiler, preprocessor, and linker flags here.
# Note that some Linux/glibc versions need -D_GNU_SOURCE in CPPFLAGS, or
@@ -50,7 +46,7 @@ SHELL = /bin/sh
# If you know that the IPv6 functions work on your machine, you can enable
# them here.
-#IPv6 = -DHAVE_IPv6_FUNCS
+##IPv6 = -DHAVE_IPv6_FUNCS
#
# Binaries are stripped with this command after installation.
@@ -63,8 +59,7 @@ STRIP = strip
###########################################################################
###########################################################################
-FEATURES = -DMAILRC='"$(MAILRC)"' -DMAILSPOOL='"$(MAILSPOOL)"' \
- -DSENDMAIL='"$(SENDMAIL)"' $(IPv6)
+FEATURES = $(IPv6)
OBJ = aux.o base64.o cache.o cmd1.o cmd2.o cmd3.o cmdtab.o collect.o \
dotlock.o edit.o fio.o getname.o getopt.o head.o hmac.o \
--- cmd1.c
+++ cmd1.c 2005-10-14 13:44:09.000000000 +0000
@@ -78,7 +78,7 @@ get_pager(void)
cp = value("PAGER");
if (cp == NULL || *cp == '\0')
- cp = value("bsdcompat") ? "more" : "pg";
+ cp = value("bsdcompat") ? PATH_MORE : PATH_PG;
return cp;
}
@@ -757,7 +757,7 @@ type1(int *msgvec, int doign, int page,
if (pipe) {
cp = value("SHELL");
if (cp == NULL)
- cp = SHELL;
+ cp = PATH_CSHELL;
obuf = Popen(cmd, "w", cp, 1);
if (obuf == NULL) {
perror(cmd);
--- cmd3.c
+++ cmd3.c 2005-10-14 13:44:09.000000000 +0000
@@ -90,7 +90,7 @@ shell(void *v)
if (bangexp(&cmd, &cmdsize) < 0)
return 1;
if ((shell = value("SHELL")) == NULL)
- shell = SHELL;
+ shell = PATH_CSHELL;
run_command(shell, 0, -1, -1, "-c", cmd, NULL);
safe_signal(SIGINT, sigint);
printf("!\n");
@@ -109,7 +109,7 @@ dosh(void *v)
char *shell;
if ((shell = value("SHELL")) == NULL)
- shell = SHELL;
+ shell = PATH_CSHELL;
run_command(shell, 0, -1, -1, NULL, NULL, NULL);
safe_signal(SIGINT, sigint);
putchar('\n');
--- collect.c
+++ collect.c 2005-10-14 13:44:09.000000000 +0000
@@ -121,7 +121,7 @@ insertcommand(FILE *fp, char *cmd)
if (sigsetjmp(pipejmp, 1))
goto endpipe;
if (cp == NULL)
- cp = SHELL;
+ cp = PATH_CSHELL;
if ((obuf = Popen(cmd, "r", cp, 0)) == NULL) {
perror(cmd);
return;
@@ -1051,7 +1051,7 @@ mespipe(char *cmd)
* stdout = new message.
*/
if ((shell = value("SHELL")) == NULL)
- shell = SHELL;
+ shell = PATH_CSHELL;
if (run_command(shell,
0, fileno(collf), fileno(nf), "-c", cmd, NULL) < 0) {
Fclose(nf);
--- def.h
+++ def.h 2005-10-14 13:45:56.000000000 +0000
@@ -642,3 +642,68 @@ enum ssl_vrfy_level {
VRFY_STRICT
};
#endif /* USE_SSL */
+
+#include <paths.h>
+#ifndef PATH_MORE
+# ifdef _PATH_MORE
+# define PATH_MORE _PATH_MORE
+# else
+# define PATH_MORE "/usr/bin/more"
+# endif
+#endif
+#ifndef PATH_PG
+# ifdef _PATH_PG
+# define PATH_PG _PATH_PG
+# else
+# define PATH_PG "/usr/bin/less"
+# endif
+#endif
+#ifndef PATH_CSHELL
+# ifdef _PATH_CSHELL
+# define PATH_CSHELL _PATH_CSHELL
+# else
+# define PATH_CSHELL "/usr/bin/tcsh"
+# endif
+#endif
+#ifndef PATH_MAILDIR
+# ifdef _PATH_MAILDIR
+# define PATH_MAILDIR _PATH_MAILDIR
+# else
+# define PATH_MAILDIR "/var/mail"
+# endif
+#endif
+#ifndef PATH_EX
+# ifdef _PATH_EX
+# define PATH_EX _PATH_EX
+# else
+# define PATH_EX "/usr/bin/ex"
+# endif
+#endif
+#ifndef PATH_VI
+# ifdef _PATH_VI
+# define PATH_VI _PATH_VI
+# else
+# define PATH_VI "/usr/bin/vi"
+# endif
+#endif
+#ifndef PATH_MASTER_RC
+# ifdef _PATH_MASTER_RC
+# define PATH_MASTER_RC _PATH_MASTER_RC
+# else
+# define PATH_MASTER_RC "/etc/mail.rc"
+# endif
+#endif
+#ifndef PATH_SENDMAIL
+# ifdef _PATH_SENDMAIL
+# define PATH_SENDMAIL _PATH_SENDMAIL
+# else
+# define PATH_SENDMAIL "/usr/sbin/sendmail"
+# endif
+#endif
+#ifndef PATH_TMP
+# ifdef _PATH_TMP
+# define PATH_TMP _PATH_TMP
+# else
+# define PATH_TMP "/tmp"
+# endif
+#endif
--- dotlock.c
+++ dotlock.c 2005-10-14 13:44:09.000000000 +0000
@@ -82,7 +82,7 @@ maildir_access(const char *fname)
static int
perhaps_setgid(const char *name, gid_t gid)
{
- char safepath[]= MAILSPOOL;
+ char safepath[]= PATH_MAILDIR;
if (strncmp(name, safepath, sizeof (safepath)-1) ||
strchr(name + sizeof (safepath), '/'))
--- edit.c
+++ edit.c 2005-10-14 13:47:03.000000000 +0000
@@ -153,7 +153,7 @@ edit1(int *msgvec, int type)
* Run an editor on the file at "fpp" of "size" bytes,
* and return a new file pointer.
* Signals must be handled by the caller.
- * "Type" is 'e' for ed, 'v' for vi.
+ * "Type" is 'e' for PATH_EX, 'v' for PATH_VI.
*/
FILE *
run_editor(FILE *fp, off_t size, int type, int readonly,
@@ -212,7 +212,7 @@ run_editor(FILE *fp, off_t size, int typ
}
nf = NULL;
if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL)
- edit = type == 'e' ? "ed" : "vi";
+ edit = type == 'e' ? PATH_EX : PATH_VI;
sigemptyset(&set);
if (run_command(edit, oldint != SIG_IGN ? &set : NULL, -1, -1,
tempEdit, NULL, NULL) < 0) {
--- main.c
+++ main.c 2005-10-14 13:44:09.000000000 +0000
@@ -403,7 +403,7 @@ usage:
rcvmode = !to && !tflag;
spreserve();
if (!nosrc)
- load(MAILRC);
+ load(PATH_MASTER_RC);
/*
* Expand returns a savestr, but load only uses the file name
* for fopen, so it's safe to do this.
--- names.c
+++ names.c 2005-10-14 13:44:09.000000000 +0000
@@ -343,7 +343,7 @@ outof(struct name *names, FILE *fo, stru
* on one another.
*/
if ((shell = value("SHELL")) == NULL)
- shell = SHELL;
+ shell = PATH_CSHELL;
sigemptyset(&nset);
sigaddset(&nset, SIGHUP);
sigaddset(&nset, SIGINT);
--- send.c
+++ send.c 2005-10-14 13:44:09.000000000 +0000
@@ -1088,7 +1088,7 @@ getpipefile(char *pipecmd, FILE **qbuf,
Ftfree(&tempPipe);
}
if ((shell = value("SHELL")) == NULL)
- shell = SHELL;
+ shell = PATH_CSHELL;
if ((rbuf = Popen(pipecmd, "W", shell, fileno(*qbuf)))
== NULL) {
perror(pipecmd);
--- sendout.c
+++ sendout.c 2005-10-14 13:44:09.000000000 +0000
@@ -884,7 +884,7 @@ start_mta(struct name *to, struct name *
if ((cp = value("sendmail")) != NULL)
cp = expand(cp);
else
- cp = SENDMAIL;
+ cp = PATH_SENDMAIL;
execv(cp, args);
perror(cp);
}
--- temp.c
+++ temp.c 2005-10-14 13:44:09.000000000 +0000
@@ -121,7 +121,7 @@ tinit(void)
tmpdir = smalloc(strlen(cp) + 1);
strcpy(tmpdir, cp);
} else {
- tmpdir = "/tmp";
+ tmpdir = PATH_TMP;
}
if (myname != NULL) {
if (getuserid(myname) < 0) {
--- v7.local.c
+++ v7.local.c 2005-10-14 13:44:09.000000000 +0000
@@ -70,7 +70,7 @@ findmail(char *user, int force, char *bu
which_protocol(cp) == PROTO_IMAP) {
snprintf(buf, size, "%s/INBOX", protbase(cp));
} else if (force || (mbox = value("MAIL")) == NULL) {
- snprintf(buf, size, "%s/%s", MAILSPOOL, user);
+ snprintf(buf, size, "%s/%s", PATH_MAILDIR, user);
} else {
strncpy(buf, mbox, size);
buf[size-1]='\0';

50
nail-11.25-toaddr.dif Normal file
View File

@ -0,0 +1,50 @@
--- main.c
+++ main.c 2011-05-13 09:28:48.052426589 +0000
@@ -186,6 +186,25 @@ main(int argc, char *argv[])
subject = NULL;
replyto = NULL;
+ if (*argv) {
+ /*
+ * Be compatible with broken mail behaviour, which use direct
+ * sendmail options for sending mails if getopt is skiped
+ * by first argument which is non option like a mail address.
+ */
+ char **opt = argv;
+ while (*(++opt) && (**opt) && (**opt != '-')) {
+ char *cp;
+ while ((cp = strrchr(*opt, ','))) {
+ *cp++ = '\0';
+ if (cp && *cp)
+ to = checkaddrs(cat(to, nalloc(cp, GTO)));
+ }
+ to = checkaddrs(cat(to, nalloc(*opt, GTO)));
+ argc--, argv++;
+ }
+ }
+
while ((i = getopt(argc, argv, optstr)) != EOF) {
switch (i) {
case 'V':
@@ -380,8 +399,19 @@ usage:
ef = argv[optind];
}
} else {
- for (i = optind; argv[i]; i++)
- to = checkaddrs(cat(to, extract(argv[i], GTO|GFULL)));
+ for (i = optind; (argv[i]) && (*argv[i] != '-'); i++) {
+ char *cp;
+ while ((cp = strrchr(argv[i], ','))) {
+ *cp++ = '\0';
+ if (cp && *cp)
+ to = checkaddrs(cat(to, nalloc(cp, GTO|GFULL)));
+ }
+ to = checkaddrs(cat(to, nalloc(argv[i], GTO|GFULL)));
+ }
+ if (argv[i] && (strcmp(argv[i], "--") == 0))
+ i++;
+ for (; argv[i]; i++)
+ smopts = cat(smopts, nalloc(argv[i], 0));
}
/*
* Check for inconsistent arguments.

23
nail-11.25-ttychar.dif Normal file
View File

@ -0,0 +1,23 @@
--- mime.c
+++ mime.c 2005-10-14 14:28:39.000000000 +0000
@@ -261,7 +261,19 @@ getcharset(int isclean)
charset = (wantcharset && wantcharset != (char *)-1) ?
wantcharset : value("charset");
if (charset == NULL) {
- charset = defcharset;
+ char *t = value("ttycharset");
+ if (t == NULL || (ascncasecmp("ANSI_X3.4", t, 9) == 0))
+ charset = defcharset;
+ else {
+ int c;
+ char *ptr;
+
+ ptr = charset = sstrdup(t);
+ while ((c = *ptr)) {
+ *ptr = lowerconv(c & 0377);
+ ptr++;
+ }
+ }
}
} else {
/*