Repair 8.11.2 merge conflicts

This commit is contained in:
Gregory Neil Shapiro 2001-01-21 22:21:43 +00:00
parent c0e6e8f8f8
commit c46d91b759
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71348
15 changed files with 225 additions and 144 deletions

View File

@ -8,17 +8,19 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: mail.local.8,v 8.14.14.3 2000/09/17 17:04:25 gshapiro Exp $
.\" $Id: mail.local.8,v 8.14.14.5 2000/12/29 18:12:16 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
.TH MAIL.LOCAL 8 "$Date: 2000/09/17 17:04:25 $"
.TH MAIL.LOCAL 8 "$Date: 2000/12/29 18:12:16 $"
.SH NAME
.B mail.local
mail.local
\- store mail in a mailbox
.SH SYNOPSIS
.B mail.local
.RB [ \-7 "] [" \-B "] [" \-b "] [" \-d "] [" \-l "] [" \-s "] [" \-f
.IR from "] "
.RB [ \-r
.IR from "] " "user ..."
.SH DESCRIPTION
.B Mail.local

View File

@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.37 2000/09/22 00:49:10 doug Exp $";
static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.39 2000/11/14 20:02:47 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -663,7 +663,7 @@ dolmtp(bouncequota)
printf("250 2.0.0 ok\r\n");
rset:
while (rcpt_num)
while (rcpt_num > 0)
free(rcpt_addr[--rcpt_num]);
if (return_path != NULL)
free(return_path);
@ -924,7 +924,7 @@ deliver(fd, name, bouncequota)
struct stat sb;
struct passwd *pw;
char path[MAXPATHLEN];
int mbfd, nr = 0, nw, off;
int mbfd = -1, nr = 0, nw, off;
char *p;
off_t curoff;
#ifdef CONTENTLENGTH

View File

@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
static char id[] = "@(#)$Id: makemap.c,v 8.135.4.11 2000/09/13 01:11:10 gshapiro Exp $";
static char id[] = "@(#)$Id: makemap.c,v 8.135.4.13 2000/10/05 23:00:50 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -357,7 +357,6 @@ main(argc, argv)
exitstat = EX_OK;
if (unmake)
{
bool stop;
errno = database->smdb_cursor(database, &cursor, 0);
if (errno != SMDBE_OK)
{
@ -371,20 +370,18 @@ main(argc, argv)
memset(&db_key, '\0', sizeof db_key);
memset(&db_val, '\0', sizeof db_val);
for (stop = FALSE, lineno = 0; !stop; lineno++)
for (lineno = 0; ; lineno++)
{
errno = cursor->smdbc_get(cursor, &db_key, &db_val,
SMDB_CURSOR_GET_NEXT);
if (errno != SMDBE_OK)
{
stop = TRUE;
}
if (!stop)
printf("%.*s\t%.*s\n",
(int) db_key.data.size,
(char *) db_key.data.data,
(int) db_val.data.size,
(char *)db_val.data.data);
break;
printf("%.*s\t%.*s\n",
(int) db_key.size,
(char *) db_key.data,
(int) db_val.size,
(char *)db_val.data);
}
(void) cursor->smdbc_close(cursor);
@ -431,16 +428,16 @@ main(argc, argv)
memset(&db_key, '\0', sizeof db_key);
memset(&db_val, '\0', sizeof db_val);
db_key.data.data = ibuf;
db_key.data = ibuf;
for (p = ibuf; *p != '\0' && !(ISSEP(*p)); p++)
{
if (foldcase && isascii(*p) && isupper(*p))
*p = tolower(*p);
}
db_key.data.size = p - ibuf;
db_key.size = p - ibuf;
if (inclnull)
db_key.data.size++;
db_key.size++;
if (*p != '\0')
*p++ = '\0';
@ -451,15 +448,15 @@ main(argc, argv)
fprintf(stderr,
"%s: %s: line %d: no RHS for LHS %s\n",
progname, mapname, lineno,
(char *) db_key.data.data);
(char *) db_key.data);
exitstat = EX_DATAERR;
continue;
}
db_val.data.data = p;
db_val.data.size = strlen(p);
db_val.data = p;
db_val.size = strlen(p);
if (inclnull)
db_val.data.size++;
db_val.size++;
/*
** Do the database insert.
@ -468,8 +465,8 @@ main(argc, argv)
if (verbose)
{
printf("key=`%s', val=`%s'\n",
(char *) db_key.data.data,
(char *) db_val.data.data);
(char *) db_key.data,
(char *) db_val.data);
}
errno = database->smdb_put(database, &db_key, &db_val,
@ -494,7 +491,7 @@ main(argc, argv)
fprintf(stderr,
"%s: %s: line %d: key %s: put error: %s\n",
progname, mapname, lineno,
(char *) db_key.data.data,
(char *) db_key.data,
errstring(errno));
exitstat = EX_IOERR;
}
@ -503,7 +500,7 @@ main(argc, argv)
fprintf(stderr,
"%s: %s: line %d: key %s: duplicate key\n",
progname, mapname,
lineno, (char *) db_key.data.data);
lineno, (char *) db_key.data);
exitstat = EX_DATAERR;
}
}

View File

@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
static char id[] = "@(#)$Id: praliases.c,v 8.59.4.10 2000/07/18 05:41:39 gshapiro Exp $";
static char id[] = "@(#)$Id: praliases.c,v 8.59.4.15 2000/10/24 00:42:59 geir Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -58,6 +58,8 @@ BITMAP256 DontBlameSendmail;
extern void syserr __P((const char *, ...));
# define DELIMITERS " ,/"
# define PATH_SEPARATOR ':'
int
main(argc, argv)
@ -172,7 +174,7 @@ main(argc, argv)
break;
b = p;
p = strpbrk(p, " ,/");
p = strpbrk(p, DELIMITERS);
/* find end of spec */
if (p != NULL)
@ -246,7 +248,7 @@ praliases(filename, argc, argv)
SMDB_DBPARAMS params;
SMDB_USER_INFO user_info;
colon = strchr(filename, ':');
colon = strchr(filename, PATH_SEPARATOR);
if (colon == NULL)
{
db_name = filename;
@ -264,6 +266,7 @@ praliases(filename, argc, argv)
{
while (isascii(*db_name) && isspace(*db_name))
db_name++;
if (*db_name != '-')
break;
while (*db_name != '\0' &&
@ -315,20 +318,20 @@ praliases(filename, argc, argv)
{
#if 0
/* skip magic @:@ entry */
if (db_key.data.size == 2 &&
db_key.data.data[0] == '@' &&
db_key.data.data[1] == '\0' &&
db_value.data.size == 2 &&
db_value.data.data[0] == '@' &&
db_value.data.data[1] == '\0')
if (db_key.size == 2 &&
db_key.data[0] == '@' &&
db_key.data[1] == '\0' &&
db_value.size == 2 &&
db_value.data[0] == '@' &&
db_value.data[1] == '\0')
continue;
#endif /* 0 */
printf("%.*s:%.*s\n",
(int) db_key.data.size,
(char *) db_key.data.data,
(int) db_value.data.size,
(char *) db_value.data.data);
(int) db_key.size,
(char *) db_key.data,
(int) db_value.size,
(char *) db_value.data);
}
if (result != SMDBE_OK && result != SMDBE_LAST_ENTRY)
@ -343,19 +346,19 @@ praliases(filename, argc, argv)
{
memset(&db_key, '\0', sizeof db_key);
memset(&db_value, '\0', sizeof db_value);
db_key.data.data = *argv;
db_key.data.size = strlen(*argv) + 1;
db_key.data = *argv;
db_key.size = strlen(*argv) + 1;
if (database->smdb_get(database, &db_key,
&db_value, 0) == SMDBE_OK)
{
printf("%.*s:%.*s\n",
(int) db_key.data.size,
(char *) db_key.data.data,
(int) db_value.data.size,
(char *) db_value.data.data);
(int) db_key.size,
(char *) db_key.data,
(int) db_value.size,
(char *) db_value.data);
}
else
printf("%s: No such key\n", (char *) db_key.data.data);
printf("%s: No such key\n", (char *) db_key.data);
}
fatal:

View File

@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
static char id[] = "@(#)$Id: rmail.c,v 8.39.4.8 2000/09/16 22:20:25 gshapiro Exp $";
static char id[] = "@(#)$Id: rmail.c,v 8.39.4.9 2000/11/17 08:42:56 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -313,12 +313,11 @@ main(argc, argv)
}
/* Allocate args (with room for sendmail args as well as recipients */
/* Allocate args (with room for sendmail args as well as recipients) */
args = (char **)xalloc(sizeof(*args) * (10 + argc));
i = 0;
args[i++] = _PATH_SENDMAIL; /* Build sendmail's argument list. */
args[i++] = "-G"; /* relay submission */
args[i++] = "-oee"; /* No errors, just status. */
#ifdef QUEUE_ONLY
args[i++] = "-odq"; /* Queue it, don't try to deliver. */

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
.\" Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1993 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1993
@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: smrsh.8,v 8.11 1999/06/09 16:51:07 ca Exp $
.\" $Id: smrsh.8,v 8.11.16.2 2000/12/15 19:50:46 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
.TH SMRSH 8 11/02/93
.TH SMRSH 8 "$Date: 2000/12/15 19:50:46 $"
.SH NAME
smrsh \- restricted shell for sendmail
.SH SYNOPSIS
@ -39,7 +39,8 @@ limits the set of programs that he or she can execute.
.PP
Briefly,
.I smrsh
limits programs to be in the directory
limits programs to be in a single directory,
by default
/usr/libexec/sm.bin,
allowing the system administrator to choose the set of acceptable commands,
and to the shell builtin commands ``exec'', ``exit'', and ``echo''.
@ -59,7 +60,7 @@ all actually forward to
``/usr/libexec/sm.bin/vacation''.
.PP
System administrators should be conservative about populating
/usr/libexec/sm.bin.
the sm.bin directory.
Reasonable additions are
.IR vacation (1),
.IR procmail (1),

View File

@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.5 2000/09/17 17:04:27 gshapiro Exp $";
static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.6 2000/10/09 20:37:16 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -76,7 +76,11 @@ static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.5 2000/09/17 17:04:27 gshapiro Exp
/* directory in which all commands must reside */
#ifndef CMDDIR
# define CMDDIR "/usr/libexec/sm.bin"
# if defined(HPUX10) || defined(HPUX11) || SOLARIS >= 20800
# define CMDDIR "/var/adm/sm.bin"
# else /* HPUX10 || HPUX11 || SOLARIS > 20800 */
# define CMDDIR "/usr/libexec/sm.bin"
# endif /* HPUX10 || HPUX11 || SOLARIS > 20800 */
#endif /* ! CMDDIR */
/* characters disallowed in the shell "-c" argument */

View File

@ -9,13 +9,13 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: aliases.5,v 8.15.4.1 2000/07/18 07:23:02 gshapiro Exp $
.\" $Id: aliases.5,v 8.15.4.2 2000/12/14 23:08:15 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
.TH ALIASES 5 "$Date: 2000/07/18 07:23:02 $"
.TH ALIASES 5 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
.B aliases
aliases
\- aliases file for sendmail
.SH SYNOPSIS
.B aliases

View File

@ -12,7 +12,7 @@
*/
#ifndef lint
static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.32 2000/09/23 00:31:33 ca Exp $";
static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.61 2000/12/28 23:46:41 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -382,7 +382,7 @@ setupmailers()
{
char buf[100];
(void) strlcpy(buf, "prog, P=/bin/sh, F=lsoDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
(void) strlcpy(buf, "prog, P=/bin/sh, F=lsouDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
sizeof buf);
makemailer(buf);
@ -827,7 +827,7 @@ switch_map_find(service, maptype, mapreturn)
char *maptype[MAXMAPSTACK];
short mapreturn[MAXMAPACTIONS];
{
int svcno;
int svcno = 0;
int save_errno = errno;
#ifdef _USE_SUN_NSSWITCH_
@ -847,7 +847,7 @@ switch_map_find(service, maptype, mapreturn)
else
lk = nsw_conf->lookups;
svcno = 0;
while (lk != NULL)
while (lk != NULL && svcno < MAXMAPSTACK)
{
maptype[svcno] = lk->service_name;
if (lk->actions[__NSW_NOTFOUND] == __NSW_RETURN)
@ -884,7 +884,7 @@ switch_map_find(service, maptype, mapreturn)
errno = save_errno;
return -1;
}
for (svcno = 0; svcno < SVC_PATHSIZE; svcno++)
for (svcno = 0; svcno < SVC_PATHSIZE && svcno < MAXMAPSTACK; svcno++)
{
switch (svcinfo->svcpath[svc][svcno])
{
@ -1514,6 +1514,7 @@ init_vendor_macros(e)
#define LA_KSTAT 12 /* special Solaris kstat(3k) implementation */
#define LA_DEVSHORT 13 /* read short from a device */
#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
#define LA_PSET 15 /* Solaris per-processor-set load average */
/* do guesses based on general OS type */
#ifndef LA_TYPE
@ -2071,6 +2072,28 @@ int getla()
#endif /* LA_TYPE == LA_ALPHAOSF */
#if LA_TYPE == LA_PSET
static int
getla()
{
double avenrun[3];
if (pset_getloadavg(PS_MYID, avenrun,
sizeof(avenrun) / sizeof(avenrun[0])) < 0)
{
if (tTd(3, 1))
dprintf("getla: pset_getloadavg failed: %s",
errstring(errno));
return -1;
}
if (tTd(3, 1))
dprintf("getla: %d\n", (int) (avenrun[0] +0.5));
return ((int) (avenrun[0] + 0.5));
}
#endif /* LA_TYPE == LA_PSET */
#if LA_TYPE == LA_ZERO
static int
@ -2230,35 +2253,12 @@ refuseconnections(name, e, d)
ENVELOPE *e;
int d;
{
time_t now;
static time_t lastconn[MAXDAEMONS];
static int conncnt[MAXDAEMONS];
#ifdef XLA
if (!xla_smtp_ok())
return TRUE;
#endif /* XLA */
now = curtime();
if (now != lastconn[d])
{
lastconn[d] = now;
conncnt[d] = 0;
}
else if (conncnt[d]++ > ConnRateThrottle && ConnRateThrottle > 0)
{
/* sleep to flatten out connection load */
sm_setproctitle(TRUE, e, "deferring connections on daemon %s: %d per second",
name, ConnRateThrottle);
if (LogLevel >= 9)
sm_syslog(LOG_INFO, NOQID,
"deferring connections on daemon %s: %d per second",
name, ConnRateThrottle);
(void) sleep(1);
}
CurrentLA = getla();
CurrentLA = sm_getla(NULL);
if (RefuseLA > 0 && CurrentLA >= RefuseLA)
{
sm_setproctitle(TRUE, e, "rejecting connections on daemon %s: load average: %d",
@ -2475,7 +2475,7 @@ setproctitle(fmt, va_alist)
if (kmem < 0 || kmempid != getpid())
{
if (kmem >= 0)
close(kmem);
(void) close(kmem);
kmem = open(_PATH_KMEM, O_RDWR, 0);
if (kmem < 0)
return;
@ -3631,6 +3631,7 @@ transienterror(err)
** type -- type of the lock. Bits can be:
** LOCK_EX -- exclusive lock.
** LOCK_NB -- non-blocking.
** LOCK_UN -- unlock.
**
** Returns:
** TRUE if the lock was acquired.
@ -4139,7 +4140,7 @@ validate_connection(sap, hostname, e)
hostname, anynet_ntoa(sap));
if (rscheck("check_relay", hostname, anynet_ntoa(sap),
e, TRUE, TRUE, 4) != EX_OK)
e, TRUE, TRUE, 4, NULL) != EX_OK)
{
static char reject[BUFSIZ*2];
extern char MsgBuf[];
@ -4381,6 +4382,20 @@ getipnodebyaddr(addr, len, family, err)
*err = h_errno;
return h;
}
# if _FFR_FREEHOSTENT
void
freehostent(h)
struct hostent *h;
{
/*
** Stub routine -- if they don't have getipnodeby*(),
** they probably don't have the free routine either.
*/
return;
}
# endif /* _FFR_FREEHOSTENT */
#endif /* NEEDSGETIPNODE && NETINET6 && __RES < 19990909 */
struct hostent *
@ -4437,9 +4452,12 @@ sm_gethostbyname(name, family)
nmaps = switch_map_find("hosts", maptype, mapreturn);
while (--nmaps >= 0)
{
if (strcmp(maptype[nmaps], "nis") == 0 ||
strcmp(maptype[nmaps], "files") == 0)
break;
}
if (nmaps >= 0)
{
/* try short name */
@ -4670,14 +4688,16 @@ add_hostnames(sa)
#if NETINET
case AF_INET:
hp = sm_gethostbyaddr((char *) &sa->sin.sin_addr,
sizeof(sa->sin.sin_addr), sa->sa.sa_family);
sizeof(sa->sin.sin_addr),
sa->sa.sa_family);
break;
#endif /* NETINET */
#if NETINET6
case AF_INET6:
hp = sm_gethostbyaddr((char *) &sa->sin6.sin6_addr,
sizeof(sa->sin6.sin6_addr), sa->sa.sa_family);
sizeof(sa->sin6.sin6_addr),
sa->sa.sa_family);
break;
#endif /* NETINET6 */
@ -4750,6 +4770,9 @@ add_hostnames(sa)
*ha);
}
}
#if _FFR_FREEHOSTENT && NETINET6
freehostent(hp);
#endif /* _FFR_FREEHOSTENT && NETINET6 */
return 0;
}
/*
@ -4818,7 +4841,7 @@ load_if_names()
if (numifs <= 0)
{
close(s);
(void) close(s);
return;
}
lifc.lifc_len = numifs * sizeof (struct lifreq);
@ -4829,7 +4852,8 @@ load_if_names()
{
if (tTd(0, 4))
dprintf("SIOCGLIFCONF failed: %s\n", errstring(errno));
close(s);
(void) close(s);
free(lifc.lifc_buf);
return;
}
@ -4862,7 +4886,10 @@ load_if_names()
s = socket(af, SOCK_DGRAM, 0);
if (s == -1)
{
free(lifc.lifc_buf);
return;
}
/*
** If we don't have a complete ifr structure,
@ -4911,7 +4938,18 @@ load_if_names()
{
case AF_INET6:
ia6 = sa->sin6.sin6_addr;
if (ia6.s6_addr == in6addr_any.s6_addr)
# ifdef __KAME__
/* convert into proper scoped address - */
if ((IN6_IS_ADDR_LINKLOCAL(&ia6) ||
IN6_IS_ADDR_SITELOCAL(&ia6)) &&
sa->sin6.sin6_scope_id == 0)
{
sa->sin6.sin6_scope_id = ntohs(ia6.s6_addr[3] |
((unsigned int) ia6.s6_addr[2] << 8));
ia6.s6_addr[2] = ia6.s6_addr[3] = 0;
}
# endif /* __KAME__ */
if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
{
addr = anynet_ntop(&ia6, buf6, sizeof buf6);
message("WARNING: interface %s is UP with %s address",
@ -4962,7 +5000,7 @@ load_if_names()
(void) add_hostnames(sa);
}
free(lifc.lifc_buf);
close(s);
(void) close(s);
#else /* NETINET6 && defined(SIOCGLIFCONF) */
# if defined(SIOCGIFCONF) && !SIOCGIFCONF_IS_BROKEN
int s;
@ -5094,7 +5132,7 @@ load_if_names()
# if NETINET6
case AF_INET6:
ia6 = sa->sin6.sin6_addr;
if (ia6.s6_addr == in6addr_any.s6_addr)
if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
{
addr = anynet_ntop(&ia6, buf6, sizeof buf6);
message("WARNING: interface %s is UP with %s address",

View File

@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
* $Id: conf.h,v 8.496.4.25 2000/08/08 23:50:40 ca Exp $
* $Id: conf.h,v 8.496.4.32 2000/12/15 19:20:53 gshapiro Exp $
*/
/* $FreeBSD$ */
@ -92,6 +92,7 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
#define MAXSHORTSTR 203 /* max short string length */
#define MAXMACNAMELEN 25 /* max macro name length */
#define MAXMACROID 0377 /* max macro id number */
/* Must match (BITMAPBITS - 1) */
#ifndef MAXHDRSLEN
# define MAXHDRSLEN (32 * 1024) /* max size of message headers */
#endif /* ! MAXHDRSLEN */
@ -528,12 +529,19 @@ typedef int pid_t;
# if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
# else /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
typedef int int32_t;
# if _FFR_MILTER
# define SM_INT32 int /* 32bit integer */
# endif /* _FFR_MILTER */
# endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
# if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
# ifndef LA_TYPE
# include <sys/loadavg.h>
# define LA_TYPE LA_SUBR /* getloadavg(3c) appears in 2.7 */
# if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
# include <sys/pset.h>
# define LA_TYPE LA_PSET /* pset_getloadavg(3c) appears in 2.9 */
# else
# define LA_TYPE LA_SUBR /* getloadavg(3c) appears in 2.7 */
# endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
# endif /* ! LA_TYPE */
# define HASGETUSERSHELL 1 /* getusershell(3c) bug fixed in 2.7 */
# endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
@ -1700,6 +1708,7 @@ typedef int pid_t;
# define __svr4__
# define SYS5SIGNALS 1
# define HASSETSID 1
# define HASSNPRINTF 1
# define HASSETREUID 1
# define HASWAITPID 1
# define HASGETDTABLESIZE 1
@ -1719,6 +1728,7 @@ typedef int pid_t;
# ifndef _PATH_SENDMAILPID
# define _PATH_SENDMAILPID "/etc/sendmail.pid"
# endif /* ! _PATH_SENDMAILPID */
# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
#endif /* __svr5__ */
/* ###################################################################### */

View File

@ -12,14 +12,14 @@
*/
#ifndef lint
static char id[] = "@(#)$Id: headers.c,v 8.203.4.7 2000/08/22 21:50:36 gshapiro Exp $";
static char id[] = "@(#)$Id: headers.c,v 8.203.4.10 2000/10/13 17:54:30 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
#include <sendmail.h>
static bool fix_mime_header __P((char *));
static size_t fix_mime_header __P((char *));
static int priencode __P((char *));
static void put_vanilla_header __P((HDR *, char *, MCI *));
@ -166,7 +166,7 @@ chompheader(line, pflag, hdrp, e)
goto hse;
}
setbitn(*p, mopts);
setbitn(bitidx(*p), mopts);
cond = TRUE;
p++;
}
@ -346,7 +346,8 @@ chompheader(line, pflag, hdrp, e)
free(sp);
define(macid("{currHeader}", NULL), newstr(qval), e);
define(macid("{hdr_name}", NULL), newstr(fname), e);
(void) rscheck(rs, fvalue, NULL, e, stripcom, TRUE, 4);
(void) rscheck(rs, fvalue, NULL, e, stripcom, TRUE, 4,
NULL);
}
}
@ -1390,14 +1391,18 @@ putheader(mci, hdr, e, flags)
wordinclass(h->h_field,
macid("{checkMIMEFieldHeaders}", NULL)))
{
if (fix_mime_header(h->h_value))
size_t len;
len = fix_mime_header(h->h_value);
if (len > 0)
{
sm_syslog(LOG_ALERT, e->e_id,
"Truncated MIME %s header due to field size (possible attack)",
h->h_field);
"Truncated MIME %s header due to field size (length = %ld) (possible attack)",
h->h_field, (unsigned long) len);
if (tTd(34, 11))
dprintf(" truncated MIME %s header due to field size (possible attack)\n",
h->h_field);
dprintf(" truncated MIME %s header due to field size (length = %ld) (possible attack)\n",
h->h_field,
(unsigned long) len);
}
}
@ -1405,15 +1410,19 @@ putheader(mci, hdr, e, flags)
wordinclass(h->h_field,
macid("{checkMIMETextHeaders}", NULL)))
{
if (strlen(h->h_value) > (size_t)MaxMimeHeaderLength)
size_t len;
len = strlen(h->h_value);
if (len > (size_t) MaxMimeHeaderLength)
{
h->h_value[MaxMimeHeaderLength - 1] = '\0';
sm_syslog(LOG_ALERT, e->e_id,
"Truncated long MIME %s header (possible attack)",
h->h_field);
"Truncated long MIME %s header (length = %ld) (possible attack)",
h->h_field, (unsigned long) len);
if (tTd(34, 11))
dprintf(" truncated long MIME %s header (possible attack)\n",
h->h_field);
dprintf(" truncated long MIME %s header (length = %ld) (possible attack)\n",
h->h_field,
(unsigned long) len);
}
}
@ -1421,14 +1430,19 @@ putheader(mci, hdr, e, flags)
wordinclass(h->h_field,
macid("{checkMIMEHeaders}", NULL)))
{
if (shorten_rfc822_string(h->h_value, MaxMimeHeaderLength))
size_t len;
len = strlen(h->h_value);
if (shorten_rfc822_string(h->h_value,
MaxMimeHeaderLength))
{
sm_syslog(LOG_ALERT, e->e_id,
"Truncated long MIME %s header (possible attack)",
h->h_field);
"Truncated long MIME %s header (length = %ld) (possible attack)",
h->h_field, (unsigned long) len);
if (tTd(34, 11))
dprintf(" truncated long MIME %s header (possible attack)\n",
h->h_field);
dprintf(" truncated long MIME %s header (length = %ld) (possible attack)\n",
h->h_field,
(unsigned long) len);
}
}
@ -1459,7 +1473,7 @@ putheader(mci, hdr, e, flags)
if (bitset(H_CHECK|H_ACHECK, h->h_flags) &&
!bitintersect(h->h_mflags, mci->mci_mailer->m_flags) &&
(h->h_macro == '\0' ||
macvalue(h->h_macro & 0377, e) == NULL))
macvalue(bitidx(h->h_macro), e) == NULL))
{
if (tTd(34, 11))
dprintf(" (skipped)\n");
@ -1821,22 +1835,23 @@ copyheader(header)
** string -- the full header
**
** Returns:
** TRUE if the header was modified, FALSE otherwise
** length of last offending field, 0 if all ok.
**
** Side Effects:
** string modified in place
*/
static bool
static size_t
fix_mime_header(string)
char *string;
{
bool modified = FALSE;
char *begin = string;
char *end;
size_t len = 0;
size_t retlen = 0;
if (string == NULL || *string == '\0')
return FALSE;
return 0;
/* Split on each ';' */
while ((end = find_character(begin, ';')) != NULL)
@ -1846,9 +1861,11 @@ fix_mime_header(string)
*end = '\0';
len = strlen(begin);
/* Shorten individual parameter */
if (shorten_rfc822_string(begin, MaxMimeFieldLength))
modified = TRUE;
retlen = len;
/* Collapse the possibly shortened string with rest */
bp = begin + strlen(begin);
@ -1872,5 +1889,5 @@ fix_mime_header(string)
/* Move past ';' */
begin = end + 1;
}
return modified;
return retlen;
}

