diff options
Diffstat (limited to 'g10/keygen.c')
-rw-r--r-- | g10/keygen.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/g10/keygen.c b/g10/keygen.c index b79f9b9ea..a16846dd8 100644 --- a/g10/keygen.c +++ b/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] == '@' |