rpms/dhcp/devel dhcp-4.0.0-FD_CLOEXEC.patch, NONE, 1.1 dhcp-4.0.0-inherit-leases.patch, 1.1, 1.2 dhcp.spec, 1.212, 1.213 dhcp-4.0.0-O_CLOEXEC.patch, 1.1, NONE dhcp-4.0.0-selinux.patch, 1.2, NONE

David Cantrell (dcantrel) fedora-extras-commits at redhat.com
Fri Aug 1 22:17:08 UTC 2008


Author: dcantrel

Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26589

Modified Files:
	dhcp-4.0.0-inherit-leases.patch dhcp.spec 
Added Files:
	dhcp-4.0.0-FD_CLOEXEC.patch 
Removed Files:
	dhcp-4.0.0-O_CLOEXEC.patch dhcp-4.0.0-selinux.patch 
Log Message:
* Fri Aug 01 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-17
- Carry over RES_OPTIONS from ifcfg-ethX files to /etc/resolv.conf (#202923)
- Clean up Requires tags for devel packages
- Allow SEARCH variable in ifcfg files to override search path (#454152)
- Do not down interface if there is an active lease (#453982)
- Clean up how dhclient-script restarts ypbind
- Set close-on-exec on dhclient.leases for SELinux (#446632)


dhcp-4.0.0-FD_CLOEXEC.patch:

--- NEW FILE dhcp-4.0.0-FD_CLOEXEC.patch ---
diff -up dhcp-4.0.0/client/dhclient.c.FD_CLOEXEC dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.FD_CLOEXEC	2008-08-01 11:02:35.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c	2008-08-01 11:14:01.000000000 -1000
@@ -2696,6 +2696,7 @@ int leases_written = 0;
 
 void rewrite_client_leases ()
 {
+	int fd, flags;
 	struct interface_info *ip;
 	struct client_state *client;
 	struct client_lease *lp;
@@ -2708,6 +2709,23 @@ void rewrite_client_leases ()
 		return;
 	}
 
+	if ((fd = fileno(leaseFile)) == -1) {
+		log_error ("could not determine fd for %s: %s", path_dhclient_db, strerror(errno));
+		return;
+	}
+
+	if ((flags = fcntl(fd, F_GETFD)) == -1) {
+		log_error ("failed to get flags for %s: %s", path_dhclient_db, strerror(errno));
+		return;
+	}
+
+	flags |= FD_CLOEXEC;
+
+	if (fcntl(fd, F_SETFD, flags) == -1) {
+		log_error ("failed to set close-on-exec for %s", path_dhclient_db);
+		return;
+	}
+
 	/* If there is a default duid, write it out. */
 	if (default_duid.len != 0)
 		write_duid(&default_duid);
@@ -2800,7 +2818,7 @@ static isc_result_t
 write_duid(struct data_string *duid)
 {
 	char *str;
-	int stat;
+	int stat, flags, fd;
 
 	if ((duid == NULL) || (duid->len <= 2))
 		return ISC_R_INVALIDARG;
@@ -2811,6 +2829,23 @@ write_duid(struct data_string *duid)
 			log_error("can't create %s: %m", path_dhclient_db);
 			return ISC_R_IOERROR;
 		}
+
+		if ((fd = fileno(leaseFile)) == -1) {
+			log_error ("could not determine fd for %s: %s", path_dhclient_db, strerror(errno));
+			return ISC_R_IOERROR;
+		}
+
+		if ((flags = fcntl(fd, F_GETFD)) == -1) {
+			log_error ("failed to get flags for %s: %s", path_dhclient_db, strerror(errno));
+			return ISC_R_IOERROR;
+		}
+
+		flags |= FD_CLOEXEC;
+
+		if (fcntl(fd, F_SETFD, flags) == -1) {
+			log_error ("failed to set close-on-exec for %s", path_dhclient_db);
+			return ISC_R_IOERROR;
+		}
 	}
 
 	/* It would make more sense to write this as a hex string,
@@ -2840,7 +2875,7 @@ write_client6_lease(struct client_state 
 {
 	struct dhc6_ia *ia;
 	struct dhc6_addr *addr;
-	int stat;
+	int stat, flags, fd;
 
 	/* This should include the current lease. */
 	if (!rewrite && (leases_written++ > 20)) {
@@ -2858,6 +2893,23 @@ write_client6_lease(struct client_state 
 			log_error("can't create %s: %m", path_dhclient_db);
 			return ISC_R_IOERROR;
 		}
+
+		if ((fd = fileno(leaseFile)) == -1) {
+			log_error ("could not determine fd for %s: %s", path_dhclient_db, strerror(errno));
+			return ISC_R_IOERROR;
+		}
+
+		if ((flags = fcntl(fd, F_GETFD)) == -1) {
+			log_error ("failed to get flags for %s: %s", path_dhclient_db, strerror(errno));
+			return ISC_R_IOERROR;
+		}
+
+		flags |= FD_CLOEXEC;
+
+		if (fcntl(fd, F_SETFD, flags) == -1) {
+			log_error ("failed to set close-on-exec for %s", path_dhclient_db);
+			return ISC_R_IOERROR;
+		}
 	}
 
 	stat = fprintf(leaseFile, "lease6 {\n");
@@ -2940,6 +2992,7 @@ int write_client_lease (client, lease, r
 {
 	struct data_string ds;
 	int errors = 0;
+	int flags, fd;
 	char *s;
 	const char *tval;
 
@@ -2961,6 +3014,23 @@ int write_client_lease (client, lease, r
 			log_error ("can't create %s: %m", path_dhclient_db);
 			return 0;
 		}
+
+		if ((fd = fileno(leaseFile)) == -1) {
+			log_error ("could not determine fd for %s: %s", path_dhclient_db, strerror(errno));
+			return ISC_R_IOERROR;
+		}
+
+		if ((flags = fcntl(fd, F_GETFD)) == -1) {
+			log_error ("failed to get flags for %s: %s", path_dhclient_db, strerror(errno));
+			return ISC_R_IOERROR;
+		}
+
+		flags |= FD_CLOEXEC;
+
+		if (fcntl(fd, F_SETFD, flags) == -1) {
+			log_error ("failed to set close-on-exec for %s", path_dhclient_db);
+			return ISC_R_IOERROR;
+		}
 	}
 
 	errno = 0;

dhcp-4.0.0-inherit-leases.patch:

Index: dhcp-4.0.0-inherit-leases.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp-4.0.0-inherit-leases.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dhcp-4.0.0-inherit-leases.patch	1 Aug 2008 21:16:41 -0000	1.1
+++ dhcp-4.0.0-inherit-leases.patch	1 Aug 2008 22:16:38 -0000	1.2
@@ -1,19 +1,34 @@
-diff -up dhcp-4.0.0//client/dhclient.c.inherit dhcp-4.0.0//client/dhclient.c
---- dhcp-4.0.0//client/dhclient.c.inherit	2008-08-01 09:49:36.000000000 -1000
-+++ dhcp-4.0.0//client/dhclient.c	2008-08-01 09:53:28.000000000 -1000
-@@ -2393,6 +2393,15 @@ void send_request (cpp)
+diff -up dhcp-4.0.0/client/dhclient.c.inherit dhcp-4.0.0/client/dhclient.c
+--- dhcp-4.0.0/client/dhclient.c.inherit	2008-08-01 11:34:29.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.c	2008-08-01 11:34:42.000000000 -1000
+@@ -2296,6 +2296,7 @@ void send_request (cpp)
+ {
+ 	struct client_state *client = cpp;
+ 
++	int i;
+ 	int result;
+ 	int interval;
+ 	struct sockaddr_in destination;
+@@ -2354,6 +2355,22 @@ void send_request (cpp)
  		/* Now do a preinit on the interface so that we can
  		   discover a new address. */
  		script_init (client, "PREINIT", (struct string_list *)0);
++
 +		/* Has an active lease */
-+		if (client -> active &&
-+			client -> active -> is_bootp &&
-+			client -> active -> expiry > cur_time &&
-+		    primary_address.s_addr != 0 &&
-+			client -> active -> address.len == 4 &&
-+			memcpy (client -> active -> address.iabuf, &primary_address, 4) == 0)
-+				client_envadd (client, "", "keep_old_ip", "%s", "yes");
-+			
++		if (client -> interface -> addresses != NULL) {
++			for (i = 0; i < client -> interface -> address_count; i++) {
++				if (client -> active &&
++				    client -> active -> is_bootp &&
++				    client -> active -> expiry > cur_time &&
++				    client -> interface -> addresses[i].s_addr != 0 &&
++				    client -> active -> address.len == 4 &&
++				    memcpy (client -> active -> address.iabuf, &(client -> interface -> addresses[i]), 4) == 0) {
++					client_envadd (client, "", "keep_old_ip", "%s", "yes");
++					break;
++				}
++			}
++		}
++
  		if (client -> alias)
  			script_write_params (client, "alias_",
  					     client -> alias);


Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -r1.212 -r1.213
--- dhcp.spec	1 Aug 2008 21:16:41 -0000	1.212
+++ dhcp.spec	1 Aug 2008 22:16:38 -0000	1.213
@@ -43,10 +43,9 @@
 Patch14:  %{name}-4.0.0-manpages.patch
 Patch15:  %{name}-4.0.0-paths.patch
 Patch16:  %{name}-4.0.0-NetworkManager-crash.patch
-Patch17:  %{name}-4.0.0-selinux.patch
+Patch17:  %{name}-4.0.0-FD_CLOEXEC.patch
 Patch18:  %{name}-4.0.0-libdhcp4client.patch
-Patch19:  %{name}-4.0.0-O_CLOEXEC.patch
-Patch20:  %{name}-4.0.0-inherit-leases.patch
+Patch19:  %{name}-4.0.0-inherit-leases.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf
@@ -191,17 +190,14 @@
 # Avoid crash when dhclient is run with NetworkManager
 %patch16 -p1
 
-# Set close-on-exec for dhclient.leases for SELinux (#446632)
+# Make sure all open file descriptors are closed-on-exec for SELinux (#446632)
 %patch17 -p1
 
 # Add the libdhcp4client target (library version of dhclient)
 %patch18 -p1
 
-# Make sure all open file descriptors are closed-on-exec for SELinux
-%patch19 -p1
-
 # If we have an active lease, do not down the interface (#453982)
-%patch20 -p1
+%patch19 -p1
 
 # Copy in documentation and example scripts for LDAP patch to dhcpd
 %{__install} -p -m 0644 %{SOURCE5} .
@@ -437,6 +433,7 @@
 - Allow SEARCH variable in ifcfg files to override search path (#454152)
 - Do not down interface if there is an active lease (#453982)
 - Clean up how dhclient-script restarts ypbind
+- Set close-on-exec on dhclient.leases for SELinux (#446632)
 
 * Sat Jun 21 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-16
 - Remove instaces of \032 in domain search option (#450042)


--- dhcp-4.0.0-O_CLOEXEC.patch DELETED ---


--- dhcp-4.0.0-selinux.patch DELETED ---




More information about the fedora-extras-commits mailing list