fetchmail-friends
[Top] [All Lists]

[fetchmail]Fix for 5.8.17 "strips space from address", found one more bug.

2001-08-09 13:04:09
First, I found a po/fr.po.orig file in my fetchmail-5.8.17 tarball. I
believe it's not supposed to be there in 5.9.0. rm is your friend ;-)



On Tue, 07 Aug 2001, Eric S. Raymond wrote in response to my bug report:

Problem #3: fetchmail doesn't cope with spaces in user names (multi-drop)

No joy on this one.  I looked, but I can't find where those spaces are 
removed. If you can reproduce this, please go in with gdb and pin down
where it's happening.

I believe I killed that bug. I tried (1) 'emma 2(_at_)test(_dot_)domain' and
(2) '"emma 2"@test.domain' which qmail-send mapped to

        (1) Delivered-To: testbaer-emma 2(_at_)test(_dot_)domain

        (2) Delivered-To: testbaer-"emma 2"@test.domain

respectively. While (1) may be broken and is untouched by my bugfix, 
(2) should be ok for our purposes.

It turns out that nxtaddr() (rfc822.c, ll. 198ff.) goes to BARE_ADDRESS
state and doesn't recognize the quote marks within the address; and
BARE_ADDRESS skips blanks (l. 318), but doesn't recognize DQUOT:

   313              else if (*hp == '<')        /* beginning of real address */
   314              {
   315                  state = INSIDE_BRACKETS;
   316                  tp = 0;
   317              }
 318              else if (!isspace(*hp))     /* just take it, ignoring 
whitespace */
   319                  address[NEXTTP()] = *hp;
   320              break;
   321
   322          case INSIDE_DQUOTE:     /* we're in a quoted string, copy 
verbatim */
   323              if (*hp != '"')

I am attaching a fix for addresses in (2) style below. As I'm not sure
about (1), it doesn't change that behaviour as I fear I'd break too many
other places I don't oversee.

Please consider this patch (against 5.8.17):

--- ./rfc822.c.orig     Thu Aug  9 21:47:34 2001
+++ ./rfc822.c  Thu Aug  9 21:49:36 2001
@@ -315,6 +315,12 @@
                state = INSIDE_BRACKETS;
                tp = 0;
            }
+           else if (*hp == '"')        /* quoted word, copy verbatim */
+           {
+               oldstate = state;
+               state = INSIDE_DQUOTE;
+                address[NEXTTP()] = *hp;
+            }
            else if (!isspace(*hp))     /* just take it, ignoring whitespace */
                address[NEXTTP()] = *hp;
            break;