[nail/el5] update to 12.4 as of mailx-12.4 from RHEL6

Dmitry Butskoy buc at fedoraproject.org
Sun Jan 4 18:50:07 UTC 2015


commit 13d0f2dd643b6ebb145e3204caecaca941384514
Author: buc <buc at grad.stu.neva.ru>
Date:   Sun Jan 4 21:52:40 2015 +0300

    update to 12.4 as of mailx-12.4 from RHEL6

 .gitignore                                         |    1 +
 mailx-12.3-pager.patch                             |   12 ++
 mailx-12.4-collect.patch                           |   13 +++
 ...c-Unconditionally-require-wordexp-support.patch |  108 ++++++++++++++++++++
 ...voke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch |   25 +++++
 mailx-12.5-outof-Introduce-expandaddr-flag.patch   |   64 ++++++++++++
 ...ble-option-processing-for-email-addresses.patch |   74 +++++++++++++
 nail.spec                                          |   87 +++++++++++-----
 sources                                            |    2 +-
 9 files changed, 360 insertions(+), 26 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2ebe735..45f5424 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 mailx-12.1.tar.bz2
+/mailx-12.4.tar.bz2
diff --git a/mailx-12.3-pager.patch b/mailx-12.3-pager.patch
new file mode 100644
index 0000000..d4b2439
--- /dev/null
+++ b/mailx-12.3-pager.patch
@@ -0,0 +1,12 @@
+diff -Nrbu mailx-12.3/cmd1.c mailx-12.3-OK/cmd1.c
+--- mailx-12.3/cmd1.c	2007-06-16 16:48:39.000000000 +0400
++++ mailx-12.3-OK/cmd1.c	2008-06-26 19:57:38.000000000 +0400
+@@ -78,7 +78,7 @@
+ 
+ 	cp = value("PAGER");
+ 	if (cp == NULL || *cp == '\0')
+-		cp = value("bsdcompat") ? "more" : "pg";
++		cp = value("bsdcompat") ? "more" : "less";
+ 	return cp;
+ }
+ 
diff --git a/mailx-12.4-collect.patch b/mailx-12.4-collect.patch
new file mode 100644
index 0000000..b84d2e8
--- /dev/null
+++ b/mailx-12.4-collect.patch
@@ -0,0 +1,13 @@
+--- mailx-12.4.orig/collect.c	2012-09-12 16:07:53.653103796 -0400
++++ mailx-12.4/collect.c	2012-09-12 21:27:05.092259236 -0400
+@@ -905,7 +905,9 @@ err:
+ 	if (collf != NULL) {
+ 		Fclose(collf);
+ 		collf = NULL;
+-	}
++	} else {
++        exit(1);
++    }
+ out:
+ 	if (collf != NULL) {
+ 		if ((cp = value("MAILX_TAIL")) != NULL) {
diff --git a/mailx-12.5-fio.c-Unconditionally-require-wordexp-support.patch b/mailx-12.5-fio.c-Unconditionally-require-wordexp-support.patch
new file mode 100644
index 0000000..7544ab2
--- /dev/null
+++ b/mailx-12.5-fio.c-Unconditionally-require-wordexp-support.patch
@@ -0,0 +1,108 @@
+From 2bae8ecf04ec2ba6bb9f0af5b80485dd0edb427d Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at 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
+
diff --git a/mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch b/mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch
new file mode 100644
index 0000000..a7fb9d3
--- /dev/null
+++ b/mailx-12.5-globname-Invoke-wordexp-with-WRDE_NOCMD-CVE-2004-277.patch
@@ -0,0 +1,25 @@
+From 73fefa0c1ac70043ec84f2d8b8f9f683213f168d Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at 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
+
diff --git a/mailx-12.5-outof-Introduce-expandaddr-flag.patch b/mailx-12.5-outof-Introduce-expandaddr-flag.patch
new file mode 100644
index 0000000..c3479e2
--- /dev/null
+++ b/mailx-12.5-outof-Introduce-expandaddr-flag.patch
@@ -0,0 +1,64 @@
+From 9984ae5cb0ea0d61df1612b06952a61323c083d9 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at 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
+
diff --git a/mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch b/mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch
new file mode 100644
index 0000000..d20bb4a
--- /dev/null
+++ b/mailx-12.5-unpack-Disable-option-processing-for-email-addresses.patch
@@ -0,0 +1,74 @@
+From e34e2ac67b80497080ebecccec40c3b61456167d Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at 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
+
diff --git a/nail.spec b/nail.spec
index 7165d30..f30bfca 100644
--- a/nail.spec
+++ b/nail.spec
@@ -1,19 +1,29 @@
-%define	use_nss	0
+%define use_nss 0
 %define rename	1
 
 Summary: Enhanced implementation of the mailx command
 Name: nail
-Version: 12.3
+Version: 12.4
 Release: 1%{?dist}
-Group: 	Applications/Internet
-License: BSD
-URL: http://nail.sourceforge.net
-Source0: http://dl.sourceforge.net/heirloom/mailx-%{version}.tar.bz2
+Group: Applications/Internet
+# mailx-12.4/nsserr.c, mailx-12.4/nss.c  have MPLv1.1 license
+# other files are BSD
+License: BSD with advertising and MPLv1.1
+URL: http://heirloom.sourceforge.net/mailx.html
+Source0: http://downloads.sourceforge.net/heirloom/mailx-%{version}.tar.bz2
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Patch0: nail-11.25-config.patch
+Patch1: mailx-12.3-pager.patch
+Patch2: mailx-12.4-collect.patch
+
+# resolves: #1171175
+Patch6: mailx-12.5-outof-Introduce-expandaddr-flag.patch
+Patch7: mailx-12.5-unpack-Disable-option-processing-for-email-addresses.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
 
 %if %{use_nss}
-BuildRequires: nss-devel, pkgconfig
+BuildRequires: nss-devel, pkgconfig, krb5-devel
 %else
 BuildRequires: openssl-devel
 %endif
@@ -21,37 +31,48 @@ BuildRequires: openssl-devel
 
 %description
 Nail is an enhanced mail command, which provides the functionality
-of the POSIX mailx command. It is derived from Berkeley Mail.
+of the POSIX mailx command, as well as SysV mail and Berkeley Mail
+(from which it is derived).
 
 Additionally to the POSIX features, nail can work with Maildir/ e-mail
 storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
 procotols (including over SSL) to operate with remote hosts, handles mime
 types and different charsets. There are a lot of other useful features,
-see %{name}.html in the documentation.
+see nail(1).
 
 And as its ancient analogues, nail 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 -n mailx-%{version}
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
 
 %if %{rename}
 #  Use old name "nail" to avoid conflicts with the Core mailx package
 sed -i '/Heirloom/ n
-	s/mailx/nail/g
+       s/mailx/nail/g
 ' %{name}.rc
 
 sed -i '/Heirloom/ n
-	s/mailx/nail/g
-	s/Mailx/Nail/g
+       s/mailx/nail/g
+       s/Mailx/Nail/g
 ' mailx.1
 
 sed -i '/Heirloom/ n
-	s/mailx/nail/g
-	s/MAILX /NAIL /g
-	s/Mailx/Nail/g
+       s/mailx/nail/g
+       s/MAILX /NAIL /g
+       s/Mailx/Nail/g
 ' mailx.1.html
 mv mailx.1.html %{name}.html
 %endif
@@ -64,18 +85,20 @@ INCLUDES="$INCLUDES `pkg-config --cflags-only-I nss`"
 export INCLUDES
 %endif
 
-echo	PREFIX=%{_prefix} \
-	BINDIR=%{_bindir} \
-	MANDIR=%{_mandir} \
-	SYSCONFDIR=%{_sysconfdir} \
-	MAILRC=%{_sysconfdir}/%{name}.rc \
-	MAILSPOOL=%{_localstatedir}/mail \
-	SENDMAIL=%{_sbindir}/sendmail \
-	UCBINSTALL=install \
+echo PREFIX=%{_prefix} \
+     BINDIR=%{_bindir} \
+     MANDIR=%{_mandir} \
+     SYSCONFDIR=%{_sysconfdir} \
+     MAILRC=%{_sysconfdir}/%{name}.rc \
+     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"
+make `cat makeflags` \
+     CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" \
+     IPv6=-DHAVE_IPv6_FUNCS
 
 
 %install
@@ -94,7 +117,7 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %files
-%defattr(-,root,root)
+%defattr(-,root,root,-)
 %doc COPYING AUTHORS README %{name}.html
 %config(noreplace) %{_sysconfdir}/%{name}.rc
 %{_bindir}/%{name}
@@ -102,6 +125,20 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sun Jan  4 2015 Dmitry Butskoy <Dmitry at Butskoy.name> - 12.4-1
+- Update to 12.4, as of RHEL6, with backported patches
+- fix CVE-2004-2771 mailx: command execution flaw, #1171175
+- fixed incorrect return code when TMPDIR points to invalid path, #857120
+
+* Thu Jun 26 2008 Dmitry Butskoy <Dmitry at Butskoy.name>
+- add missed BR for krb5-devel
+- activate IPv6 support
+- use proper config filename in manuals
+- use "less" instead of non-provided "pg" for nobsdcompat mode
+
+* Fri Aug 17 2007 Dmitry Butskoy <Dmitry at Butskoy.name>
+- Change License tag to "BSD with advertising"
+
 * Tue Jul 24 2007 Dmitry Butskoy <Dmitry at Butskoy.name> - 12.3-1
 - update to 12.3
 
diff --git a/sources b/sources
index 40756d4..41257bd 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-54406da3f55ded303c7a58bf9e307033  mailx-12.3.tar.bz2
+0c93759e34200eb56a0e7c464680a54a  mailx-12.4.tar.bz2


More information about the scm-commits mailing list