View File

@ -9,13 +9,13 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: mailq.1,v 8.14.28.2 2000/09/17 17:04:27 gshapiro Exp $
.\" $Id: mailq.1,v 8.14.28.3 2000/12/14 23:08:15 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
.TH MAILQ 1 "$Date: 2000/09/17 17:04:27 $"
.TH MAILQ 1 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
.B mailq
mailq
\- print the mail queue
.SH SYNOPSIS
.B mailq

View File

@ -12,7 +12,7 @@
*/
#ifndef lint
static char id[] = "@(#)$Id: mci.c,v 8.133.10.3 2000/06/23 16:17:06 ca Exp $";
static char id[] = "@(#)$Id: mci.c,v 8.133.10.7 2000/12/12 00:39:34 ca Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -276,8 +276,10 @@ mci_flush(doquit, allbut)
return;
for (i = 0; i < MaxMciCache; i++)
{
if (allbut != MciCache[i])
mci_uncache(&MciCache[i], doquit);
}
}
/*
** MCI_GET -- get information about a particular host
@ -302,7 +304,7 @@ mci_get(host, m)
(void) mci_scan(NULL);
if (m->m_mno < 0)
syserr("negative mno %d (%s)", m->m_mno, m->m_name);
syserr("!negative mno %d (%s)", m->m_mno, m->m_name);
s = stab(host, ST_MCI + m->m_mno, ST_ENTER);
mci = &s->s_mci;
@ -385,7 +387,7 @@ mci_match(host, m)
register MCI *mci;
register STAB *s;
if (m->m_mno < 0)
if (m->m_mno < 0 || m->m_mno > MAXMAILERS)
return FALSE;
s = stab(host, ST_MCI + m->m_mno, ST_FIND);
if (s == NULL)
@ -462,7 +464,7 @@ static struct mcifbits MciFlags[] =
{ MCIF_8BITOK, "8BITOK" },
{ MCIF_CVT7TO8, "CVT7TO8" },
{ MCIF_INMIME, "INMIME" },
{ 0, NULL }
{ 0, NULL }
};
@ -1331,12 +1333,12 @@ mci_generate_persistent_path(host, path, pathlen, createflag)
#if NETINET || NETINET6
/* check for bogus bracketed address */
if (host[0] == '[' &&
if (host[0] == '['
# if NETINET6
inet_pton(AF_INET6, t_host, &in6_addr) != 1 &&
&& inet_pton(AF_INET6, t_host, &in6_addr) != 1
# endif /* NETINET6 */
# if NETINET
inet_addr(t_host) == INADDR_NONE
&& inet_addr(t_host) == INADDR_NONE
# endif /* NETINET */
)
return -1;

View File

@ -12,7 +12,7 @@
*/
#ifndef lint
static char id[] = "@(#)$Id: savemail.c,v 8.212.4.5 2000/08/22 22:46:00 gshapiro Exp $";
static char id[] = "@(#)$Id: savemail.c,v 8.212.4.11 2000/12/18 18:00:44 ca Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@ -995,6 +995,8 @@ errbody(mci, e, separator)
if (e->e_msgboundary != NULL)
{
time_t now = curtime();
putline("", mci);
(void) snprintf(buf, sizeof buf, "--%s", e->e_msgboundary);
putline(buf, mci);
@ -1048,7 +1050,13 @@ errbody(mci, e, separator)
char *action;
if (QS_IS_BADADDR(q->q_state))
{
/* RFC 1891, 6.2.6 (b) */
if (bitset(QHASNOTIFY, q->q_flags) &&
!bitset(QPINGONFAILURE, q->q_flags))
continue;
action = "failed";
}
else if (!bitset(QPRIMARY, q->q_flags))
continue;
else if (bitset(QDELIVERED, q->q_flags))
@ -1198,7 +1206,7 @@ errbody(mci, e, separator)
/* Last-Attempt-Date: -- fine granularity */
if (q->q_statdate == (time_t) 0L)
q->q_statdate = curtime();
q->q_statdate = now;
(void) snprintf(buf, sizeof buf,
"Last-Attempt-Date: %s",
arpadate(ctime(&q->q_statdate)));

View File

@ -9,13 +9,13 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: sendmail.8,v 8.36.8.2 2000/09/07 21:14:00 ca Exp $
.\" $Id: sendmail.8,v 8.36.8.3 2000/12/14 23:08:15 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
.TH SENDMAIL 8 "$Date: 2000/09/07 21:14:00 $"
.TH SENDMAIL 8 "$Date: 2000/12/14 23:08:15 $"
.SH NAME
.B sendmail
sendmail
\- an electronic mail transport agent
.SH SYNOPSIS
.B sendmail