diff -ur sendmail-8.13.2-orig/sendmail/conf.c sendmail-8.13.2-multiline/sendmail/conf.c --- sendmail-8.13.2-orig/sendmail/conf.c 2004-10-06 17:36:06.000000000 -0400 +++ sendmail-8.13.2-multiline/sendmail/conf.c 2004-12-16 12:28:15.000000000 -0500 @@ -6027,6 +6027,10 @@ /* CRLPath; needs documentation; Al Smith */ "_FFR_CRLPATH", #endif /* _FFR_CRLPATH */ +#if _FFR_MULTILINE_ERRORS + /* Multiline error processing */ + "_FFR_MULTILINE_ERRORS", +#endif /* _FFR_MULTINELINE_ERRORS */ #if _FFR_DAEMON_NETUNIX /* Allow local (not just TCP) socket connection to server. */ "_FFR_DAEMON_NETUNIX", diff -ur sendmail-8.13.2-orig/sendmail/conf.h sendmail-8.13.2-multiline/sendmail/conf.h --- sendmail-8.13.2-orig/sendmail/conf.h 2004-07-23 16:45:01.000000000 -0400 +++ sendmail-8.13.2-multiline/sendmail/conf.h 2004-12-16 12:28:15.000000000 -0500 @@ -60,7 +60,7 @@ **********************************************************************/ #define MAXLINE 2048 /* max line length */ -#define MAXNAME 256 /* max length of a name */ +#define MAXNAME 256*10 /* max length of a name */ #ifndef MAXAUTHINFO # define MAXAUTHINFO 100 /* max length of authinfo token */ #endif /* ! MAXAUTHINFO */ diff -ur sendmail-8.13.2-orig/sendmail/err.c sendmail-8.13.2-multiline/sendmail/err.c --- sendmail-8.13.2-orig/sendmail/err.c 2003-01-09 21:16:46.000000000 -0500 +++ sendmail-8.13.2-multiline/sendmail/err.c 2004-12-16 12:50:40.000000000 -0500 @@ -620,11 +620,73 @@ /* if DisConnected, OutChannel now points to the transcript */ if (!DisConnected && (OpMode == MD_SMTP || OpMode == MD_DAEMON || OpMode == MD_ARPAFTP)) +#if _FFR_MULTILINE_ERRORS + { + register char * msg2; + + if ((msg2 = strchr(msg, '\n')) && + !ISSMTPREPLY((msg2 + 1))) /* detect already multilined msg's */ + { + char msgcode[16]; + register char * msgbeg; + int errtxtoffset; + + errtxtoffset = ((int)(errtxt - msg) < sizeof msgcode - 2) ? + errtxt - msg : sizeof msgcode - 2; + msgbeg = msg + errtxtoffset; + if (errtxtoffset) + { + sm_strlcpy(msgcode, msg, errtxtoffset); + msgcode[errtxtoffset - 1] = msg[errtxtoffset - 1]; + } + msgcode[errtxtoffset] = '\0'; + + do + { + if (msg2 || (msg2 = strchr(msgbeg, '\n'))) + *msg2 = '\0'; + + if(!msg2 || !*(msg2+1)) + msgcode[3] = msg[3]; + else + msgcode[3] = '-'; + + (void) sm_io_fprintf(OutChannel, SM_TIME_DEFAULT, "%s%s\r\n", + msgcode, msgbeg); + if (msg2) + { + *msg2 = ' '; + msgbeg = msg2 + 1; + msg2 = NULL; /* needed */ + } + else + break; + + } while (msgbeg && *msgbeg); + } + else + (void) sm_io_fprintf(OutChannel, SM_TIME_DEFAULT, "%s\r\n", + msg); + } + else + { + register int i = 0; + while (msg[i]) + { + if(msg[i] == '\n') + msg[i] = ' '; + i++; + } + (void) sm_io_fprintf(OutChannel, SM_TIME_DEFAULT, "%s\n", + errtxt); + } +#else (void) sm_io_fprintf(OutChannel, SM_TIME_DEFAULT, "%s\r\n", msg); else (void) sm_io_fprintf(OutChannel, SM_TIME_DEFAULT, "%s\n", errtxt); +#endif /* _FFR_MULTILINE_ERRORS */ if (TrafficLogFile != NULL) (void) sm_io_fprintf(TrafficLogFile, SM_TIME_DEFAULT, "%05d >>> %s\n", (int) CurrentPid, diff -ur sendmail-8.13.2-orig/sendmail/parseaddr.c sendmail-8.13.2-multiline/sendmail/parseaddr.c --- sendmail-8.13.2-orig/sendmail/parseaddr.c 2004-08-06 18:19:36.000000000 -0400 +++ sendmail-8.13.2-multiline/sendmail/parseaddr.c 2004-12-16 12:28:15.000000000 -0500 @@ -2007,7 +2007,11 @@ a->q_host = NULL; setstat(EX_UNAVAILABLE); } +#if _FFR_MULTILINE_ERRORS + convnlstring(ubuf); +#endif /* _FFR_MULTILINE_ERRORS */ stripquotes(ubuf); + if (ISSMTPCODE(ubuf) && ubuf[3] == ' ') { char fmt[16]; diff -ur sendmail-8.13.2-orig/sendmail/sendmail.h sendmail-8.13.2-multiline/sendmail/sendmail.h --- sendmail-8.13.2-orig/sendmail/sendmail.h 2004-11-09 14:45:46.000000000 -0500 +++ sendmail-8.13.2-multiline/sendmail/sendmail.h 2004-12-16 12:28:15.000000000 -0500 @@ -2451,6 +2451,9 @@ extern time_t curtime __P((void)); extern char *defcharset __P((ENVELOPE *)); extern char *denlstring __P((char *, bool, bool)); +#if _FFR_MULTILINE_ERRORS +extern void convnlstring __P((char *)); +#endif /* _FFR_MULTILINE_ERRORS */ extern void dferror __P((SM_FILE_T *volatile, char *, ENVELOPE *)); extern void disconnect __P((int, ENVELOPE *)); #if _FFR_CONTROL_MSTAT diff -ur sendmail-8.13.2-orig/sendmail/util.c sendmail-8.13.2-multiline/sendmail/util.c --- sendmail-8.13.2-orig/sendmail/util.c 2004-08-02 14:50:59.000000000 -0400 +++ sendmail-8.13.2-multiline/sendmail/util.c 2004-12-16 12:28:15.000000000 -0500 @@ -2325,6 +2325,57 @@ return bp; } +#if _FFR_MULTILINE_ERRORS +/* +** CONVNLSTRING -- Convert "\n" in string to '\n'. This is done in place. +** +** Parameters: +** s -- string +** +** Returns: +** +** nothing +** +** Side effects: +** s now contains unquoted newline charachters +** +*/ +void +convnlstring(s) + char *s; +{ + register char *p; + register char *q; + register char c; + register int in_esc = false; + + if (s == NULL) + return; + + p = q = s; + do + { + c = *p++; + if (c == '\\' && !in_esc) + { + if ( *p == 'n') + { + c = '\n'; + p++; + } + else if (*p == '\\') + { + in_esc = true; + } + } + else + in_esc = false; + + *q++ = c; + } while (c != '\0'); +} +#endif /* _FFR_MULTILINE_ERRORS */ + /* ** STRREPLNONPRT -- replace "unprintable" characters in a string with subst **