Resolve conflicts from sendmail 8.13.3 import

MFC after:	4 days
This commit is contained in:
Gregory Neil Shapiro 2005-02-14 02:39:14 +00:00
parent 6af83ee0d2
commit 684b2a5fa3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=141862
9 changed files with 78 additions and 127 deletions

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Donn Seeley at UUNET Technologies, Inc.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*/
#include <sm/gen.h>
SM_RCSID("@(#)$Id: vsscanf.c,v 1.23 2002/02/01 02:28:00 ca Exp $")
#include <string.h>
#include <sm/io.h>
/*
** SM_EOFREAD -- dummy read function for faked file below
**
** Parameters:
** fp -- file pointer
** buf -- location to place read data
** len -- number of bytes to read
**
** Returns:
** 0 (zero) always
*/
/* type declaration for later use */
static ssize_t sm_eofread __P((SM_FILE_T *, char *, size_t));
/* ARGSUSED0 */
static ssize_t
sm_eofread(fp, buf, len)
SM_FILE_T *fp;
char *buf;
size_t len;
{
return 0;
}
/*
** SM_VSSCANF -- scan a string to find data units
**
** Parameters:
** str -- strings containing data
** fmt -- format directive for finding data units
** ap -- memory locations to place format found data units
**
** Returns:
** Failure: SM_IO_EOF
** Success: number of data units found
**
** Side Effects:
** Attempts to strlen() 'str'; if not a '\0' terminated string
** then the call may SEGV/fail.
** Faking the string 'str' as a file.
*/
int
sm_vsscanf(str, fmt, ap)
const char *str;
const char *fmt;
SM_VA_LOCAL_DECL
{
SM_FILE_T fake;
fake.sm_magic = SmFileMagic;
fake.f_timeout = SM_TIME_FOREVER;
fake.f_timeoutstate = SM_TIME_BLOCK;
fake.f_file = -1;
fake.f_flags = SMRD;
fake.f_bf.smb_base = fake.f_p = (unsigned char *)str;
fake.f_bf.smb_size = fake.f_r = strlen(str);
fake.f_read = sm_eofread;
fake.f_ub.smb_base = NULL;
fake.f_close = NULL;
fake.f_open = NULL;
fake.f_write = NULL;
fake.f_seek = NULL;
fake.f_setinfo = fake.f_getinfo = NULL;
fake.f_type = "sm_vsscanf:fake";
return sm_vfscanf(&fake, SM_TIME_FOREVER, fmt, ap);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -15,12 +15,12 @@
#include <sm/gen.h>
SM_IDSTR(copyright,
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
"@(#) Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1990, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.251 2003/11/03 18:38:29 ca Exp $")
SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.253 2004/11/01 20:42:42 ca Exp $")
#include <stdlib.h>
#include <sm/errstring.h>
@ -148,6 +148,7 @@ bool nofsync = false;
bool HoldErrs = false; /* Hold errors in ErrBuf */
bool LMTPMode = false;
bool BounceQuota = false; /* permanent error when over quota */
bool CloseMBDB = false;
char *HomeMailFile = NULL; /* store mail in homedir */
#if HASHSPOOL
@ -159,6 +160,9 @@ bool StripRcptDomain = true;
#endif /* HASHSPOOL */
char SpoolPath[MAXPATHLEN];
char *parseaddr __P((char *, bool));
char *process_recipient __P((char *));
void dolmtp __P((void));
void deliver __P((int, char *));
int e_to_sys __P((int));
void notifybiff __P((char *));
@ -173,6 +177,18 @@ const char *hashname __P((char *));
#endif /* HASHSPOOL */
static void
sm_exit(status)
int status;
{
if (CloseMBDB)
{
sm_mbdb_terminate();
CloseMBDB = false; /* not really necessary, but ... */
}
exit(status);
}
int
main(argc, argv)
int argc;
@ -202,11 +218,13 @@ main(argc, argv)
# endif /* LOG_MAIL */
from = NULL;
/* XXX can this be converted to a compile time check? */
if (sm_strlcpy(SpoolPath, _PATH_MAILDIR, sizeof(SpoolPath)) >=
sizeof(SpoolPath))
{
mailerr("421", "Configuration error: _PATH_MAILDIR too large");
exit(EX_CONFIG);
sm_exit(EX_CONFIG);
}
#if HASHSPOOL
while ((ch = getopt(argc, argv, "7BbdD:f:h:r:lH:p:ns")) != -1)
@ -340,22 +358,21 @@ main(argc, argv)
mailerr(errcode, "Can not open mailbox database %s: %s",
mbdbname, sm_strexit(err));
exit(err);
sm_exit(err);
}
CloseMBDB = true;
if (LMTPMode)
{
extern void dolmtp __P((void));
if (argc > 0)
{
mailerr("421", "Users should not be specified in command line if LMTP required");
exit(EX_TEMPFAIL);
sm_exit(EX_TEMPFAIL);
}
dolmtp();
/* NOTREACHED */
exit(EX_OK);
sm_exit(EX_OK);
}
/* Non-LMTP from here on out */
@ -390,11 +407,11 @@ main(argc, argv)
if (fd < 0)
{
flush_error();
exit(ExitVal);
sm_exit(ExitVal);
}
for (; *argv != NULL; ++argv)
deliver(fd, *argv);
exit(ExitVal);
sm_exit(ExitVal);
/* NOTREACHED */
return ExitVal;
}
@ -484,7 +501,7 @@ parseaddr(s, rcpt)
if (p == NULL)
{
mailerr("421 4.3.0", "Memory exhausted");
exit(EX_TEMPFAIL);
sm_exit(EX_TEMPFAIL);
}
(void) sm_strlcpy(p, s, l);
@ -540,7 +557,7 @@ dolmtp()
{
(void) fflush(stdout);
if (fgets(buf, sizeof(buf) - 1, stdin) == NULL)
exit(EX_OK);
sm_exit(EX_OK);
p = buf + strlen(buf) - 1;
if (p >= buf && *p == '\n')
*p-- = '\0';
@ -654,7 +671,7 @@ dolmtp()
if (sm_strcasecmp(buf, "quit") == 0)
{
printf("221 2.0.0 Bye\r\n");
exit(EX_OK);
sm_exit(EX_OK);
}
goto syntaxerr;
/* NOTREACHED */
@ -681,7 +698,7 @@ dolmtp()
{
mailerr("421 4.3.0",
"Memory exhausted");
exit(EX_TEMPFAIL);
sm_exit(EX_TEMPFAIL);
}
}
if (sm_strncasecmp(buf + 5, "to:", 3) != 0 ||
@ -900,7 +917,7 @@ store(from, inbody)
if (LMTPMode)
{
/* Got a premature EOF -- toss message and exit */
exit(EX_OK);
sm_exit(EX_OK);
}
/* If message not newline terminated, need an extra. */
@ -1564,7 +1581,7 @@ usage()
{
ExitVal = EX_USAGE;
mailerr(NULL, "usage: mail.local [-7] [-B] [-b] [-d] [-l] [-s] [-f from|-r from] [-h filename] user ...");
exit(ExitVal);
sm_exit(ExitVal);
}
void

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2002, 2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
@ -14,13 +14,13 @@
#include <sm/gen.h>
SM_IDSTR(copyright,
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
"@(#) Copyright (c) 1998-2002, 2004 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1992 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.176 2002/06/27 23:41:04 gshapiro Exp $")
SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.177 2004/08/03 23:57:24 ca Exp $")
#include <sys/types.h>
@ -52,6 +52,8 @@ BITMAP256 DontBlameSendmail;
#define BUFSIZE 1024
#define ISSEP(c) (sep == '\0' ? isascii(c) && isspace(c) : (c) == sep)
static void usage __P((char *));
static void
usage(progname)
char *progname;

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
.\" Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1993 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1993
@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: smrsh.8,v 8.20 2003/10/07 18:05:12 ca Exp $
.\" $Id: smrsh.8,v 8.22 2004/08/06 03:55:35 gshapiro Exp $
.\"
.TH SMRSH 8 "$Date: 2003/10/07 18:05:12 $"
.TH SMRSH 8 "$Date: 2004/08/06 03:55:35 $"
.SH NAME
smrsh \- restricted shell for sendmail
.SH SYNOPSIS
@ -91,7 +91,7 @@ to change the default program directory
.PP
/var/adm/sm.bin \- directory for restricted programs on HP UX and Solaris
.PP
/usr/libexec/sm.bin \- directory for restricted programs on FreeBSD (>= 3.3)
/usr/libexec/sm.bin \- directory for restricted programs on FreeBSD (>= 3.3) and DragonFly BSD
.SH SEE ALSO
sendmail(8)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1993 Eric P. Allman. All rights reserved.
* Copyright (c) 1993
@ -15,13 +15,13 @@
#include <sm/gen.h>
SM_IDSTR(copyright,
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
"@(#) Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1993 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1993\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.63 2003/12/15 17:12:29 ca Exp $")
SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.65 2004/08/06 18:54:22 ca Exp $")
/*
** SMRSH -- sendmail restricted shell
@ -97,6 +97,8 @@ SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.63 2003/12/15 17:12:29 ca Exp $")
char newcmdbuf[1000];
char *prg, *par;
static void addcmd __P((char *, bool, size_t));
/*
** ADDCMD -- add a string to newcmdbuf, check for overflow
**
@ -110,7 +112,7 @@ char *prg, *par;
**
*/
void
static void
addcmd(s, cmd, len)
char *s;
bool cmd;

View File

@ -14,7 +14,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: conf.c,v 8.1047 2004/07/14 21:54:23 ca Exp $")
SM_RCSID("@(#)$Id: conf.c,v 8.1052 2004/12/15 22:45:55 ca Exp $")
#include <sendmail/pathnames.h>
#if NEWDB
@ -36,6 +36,12 @@ static void setupmaps __P((void));
static void setupmailers __P((void));
static void setupqueues __P((void));
static int get_num_procs_online __P((void));
static int add_hostnames __P((SOCKADDR *));
#if NETINET6 && NEEDSGETIPNODE
static struct hostent *getipnodebyname __P((char *, int, int, int *));
static struct hostent *getipnodebyaddr __P((char *, int, int, int *));
#endif /* NETINET6 && NEEDSGETIPNODE */
/*
@ -145,6 +151,9 @@ struct prival PrivacyValues[] =
{ "noreceipts", PRIV_NORECEIPTS },
{ "nobodyreturn", PRIV_NOBODYRETN },
{ "goaway", PRIV_GOAWAY },
#if _FFR_PRIV_NOACTUALRECIPIENT
{ "noactualrecipient", PRIV_NOACTUALRECIPIENT },
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
{ NULL, 0 }
};
@ -6023,10 +6032,6 @@ char *FFRCompileOptions[] =
/* Allow local (not just TCP) socket connection to server. */
"_FFR_DAEMON_NETUNIX",
#endif /* _FFR_DAEMON_NETUNIX */
#if _FFR_DEAL_WITH_ERROR_SSL
/* Deal with SSL errors by recognizing them as EOF. */
"_FFR_DEAL_WITH_ERROR_SSL",
#endif /* _FFR_DEAL_WITH_ERROR_SSL */
#if _FFR_DEPRECATE_MAILER_FLAG_I
/* What it says :-) */
"_FFR_DEPRECATE_MAILER_FLAG_I",
@ -6131,7 +6136,7 @@ char *FFRCompileOptions[] =
** Gurusamy Sarathy of ActiveState
*/
"_FFR_MAXDATASIZE"
"_FFR_MAXDATASIZE",
#endif /* _FFR_MAXDATASIZE */
#if _FFR_MAX_FORWARD_ENTRIES
/* Try to limit number of .forward entries */
@ -6166,6 +6171,15 @@ char *FFRCompileOptions[] =
/* Disable PIPELINING, delay client if used. */
"_FFR_NO_PIPE",
#endif /* _FFR_NO_PIPE */
#if _FFR_PRIV_NOACTUALRECIPIENT
/*
** PrivacyOptions=noactualrecipient stops sendmail from putting
** X-Actual-Recipient lines in DSNs revealing the actual
** account that addresses map to. Patch from Dan Harkless.
*/
"_FFR_PRIV_NOACTUALRECIPIENT"
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
#if _FFR_QUEUEDELAY
/* Exponential queue delay; disabled in 8.13 since it isn't used. */
"_FFR_QUEUEDELAY",
@ -6214,7 +6228,7 @@ char *FFRCompileOptions[] =
#endif /* _FFR_SHM_STATUS */
#if _FFR_SKIP_DOMAINS
/* process every N'th domain instead of every N'th message */
"_FFR_SKIP_DOMAINS"
"_FFR_SKIP_DOMAINS",
#endif /* _FFR_SKIP_DOMAINS */
#if _FFR_SLEEP_USE_SELECT
/* Use select(2) in libsm/clock.c to emulate sleep(2) */

View File

@ -14,7 +14,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: headers.c,v 8.286 2004/07/08 17:57:32 ca Exp $")
SM_RCSID("@(#)$Id: headers.c,v 8.287 2004/12/03 18:29:51 ca Exp $")
static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *));
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
@ -1812,7 +1812,7 @@ put_vanilla_header(h, v, mci)
register char *nlp;
register char *obp;
int putflags;
char obuf[MAXLINE];
char obuf[MAXLINE + 256]; /* additional length for h_field */
putflags = PXLF_HEADER;
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))

