[iputils] Call usage() before limiting capabilities

jsynacek jsynacek at fedoraproject.org
Tue Nov 27 12:29:04 UTC 2012


commit 1f3c9215589e7105be913dde7e3a4bd5c1077900
Author: Jan Synacek <jsynacek at redhat.com>
Date:   Tue Nov 27 13:27:30 2012 +0100

    Call usage() before limiting capabilities

 iputils-20121125-usage-before-caps.patch |   60 ++++++++++++++++++++++++++++++
 iputils.spec                             |    3 +
 2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/iputils-20121125-usage-before-caps.patch b/iputils-20121125-usage-before-caps.patch
new file mode 100644
index 0000000..e9fc688
--- /dev/null
+++ b/iputils-20121125-usage-before-caps.patch
@@ -0,0 +1,60 @@
+From 8e892529af268a4e86bae045e07c93b5d4c360b0 Mon Sep 17 00:00:00 2001
+From: Jan Synacek <jsynacek at redhat.com>
+Date: Tue, 27 Nov 2012 12:53:23 +0100
+Subject: [PATCH 2/2] arping: Call usage() before limiting capabilities.
+
+Otherwise, running arping binary without the capabilities set results in printing
+warnings with the usage.
+
+Signed-off-by: Jan Synacek <jsynacek at redhat.com>
+---
+ arping.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/arping.c b/arping.c
+index ccb68a0..02e3d9c 100644
+--- a/arping.c
++++ b/arping.c
+@@ -959,19 +959,6 @@ main(int argc, char **argv)
+ 	int socket_errno;
+ 	int ch;
+ 
+-	limit_capabilities();
+-
+-#ifdef USE_IDN
+-	setlocale(LC_ALL, "");
+-#endif
+-
+-	enable_capability_raw();
+-
+-	s = socket(PF_PACKET, SOCK_DGRAM, 0);
+-	socket_errno = errno;
+-
+-	disable_capability_raw();
+-
+ 	while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
+ 		switch(ch) {
+ 		case 'b':
+@@ -1023,6 +1010,19 @@ main(int argc, char **argv)
+ 
+ 	target = *argv;
+ 
++	limit_capabilities();
++
++#ifdef USE_IDN
++	setlocale(LC_ALL, "");
++#endif
++
++	enable_capability_raw();
++
++	s = socket(PF_PACKET, SOCK_DGRAM, 0);
++	socket_errno = errno;
++
++	disable_capability_raw();
++
+ 	if (device.name && !*device.name)
+ 		device.name = NULL;
+ 
+-- 
+1.7.11.7
+
diff --git a/iputils.spec b/iputils.spec
index 07f328a..7b8546f 100644
--- a/iputils.spec
+++ b/iputils.spec
@@ -20,6 +20,7 @@ Patch3: iputils-ifenslave.patch
 Patch4: iputils-20121112-idn.patch
 Patch5: iputils-20071127-corr_type.patch
 Patch7: iputils-20121121-ifaddrs.patch
+Patch8: iputils-20121125-usage-before-caps.patch
 
 BuildRequires: docbook-utils perl-SGMLSpm
 BuildRequires: glibc-kernheaders >= 2.4-8.19
@@ -63,6 +64,7 @@ The iputils-sysvinit contains SysV initscritps support.
 %patch4 -p1 -b .idn
 %patch5 -p1 -b .corr_type
 %patch7 -p1 -b .ifaddrs
+%patch8 -p1 -b .usage-before-caps
 
 %build
 %ifarch s390 s390x
@@ -148,6 +150,7 @@ mv -f RELNOTES.tmp RELNOTES
 * Mon Nov 26 2012 Jan Synáček <jsynacek at redhat.com> - 20121125-2
 - Comment patches and cleanup
 - Update ifaddrs patch
+- Call usage() before limiting capabilities
 
 * Mon Nov 26 2012 Jan Synáček <jsynacek at redhat.com> - 20121125-1
 - Update to iputils-s20121125 (#879952)


More information about the scm-commits mailing list