Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

21 changed files with 1 additions and 1283 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
SOURCES/mailx-12.5.tar.xz

View File

@ -1 +0,0 @@
4a32285906e04e06a2c7665f04bd6510fc278462 SOURCES/mailx-12.5.tar.xz

View File

@ -1,34 +0,0 @@
#!/bin/sh
#
# Mailx's upstream provides only the CVS method of downloading source code.
# This script can be used for downloading the CVS repository and creating
# the tarball.
#
# Usage: ./get-upstream-tarball.sh
#
# This code is in the public domain; do with it what you wish.
#
# Copyright (C) 2012 Peter Schiffer <pschiffe@redhat.com>
#
newdir=new-upstream-tarball
mkdir $newdir
cd $newdir
# checkout cvs
echo "== Just press Enter =="
cvs -d:pserver:anonymous@nail.cvs.sourceforge.net:/cvsroot/nail login
cvs -d:pserver:anonymous@nail.cvs.sourceforge.net:/cvsroot/nail co nail
# remove CVS folders
rm -rf nail/CVS nail/catd/CVS
# find version in nail/version.c file defined as: #define V "xxx"
ver=$(sed -rn 's/#define\s+V\s+\"([0-9.]+)\"/\1/p' nail/version.c)
mv nail mailx-$ver
tar cJf mailx-$ver.tar.xz mailx-$ver
rm -rf mailx-$ver

View File

@ -1,12 +0,0 @@
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;
}

View File

