diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 4 | ||||
-rw-r--r-- | g10/keygen.c | 16 |
2 files changed, 19 insertions, 1 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 1e110efe4..e7e9ac753 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +Fri Jun 26 10:37:35 1998 Werner Koch ([email protected]) + + * keygen.c (has_invalid_email_chars): New. + Wed Jun 24 16:40:22 1998 Werner Koch ([email protected]) * armor.c (armor_filter): Now creates valid onepass_sig packets 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] == '@' |