aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-09-19 23:10:18 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-09-19 23:10:18 +0000
commit7052f7f510a90d1cce53bb1541ef99d092033503 (patch)
treef4d424d33990112216de891e78e6276ffd9b19d2
parent0dc147c15f787f2e381594b96e842d226504bfa4 (diff)
downloadfetchmail-7052f7f510a90d1cce53bb1541ef99d092033503.tar.gz
fetchmail-7052f7f510a90d1cce53bb1541ef99d092033503.tar.bz2
fetchmail-7052f7f510a90d1cce53bb1541ef99d092033503.zip
Alexander Kourakos's patch to improve rewriting.
svn path=/trunk/; revision=1376
-rw-r--r--NEWS1
-rw-r--r--rfc822.c40
2 files changed, 28 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index a449b069..0b906115 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@
fetchmail-4.2.4 (Thu Sep 18 16:19:10 EDT 1997)
* Small compilation cleanups, thanks to Florian laRoche.
* Removed the length consistency check, it mysteriously fails under POP3.
+* Added Alexander Kourakos's patch to improve address rewriting.
fetchmail-4.2.3 (Thu Sep 18 16:19:10 EDT 1997)
* Fix a bug in IMAP message-size retrieval.
diff --git a/rfc822.c b/rfc822.c
index b6103c8c..5e9e2da5 100644
--- a/rfc822.c
+++ b/rfc822.c
@@ -74,11 +74,14 @@ const char *host; /* server hostname */
* an obscure misfeature described in sections
* 6.1, 6.2.6, and A.1.5 of the RFC822 standard.
*/
- else if ((*from == ',' || HEADER_END(from)) && has_bare_name_part && !has_host_part && from[-1] != ';')
+ else if ((*from == ',' || HEADER_END(from) || from[1] == '(')
+ && has_bare_name_part
+ && !has_host_part
+ && from[-1] != ';')
{
int hostlen;
- while (isspace(*from))
+ while (isspace(*from) || (*from == ','))
--from;
from++;
hostlen = strlen(host);
@@ -86,7 +89,7 @@ const char *host; /* server hostname */
cp[hostlen+1] = *cp;
*from++ = '@';
memcpy(from, host, hostlen);
- from += strlen(from);
+ from += hostlen;
has_host_part = TRUE;
}
else if (!isspace(*from))
@@ -101,20 +104,31 @@ const char *host; /* server hostname */
case 3: /* we're in a <>-enclosed address */
if (*from == '@')
has_host_part = TRUE;
- else if (*from == '>' && !has_host_part)
+ else if (*from == '>')
{
- int hostlen;
-
- hostlen = strlen(host);
- for (cp = from + strlen(from); cp >= from; --cp)
- cp[hostlen+1] = *cp;
- *from++ = '@';
- memcpy(from, host, hostlen);
- from += strlen(from);
- has_host_part = TRUE;
+ state = 1;
+ if (!has_host_part)
+ {
+ int hostlen;
+
+ hostlen = strlen(host);
+ for (cp = from + strlen(from); cp >= from; --cp)
+ cp[hostlen+1] = *cp;
+ *from++ = '@';
+ memcpy(from, host, hostlen);
+ from += hostlen;
+ has_host_part = TRUE;
+ }
}
break;
}
+
+ /*
+ * If we passed a comma, reset everything.
+ */
+ if (from[-1] == ',' && !parendepth) {
+ has_host_part = has_bare_name_part = FALSE;
+ }
}
}