rpms/dhcpv6/F-7 dhcpv6-0.10-file-checks.patch, NONE, 1.1 dhcpv6.spec, 1.57, 1.58 dhcpv6-0.10-init_leases.patch, 1.1, NONE

David Cantrell (dcantrel) fedora-extras-commits at redhat.com
Mon Sep 10 19:33:02 UTC 2007


Author: dcantrel

Update of /cvs/pkgs/rpms/dhcpv6/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3780

Modified Files:
	dhcpv6.spec 
Added Files:
	dhcpv6-0.10-file-checks.patch 
Removed Files:
	dhcpv6-0.10-init_leases.patch 
Log Message:
* Mon Sep 10 2007 David Cantrell <dcantrell at redhat.com> - 0.10-44
- Fix more segfaults when dhcp6s starts with empty control files (#253968)


dhcpv6-0.10-file-checks.patch:

--- NEW FILE dhcpv6-0.10-file-checks.patch ---
diff -up dhcp-0.10/dhcp6s.c.file_check dhcp-0.10/dhcp6s.c
--- dhcp-0.10/dhcp6s.c.file_check	2007-09-10 15:25:12.000000000 -0400
+++ dhcp-0.10/dhcp6s.c	2007-09-10 15:25:12.000000000 -0400
@@ -1096,13 +1096,14 @@ static struct dhcp6_timer
 	struct timeval timo;
 	struct stat buf;
 	FILE *file;
-	stat(PATH_SERVER6_LEASE, &buf);
 	strcpy(server6_lease_temp, PATH_SERVER6_LEASE);
-	strcat(server6_lease_temp, "XXXXXX");	
-	if (buf.st_size > MAX_FILE_SIZE) {
-		file = sync_leases(server6_lease_file, PATH_SERVER6_LEASE, server6_lease_temp);
-		if (file != NULL)
-			server6_lease_file = file;
+	strcat(server6_lease_temp, "XXXXXX");
+	if (!stat(PATH_SERVER6_LEASE, &buf)) {
+		if (buf.st_size > MAX_FILE_SIZE) {
+			file = sync_leases(server6_lease_file, PATH_SERVER6_LEASE, server6_lease_temp);
+			if (file != NULL)
+				server6_lease_file = file;
+		}
 	}
 	d = DHCP6_SYNCFILE_TIME;
 	timo.tv_sec = (long)d;
diff -up dhcp-0.10/lease.c.file_check dhcp-0.10/lease.c
--- dhcp-0.10/lease.c.file_check	2007-09-10 15:25:12.000000000 -0400
+++ dhcp-0.10/lease.c	2007-09-10 15:26:18.000000000 -0400
@@ -180,18 +180,30 @@ FILE *
 init_leases(const char *name)
 {
 	FILE *file;
-	file = fopen(name, "a+");
+	struct stat stbuf;
+	if (name != NULL) {
+		file = fopen(name, "a+");
+	} else {
+		dprintf(LOG_ERR, "%s" "no lease file specified", FNAME);
+		return (NULL);
+	}
 	if(!file) {
 		dprintf(LOG_ERR, "%s" "could not open lease file", FNAME);
 		return (NULL);
 	}
+	if (stat(name, &stbuf)) {
+		dprintf(LOG_ERR, "%s" "could not stat lease file", FNAME);
+		return (NULL);
+	}
 	if (dhcp6_mode == DHCP6_MODE_SERVER) {
 		if (0 != init_lease_hashes()) {
 			dprintf(LOG_ERR, "%s" "Could not initialize hash arrays", FNAME);
 			return (NULL);
 		}
 	}
-	lease_parse(file);
+	if (stbuf.st_size > 0 ) {
+		lease_parse(file);
+	}
 	return file;
 } 
 


Index: dhcpv6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/F-7/dhcpv6.spec,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- dhcpv6.spec	4 Sep 2007 17:59:11 -0000	1.57
+++ dhcpv6.spec	10 Sep 2007 19:32:30 -0000	1.58
@@ -1,7 +1,7 @@
 Summary: DHCPv6 - DHCP server and client for IPv6
 Name:    dhcpv6
 Version: 0.10
-Release: 43%{?dist}
+Release: 44%{?dist}
 License: BSD
 Group:   System Environment/Daemons
 URL:     http://dhcpv6.sourceforge.net/
@@ -16,7 +16,7 @@
 Patch4:  %{name}-0.10-no-strlcat.patch
 Patch5:  %{name}-0.10-salen.patch
 Patch6:  %{name}-0.10-initscripts.patch
-Patch7:  %{name}-0.10-init_leases.patch
+Patch7:  %{name}-0.10-file-checks.patch
 
 Patch99: %{name}-0.10-libdhcp6client.patch
 
@@ -69,7 +69,7 @@
 %patch4 -p1 -b .no_strlcat
 %patch5 -p1 -b .salen
 %patch6 -p1 -b .initscripts
-%patch7 -p1 -b .init_leases
+%patch7 -p1 -b .file_check
 
 %patch99 -p1 -b .libdhcp6client
 
@@ -162,6 +162,9 @@
 %{_libdir}/libdhcp6client.a
 
 %changelog
+* Mon Sep 10 2007 David Cantrell <dcantrell at redhat.com> - 0.10-44
+- Fix more segfaults when dhcp6s starts with empty control files (#253968)
+
 * Tue Sep 04 2007 David Cantrell <dcantrell at redhat.com> - 0.10-43
 - Do not parse an empty /var/lib/dhcpv6/server6.leases file (#253968)
 


--- dhcpv6-0.10-init_leases.patch DELETED ---




More information about the fedora-extras-commits mailing list