mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Allow to specify seconds since Epoch beyond 2038.
* g10/keygen.c (parse_expire_string_with_ct): Use new function scan_secondsstr. (parse_creation_string): Ditto. -- Noet that we cap the seconds at the year 2106. GnuPG-bug-id: 6736
This commit is contained in:
parent
a17363e992
commit
606933dfb4
13
g10/keygen.c
13
g10/keygen.c
@ -2759,14 +2759,21 @@ parse_expire_string_with_ct (const char *string, u32 creation_time)
|
|||||||
|| !strcmp (string, "never") || !strcmp (string, "-"))
|
|| !strcmp (string, "never") || !strcmp (string, "-"))
|
||||||
seconds = 0;
|
seconds = 0;
|
||||||
else if (!strncmp (string, "seconds=", 8))
|
else if (!strncmp (string, "seconds=", 8))
|
||||||
seconds = atoi (string+8);
|
seconds = scan_secondsstr (string+8);
|
||||||
else if ((abs_date = scan_isodatestr(string))
|
else if ((abs_date = scan_isodatestr(string))
|
||||||
&& (abs_date+86400/2) > curtime)
|
&& (abs_date+86400/2) > curtime)
|
||||||
seconds = (abs_date+86400/2) - curtime;
|
seconds = (abs_date+86400/2) - curtime;
|
||||||
else if ((tt = isotime2epoch (string)) != (time_t)(-1))
|
else if ((tt = isotime2epoch (string)) != (time_t)(-1))
|
||||||
seconds = (u32)tt - curtime;
|
seconds = (u32)tt - curtime;
|
||||||
else if ((mult = check_valid_days (string)))
|
else if ((mult = check_valid_days (string)))
|
||||||
seconds = atoi (string) * 86400L * mult;
|
{
|
||||||
|
uint64_t tmp64;
|
||||||
|
tmp64 = scan_secondsstr (string) * 86400L * mult;
|
||||||
|
if (tmp64 >= (u32)(-1))
|
||||||
|
seconds = (u32)(-1) - 1; /* cap value. */
|
||||||
|
else
|
||||||
|
seconds = (u32)tmp64;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
seconds = (u32)(-1);
|
seconds = (u32)(-1);
|
||||||
|
|
||||||
@ -2790,7 +2797,7 @@ parse_creation_string (const char *string)
|
|||||||
if (!*string)
|
if (!*string)
|
||||||
seconds = 0;
|
seconds = 0;
|
||||||
else if ( !strncmp (string, "seconds=", 8) )
|
else if ( !strncmp (string, "seconds=", 8) )
|
||||||
seconds = atoi (string+8);
|
seconds = scan_secondsstr (string+8);
|
||||||
else if ( !(seconds = scan_isodatestr (string)))
|
else if ( !(seconds = scan_isodatestr (string)))
|
||||||
{
|
{
|
||||||
time_t tmp = isotime2epoch (string);
|
time_t tmp = isotime2epoch (string);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user