mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
bug fixes
This commit is contained in:
parent
248f46c5d3
commit
5911e300ff
12 changed files with 328 additions and 202 deletions
16
g10/keygen.c
16
g10/keygen.c
|
@ -519,6 +519,7 @@ ask_valid_days()
|
|||
if( !valid_days )
|
||||
tty_printf(_("Key does not expire at all\n"));
|
||||
else {
|
||||
/* print the date when the key expires */
|
||||
tty_printf(_("Key expires at %s\n"), strtimestamp(
|
||||
add_days_to_timestamp( make_timestamp(), valid_days )));
|
||||
}
|
||||
|
@ -534,6 +535,19 @@ ask_valid_days()
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
has_invalid_email_chars( const char *s )
|
||||
{
|
||||
for( ; *s; s++ ) {
|
||||
if( *s & 0x80 )
|
||||
return 1;
|
||||
if( !strchr("01234567890abcdefghijklmnopqrstuvwxyz_-.@", *s ) )
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
ask_user_id()
|
||||
{
|
||||
|
@ -573,7 +587,7 @@ ask_user_id()
|
|||
tty_kill_prompt();
|
||||
if( !*amail )
|
||||
break; /* no email address is okay */
|
||||
else if( strcspn( amail, "abcdefghijklmnopqrstuvwxyz_-.@" )
|
||||
else if( has_invalid_email_chars(amail)
|
||||
|| string_count_chr(amail,'@') != 1
|
||||
|| *amail == '@'
|
||||
|| amail[strlen(amail)-1] == '@'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue