aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-09-23 20:42:52 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-09-23 20:42:52 +0000
commit64fd771b149e643658983d30384fdd8e8d3c06d6 (patch)
tree0bc86fd00c6328943ecec3aea7a8f20cd2c7ebb6
parent9b6b11cf6cc3e0d3408aad96abaec98efb685122 (diff)
downloadfetchmail-64fd771b149e643658983d30384fdd8e8d3c06d6.tar.gz
fetchmail-64fd771b149e643658983d30384fdd8e8d3c06d6.tar.bz2
fetchmail-64fd771b149e643658983d30384fdd8e8d3c06d6.zip
Avoid spurious matches in the Received line.
svn path=/trunk/; revision=1393
-rw-r--r--NEWS5
-rw-r--r--driver.c10
2 files changed, 8 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 1a868697..b054a20a 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,11 @@
Release Notes:
------------------------------------------------------------------------------
+fetchmail-4.2.6 ()
+* Prevent bad matches on Received line due to hostnames ending "for" and "by".
+
+There are 284 people on the fetchmail-friends list.
+
fetchmail-4.2.5 (Mon Sep 22 23:38:46 EDT 1997)
* Greg Stark's patch for better autoconfiguration on mixed libc5/libc6 systems.
* We no longer mess with CFLAGS/LDFLAGS to get Kerberos support linked.
diff --git a/driver.c b/driver.c
index 3447c7ff..592272b1 100644
--- a/driver.c
+++ b/driver.c
@@ -303,7 +303,7 @@ struct idlist **xmit_names; /* list of recipient names parsed out */
static char *parse_received(struct query *ctl, char *bufp)
/* try to extract real addressee from the Received line */
{
- char *ok;
+ char *ok = (char *)NULL;
static char rbuf[HOSTLEN + USERNAMELEN + 4];
/*
@@ -314,9 +314,7 @@ static char *parse_received(struct query *ctl, char *bufp)
* address in the Received line. Sendmail itself only
* does this when the mail has a single recipient.
*/
- if ((ok = strstr(bufp, "by ")) == (char *)NULL)
- ok = (char *)NULL;
- else
+ if ((ok = strstr(bufp, "by ")) && isspace(ok[-1]))
{
char *sp, *tp;
@@ -335,10 +333,8 @@ static char *parse_received(struct query *ctl, char *bufp)
*/
if (!is_host_alias(rbuf, ctl))
ok = (char *)NULL;
- else if ((ok = strstr(sp, "for ")) != 0)
+ else if ((ok = strstr(sp, "for ")) && isspace(ok[-1]))
{
- char *sp, *tp;
-
tp = rbuf;
sp = ok + 4;
if (*sp == '<')