email check not rfc 822 compliant
5468696A6D656E
thijmen at xs4all.nl
Sat Nov 16 18:39:01 CET 2002
The email check is not fully rfc 822 compliant.
When i try to enter the email address:
"this is a valid email address"@gnupg.org or
"this is an valid email"."using quoted strings"@gnupg.org
it says it's invalid.
I've changed the appropriate routine like this:
static int
has_invalid_email_chars( const char *s )
{
int at_seen=0;
int quoted=0;
static char valid_chars[] = "01234567890_-."
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for( ; *s; s++ ) {
if( *s & 0x80 )
return 1;
if(!quoted && *s == '@' )
at_seen=1;
else if( !at_seen && !quoted && *s == '\"')
quoted = 1;
else if( !at_seen && quoted && *s == '\"')
{
quoted = 0;//end of quoted string, next char *should* be a @ or .
if (strlen(s) < 2 || (s[1] != '@' && s[1] != '.' ))
return 1;
}
else if( !at_seen && !quoted && !( !!strchr( valid_chars, *s ) || *s == '+' ) )
return 1;
else if( at_seen && !strchr( valid_chars, *s ) )
return 1;
}
return 0;
}
More information about the Gnupg-devel
mailing list