Print this page
XXXX update sendmail to 8.14.9
*** 1,7 ****
/*
! * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
--- 1,7 ----
/*
! * Copyright (c) 1998-2006, 2008 Proofpoint, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
*** 11,21 ****
*
*/
#include <sendmail.h>
! SM_RCSID("@(#)$Id: collect.c,v 8.284 2008/08/06 05:26:24 ca Exp $")
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
static SM_FILE_T *collect_dfopen __P((ENVELOPE *));
static SM_FILE_T *collect_eoh __P((ENVELOPE *, int, int));
--- 11,21 ----
*
*/
#include <sendmail.h>
! SM_RCSID("@(#)$Id: collect.c,v 8.287 2013-11-22 20:51:55 ca Exp $")
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
static SM_FILE_T *collect_dfopen __P((ENVELOPE *));
static SM_FILE_T *collect_eoh __P((ENVELOPE *, int, int));
*** 298,307 ****
--- 298,310 ----
int numhdrs;
int afd;
unsigned char *pbp;
unsigned char peekbuf[8];
char bufbuf[MAXLINE];
+ #if _FFR_REJECT_NUL_BYTE
+ bool hasNUL; /* has at least one NUL input byte */
+ #endif /* _FFR_REJECT_NUL_BYTE */
df = NULL;
ignrdot = smtpmode ? false : IgnrDot;
/* timeout for I/O functions is in milliseconds */
*** 313,322 ****
--- 316,328 ----
inputerr = false;
headeronly = hdrp != NULL;
hdrslen = 0;
numhdrs = 0;
HasEightBits = false;
+ #if _FFR_REJECT_NUL_BYTE
+ hasNUL = false;
+ #endif /* _FFR_REJECT_NUL_BYTE */
buf = bp = bufbuf;
buflen = sizeof(bufbuf);
pbp = peekbuf;
istate = IS_BOL;
mstate = SaveFrom ? MS_HEADER : MS_UFROM;
*** 401,410 ****
--- 407,420 ----
else
(void) sm_io_putc(TrafficLogFile,
SM_TIME_DEFAULT,
c);
}
+ #if _FFR_REJECT_NUL_BYTE
+ if (c == '\0')
+ hasNUL = true;
+ #endif /* _FFR_REJECT_NUL_BYTE */
if (c == SM_IO_EOF)
goto readerr;
if (SevenBitInput)
c &= 0x7f;
else
*** 867,877 ****
"552 Message exceeds maximum fixed size (%ld)",
MaxMessageSize);
if (LogLevel > 6)
sm_syslog(LOG_NOTICE, e->e_id,
"message size (%ld) exceeds maximum (%ld)",
! e->e_msgsize, MaxMessageSize);
}
}
/* check for illegal 8-bit data */
if (HasEightBits)
--- 877,888 ----
"552 Message exceeds maximum fixed size (%ld)",
MaxMessageSize);
if (LogLevel > 6)
sm_syslog(LOG_NOTICE, e->e_id,
"message size (%ld) exceeds maximum (%ld)",
! PRT_NONNEGL(e->e_msgsize),
! MaxMessageSize);
}
}
/* check for illegal 8-bit data */
if (HasEightBits)
*** 890,899 ****
--- 901,918 ----
if (e->e_bodytype != NULL &&
sm_strcasecmp(e->e_bodytype, "8BITMIME") == 0)
e->e_bodytype = "7BIT";
}
+ #if _FFR_REJECT_NUL_BYTE
+ if (hasNUL && RejectNUL)
+ {
+ e->e_status = "5.6.1";
+ usrerrenh(e->e_status, "554 NUL byte not allowed");
+ }
+ #endif /* _FFR_REJECT_NUL_BYTE */
+
if (SuperSafe == SAFE_REALLY && !bitset(EF_FATALERRS, e->e_flags))
{
char *dfname = queuename(e, DATAFL_LETTER);
if ((e->e_dfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT, dfname,
SM_IO_RDONLY_B, NULL)) == NULL)