rpms/dhcpv6/devel dhcpv6-0.10-file-checks.patch, NONE, 1.1 dhcpv6.spec, 1.64, 1.65 dhcpv6-0.10-init_leases.patch, 1.1, NONE

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


Author: dcantrel

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

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-50
- 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/devel/dhcpv6.spec,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- dhcpv6.spec	10 Sep 2007 18:03:29 -0000	1.64
+++ dhcpv6.spec	10 Sep 2007 19:38:42 -0000	1.65
@@ -1,7 +1,7 @@
 Summary: DHCPv6 - DHCP server and client for IPv6
 Name:    dhcpv6
 Version: 0.10
-Release: 49%{?dist}
+Release: 50%{?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
 Patch8:  %{name}-0.10-device-names.patch
 Patch9:  %{name}-0.10-lsb.patch
 Patch10: %{name}-0.10-IA_NA-ignore.patch
@@ -87,7 +87,7 @@
 %patch4 -p1 -b .no_strlcat
 %patch5 -p1 -b .salen
 %patch6 -p1 -b .initscripts
-%patch7 -p1 -b .init_leases
+%patch7 -p1 -b .file-checks
 %patch8 -p1 -b .device-names
 %patch9 -p1 -b .lsb
 %patch10 -p1 -b .ia_na_ignore
@@ -189,6 +189,9 @@
 %{_libdir}/libdhcp6client.a
 
 %changelog
+* Mon Sep 10 2007 David Cantrell <dcantrell at redhat.com> - 0.10-50
+- Fix more segfaults when dhcp6s starts with empty control files (#253968)
+
 * Mon Sep 10 2007 David Cantrell <dcantrell at redhat.com> - 0.10-49
 - Make dhcp6r and dhcp6s init scripts conform to Fedora guidelines (#246909)
 - Let dhcp6c ignore reply msgs that contain IA_NA with T1 > T2 (#254194)


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




More information about the fedora-extras-commits mailing list