diff --exclude=CVS --exclude=.#* --exclude=*.patch --exclude=*.orig -ruN cyrus-imapd/imap/message.c cyrus-imapd.8bit/imap/message.c --- cyrus-imapd/imap/message.c Tue Jan 2 16:20:30 2001 +++ cyrus-imapd.8bit/imap/message.c Tue Jan 2 16:17:12 2001 @@ -225,10 +225,11 @@ { char buf[4096+1]; unsigned char *p; - int r = 0; - int n; + int r = 0, b = 0; + int n, i; int sawcr = 0, sawnl; int reject8bit = config_getswitch("reject8bit", 0); + int mask8bitchar = config_getswitch("mask8bit", 1); int inheader = 1, blankline = 1; while (size) { @@ -242,6 +243,24 @@ if (n != strlen(buf)) r = IMAP_MESSAGE_CONTAINSNULL; size -= n; + i = 0; + + /* Skip over UNIX From line -- dustin sallings */ + if(b++ == 0 && (strncmp(buf, "From ", 5) == 0) ) + { + syslog(LOG_INFO, "Message contains UNIX From line"); + for (i = 0; buf[i] && buf[i] != '\n' && buf[i] != '\r'; i++); + if (buf[i]) { + for(; buf[i] && buf[i] == '\n' || buf[i] == '\r'; i++); + /* if (buf[i] == NULL) */ + if (buf[i] == '\0') + continue; /* Get the next thing */ + } + else { + r=IMAP_MESSAGE_CONTAINSNULL; + } + } + if (r) continue; for (p = (unsigned char *)buf; *p; p++) { @@ -264,7 +283,7 @@ /* We have been configured to reject all mail of this form. */ if (!r) r = IMAP_MESSAGE_CONTAINS8BIT; - } else { + } else if (mask8bitchar) { /* We have been configured to munge all mail of this form. */ *p = 'X'; @@ -273,7 +292,8 @@ } } - fwrite(buf, 1, n, to); + /* i will be zero here unless there was a UNIX From line */ + fwrite(buf, 1, n-i, to); } if (r) return r; diff --exclude=CVS --exclude=.#* --exclude=*.patch --exclude=*.orig -ruN cyrus-imapd/man/deliver.8 cyrus-imapd.8bit/man/deliver.8 --- cyrus-imapd/man/deliver.8 Fri Feb 23 12:41:32 2001 +++ cyrus-imapd.8bit/man/deliver.8 Fri Mar 9 12:06:09 2001 @@ -146,8 +146,10 @@ Accept messages using the LMTP protocol. .SH NOTES Depending on the setting of \fBreject8bit\fR in \fBimapd.conf(5)\fR, deliver -either rejects messages with 8-bit-set characters in the headers or -changes these characters to `X'. +either rejects/accepts messages with 8-bit-set characters in the headers. +If we accept messages with 8-bit-set characters in the headers, then depending +on the setting of \fBmask8bit\fR, these characters are either left un-touched +or changed to `X'. This is because such characters can't be interpreted since the character set is not known, although some communities not well-served by US-ASCII assume that those characters can be used to represent characters not diff --exclude=CVS --exclude=.#* --exclude=*.patch --exclude=*.orig -ruN cyrus-imapd/man/imapd.conf.5 cyrus-imapd.8bit/man/imapd.conf.5 --- cyrus-imapd/man/imapd.conf.5 Thu Sep 27 12:42:06 2001 +++ cyrus-imapd.8bit/man/imapd.conf.5 Mon Oct 1 13:16:55 2001 @@ -187,8 +187,11 @@ savings. .IP "\fBreject8bit:\fR no" 5 If enabled, lmtpd rejects messages with 8-bit characters in the headers. -Otherwise, 8-bit characters are changed to `X'. (A proper soultion to -non-ASCII characters in headers is offered by RFC 2047 and its predecessors.) +.IP "\fBmask8bit:\fR yes" 5 +If enabled, lmtpd masks messages with 8-bit characters. These characters +are changed to `X'. If \fBreject8bit\fR is enabled, setting \fBmask8bit\fR +has no effect. (A proper soultion to non-ASCII characters in headers is +offered by RFC 2047 and its predecessors.) .IP "\fBmaxmessagesize:\fR " 5 Maximum incoming LMTP message size. If set, lmtpd will reject messages larger than \fImaxmessagesize\fR bytes. The default