View File

@ -14,7 +14,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: mci.c,v 8.211 2003/03/31 17:35:50 ca Exp $")
SM_RCSID("@(#)$Id: mci.c,v 8.212 2004/08/04 21:11:31 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@ -1046,7 +1046,7 @@ mci_store_persistent(mci)
int
mci_traverse_persistent(action, pathname)
int (*action)();
int (*action)__P((char *, char *));
char *pathname;
{
struct stat statbuf;

View File

@ -13,7 +13,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: savemail.c,v 8.303 2004/01/14 02:56:51 ca Exp $")
SM_RCSID("@(#)$Id: savemail.c,v 8.304 2004/10/06 21:36:06 ca Exp $")
static void errbody __P((MCI *, ENVELOPE *, char *));
static bool pruneroute __P((char *));
@ -1182,6 +1182,9 @@ errbody(mci, e, separator)
/* X-Actual-Recipient: -- the real problem address */
if (actual[0] != '\0' &&
q->q_finalrcpt != NULL &&
#if _FFR_PRIV_NOACTUALRECIPIENT
!bitset(PRIV_NOACTUALRECIPIENT, PrivacyFlags) &&
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
strcmp(actual, q->q_finalrcpt) != 0)
{
(void) sm_snprintf(buf, sizeof buf,