Fix parsing of lease file dates & times on 64-bit platforms (#628258)
This commit is contained in:
parent
a21bc05f7d
commit
63aa3f4bc6
@ -1,6 +1,6 @@
|
|||||||
diff -up dhcp-4.2.0/common/parse.c.64-bit_lease_parse dhcp-4.2.0/common/parse.c
|
diff -up dhcp-4.2.0/common/parse.c.64-bit_lease_parse dhcp-4.2.0/common/parse.c
|
||||||
--- dhcp-4.2.0/common/parse.c.64-bit_lease_parse 2009-10-28 05:12:29.000000000 +0100
|
--- dhcp-4.2.0/common/parse.c.64-bit_lease_parse 2009-10-28 05:12:29.000000000 +0100
|
||||||
+++ dhcp-4.2.0/common/parse.c 2010-07-21 16:11:36.000000000 +0200
|
+++ dhcp-4.2.0/common/parse.c 2010-09-01 13:06:31.000000000 +0200
|
||||||
@@ -905,8 +905,8 @@ TIME
|
@@ -905,8 +905,8 @@ TIME
|
||||||
parse_date_core(cfile)
|
parse_date_core(cfile)
|
||||||
struct parse *cfile;
|
struct parse *cfile;
|
||||||
@ -12,3 +12,90 @@ diff -up dhcp-4.2.0/common/parse.c.64-bit_lease_parse dhcp-4.2.0/common/parse.c
|
|||||||
const char *val;
|
const char *val;
|
||||||
enum dhcp_token token;
|
enum dhcp_token token;
|
||||||
static int months [11] = { 31, 59, 90, 120, 151, 181,
|
static int months [11] = { 31, 59, 90, 120, 151, 181,
|
||||||
|
@@ -931,7 +931,7 @@ parse_date_core(cfile)
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- guess = atoi(val);
|
||||||
|
+ guess = atol(val);
|
||||||
|
|
||||||
|
if (!parse_semi(cfile))
|
||||||
|
return (TIME)0;
|
||||||
|
@@ -945,7 +945,7 @@ parse_date_core(cfile)
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
- wday = atoi (val);
|
||||||
|
+ wday = atol (val);
|
||||||
|
|
||||||
|
/* Year... */
|
||||||
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
@@ -960,7 +960,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;
|
||||||
|
|
||||||
|
@@ -982,7 +982,7 @@ parse_date_core(cfile)
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
- mon = atoi (val) - 1;
|
||||||
|
+ mon = atol (val) - 1;
|
||||||
|
|
||||||
|
/* Slash separating month from day... */
|
||||||
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
@@ -1002,7 +1002,7 @@ parse_date_core(cfile)
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
- mday = atoi (val);
|
||||||
|
+ mday = atol (val);
|
||||||
|
|
||||||
|
/* Hour... */
|
||||||
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
@@ -1012,7 +1012,7 @@ parse_date_core(cfile)
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
- hour = atoi (val);
|
||||||
|
+ hour = atol (val);
|
||||||
|
|
||||||
|
/* Colon separating hour from minute... */
|
||||||
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
@@ -1032,7 +1032,7 @@ parse_date_core(cfile)
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
- min = atoi (val);
|
||||||
|
+ min = atol (val);
|
||||||
|
|
||||||
|
/* Colon separating minute from second... */
|
||||||
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
@@ -1052,12 +1052,12 @@ parse_date_core(cfile)
|
||||||
|
skip_to_semi (cfile);
|
||||||
|
return (TIME)0;
|
||||||
|
}
|
||||||
|
- sec = atoi (val);
|
||||||
|
+ sec = atol (val);
|
||||||
|
|
||||||
|
token = peek_token (&val, (unsigned *)0, cfile);
|
||||||
|
if (token == NUMBER) {
|
||||||
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
- tzoff = atoi (val);
|
||||||
|
+ tzoff = atol (val);
|
||||||
|
} else
|
||||||
|
tzoff = 0;
|
||||||
|
|
||||||
|
@@ -1090,7 +1090,7 @@ TIME
|
||||||
|
parse_date(cfile)
|
||||||
|
struct parse *cfile;
|
||||||
|
{
|
||||||
|
- int guess;
|
||||||
|
+ TIME guess;
|
||||||
|
guess = parse_date_core(cfile);
|
||||||
|
|
||||||
|
/* Make sure the date ends in a semicolon... */
|
||||||
|
@ -29,7 +29,7 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume seconds */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume seconds */
|
||||||
|
|
||||||
guess = atoi(val);
|
guess = atol(val);
|
||||||
-
|
-
|
||||||
- if (!parse_semi(cfile))
|
- if (!parse_semi(cfile))
|
||||||
- return (TIME)0;
|
- return (TIME)0;
|
||||||
@ -45,7 +45,7 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
return (TIME)0;
|
return (TIME)0;
|
||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume day of week */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume day of week */
|
||||||
wday = atoi (val);
|
wday = atol (val);
|
||||||
|
|
||||||
/* Year... */
|
/* Year... */
|
||||||
- token = next_token (&val, (unsigned *)0, cfile);
|
- token = next_token (&val, (unsigned *)0, cfile);
|
||||||
@ -88,7 +88,7 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
return (TIME)0;
|
return (TIME)0;
|
||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume Month */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume Month */
|
||||||
mon = atoi (val) - 1;
|
mon = atol (val) - 1;
|
||||||
|
|
||||||
/* Slash separating month from day... */
|
/* Slash separating month from day... */
|
||||||
- token = next_token (&val, (unsigned *)0, cfile);
|
- token = next_token (&val, (unsigned *)0, cfile);
|
||||||
@ -114,7 +114,7 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
return (TIME)0;
|
return (TIME)0;
|
||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume Day of month */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume Day of month */
|
||||||
mday = atoi (val);
|
mday = atol (val);
|
||||||
|
|
||||||
/* Hour... */
|
/* Hour... */
|
||||||
- token = next_token (&val, (unsigned *)0, cfile);
|
- token = next_token (&val, (unsigned *)0, cfile);
|
||||||
@ -127,7 +127,7 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
return (TIME)0;
|
return (TIME)0;
|
||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume Hour */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume Hour */
|
||||||
hour = atoi (val);
|
hour = atol (val);
|
||||||
|
|
||||||
/* Colon separating hour from minute... */
|
/* Colon separating hour from minute... */
|
||||||
- token = next_token (&val, (unsigned *)0, cfile);
|
- token = next_token (&val, (unsigned *)0, cfile);
|
||||||
@ -153,7 +153,7 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
return (TIME)0;
|
return (TIME)0;
|
||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume Minute */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume Minute */
|
||||||
min = atoi (val);
|
min = atol (val);
|
||||||
|
|
||||||
/* Colon separating minute from second... */
|
/* Colon separating minute from second... */
|
||||||
- token = next_token (&val, (unsigned *)0, cfile);
|
- token = next_token (&val, (unsigned *)0, cfile);
|
||||||
@ -179,14 +179,14 @@ diff -up dhcp-4.2.0/common/parse.c.parse_date dhcp-4.2.0/common/parse.c
|
|||||||
return (TIME)0;
|
return (TIME)0;
|
||||||
}
|
}
|
||||||
+ next_token(&val, (unsigned *)0, cfile); /* consume Second */
|
+ next_token(&val, (unsigned *)0, cfile); /* consume Second */
|
||||||
sec = atoi (val);
|
sec = atol (val);
|
||||||
|
|
||||||
+ tzoff = 0;
|
+ tzoff = 0;
|
||||||
token = peek_token (&val, (unsigned *)0, cfile);
|
token = peek_token (&val, (unsigned *)0, cfile);
|
||||||
if (token == NUMBER) {
|
if (token == NUMBER) {
|
||||||
- token = next_token (&val, (unsigned *)0, cfile);
|
- token = next_token (&val, (unsigned *)0, cfile);
|
||||||
+ next_token (&val, (unsigned *)0, cfile); /* consume tzoff */
|
+ next_token (&val, (unsigned *)0, cfile); /* consume tzoff */
|
||||||
tzoff = atoi (val);
|
tzoff = atol (val);
|
||||||
- } else
|
- } else
|
||||||
- tzoff = 0;
|
- tzoff = 0;
|
||||||
+ } else if (token != SEMI) {
|
+ } else if (token != SEMI) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Summary: Dynamic host configuration protocol software
|
Summary: Dynamic host configuration protocol software
|
||||||
Name: dhcp
|
Name: dhcp
|
||||||
Version: 4.2.0
|
Version: 4.2.0
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
|
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
|
||||||
# dcantrell maintaining the package) made incorrect use of the epoch and
|
# dcantrell maintaining the package) made incorrect use of the epoch and
|
||||||
# that's why it is at 12 now. It should have never been used, but it was.
|
# that's why it is at 12 now. It should have never been used, but it was.
|
||||||
@ -510,6 +510,9 @@ fi
|
|||||||
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
|
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 1 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-5
|
||||||
|
- Fix parsing of lease file dates & times on 64-bit platforms (#628258)
|
||||||
|
|
||||||
* Tue Aug 31 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-4
|
* Tue Aug 31 2010 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.0-4
|
||||||
- RFC 3442 - Classless Static Route Option for DHCPv4 (#516325)
|
- RFC 3442 - Classless Static Route Option for DHCPv4 (#516325)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user