@ -1,13 +0,0 @@
--- 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) {

View File

@ -1,227 +0,0 @@
diff --git a/aux.c b/aux.c
index e51a19a..2733787 100644
--- a/aux.c
+++ b/aux.c
@@ -904,7 +904,7 @@ getrandstring(size_t length)
data[i] = (int)(255 * (rand() / (RAND_MAX + 1.0))) ^
nodedigest[i % sizeof nodedigest];
}
- if (fd > 0)
+ if (fd >= 0)
close(fd);
cp = memtob64(data, length);
rp = salloc(length+1);
diff --git a/cache.c b/cache.c
index 9cf7587..a71b019 100644
--- a/cache.c
+++ b/cache.c
@@ -588,6 +588,7 @@ cache_setptr(int transparent)
message[i].m_uid = contents[i];
getcache1(&mb, &message[i], NEED_UNSPEC, 3);
}
+ free(contents);
ok = OKAY;
if (ok == OKAY) {
mb.mb_type = MB_CACHE;
diff --git a/cmd3.c b/cmd3.c
index cb19e2b..2a5ea68 100644
--- a/cmd3.c
+++ b/cmd3.c
@@ -835,7 +835,7 @@ cfile(void *v)
newfileinfo();
return 0;
}
- strncpy(mboxname, expand("&"), sizeof mboxname)[sizeof mboxname-1]='\0';
+ strncpy(mboxname, expand("&"), sizeof mboxname-1)[sizeof mboxname-1]='\0';
return file1(*argv);
}
@@ -1344,7 +1344,7 @@ account(void *v)
a->ac_name = NULL;
return define1(args[0], 1);
}
- strncpy(mboxname, expand("&"), sizeof mboxname)[sizeof mboxname-1]='\0';
+ strncpy(mboxname, expand("&"), sizeof mboxname-1)[sizeof mboxname-1]='\0';
oqf = savequitflags();
if ((a = get_oldaccount(args[0])) == NULL) {
if (args[1]) {
diff --git a/collect.c b/collect.c
index 953ae07..949fd32 100644
--- a/collect.c
+++ b/collect.c
@@ -902,6 +902,11 @@ cont:
}
goto out;
err:
+ if (linebuf != NULL) {
+ free(linebuf);
+ linebuf = NULL;
+ }
+
if (collf != NULL) {
Fclose(collf);
collf = NULL;
@@ -909,6 +914,9 @@ err:
exit(1);
}
out:
+ if (linebuf != NULL)
+ free(linebuf);
+
if (collf != NULL) {
if ((cp = value("MAILX_TAIL")) != NULL) {
if (is_a_tty[0])
diff --git a/imap.c b/imap.c
index 66e0a6b..28b5e22 100644
--- a/imap.c
+++ b/imap.c
@@ -1181,8 +1181,10 @@ imap_setfile1(const char *xserver, int newmail, int isedit, int transparent)
if (!same_imap_account) {
if (!disconnected(account) &&
sopen(sp, &so, use_ssl, uhp,
- use_ssl ? "imaps" : "imap", verbose) != OKAY)
- return -1;
+ use_ssl ? "imaps" : "imap", verbose) != OKAY) {
+ free(account);
+ return -1;
+ }
} else
so = mb.mb_sock;
if (!transparent)
diff --git a/macro.c b/macro.c
index 741343b..6aba6aa 100644
--- a/macro.c
+++ b/macro.c
@@ -128,6 +128,7 @@ define1(const char *name, int account)
mp->ma_name);
if (sourcing)
unstack();
+ freelines(lst);
free(mp->ma_name);
free(mp);
return 1;
diff --git a/main.c b/main.c
index 573ec9c..f7612a5 100644
--- a/main.c
+++ b/main.c
@@ -462,7 +462,7 @@ usage:
*/
if ((cp = value("folder")) != NULL &&
which_protocol(cp) == PROTO_IMAP)
- strncpy(mailname, cp, PATHSIZE)[PATHSIZE-1] = '\0';
+ strncpy(mailname, cp, PATHSIZE-1)[PATHSIZE-1] = '\0';
}
i = setfile(ef, 0);
if (i < 0)
@@ -500,7 +500,7 @@ usage:
safe_signal(SIGINT, SIG_IGN);
safe_signal(SIGQUIT, SIG_IGN);
}
- strncpy(mboxname, expand("&"), sizeof mboxname)[sizeof mboxname-1]='\0';
+ strncpy(mboxname, expand("&"), sizeof mboxname-1)[sizeof mboxname-1]='\0';
quit();
return exit_status;
}
diff --git a/popen.c b/popen.c
index 348fd1e..9520b41 100644
--- a/popen.c
+++ b/popen.c
@@ -246,9 +246,11 @@ Zopen(const char *file, const char *mode, int *compression)
open: if ((output = Ftemp(&tempfn, "Rz", "w+", 0600, 0)) == NULL) {
perror(catgets(catd, CATSET, 167, "tmpfile"));
close(input);
+ Ftfree(&tempfn);
return NULL;
}
unlink(tempfn);
+ Ftfree(&tempfn);
if (input >= 0 || (*compression&FP_MASK) == FP_IMAP ||
(*compression&FP_MASK) == FP_MAILDIR) {
if (decompress(*compression, input, fileno(output)) < 0) {
diff --git a/quit.c b/quit.c
index f70aec2..1827516 100644
--- a/quit.c
+++ b/quit.c
@@ -141,7 +141,7 @@ quit(void)
FILE *fbuf, *rbuf, *readstat = NULL, *abuf;
struct message *mp;
int c;
- char *tempResid;
+ char *tempResid = NULL;
struct stat minfo;
/*
@@ -313,6 +313,8 @@ cream:
newmail:
printf(catgets(catd, CATSET, 166, "Thou hast new mail.\n"));
+ if (tempResid != NULL)
+ Ftfree(&tempResid);
if (fbuf != NULL) {
Fclose(fbuf);
dot_unlock(mailname);
diff --git a/send.c b/send.c
index ea3d5b7..40e6bda 100644
--- a/send.c
+++ b/send.c
@@ -568,6 +568,7 @@ skip: switch (ip->m_mimecontent) {
Pclose(obuf);
safe_signal(SIGPIPE, oldpipe);
}
+ obuf = origobuf;
}
}
return rt;
diff --git a/sendout.c b/sendout.c
index f83952a..e734ee2 100644
--- a/sendout.c
+++ b/sendout.c
@@ -463,6 +463,7 @@ infix(struct header *hp, FILE *fi, int dosign)
if ((nfi = Fopen(tempMail, "r")) == NULL) {
perror(tempMail);
Fclose(nfo);
+ Ftfree(&tempMail);
return(NULL);
}
rm(tempMail);
@@ -1511,6 +1512,7 @@ resend_msg(struct message *mp, struct name *to, int add_resent)
if ((nfi = Fopen(tempMail, "r")) == NULL) {
senderr++;
perror(tempMail);
+ Ftfree(&tempMail);
return STOP;
}
rm(tempMail);
diff --git a/smtp.c b/smtp.c
index baab5d1..ce6870e 100644
--- a/smtp.c
+++ b/smtp.c
@@ -334,6 +334,7 @@ talk_smtp(struct name *to, FILE *fi, struct sock *sp,
password);
b64 = memtob64(o, strlen(user)+strlen(password)+2);
snprintf(o, sizeof o, "%s\r\n", b64);
+ free(b64);
SMTP_OUT(o);
SMTP_ANSWER(2);
break;
diff --git a/ssl.c b/ssl.c
index 6a0b322..7fbe4a3 100644
--- a/ssl.c
+++ b/ssl.c
@@ -135,6 +135,8 @@ smime_split(FILE *ip, FILE **hp, FILE **bp, long xcount, int keep)
if ((*hp = Ftemp(&hn, "Rh", "w+", 0600, 1)) == NULL ||
(*bp = Ftemp(&bn, "Rb", "w+", 0600, 1)) == NULL) {
perror("tempfile");
+ if (hn)
+ Ftfree(&hn);
return STOP;
}
rm(hn);
@@ -178,6 +180,7 @@ smime_split(FILE *ip, FILE **hp, FILE **bp, long xcount, int keep)
fwrite(buf, sizeof *buf, buflen, *bp);
fflush(*bp);
rewind(*bp);
+ free(savedfields);
free(buf);
return OKAY;
}

View File

@ -1,45 +0,0 @@
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)

View File

@ -1,174 +0,0 @@
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);
}

View File

@ -1,108 +0,0 @@
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 (gritter) 9/16/09";
#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 */
}
/*
--
1.9.3

View File

@ -1,12 +0,0 @@
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;

View File

@ -1,25 +0,0 @@
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

View File

@ -1,12 +0,0 @@
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);
}

View File

@ -1,28 +0,0 @@
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 <DoNotReply>\(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;

View File

@ -1,25 +0,0 @@
From 5b7f57844682339340333034be1b8f99acafde28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
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

View File

@ -1,41 +0,0 @@
diff --git a/openssl.c b/openssl.c
index b4e33fc..9d1eaf4 100644
--- a/openssl.c
+++ b/openssl.c
@@ -136,6 +136,7 @@ ssl_rand_init(void)
int state = 0;
if ((cp = value("ssl-rand-egd")) != NULL) {
+#ifndef OPENSSL_NO_EGD
cp = expand(cp);
if (RAND_egd(cp) == -1) {
fprintf(stderr, catgets(catd, CATSET, 245,
@@ -143,6 +144,9 @@ ssl_rand_init(void)
cp);
} else
state = 1;
+#else
+ fprintf(stderr, "entropy daemon not available\n");
+#endif
} else if ((cp = value("ssl-rand-file")) != NULL) {
cp = expand(cp);
if (RAND_load_file(cp, 1024) == -1) {
@@ -216,9 +220,16 @@ ssl_select_method(const char *uhp)
cp = ssl_method_string(uhp);
if (cp != NULL) {
- if (equal(cp, "ssl2"))
+ if (equal(cp, "ssl2")) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000
method = SSLv2_client_method();
- else if (equal(cp, "ssl3"))
+#else
+ /* SSLv2 support was removed in OpenSSL 1.1.0 */
+ fprintf(stderr, catgets(catd, CATSET, 244,
+ "Unsupported SSL method \"%s\"\n"), cp);
+ method = SSLv23_client_method();
+#endif
+ } else if (equal(cp, "ssl3"))
method = SSLv3_client_method();
else if (equal(cp, "tls1"))
method = TLSv1_client_method();

