| 1 |
diff -urp dhcp-4.1.0p1.orig/client/dhclient.c dhcp-4.1.0p1/client/dhclient.c
|
| 2 |
--- dhcp-4.1.0p1.orig/client/dhclient.c 2009-08-15 11:44:33.000000000 -0400
|
| 3 |
+++ dhcp-4.1.0p1/client/dhclient.c 2009-08-15 12:32:52.000000000 -0400
|
| 4 |
@@ -37,6 +37,9 @@
|
| 5 |
#include <sys/time.h>
|
| 6 |
#include <sys/wait.h>
|
| 7 |
#include <limits.h>
|
| 8 |
+#ifdef HAVE_LIBCAP_NG
|
| 9 |
+#include <cap-ng.h>
|
| 10 |
+#endif
|
| 11 |
|
| 12 |
/*
|
| 13 |
* Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
|
| 14 |
@@ -422,6 +425,15 @@ main(int argc, char **argv) {
|
| 15 |
path_dhclient_script = s;
|
| 16 |
}
|
| 17 |
|
| 18 |
+#ifdef HAVE_LIBCAP_NG
|
| 19 |
+ /* Drop capabilities */
|
| 20 |
+ capng_clear(CAPNG_SELECT_BOTH);
|
| 21 |
+ capng_updatev(CAPNG_ADD,
|
| 22 |
+ CAPNG_EFFECTIVE|CAPNG_PERMITTED|CAPNG_BOUNDING_SET,
|
| 23 |
+ CAP_NET_ADMIN, CAP_NET_RAW, CAP_NET_BIND_SERVICE, -1);
|
| 24 |
+ capng_apply(CAPNG_SELECT_BOTH);
|
| 25 |
+#endif
|
| 26 |
+
|
| 27 |
/* Set up the initial dhcp option universe. */
|
| 28 |
initialize_common_option_spaces();
|
| 29 |
|
| 30 |
diff -urp dhcp-4.1.0p1.orig/client/Makefile.am dhcp-4.1.0p1/client/Makefile.am
|
| 31 |
--- dhcp-4.1.0p1.orig/client/Makefile.am 2009-08-15 11:44:33.000000000 -0400
|
| 32 |
+++ dhcp-4.1.0p1/client/Makefile.am 2009-08-15 12:32:34.000000000 -0400
|
| 33 |
@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c
|
| 34 |
scripts/netbsd scripts/nextstep scripts/openbsd \
|
| 35 |
scripts/solaris scripts/openwrt
|
| 36 |
dhclient_LDADD = ../common/libdhcp.a ../minires/libres.a \
|
| 37 |
- ../omapip/libomapi.a ../dst/libdst.a
|
| 38 |
+ ../omapip/libomapi.a ../dst/libdst.a $(CAPNG_LDADD)
|
| 39 |
man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
|
| 40 |
EXTRA_DIST = $(man_MANS)
|
| 41 |
|
| 42 |
diff -urp dhcp-4.1.0p1.orig/configure.ac dhcp-4.1.0p1/configure.ac
|
| 43 |
--- dhcp-4.1.0p1.orig/configure.ac 2009-08-15 11:44:33.000000000 -0400
|
| 44 |
+++ dhcp-4.1.0p1/configure.ac 2009-08-15 12:32:34.000000000 -0400
|
| 45 |
@@ -388,6 +388,9 @@ AC_TRY_LINK(
|
| 46 |
# Look for optional headers.
|
| 47 |
AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
|
| 48 |
|
| 49 |
+# look for capabilities library
|
| 50 |
+LIBCAP_NG_PATH
|
| 51 |
+
|
| 52 |
# find an MD5 library
|
| 53 |
AC_SEARCH_LIBS(MD5_Init, [crypto])
|
| 54 |
AC_SEARCH_LIBS(MD5Init, [crypto])
|