rpms/dhcp/devel dhcp-4.1.1-capability.patch, 1.1, 1.2 dhcp.spec, 1.284, 1.285

Jiří Popelka jpopelka at fedoraproject.org
Tue Feb 2 12:28:55 UTC 2010


Author: jpopelka

Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8788

Modified Files:
	dhcp-4.1.1-capability.patch dhcp.spec 
Log Message:
* Tue Feb 02 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.1.1-2
- Fix capability patch (#546765)


dhcp-4.1.1-capability.patch:
 client/Makefile.am |    2 +-
 client/dhclient.c  |   23 +++++++++++++++++++++++
 configure.ac       |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)

Index: dhcp-4.1.1-capability.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp-4.1.1-capability.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- dhcp-4.1.1-capability.patch	20 Jan 2010 17:04:15 -0000	1.1
+++ dhcp-4.1.1-capability.patch	2 Feb 2010 12:28:54 -0000	1.2
@@ -1,6 +1,6 @@
 diff -up dhcp-4.1.1/client/dhclient.c.capability dhcp-4.1.1/client/dhclient.c
---- dhcp-4.1.1/client/dhclient.c.capability	2010-01-20 17:39:07.000000000 +0100
-+++ dhcp-4.1.1/client/dhclient.c	2010-01-20 17:39:07.000000000 +0100
+--- dhcp-4.1.1/client/dhclient.c.capability	2010-02-02 11:58:29.000000000 +0100
++++ dhcp-4.1.1/client/dhclient.c	2010-02-02 12:04:39.000000000 +0100
 @@ -37,6 +37,9 @@
  #include <sys/time.h>
  #include <sys/wait.h>
@@ -11,17 +11,42 @@ diff -up dhcp-4.1.1/client/dhclient.c.ca
  
  /*
   * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
-@@ -424,6 +427,15 @@ main(int argc, char **argv) {
+@@ -89,6 +92,9 @@ int wanted_ia_ta = 0;
+ int wanted_ia_pd = 0;
+ char *mockup_relay = NULL;
+ int bootp_broadcast_always = 0;
++#ifdef HAVE_LIBCAP_NG
++static int keep_capabilities = 0;
++#endif
+ 
+ extern u_int32_t default_requested_options[];
+ 
+@@ -376,6 +382,10 @@ main(int argc, char **argv) {
+ 			}
+ 
+ 			dhclient_request_options = argv[i];
++#ifdef HAVE_LIBCAP_NG
++		} else if (!strcmp(argv[i], "-nc")) {
++			keep_capabilities = 1;
++#endif
+ 		} else if (argv[i][0] == '-') {
+ 		    usage();
+ 		} else if (interfaces_requested < 0) {
+@@ -424,6 +434,19 @@ main(int argc, char **argv) {
  		path_dhclient_script = s;
  	}
  
 +#ifdef HAVE_LIBCAP_NG
 +	/* Drop capabilities */
-+	capng_clear(CAPNG_SELECT_BOTH);
-+	capng_updatev(CAPNG_ADD,
-+			CAPNG_EFFECTIVE|CAPNG_PERMITTED|CAPNG_BOUNDING_SET,
-+			CAP_NET_ADMIN, CAP_NET_RAW, CAP_NET_BIND_SERVICE, -1);
-+	capng_apply(CAPNG_SELECT_BOTH);
++	if (!keep_capabilities) {
++		capng_clear(CAPNG_SELECT_CAPS);
++		capng_update(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
++				CAP_DAC_OVERRIDE); // Drop this someday
++		capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
++				CAP_NET_ADMIN, CAP_NET_RAW,
++				CAP_NET_BIND_SERVICE, CAP_SYS_ADMIN, -1);
++		capng_apply(CAPNG_SELECT_CAPS);
++	}
 +#endif
 +
  	/* Set up the initial dhcp option universe. */
@@ -29,7 +54,7 @@ diff -up dhcp-4.1.1/client/dhclient.c.ca
  
 diff -up dhcp-4.1.1/client/Makefile.am.capability dhcp-4.1.1/client/Makefile.am
 --- dhcp-4.1.1/client/Makefile.am.capability	2008-11-18 23:33:22.000000000 +0100
-+++ dhcp-4.1.1/client/Makefile.am	2010-01-20 17:39:07.000000000 +0100
++++ dhcp-4.1.1/client/Makefile.am	2010-02-02 12:05:31.000000000 +0100
 @@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c 
  		   scripts/netbsd scripts/nextstep scripts/openbsd \
  		   scripts/solaris scripts/openwrt
@@ -40,14 +65,46 @@ diff -up dhcp-4.1.1/client/Makefile.am.c
  EXTRA_DIST = $(man_MANS)
  
 diff -up dhcp-4.1.1/configure.ac.capability dhcp-4.1.1/configure.ac
---- dhcp-4.1.1/configure.ac.capability	2010-01-20 17:39:07.000000000 +0100
-+++ dhcp-4.1.1/configure.ac	2010-01-20 17:39:07.000000000 +0100
-@@ -419,6 +419,9 @@ AC_TRY_LINK(
+--- dhcp-4.1.1/configure.ac.capability	2010-02-02 11:58:29.000000000 +0100
++++ dhcp-4.1.1/configure.ac	2010-02-02 12:07:04.000000000 +0100
+@@ -419,6 +419,41 @@ AC_TRY_LINK(
  # Look for optional headers.
  AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
  
 +# look for capabilities library
-+LIBCAP_NG_PATH
++AC_ARG_WITH(libcap-ng,
++    [  --with-libcap-ng=[auto/yes/no]  Add Libcap-ng support [default=auto]],,
++    with_libcap_ng=auto)
++
++# Check for Libcap-ng API
++#
++# libcap-ng detection
++if test x$with_libcap_ng = xno ; then
++    have_libcap_ng=no;
++else
++    # Start by checking for header file
++    AC_CHECK_HEADER(cap-ng.h, capng_headers=yes, capng_headers=no)
++
++    # See if we have libcap-ng library
++    AC_CHECK_LIB(cap-ng, capng_clear,
++                 CAPNG_LDADD=-lcap-ng,)
++
++    # Check results are usable
++    if test x$with_libcap_ng = xyes -a x$CAPNG_LDADD = x ; then
++       AC_MSG_ERROR(libcap-ng support was requested and the library was not found)
++    fi
++    if test x$CAPNG_LDADD != x -a $capng_headers = no ; then
++       AC_MSG_ERROR(libcap-ng libraries found but headers are missing)
++    fi
++fi
++AC_SUBST(CAPNG_LDADD)
++AC_MSG_CHECKING(whether to use libcap-ng)
++if test x$CAPNG_LDADD != x ; then
++    AC_DEFINE(HAVE_LIBCAP_NG,1,[libcap-ng support])
++    AC_MSG_RESULT(yes)
++else
++    AC_MSG_RESULT(no)
++fi
 +
  # find an MD5 library
  AC_SEARCH_LIBS(MD5_Init, [crypto])


Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.284
retrieving revision 1.285
diff -u -p -r1.284 -r1.285
--- dhcp.spec	20 Jan 2010 17:04:16 -0000	1.284
+++ dhcp.spec	2 Feb 2010 12:28:55 -0000	1.285
@@ -13,7 +13,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  %{basever}
-Release:  1%{?dist}
+Release:  2%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -499,6 +499,9 @@ fi
 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
 
 %changelog
+* Tue Feb 02 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.1.1-2
+- Fix capability patch (#546765)
+
 * Wed Jan 20 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.1.1-1
 - Upgraded to ISC dhcp-4.1.1
 



More information about the scm-commits mailing list