mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-25 22:19:59 +01:00
gpg: Allow expiration time after 2013-01-19 on 32 bit Windows.
* g10/keygen.c (parse_expire_string): Use isotime2epoch_u64. (parse_creation_string): Ditto. -- GnuPG-bug-id: 6736
This commit is contained in:
parent
bb70089d57
commit
5da8fe1c40
25
g10/keygen.c
25
g10/keygen.c
@ -2679,13 +2679,14 @@ ask_curve (int *algo, int *subkey_algo, const char *current)
|
||||
* similar.
|
||||
*/
|
||||
u32
|
||||
parse_expire_string( const char *string )
|
||||
parse_expire_string (const char *string)
|
||||
{
|
||||
int mult;
|
||||
u32 seconds;
|
||||
u32 abs_date = 0;
|
||||
u32 curtime = make_timestamp ();
|
||||
time_t tt;
|
||||
uint64_t tt;
|
||||
uint64_t tmp64;
|
||||
|
||||
if (!string || !*string || !strcmp (string, "none")
|
||||
|| !strcmp (string, "never") || !strcmp (string, "-"))
|
||||
@ -2695,11 +2696,16 @@ parse_expire_string( const char *string )
|
||||
else if ((abs_date = scan_isodatestr(string))
|
||||
&& (abs_date+86400/2) > curtime)
|
||||
seconds = (abs_date+86400/2) - curtime;
|
||||
else if ((tt = isotime2epoch (string)) != (time_t)(-1))
|
||||
seconds = (u32)tt - curtime;
|
||||
else if ((tt = isotime2epoch_u64 (string)) != (uint64_t)(-1))
|
||||
{
|
||||
tmp64 = tt - curtime;
|
||||
if (tmp64 >= (u32)(-1))
|
||||
seconds = (u32)(-1) - 1; /* cap value. */
|
||||
else
|
||||
seconds = (u32)tmp64;
|
||||
}
|
||||
else if ((mult = check_valid_days (string)))
|
||||
{
|
||||
uint64_t tmp64;
|
||||
tmp64 = scan_secondsstr (string) * 86400L * mult;
|
||||
if (tmp64 >= (u32)(-1))
|
||||
seconds = (u32)(-1) - 1; /* cap value. */
|
||||
@ -2725,8 +2731,13 @@ parse_creation_string (const char *string)
|
||||
seconds = scan_secondsstr (string+8);
|
||||
else if ( !(seconds = scan_isodatestr (string)))
|
||||
{
|
||||
time_t tmp = isotime2epoch (string);
|
||||
seconds = (tmp == (time_t)(-1))? 0 : tmp;
|
||||
uint64_t tmp = isotime2epoch_u64 (string);
|
||||
if (tmp == (uint64_t)(-1))
|
||||
seconds = 0;
|
||||
else if (tmp > (u32)(-1))
|
||||
seconds = 0;
|
||||
else
|
||||
seconds = tmp;
|
||||
}
|
||||
return seconds;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user