]> Pileus Git - ~andy/fetchmail/commitdiff
Fix the Sender problem.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 12 May 2001 07:18:55 +0000 (07:18 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 12 May 2001 07:18:55 +0000 (07:18 -0000)
svn path=/trunk/; revision=3307

NEWS
driver.c
fetchmail.man

diff --git a/NEWS b/NEWS
index 1559a7663e7c31b18572c89401842641863b5bb7..3799c93758eb8684f4b6483403507d55def6bf28 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@
 * GCC warning cleanups from ahaas@neosoft.com.
 * Plug another hole that was letting zombies through.
 * SA_RESDTART portability fix for SunOS.
+* Ignore Sender and Resent-Sender headers unless they contain @.
 
 fetchmail-5.8.2 (Tue May  8 17:07:53 EDT 2001), 20481 lines:
 
index 4038b484edfce9061d1c73e0b43710c5a34b409d..11338f77860ec1e3fbeec5aed7af070a4ddc96d3 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -760,9 +760,27 @@ static int readheaders(int sock,
            resent_from_offs = (line - msgblk.headers);
        else if (!strncasecmp("Apparently-From:", line, 16))
            app_from_offs = (line - msgblk.headers);
-       else if (!strncasecmp("Sender:", line, 7))
+       /*
+        * Netscape 4.7 puts "Sender: zap" in mail headers.  Perverse...
+        *
+        * But a literal reading of RFC822 sec. 4.4.2 supports the idea
+        * that Sender: *doesn't* have to be a working email address.
+        *
+        * The definition of the Sender header in RFC822 says, in
+        * part, "The Sender mailbox specification includes a word
+        * sequence which must correspond to a specific agent (i.e., a
+        * human user or a computer program) rather than a standard
+        * address."  That implies that the contents of the Sender
+        * field don't need to be a legal email address at all So
+        * ignore any Sender or Resent-Semnder lines unless they
+        * contain @.
+        *
+        * (RFC2822 says the condents of Sender must be a valid mailbox
+        * address, which is also what RFC822 4.4.4 implies.)
+        */
+       else if (!strncasecmp("Sender:", line, 7) && strchr(line, '@'))
            sender_offs = (line - msgblk.headers);
-       else if (!strncasecmp("Resent-Sender:", line, 14))
+       else if (!strncasecmp("Resent-Sender:", line, 14) && strchr(line, '@'))
            resent_sender_offs = (line - msgblk.headers);
 
 #ifdef __UNUSED__
index ad6ab70f5586002c430e39e55cb7e16cec127673..cc7e46a2c9f1a24cdae6732df338bba3ce372e33 100644 (file)
@@ -1633,8 +1633,8 @@ When trying to determine the originating address of a message,
 fetchmail looks through headers in the following order: 
 
         Return-Path:
-        Resent-Sender:
-        Sender:
+        Resent-Sender: (ignored if it doesn't contain an @)
+        Sender: (ignored if it doesn't contain an @)
         Resent-From:
         From:
         Reply-To: