diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-09-23 15:55:06 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-09-23 15:55:06 +0000 |
commit | 5e1a3ffecfb86e42d37a62a28d936554577ed1dd (patch) | |
tree | a943c2e11fb986ea24af706427d4ea1af1920e4a /driver.c | |
parent | 4461170609dfd3a5413fb450a1fa5a6d02699d11 (diff) | |
download | fetchmail-5e1a3ffecfb86e42d37a62a28d936554577ed1dd.tar.gz fetchmail-5e1a3ffecfb86e42d37a62a28d936554577ed1dd.tar.bz2 fetchmail-5e1a3ffecfb86e42d37a62a28d936554577ed1dd.zip |
Handle RFC822 continuation.
svn path=/trunk/; revision=108
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -417,8 +417,9 @@ const char *host; /********************************************************************* function: nxtaddr description: Parse addresses in succession out of a specified RFC822 - header. Note: RFC822 escaping with \ is *not* handled. - + header. Note 1: RFC822 escaping with \ is *not* handled. + Note 2: it is important that this routine not stop on \r, + since we use \r as a marker for RFC822 continuations below. arguments: hdr header line to be parsed, NUL to continue in previous hdr @@ -615,8 +616,18 @@ int rewrite; } else { - int newlen = oldlen + strlen(bufp); + int newlen; + /* + * We deal with RFC822 continuation lines here. + * Replace previous '\n' with '\r' so nxtaddr + * and reply-hack will be able to see past it. + * We'll undo this before writing the header. + */ + if (isspace(bufp[0])) + headers[oldlen-1] = '\r'; + + newlen = oldlen + strlen(bufp); headers = realloc(headers, newlen + 1); if (headers == NULL) return(PS_IOERR); @@ -709,6 +720,11 @@ int rewrite; break; } + /* change continuation markers back to regular newlines */ + for (cp = headers; cp < headers + oldlen; cp++) + if (*cp == '\r') + *cp = '\n'; + if (write(mboxfd,headers,oldlen) < 0) { free(headers); |