diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1999-10-03 12:36:26 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1999-10-03 12:36:26 +0000 |
commit | 1f1fc6c50f0b0087f02ba952e673f5977d61ab41 (patch) | |
tree | 9b74eb9f06c5528da958914dd3adf776c101bc06 /driver.c | |
parent | 84bc861ea542c95bedf07c317f793c9ba0be3414 (diff) | |
download | fetchmail-1f1fc6c50f0b0087f02ba952e673f5977d61ab41.tar.gz fetchmail-1f1fc6c50f0b0087f02ba952e673f5977d61ab41.tar.bz2 fetchmail-1f1fc6c50f0b0087f02ba952e673f5977d61ab41.zip |
Address Mark BBurton's problem.
svn path=/trunk/; revision=2633
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -230,6 +230,19 @@ static void find_server_names(const char *hdr, } } +/* + * Return zero on a syntactically invalid address, nz on a valid one. + * + * This used to be strchr(a, '.'), but it turns out that lines like this + * + * Received: from punt-1.mail.demon.net by mailstore for markb@ordern.com + * id 938765929:10:27223:2; Fri, 01 Oct 99 08:18:49 GMT + * + * are not uncommon. So now we just check that the following token is + * not itself an email address. + */ +#define VALID_ADDRESS(a) !strchr(rbuf, '@') + static char *parse_received(struct query *ctl, char *bufp) /* try to extract real address from the Received line */ /* If a valid Received: line is found, we return the full address in @@ -254,7 +267,7 @@ static char *parse_received(struct query *ctl, char *bufp) if (outlevel >= O_DEBUG) report(stdout, _("analyzing Received line:\n%s"), bufp); - /* search for whitepace-surrounded "by" followed by xxxx.yyyy */ + /* search for whitepace-surrounded "by" followed by valid address */ for (base = bufp; ; base = ok + 2) { if (!(ok = strstr(base, "by"))) @@ -273,8 +286,8 @@ static char *parse_received(struct query *ctl, char *bufp) *tp++ = *sp; *tp = '\0'; - /* look for embedded periods */ - if (strchr(rbuf, '.')) + /* look for valid address */ + if (VALID_ADDRESS(rbuf)) break; else ok = sp - 1; /* arrange to skip this token */ |