View File

@ -1,64 +0,0 @@
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

@ -1,74 +0,0 @@
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

@ -1,12 +0,0 @@
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);
}
}

View File

@ -1,11 +0,0 @@
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
+

View File

@ -1,364 +0,0 @@
%global use_nss 0
%global mailrc %{_sysconfdir}/mail.rc
Summary: Enhanced implementation of the mailx command
Name: mailx
Version: 12.5
Release: 29%{?dist}
# MPLv1.1 .. nss.c, nsserr.c
License: BSD with advertising and MPLv1.1
Group: Applications/Internet
URL: http://heirloom.sourceforge.net/mailx.html
# Mailx's upstream provides only the CVS method of downloading source code.
# Use get-upstream-tarball.sh script to download current version of mailx.
Source0: mailx-%{version}.tar.xz
Source1: get-upstream-tarball.sh
Patch0: nail-11.25-config.patch
Patch1: mailx-12.3-pager.patch
Patch2: mailx-12.5-lzw.patch
# resolves: #805410
Patch3: mailx-12.5-fname-null.patch
# resolves: #857120
Patch4: mailx-12.5-collect.patch
# resolves: #948869
Patch5: mailx-12.5-usage.patch
# resolves: #1099275 and #979460
Patch6: mailx-12.5-man-page-fixes.patch
Patch7: mailx-12.5-outof-Introduce-expandaddr-flag.patch
Patch8: mailx-12.5-fio.c-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
# resolves: #1113617
Patch11: mailx-12.5-empty-from.patch
# resolves: #1296536
Patch12: mailx-12.5-nss-hostname-matching.patch
# resolves: #1494559
Patch13: mailx-12.5-encsplit.patch
# fix issues with openssl >= 1.1.0
Patch14: mailx-12.5-openssl.patch
# resolves: #1602614
Patch15: mailx-12.5-coverity.patch
BuildRequires: gcc
%if %{use_nss}
BuildRequires: nss-devel, pkgconfig, krb5-devel
%else
BuildRequires: openssl-devel
%endif
Obsoletes: nail < %{version}
Provides: nail = %{version}
%description
Mailx is an enhanced mail command, which provides the functionality
of the POSIX mailx command, as well as SysV mail and Berkeley Mail
(from which it is derived).
Additionally to the POSIX features, mailx can work with Maildir/ e-mail
storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
protocols (including over SSL) to operate with remote hosts, handles mime
types and different charsets. There are a lot of other useful features,
see mailx(1).
And as its ancient analogues, mailx can be used as a mail script language,
both for sending and receiving mail.
Besides the "mailx" command, this package provides "mail" and "Mail"
(which should be compatible with its predecessors from the mailx-8.x source),
as well as "nail" (the initial name of this project).
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
sed -i 's,/etc/nail.rc,%{mailrc},g' mailx.1
%build
%if %{use_nss}
INCLUDES="$INCLUDES `pkg-config --cflags-only-I nss`"
export INCLUDES
%endif
export LDFLAGS="%{build_ldflags}"
echo PREFIX=%{_prefix} \
BINDIR=/bin \
MANDIR=%{_mandir} \
SYSCONFDIR=%{_sysconfdir} \
MAILRC=%{mailrc} \
MAILSPOOL=%{_localstatedir}/mail \
SENDMAIL=%{_sbindir}/sendmail \
UCBINSTALL=install \
> makeflags
# %{?_smp_mflags} cannot be used here
make `cat makeflags` \
CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" \
IPv6=-DHAVE_IPv6_FUNCS
%install
make DESTDIR=$RPM_BUILD_ROOT STRIP=: `cat makeflags` install
ln -s mailx $RPM_BUILD_ROOT/bin/mail
install -d $RPM_BUILD_ROOT%{_bindir}
pref=`echo %{_bindir} | sed 's,/[^/]*,../,g'`
pushd $RPM_BUILD_ROOT%{_bindir}
ln -s ${pref}bin/mailx Mail
ln -s ${pref}bin/mailx nail
popd
pushd $RPM_BUILD_ROOT%{_mandir}/man1
ln -s mailx.1 mail.1
ln -s mailx.1 Mail.1
ln -s mailx.1 nail.1
popd
%triggerpostun -- mailx < 12
[[ -f %{mailrc}.rpmnew ]] && {
# old config was changed. Merge both together.
( echo '# The settings above was inherited from the old mailx-8.x config'
echo
cat %{mailrc}.rpmnew
) >>%{mailrc}
} || :
%triggerpostun -- nail <= 12.3
[[ -f %{_sysconfdir}/nail.rc.rpmsave ]] && {
# old config was changed...
save=%{mailrc}.rpmnew
[[ -f $save ]] && save=%{mailrc}.rpmsave
mv -f %{mailrc} $save
mv -f %{_sysconfdir}/nail.rc.rpmsave %{mailrc}
} || :
%files
%doc COPYING AUTHORS README
%config(noreplace) %{mailrc}
/bin/*
%{_bindir}/*
%{_mandir}/*/*
%changelog
* Thu Oct 18 2018 Nikola Forró <nforro@redhat.com> - 12.5-29
- fix important Covscan defects
resolves: #1602614
* Wed Apr 18 2018 Nikola Forró <nforro@redhat.com> - 12.5-28
- switch to OpenSSL
* Tue Feb 20 2018 Nikola Forró <nforro@redhat.com> - 12.5-27
- add missing gcc build dependency
* Fri Feb 9 2018 Florian Weimer <fweimer@redhat.com> - 12.5-26
- Use LDFLAGS from redhat-rpm-config
* Wed Feb 07 2018 Nikola Forró <nforro@redhat.com> - 12.5-25
- fix also quoted-printable encoded words
related: #1494559, #1515591
* Wed Nov 22 2017 Nikola Forró <nforro@redhat.com> - 12.5-24
- add missing linear whitespace to encsplit patch
resolves: #1515591
* Fri Sep 22 2017 Nikola Forró <nforro@redhat.com> - 12.5-23
- fix multi-byte encoded line-folding
resolves: #1494559
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 12.5-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 12.5-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 12.5-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 12.5-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Jan 07 2016 Nikola Forró <nforro@redhat.com> - 12.5-18
- fix nss hostname matching
resolves: #1296536
* Thu Jul 16 2015 Nikola Forró <nforro@redhat.com> - 12.5-17
- fix SIGSEGV crash in smtp_auth_var()
- add warning message for empty from
resolves: #1113617
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 12.5-15
- Rebuilt for Fedora 23 Change
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
* Wed Dec 17 2014 jchaloup <jchaloup@redhat.com> - 12.5-14
- Security fix for CVE-2004-2771, CVE-2014-7844
resolves: #1174903
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Jun 13 2014 Peter Schiffer <pschiffe@redhat.com> - 12.5-12
- added 2 clarifications to the mailx(1) man page
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jul 22 2013 Peter Schiffer <pschiffe@redhat.com> - 12.5-9
- related: #912785
used -D_FILE_OFFSET_BITS=64 flag at the compile time
- return error code when TMPDIR is set to an invalid path while sending email
- added missing -v option to the usage message
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Mon Nov 5 2012 Peter Schiffer <pschiffe@redhat.com> - 12.5-7
- cleaned .spec file
- resolves: #805410
fixed SIGSEGV crash in which_protocol() function
- updated get-upstream-tarball.sh script and added it as additional source
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Aug 17 2011 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.5-4
- Fix decompress lzw issues (#731342)
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Thu Jan 27 2011 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.5-2
- rebuild for new krb5-libs
* Tue Oct 26 2010 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.5-1
- update to 12.5
- drop patches applied upstream
* Fri Oct 1 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 12.4-7
- fix the typo in man-page
* Mon Dec 21 2009 Ivana Hutarova Varekova <varekova@redhat.com> - 12.4-6
- fix source tag
* Fri Dec 18 2009 Ivana Hutarova Varekova <varekova@redhat.com> - 12.4-5
- fix license tag
* Sat Dec 12 2009 Robert Scheck <robert@fedoraproject.org> - 12.4-4
- Make OpenSSL support working again if NSS flag is disabled
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Mon Aug 11 2008 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.4-1
- update to 12.4
* Tue Jul 29 2008 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.3-1
- Place mailx to /bin/mailx, to avoid extra symlink in redhat-lsb package
- /bin/mailx is now a base binary, another symlinked to it.
* Thu Jun 26 2008 Dmitry Butskoy <Dmitry@Butskoy.name>
- add missed BR for krb5-devel
- activate IPv6 support
- change config to /etc/mail.rc for compatibility
- add triggerpostun scriptlets against previous mailx and nail
to check and merge (when possible) their user config changes
- use proper config filename in manuals
- use "less" instead of non-provided "pg" for nobsdcompat mode
* Wed Jun 18 2008 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.3-0
- Change the name from "nail" to upstream's "mailx".
Merge with the ordinary "mailx" cvs tree for Fedora 10.
Now this stuff supersedes the old ancient mailx-8.x in Fedora.
- Build with nss instead of openssl, for "Security Consolidation" process.
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 12.3-4
- Autorebuild for GCC 4.3
* Wed Dec 05 2007 Release Engineering <rel-eng at fedoraproject dot org> - 12.3-3
- Rebuild for deps
* Tue Aug 28 2007 Fedora Release Engineering <rel-eng at fedoraproject dot org> - 12.3-2
- Rebuild for selinux ppc32 issue.
* Fri Aug 17 2007 Dmitry Butskoy <Dmitry@Butskoy.name>
- Change License tag to "BSD with advertising"
* Tue Jul 24 2007 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.3-1
- update to 12.3
* Fri Jan 12 2007 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.2-1
- update to 12.2
- spec file cleanups
* Fri Jun 16 2006 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.1-1
- update to 12.1
* Wed Mar 22 2006 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.0-2
- complete "mailx to nail" changes in the manual and config files
- drop _smp_mflags: it caused make to work incorrectly.
* Tue Mar 21 2006 Dmitry Butskoy <Dmitry@Butskoy.name> - 12.0-1
- upgrade to 12.0
- change new upstream name "mailx" to the old name "nail" to avoid
conflicts with the Core mailx package.
- drop Source1, use package's html file instead.
* Mon Oct 17 2005 Dmitry Butskoy <Dmitry@Butskoy.name> - 11.25-4
- don't strip binaries on makeinstall (#170972)
* Mon Oct 3 2005 Dmitry Butskoy <Dmitry@Butskoy.name>
- clear buildroot before install (Michael Schwendt)
* Mon Sep 26 2005 Dmitry Butskoy <Dmitry@Butskoy.name> - 11.25-3
- more spec file cleanups
- accepted for Fedora Extra
(review by Aurelien Bompard <gauret@free.fr>)
* Mon Aug 22 2005 Dmitry Butskoy <Dmitry@Butskoy.name> - 11.25-2
- spec file cleanups (#166343)
* Fri Aug 19 2005 Dmitry Butskoy <Dmitry@Butskoy.name> - 11.25-1
- initial release
- add "set bsdcompat" to nail.rc as default
- copy nail web page to doc

1
dead.package.c9s Normal file
View File

@ -0,0 +1 @@
mailx package is retired for CS-547