Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37762768
en ru br
ALT Linux repos
S:4.4.3.P1-alt1
5.0: 3.0.7-alt1
4.1: 3.0.6-alt2.M41.1
4.0: 3.0.6-alt1
3.0: 3.0.2-alt1

Group :: System/Servers
RPM: dhcp

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: 0017-Ensure-64-bit-platforms-parse-lease-file-dates-times.patch
Download


From 0 Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <sem@altlinux.org>
Date: Thu, 25 Oct 2012 17:51:18 +0400
Subject: [PATCH 17] Ensure 64-bit platforms parse lease file dates & times
 correctly.
Applied dhcp-4.2.4-64_bit_lease_parse.patch from Fedora.
RH bug #448615.
diff --git a/dhcp/common/parse.c b/dhcp/common/parse.c
index defaced..defaced 100644
--- a/dhcp/common/parse.c
+++ b/dhcp/common/parse.c
@@ -943,8 +943,8 @@ TIME
 parse_date_core(cfile)
 	struct parse *cfile;
 {
-	int guess;
-	int tzoff, year, mon, mday, hour, min, sec;
+	TIME guess;
+	long int tzoff, year, mon, mday, hour, min, sec;
 	const char *val;
 	enum dhcp_token token;
 	static int months[11] = { 31, 59, 90, 120, 151, 181,
@@ -970,7 +970,7 @@ parse_date_core(cfile)
 		}
 
 		skip_token(&val, NULL, cfile); /* consume number */
-		guess = atoi(val);
+		guess = atol(val);
 
 		return((TIME)guess);
 	}
@@ -998,7 +998,7 @@ parse_date_core(cfile)
 	   somebody invents a time machine, I think we can safely disregard
 	   it.   This actually works around a stupid Y2K bug that was present
 	   in a very early beta release of dhcpd. */
-	year = atoi(val);
+	year = atol(val);
 	if (year > 1900)
 		year -= 1900;
 
@@ -1022,7 +1022,7 @@ parse_date_core(cfile)
 		return((TIME)0);
 	}
 	skip_token(&val, NULL, cfile); /* consume month */
-	mon = atoi(val) - 1;
+	mon = atol(val) - 1;
 
 	/* Slash separating month from day... */
 	token = peek_token(&val, NULL, cfile);
@@ -1044,7 +1044,7 @@ parse_date_core(cfile)
 		return((TIME)0);
 	}
 	skip_token(&val, NULL, cfile); /* consume day of month */
-	mday = atoi(val);
+	mday = atol(val);
 
 	/* Hour... */
 	token = peek_token(&val, NULL, cfile);
@@ -1055,7 +1055,7 @@ parse_date_core(cfile)
 		return((TIME)0);
 	}
 	skip_token(&val, NULL, cfile); /* consume hour */
-	hour = atoi(val);
+	hour = atol(val);
 
 	/* Colon separating hour from minute... */
 	token = peek_token(&val, NULL, cfile);
@@ -1077,7 +1077,7 @@ parse_date_core(cfile)
 		return((TIME)0);
 	}
 	skip_token(&val, NULL, cfile); /* consume minute */
-	min = atoi(val);
+	min = atol(val);
 
 	/* Colon separating minute from second... */
 	token = peek_token(&val, NULL, cfile);
@@ -1099,13 +1099,13 @@ parse_date_core(cfile)
 		return((TIME)0);
 	}
 	skip_token(&val, NULL, cfile); /* consume second */
-	sec = atoi(val);
+	sec = atol(val);
 
 	tzoff = 0;
 	token = peek_token(&val, NULL, cfile);
 	if (token == NUMBER) {
 		skip_token(&val, NULL, cfile); /* consume tzoff */
-		tzoff = atoi(val);
+		tzoff = atol(val);
 	} else if (token != SEMI) {
 		skip_token(&val, NULL, cfile);
 		parse_warn(cfile,
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin