Repair 8.11.3 merge conflicts
This commit is contained in:
parent
1ed4a948e1
commit
b466200952
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
|
||||
# Copyright (c) 1988, 1993
|
||||
@ -155,28 +155,28 @@ define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
|
||||
CONCAT(CY, $'1`),
|
||||
CONCAT(C, $3, $'1`))')
|
||||
sinclude(_CF_DIR_`'siteconfig/$1.m4)')
|
||||
define(`EXPOSED_USER', `PUSHDIVERT(5)CE$1
|
||||
define(`EXPOSED_USER', `PUSHDIVERT(5)C{E}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
ifdef(`_FFR_EXPOSED_USER_FILE', `define(`EXPOSED_USER_FILE', `PUSHDIVERT(5)FE$1
|
||||
ifdef(`_FFR_EXPOSED_USER_FILE', `define(`EXPOSED_USER_FILE', `PUSHDIVERT(5)F{E}$1
|
||||
POPDIVERT`'dnl`'')', `dnl')
|
||||
define(`LOCAL_USER', `PUSHDIVERT(5)CL$1
|
||||
define(`LOCAL_USER', `PUSHDIVERT(5)C{L}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`MASQUERADE_AS', `define(`MASQUERADE_NAME', $1)')
|
||||
define(`MASQUERADE_DOMAIN', `PUSHDIVERT(5)CM$1
|
||||
define(`MASQUERADE_DOMAIN', `PUSHDIVERT(5)C{M}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`MASQUERADE_EXCEPTION', `PUSHDIVERT(5)CN$1
|
||||
define(`MASQUERADE_EXCEPTION', `PUSHDIVERT(5)C{N}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`MASQUERADE_DOMAIN_FILE', `PUSHDIVERT(5)FM$1
|
||||
define(`MASQUERADE_DOMAIN_FILE', `PUSHDIVERT(5)F{M}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`LOCAL_DOMAIN', `PUSHDIVERT(5)Cw$1
|
||||
define(`LOCAL_DOMAIN', `PUSHDIVERT(5)C{w}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`CANONIFY_DOMAIN', `PUSHDIVERT(5)C{Canonify}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`CANONIFY_DOMAIN_FILE', `PUSHDIVERT(5)F{Canonify}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`GENERICS_DOMAIN', `PUSHDIVERT(5)CG$1
|
||||
define(`GENERICS_DOMAIN', `PUSHDIVERT(5)C{G}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`GENERICS_DOMAIN_FILE', `PUSHDIVERT(5)FG$1
|
||||
define(`GENERICS_DOMAIN_FILE', `PUSHDIVERT(5)F{G}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`LDAPROUTE_DOMAIN', `PUSHDIVERT(5)C{LDAPRoute}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
@ -188,9 +188,9 @@ POPDIVERT`'dnl`'')
|
||||
define(`VIRTUSER_DOMAIN_FILE', `PUSHDIVERT(5)F{VirtHost}$1
|
||||
define(`_VIRTHOSTS_')
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`RELAY_DOMAIN', `PUSHDIVERT(5)CR$1
|
||||
define(`RELAY_DOMAIN', `PUSHDIVERT(5)C{R}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`RELAY_DOMAIN_FILE', `PUSHDIVERT(5)FR$1
|
||||
define(`RELAY_DOMAIN_FILE', `PUSHDIVERT(5)F{R}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
define(`TRUST_AUTH_MECH', `PUSHDIVERT(5)C{TrustAuthMech}$1
|
||||
POPDIVERT`'dnl`'')
|
||||
@ -254,4 +254,4 @@ define(`confMILTER_MACROS_ENVRCPT', ``{rcpt_mailer}, {rcpt_host}, {rcpt_addr}'')
|
||||
|
||||
|
||||
divert(0)dnl
|
||||
VERSIONID(`$Id: cfhead.m4,v 8.76.4.13 2000/08/24 17:09:50 gshapiro Exp $')
|
||||
VERSIONID(`$Id: cfhead.m4,v 8.76.4.15 2001/02/14 04:07:20 gshapiro Exp $')
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -12,14 +12,14 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
|
||||
"@(#) Copyright (c) 1998-2001 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";
|
||||
#endif /* ! lint */
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.39 2000/11/14 20:02:47 gshapiro Exp $";
|
||||
static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.57 2001/02/11 20:08:20 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -108,37 +108,25 @@ extern size_t strlcat __P((char *, const char *, size_t));
|
||||
# if defined(_AIX)
|
||||
# define USE_LOCKF 1
|
||||
# define USE_SETEUID 1
|
||||
# define USE_VSYSLOG 0
|
||||
# endif /* defined(_AIX) */
|
||||
|
||||
# if defined(__hpux)
|
||||
# define USE_LOCKF 1
|
||||
# define USE_SETRESUID 1
|
||||
# define USE_VSYSLOG 0
|
||||
# endif /* defined(__hpux) */
|
||||
|
||||
# ifdef DGUX
|
||||
# define HASSNPRINTF 1
|
||||
# define USE_LOCKF 1
|
||||
# define USE_VSYSLOG 0
|
||||
# endif /* DGUX */
|
||||
|
||||
# if defined(_CRAY)
|
||||
# if !defined(MAXPATHLEN)
|
||||
# define MAXPATHLEN PATHSIZE
|
||||
# endif /* !defined(MAXPATHLEN) */
|
||||
# define USE_VSYSLOG 0
|
||||
# define _PATH_MAILDIR "/usr/spool/mail"
|
||||
# endif /* defined(_CRAY) */
|
||||
|
||||
# if defined(ultrix)
|
||||
# define USE_VSYSLOG 0
|
||||
# endif /* defined(ultrix) */
|
||||
|
||||
# if defined(__osf__)
|
||||
# define USE_VSYSLOG 0
|
||||
# endif /* defined(__osf__) */
|
||||
|
||||
# if defined(NeXT) && !defined(__APPLE__)
|
||||
# include <libc.h>
|
||||
# define _PATH_MAILDIR "/usr/spool/mail"
|
||||
@ -162,10 +150,6 @@ extern size_t strlcat __P((char *, const char *, size_t));
|
||||
# define LOCK_EX F_LOCK
|
||||
# endif /* USE_LOCKF */
|
||||
|
||||
# ifndef USE_VSYSLOG
|
||||
# define USE_VSYSLOG 1
|
||||
# endif /* ! USE_VSYSLOG */
|
||||
|
||||
# ifndef LOCK_EX
|
||||
# include <sys/file.h>
|
||||
# endif /* ! LOCK_EX */
|
||||
@ -207,18 +191,19 @@ extern FILE *fdopen __P((int, const char *));
|
||||
# define HASSNPRINTF 1 /* has snprintf starting in 4.3 */
|
||||
# endif /* _AIX4 >= 40300 */
|
||||
|
||||
# if !HASSNPRINTF
|
||||
# if !HASSNPRINTF && !SFIO
|
||||
extern int snprintf __P((char *, size_t, const char *, ...));
|
||||
# ifndef _CRAY
|
||||
extern int vsnprintf __P((char *, size_t, const char *, ...));
|
||||
# endif /* ! _CRAY */
|
||||
# endif /* !HASSNPRINTF */
|
||||
# endif /* !HASSNPRINTF && !SFIO */
|
||||
|
||||
/*
|
||||
** If you don't have setreuid, and you have saved uids, and you have
|
||||
** a seteuid() call that doesn't try to emulate using setuid(), then
|
||||
** you can try defining USE_SETEUID.
|
||||
*/
|
||||
|
||||
# ifdef USE_SETEUID
|
||||
# define setreuid(r, e) seteuid(e)
|
||||
# endif /* USE_SETEUID */
|
||||
@ -226,6 +211,7 @@ extern int vsnprintf __P((char *, size_t, const char *, ...));
|
||||
/*
|
||||
** And of course on hpux you have setresuid()
|
||||
*/
|
||||
|
||||
# ifdef USE_SETRESUID
|
||||
# define setreuid(r, e) setresuid(-1, e, -1)
|
||||
# endif /* USE_SETRESUID */
|
||||
@ -263,21 +249,23 @@ off_t BodyLength;
|
||||
#endif /* CONTENTLENGTH */
|
||||
|
||||
bool EightBitMime = TRUE; /* advertise 8BITMIME in LMTP */
|
||||
char ErrBuf[10240]; /* error buffer */
|
||||
int ExitVal = EX_OK; /* sysexits.h error value. */
|
||||
bool HoldErrs = FALSE; /* Hold errors in ErrBuf */
|
||||
bool LMTPMode = FALSE;
|
||||
bool bouncequota = FALSE; /* permanent error when over quota */
|
||||
bool BounceQuota = FALSE; /* permanent error when over quota */
|
||||
bool nobiff = FALSE;
|
||||
bool nofsync = FALSE;
|
||||
|
||||
void deliver __P((int, char *, bool));
|
||||
void deliver __P((int, char *));
|
||||
int e_to_sys __P((int));
|
||||
void notifybiff __P((char *));
|
||||
int store __P((char *, int));
|
||||
int store __P((char *, int, bool *));
|
||||
void usage __P((void));
|
||||
void vwarn __P((const char *, _BSD_VA_LIST_));
|
||||
int lockmbox __P((char *));
|
||||
void unlockmbox __P((void));
|
||||
void mailerr __P((const char *, const char *, ...));
|
||||
void flush_error __P((void));
|
||||
|
||||
|
||||
int
|
||||
@ -291,7 +279,6 @@ main(argc, argv)
|
||||
char *from;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern void dolmtp __P((bool));
|
||||
|
||||
|
||||
/* make sure we have some open file descriptors */
|
||||
@ -321,7 +308,7 @@ main(argc, argv)
|
||||
break;
|
||||
|
||||
case 'b': /* bounce mail when over quota. */
|
||||
bouncequota = TRUE;
|
||||
BounceQuota = TRUE;
|
||||
break;
|
||||
|
||||
case 'd': /* Backward compatible. */
|
||||
@ -331,7 +318,7 @@ main(argc, argv)
|
||||
case 'r': /* Backward compatible. */
|
||||
if (from != NULL)
|
||||
{
|
||||
mailerr(NULL, "multiple -f options");
|
||||
mailerr(NULL, "Multiple -f options");
|
||||
usage();
|
||||
}
|
||||
from = optarg;
|
||||
@ -358,8 +345,21 @@ main(argc, argv)
|
||||
notifybiff(NULL);
|
||||
|
||||
if (LMTPMode)
|
||||
dolmtp(bouncequota);
|
||||
{
|
||||
extern void dolmtp __P((void));
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
mailerr("421", "Users should not be specified in command line if LMTP required");
|
||||
exit(EX_TEMPFAIL);
|
||||
}
|
||||
|
||||
dolmtp();
|
||||
/* NOTREACHED */
|
||||
exit(EX_OK);
|
||||
}
|
||||
|
||||
/* Non-LMTP from here on out */
|
||||
if (*argv == '\0')
|
||||
usage();
|
||||
|
||||
@ -368,6 +368,7 @@ main(argc, argv)
|
||||
** uid matches, otherwise, use the name from the password file
|
||||
** corresponding to the uid.
|
||||
*/
|
||||
|
||||
uid = getuid();
|
||||
|
||||
if (from == NULL && ((from = getlogin()) == NULL ||
|
||||
@ -384,8 +385,17 @@ main(argc, argv)
|
||||
** failures. This results in the delivery being reattempted later
|
||||
** at the expense of repeated failures and multiple deliveries.
|
||||
*/
|
||||
for (fd = store(from, 0); *argv; ++argv)
|
||||
deliver(fd, *argv, bouncequota);
|
||||
|
||||
HoldErrs = TRUE;
|
||||
fd = store(from, 0, NULL);
|
||||
HoldErrs = FALSE;
|
||||
if (fd < 0)
|
||||
{
|
||||
flush_error();
|
||||
exit(ExitVal);
|
||||
}
|
||||
for (; *argv != NULL; ++argv)
|
||||
deliver(fd, *argv);
|
||||
exit(ExitVal);
|
||||
/* NOTREACHED */
|
||||
return ExitVal;
|
||||
@ -473,7 +483,7 @@ parseaddr(s, rcpt)
|
||||
p = malloc(l);
|
||||
if (p == NULL)
|
||||
{
|
||||
printf("421 4.3.0 memory exhausted\r\n");
|
||||
mailerr("421 4.3.0", "Memory exhausted");
|
||||
exit(EX_TEMPFAIL);
|
||||
}
|
||||
|
||||
@ -486,15 +496,14 @@ process_recipient(addr)
|
||||
char *addr;
|
||||
{
|
||||
if (getpwnam(addr) == NULL)
|
||||
return "550 5.1.1 user unknown";
|
||||
return "550 5.1.1 User unknown";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define RCPT_GROW 30
|
||||
|
||||
void
|
||||
dolmtp(bouncequota)
|
||||
bool bouncequota;
|
||||
dolmtp()
|
||||
{
|
||||
char *return_path = NULL;
|
||||
char **rcpt_addr = NULL;
|
||||
@ -508,7 +517,10 @@ dolmtp(bouncequota)
|
||||
char myhostname[1024];
|
||||
char buf[4096];
|
||||
|
||||
memset(myhostname, '\0', sizeof myhostname);
|
||||
(void) gethostname(myhostname, sizeof myhostname - 1);
|
||||
if (myhostname[0] == '\0')
|
||||
strlcpy(myhostname, "localhost", sizeof myhostname);
|
||||
|
||||
printf("220 %s LMTP ready\r\n", myhostname);
|
||||
for (;;)
|
||||
@ -528,24 +540,37 @@ dolmtp(bouncequota)
|
||||
case 'D':
|
||||
if (strcasecmp(buf, "data") == 0)
|
||||
{
|
||||
bool inbody = FALSE;
|
||||
|
||||
if (rcpt_num == 0)
|
||||
{
|
||||
printf("503 5.5.1 No recipients\r\n");
|
||||
mailerr("503 5.5.1", "No recipients");
|
||||
continue;
|
||||
}
|
||||
msgfd = store(return_path, rcpt_num);
|
||||
if (msgfd == -1)
|
||||
HoldErrs = TRUE;
|
||||
msgfd = store(return_path, rcpt_num, &inbody);
|
||||
HoldErrs = FALSE;
|
||||
if (msgfd < 0 && !inbody)
|
||||
{
|
||||
flush_error();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; i < rcpt_num; i++)
|
||||
{
|
||||
if (msgfd < 0)
|
||||
{
|
||||
/* print error for rcpt */
|
||||
flush_error();
|
||||
continue;
|
||||
}
|
||||
p = strchr(rcpt_addr[i], '+');
|
||||
if (p != NULL)
|
||||
*p++ = '\0';
|
||||
deliver(msgfd, rcpt_addr[i],
|
||||
bouncequota);
|
||||
*p = '\0';
|
||||
deliver(msgfd, rcpt_addr[i]);
|
||||
}
|
||||
(void) close(msgfd);
|
||||
if (msgfd >= 0)
|
||||
(void) close(msgfd);
|
||||
goto rset;
|
||||
}
|
||||
goto syntaxerr;
|
||||
@ -559,7 +584,7 @@ dolmtp(bouncequota)
|
||||
/* check for duplicate per RFC 1651 4.2 */
|
||||
if (gotlhlo)
|
||||
{
|
||||
printf("503 %s Duplicate LHLO\r\n",
|
||||
mailerr("503", "%s Duplicate LHLO",
|
||||
myhostname);
|
||||
continue;
|
||||
}
|
||||
@ -581,17 +606,19 @@ dolmtp(bouncequota)
|
||||
{
|
||||
if (return_path != NULL)
|
||||
{
|
||||
printf("503 5.5.1 Nested MAIL command\r\n");
|
||||
mailerr("503 5.5.1",
|
||||
"Nested MAIL command");
|
||||
continue;
|
||||
}
|
||||
if (strncasecmp(buf+5, "from:", 5) != 0 ||
|
||||
((return_path = parseaddr(buf + 10,
|
||||
FALSE)) == NULL))
|
||||
{
|
||||
printf("501 5.5.4 Syntax error in parameters\r\n");
|
||||
mailerr("501 5.5.4",
|
||||
"Syntax error in parameters");
|
||||
continue;
|
||||
}
|
||||
printf("250 2.5.0 ok\r\n");
|
||||
printf("250 2.5.0 Ok\r\n");
|
||||
continue;
|
||||
}
|
||||
goto syntaxerr;
|
||||
@ -602,7 +629,7 @@ dolmtp(bouncequota)
|
||||
case 'N':
|
||||
if (strcasecmp(buf, "noop") == 0)
|
||||
{
|
||||
printf("250 2.0.0 ok\r\n");
|
||||
printf("250 2.0.0 Ok\r\n");
|
||||
continue;
|
||||
}
|
||||
goto syntaxerr;
|
||||
@ -613,7 +640,7 @@ dolmtp(bouncequota)
|
||||
case 'Q':
|
||||
if (strcasecmp(buf, "quit") == 0)
|
||||
{
|
||||
printf("221 2.0.0 bye\r\n");
|
||||
printf("221 2.0.0 Bye\r\n");
|
||||
exit(EX_OK);
|
||||
}
|
||||
goto syntaxerr;
|
||||
@ -626,7 +653,8 @@ dolmtp(bouncequota)
|
||||
{
|
||||
if (return_path == NULL)
|
||||
{
|
||||
printf("503 5.5.1 Need MAIL command\r\n");
|
||||
mailerr("503 5.5.1",
|
||||
"Need MAIL command");
|
||||
continue;
|
||||
}
|
||||
if (rcpt_num >= rcpt_alloc)
|
||||
@ -638,7 +666,8 @@ dolmtp(bouncequota)
|
||||
sizeof(char **));
|
||||
if (rcpt_addr == NULL)
|
||||
{
|
||||
printf("421 4.3.0 memory exhausted\r\n");
|
||||
mailerr("421 4.3.0",
|
||||
"Memory exhausted");
|
||||
exit(EX_TEMPFAIL);
|
||||
}
|
||||
}
|
||||
@ -646,21 +675,23 @@ dolmtp(bouncequota)
|
||||
((rcpt_addr[rcpt_num] = parseaddr(buf + 8,
|
||||
TRUE)) == NULL))
|
||||
{
|
||||
printf("501 5.5.4 Syntax error in parameters\r\n");
|
||||
mailerr("501 5.5.4",
|
||||
"Syntax error in parameters");
|
||||
continue;
|
||||
}
|
||||
if ((err = process_recipient(rcpt_addr[rcpt_num])) != NULL)
|
||||
err = process_recipient(rcpt_addr[rcpt_num]);
|
||||
if (err != NULL)
|
||||
{
|
||||
printf("%s\r\n", err);
|
||||
mailerr(NULL, "%s", err);
|
||||
continue;
|
||||
}
|
||||
rcpt_num++;
|
||||
printf("250 2.1.5 ok\r\n");
|
||||
printf("250 2.1.5 Ok\r\n");
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(buf, "rset") == 0)
|
||||
{
|
||||
printf("250 2.0.0 ok\r\n");
|
||||
printf("250 2.0.0 Ok\r\n");
|
||||
|
||||
rset:
|
||||
while (rcpt_num > 0)
|
||||
@ -678,7 +709,7 @@ rset:
|
||||
case 'V':
|
||||
if (strncasecmp(buf, "vrfy ", 5) == 0)
|
||||
{
|
||||
printf("252 2.3.3 try RCPT to attempt delivery\r\n");
|
||||
printf("252 2.3.3 Try RCPT to attempt delivery\r\n");
|
||||
continue;
|
||||
}
|
||||
goto syntaxerr;
|
||||
@ -687,7 +718,7 @@ rset:
|
||||
|
||||
default:
|
||||
syntaxerr:
|
||||
printf("500 5.5.2 Syntax error\r\n");
|
||||
mailerr("500 5.5.2", "Syntax error");
|
||||
continue;
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
@ -696,9 +727,10 @@ rset:
|
||||
}
|
||||
|
||||
int
|
||||
store(from, lmtprcpts)
|
||||
store(from, lmtprcpts, inbody)
|
||||
char *from;
|
||||
int lmtprcpts;
|
||||
bool *inbody;
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
time_t tval;
|
||||
@ -709,28 +741,25 @@ store(from, lmtprcpts)
|
||||
int fd;
|
||||
char tmpbuf[sizeof _PATH_LOCTMP + 1];
|
||||
|
||||
if (inbody != NULL)
|
||||
*inbody = FALSE;
|
||||
|
||||
(void) umask(0077);
|
||||
(void) strlcpy(tmpbuf, _PATH_LOCTMP, sizeof tmpbuf);
|
||||
if ((fd = mkstemp(tmpbuf)) == -1 || (fp = fdopen(fd, "w+")) == NULL)
|
||||
if ((fd = mkstemp(tmpbuf)) < 0 || (fp = fdopen(fd, "w+")) == NULL)
|
||||
{
|
||||
if (lmtprcpts)
|
||||
{
|
||||
printf("451 4.3.0 unable to open temporary file\r\n");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mailerr("451 4.3.0", "unable to open temporary file");
|
||||
exit(ExitVal);
|
||||
}
|
||||
mailerr("451 4.3.0", "Unable to open temporary file");
|
||||
return -1;
|
||||
}
|
||||
(void) unlink(tmpbuf);
|
||||
|
||||
if (LMTPMode)
|
||||
{
|
||||
printf("354 go ahead\r\n");
|
||||
printf("354 Go ahead\r\n");
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
if (inbody != NULL)
|
||||
*inbody = TRUE;
|
||||
|
||||
(void) time(&tval);
|
||||
(void) fprintf(fp, "From %s %s", from, ctime(&tval));
|
||||
@ -742,7 +771,7 @@ store(from, lmtprcpts)
|
||||
|
||||
line[0] = '\0';
|
||||
eline = TRUE;
|
||||
while (fgets(line, sizeof(line), stdin) != (char *)NULL)
|
||||
while (fgets(line, sizeof(line), stdin) != (char *) NULL)
|
||||
{
|
||||
size_t line_len = 0;
|
||||
int peek;
|
||||
@ -753,7 +782,7 @@ store(from, lmtprcpts)
|
||||
line_len++;
|
||||
|
||||
/* Check for dot-stuffing */
|
||||
if (prevfl && lmtprcpts && line[0] == '.')
|
||||
if (prevfl && LMTPMode && line[0] == '.')
|
||||
{
|
||||
if (line[1] == '\n' ||
|
||||
(line[1] == '\r' && line[2] == '\n'))
|
||||
@ -797,7 +826,8 @@ store(from, lmtprcpts)
|
||||
if (prevfl && line[0] == '\n' && HeaderLength == 0)
|
||||
{
|
||||
eline = FALSE;
|
||||
HeaderLength = ftell(fp);
|
||||
if (fp != NULL)
|
||||
HeaderLength = ftell(fp);
|
||||
if (HeaderLength <= 0)
|
||||
{
|
||||
/*
|
||||
@ -815,6 +845,7 @@ store(from, lmtprcpts)
|
||||
else
|
||||
{
|
||||
if (eline && line[0] == 'F' &&
|
||||
fp != NULL &&
|
||||
!memcmp(line, "From ", 5))
|
||||
(void) putc('>', fp);
|
||||
eline = FALSE;
|
||||
@ -834,40 +865,39 @@ store(from, lmtprcpts)
|
||||
#endif /* CONTENTLENGTH */
|
||||
|
||||
}
|
||||
(void) fwrite(line, sizeof(char), line_len, fp);
|
||||
if (ferror(fp))
|
||||
if (fp != NULL)
|
||||
{
|
||||
if (lmtprcpts)
|
||||
{
|
||||
while (lmtprcpts--)
|
||||
printf("451 4.3.0 temporary file write error\r\n");
|
||||
(void) fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
(void) fwrite(line, sizeof(char), line_len, fp);
|
||||
if (ferror(fp))
|
||||
{
|
||||
mailerr("451 4.3.0",
|
||||
"temporary file write error");
|
||||
"Temporary file write error");
|
||||
(void) fclose(fp);
|
||||
exit(ExitVal);
|
||||
fp = NULL;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lmtprcpts)
|
||||
/* check if an error occurred */
|
||||
if (fp == NULL)
|
||||
return -1;
|
||||
|
||||
if (LMTPMode)
|
||||
{
|
||||
/* Got a premature EOF -- toss message and exit */
|
||||
exit(EX_OK);
|
||||
}
|
||||
|
||||
/* If message not newline terminated, need an extra. */
|
||||
if (strchr(line, '\n') == NULL)
|
||||
if (fp != NULL && strchr(line, '\n') == NULL)
|
||||
(void) putc('\n', fp);
|
||||
|
||||
lmtpdot:
|
||||
|
||||
#ifdef CONTENTLENGTH
|
||||
BodyLength = ftell(fp);
|
||||
if (fp != NULL)
|
||||
BodyLength = ftell(fp);
|
||||
if (HeaderLength == 0 && BodyLength > 0) /* empty body */
|
||||
{
|
||||
HeaderLength = BodyLength;
|
||||
@ -893,32 +923,23 @@ store(from, lmtprcpts)
|
||||
#endif /* CONTENTLENGTH */
|
||||
|
||||
/* Output a newline; note, empty messages are allowed. */
|
||||
(void) putc('\n', fp);
|
||||
if (fp != NULL)
|
||||
(void) putc('\n', fp);
|
||||
|
||||
if (fflush(fp) == EOF || ferror(fp) != 0)
|
||||
if (fp == NULL || fflush(fp) == EOF || ferror(fp) != 0)
|
||||
{
|
||||
if (lmtprcpts)
|
||||
{
|
||||
while (lmtprcpts--)
|
||||
printf("451 4.3.0 temporary file write error\r\n");
|
||||
mailerr("451 4.3.0", "Temporary file write error");
|
||||
if (fp != NULL)
|
||||
(void) fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mailerr("451 4.3.0", "temporary file write error");
|
||||
(void) fclose(fp);
|
||||
exit(ExitVal);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
void
|
||||
deliver(fd, name, bouncequota)
|
||||
deliver(fd, name)
|
||||
int fd;
|
||||
char *name;
|
||||
bool bouncequota;
|
||||
{
|
||||
struct stat fsb;
|
||||
struct stat sb;
|
||||
@ -926,6 +947,7 @@ deliver(fd, name, bouncequota)
|
||||
char path[MAXPATHLEN];
|
||||
int mbfd = -1, nr = 0, nw, off;
|
||||
char *p;
|
||||
char *errcode;
|
||||
off_t curoff;
|
||||
#ifdef CONTENTLENGTH
|
||||
off_t headerbytes;
|
||||
@ -939,28 +961,17 @@ deliver(fd, name, bouncequota)
|
||||
** Disallow delivery to unknown names -- special mailboxes can be
|
||||
** handled in the sendmail aliases file.
|
||||
*/
|
||||
|
||||
if ((pw = getpwnam(name)) == NULL)
|
||||
{
|
||||
if (ExitVal != EX_TEMPFAIL)
|
||||
ExitVal = EX_UNAVAILABLE;
|
||||
if (LMTPMode)
|
||||
{
|
||||
if (ExitVal == EX_TEMPFAIL)
|
||||
printf("451 4.3.0 cannot lookup name: %s\r\n",
|
||||
name);
|
||||
else
|
||||
printf("550 5.1.1 unknown name: %s\r\n", name);
|
||||
}
|
||||
if (ExitVal == EX_TEMPFAIL)
|
||||
errcode = "451 4.3.0";
|
||||
else
|
||||
{
|
||||
char *errcode = NULL;
|
||||
|
||||
if (ExitVal == EX_TEMPFAIL)
|
||||
errcode = "451 4.3.0";
|
||||
else
|
||||
errcode = "550 5.1.1";
|
||||
mailerr(errcode, "unknown name: %s", name);
|
||||
ExitVal = EX_UNAVAILABLE;
|
||||
errcode = "550 5.1.1";
|
||||
}
|
||||
mailerr(errcode, "Unknown name: %s", name);
|
||||
return;
|
||||
}
|
||||
endpwent();
|
||||
@ -1020,16 +1031,13 @@ tryagain:
|
||||
if (off == EX_TEMPFAIL || e_to_sys(off) == EX_TEMPFAIL)
|
||||
{
|
||||
ExitVal = EX_TEMPFAIL;
|
||||
mailerr("451 4.3.0",
|
||||
"lockmailbox %s failed; error code %d %s",
|
||||
p, off, errno > 0 ? errstring(errno) : "");
|
||||
errcode = "451 4.3.0";
|
||||
}
|
||||
else
|
||||
{
|
||||
mailerr("551 5.3.0",
|
||||
"lockmailbox %s failed; error code %d %s",
|
||||
p, off, errno > 0 ? errstring(errno) : "");
|
||||
}
|
||||
errcode = "551 5.3.0";
|
||||
|
||||
mailerr(errcode, "lockmailbox %s failed; error code %d %s",
|
||||
p, off, errno > 0 ? errstring(errno) : "");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1056,7 +1064,7 @@ tryagain:
|
||||
"%s: lstat: file changed after open", path);
|
||||
goto err1;
|
||||
}
|
||||
if (mbfd == -1)
|
||||
if (mbfd < 0)
|
||||
{
|
||||
if (save_errno == EEXIST)
|
||||
goto tryagain;
|
||||
@ -1143,7 +1151,7 @@ tryagain:
|
||||
if (!nobiff)
|
||||
{
|
||||
/* Get the starting offset of the new message for biff. */
|
||||
curoff = lseek(mbfd, (off_t)0, SEEK_END);
|
||||
curoff = lseek(mbfd, (off_t) 0, SEEK_END);
|
||||
if (sizeof curoff > sizeof(long))
|
||||
(void) snprintf(biffmsg, sizeof(biffmsg), "%s@%s\n",
|
||||
name, quad_to_string(curoff));
|
||||
@ -1153,9 +1161,9 @@ tryagain:
|
||||
}
|
||||
|
||||
/* Copy the message into the file. */
|
||||
if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1)
|
||||
if (lseek(fd, (off_t) 0, SEEK_SET) == (off_t) -1)
|
||||
{
|
||||
mailerr("450 4.2.0", "temporary file: %s",
|
||||
mailerr("450 4.2.0", "Temporary file: %s",
|
||||
errstring(errno));
|
||||
goto err1;
|
||||
}
|
||||
@ -1192,13 +1200,12 @@ tryagain:
|
||||
{
|
||||
if ((nw = write(mbfd, buf + off, nr - off)) < 0)
|
||||
{
|
||||
errcode = "450 4.2.0";
|
||||
#ifdef EDQUOT
|
||||
if (errno == EDQUOT && bouncequota)
|
||||
mailerr("552 5.2.2", "%s: %s",
|
||||
path, errstring(errno));
|
||||
else
|
||||
if (errno == EDQUOT && BounceQuota)
|
||||
errcode = "552 5.2.2";
|
||||
#endif /* EDQUOT */
|
||||
mailerr("450 4.2.0", "%s: %s",
|
||||
mailerr(errcode, "%s: %s",
|
||||
path, errstring(errno));
|
||||
goto err3;
|
||||
}
|
||||
@ -1206,7 +1213,7 @@ tryagain:
|
||||
}
|
||||
if (nr < 0)
|
||||
{
|
||||
mailerr("450 4.2.0", "temporary file: %s",
|
||||
mailerr("450 4.2.0", "Temporary file: %s",
|
||||
errstring(errno));
|
||||
goto err3;
|
||||
}
|
||||
@ -1216,15 +1223,7 @@ tryagain:
|
||||
{
|
||||
mailerr("450 4.2.0", "%s: %s", path, errstring(errno));
|
||||
err3:
|
||||
if (setreuid(0, 0) < 0)
|
||||
{
|
||||
#if 0
|
||||
/* already printed an error above for this recipient */
|
||||
(void) e_to_sys(errno);
|
||||
mailerr("450 4.2.0", "setreuid(0, 0): %s",
|
||||
errstring(errno));
|
||||
#endif /* 0 */
|
||||
}
|
||||
(void) setreuid(0, 0);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "reset euid = %d\n", geteuid());
|
||||
#endif /* DEBUG */
|
||||
@ -1238,12 +1237,12 @@ err0: unlockmbox();
|
||||
/* Close and check -- NFS doesn't write until the close. */
|
||||
if (close(mbfd))
|
||||
{
|
||||
errcode = "450 4.2.0";
|
||||
#ifdef EDQUOT
|
||||
if (errno == EDQUOT && bouncequota)
|
||||
mailerr("552 5.2.2", "%s: %s", path, errstring(errno));
|
||||
else
|
||||
if (errno == EDQUOT && BounceQuota)
|
||||
errcode = "552 5.2.2";
|
||||
#endif /* EDQUOT */
|
||||
mailerr("450 4.2.0", "%s: %s", path, errstring(errno));
|
||||
mailerr(errcode, "%s: %s", path, errstring(errno));
|
||||
(void) truncate(path, curoff);
|
||||
}
|
||||
else if (!nobiff)
|
||||
@ -1260,7 +1259,7 @@ err0: unlockmbox();
|
||||
#endif /* DEBUG */
|
||||
unlockmbox();
|
||||
if (LMTPMode)
|
||||
printf("250 2.1.5 %s OK\r\n", name);
|
||||
printf("250 2.1.5 %s Ok\r\n", name);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1415,7 +1414,7 @@ notifybiff(msg)
|
||||
if (addr.sin_family == AF_UNSPEC)
|
||||
return;
|
||||
|
||||
if (f < 0 && (f = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
|
||||
if (f < 0 && (f = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||
return;
|
||||
len = strlen(msg) + 1;
|
||||
(void) sendto(f, msg, len, 0, (struct sockaddr *) &addr, sizeof(addr));
|
||||
@ -1439,61 +1438,53 @@ mailerr(hdr, fmt, va_alist)
|
||||
va_dcl
|
||||
#endif /* __STDC__ */
|
||||
{
|
||||
size_t len = 0;
|
||||
va_list ap;
|
||||
|
||||
(void) e_to_sys(errno);
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else /* __STDC__ */
|
||||
va_start(ap);
|
||||
#endif /* __STDC__ */
|
||||
|
||||
if (LMTPMode)
|
||||
{
|
||||
if (hdr != NULL)
|
||||
printf("%s ", hdr);
|
||||
(void) vprintf(fmt, ap);
|
||||
(void) printf("\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) e_to_sys(errno);
|
||||
vwarn(fmt, ap);
|
||||
{
|
||||
snprintf(ErrBuf, sizeof ErrBuf, "%s ", hdr);
|
||||
len = strlen(ErrBuf);
|
||||
}
|
||||
}
|
||||
(void) vsnprintf(&ErrBuf[len], sizeof ErrBuf - len, fmt, ap);
|
||||
|
||||
if (!HoldErrs)
|
||||
flush_error();
|
||||
|
||||
/* Log the message to syslog. */
|
||||
if (!LMTPMode)
|
||||
syslog(LOG_ERR, "%s", ErrBuf);
|
||||
}
|
||||
|
||||
void
|
||||
vwarn(fmt, ap)
|
||||
const char *fmt;
|
||||
_BSD_VA_LIST_ ap;
|
||||
flush_error()
|
||||
{
|
||||
/*
|
||||
** Log the message to stderr.
|
||||
**
|
||||
** Don't use LOG_PERROR as an openlog() flag to do this,
|
||||
** it's not portable enough.
|
||||
*/
|
||||
|
||||
if (ExitVal != EX_USAGE)
|
||||
(void) fprintf(stderr, "mail.local: ");
|
||||
(void) vfprintf(stderr, fmt, ap);
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
#if USE_VSYSLOG
|
||||
/* Log the message to syslog. */
|
||||
vsyslog(LOG_ERR, fmt, ap);
|
||||
#else /* USE_VSYSLOG */
|
||||
if (LMTPMode)
|
||||
printf("%s\r\n", ErrBuf);
|
||||
else
|
||||
{
|
||||
char fmtbuf[10240];
|
||||
|
||||
(void) vsnprintf(fmtbuf, sizeof fmtbuf, fmt, ap);
|
||||
syslog(LOG_ERR, "%s", fmtbuf);
|
||||
if (ExitVal != EX_USAGE)
|
||||
(void) fprintf(stderr, "mail.local: ");
|
||||
fprintf(stderr, "%s\n", ErrBuf);
|
||||
}
|
||||
#endif /* USE_VSYSLOG */
|
||||
}
|
||||
|
||||
/*
|
||||
* e_to_sys --
|
||||
* Guess which errno's are temporary. Gag me.
|
||||
*/
|
||||
|
||||
int
|
||||
e_to_sys(num)
|
||||
int num;
|
||||
@ -1506,7 +1497,7 @@ e_to_sys(num)
|
||||
{
|
||||
#ifdef EDQUOT
|
||||
case EDQUOT: /* Disc quota exceeded */
|
||||
if (bouncequota)
|
||||
if (BounceQuota)
|
||||
{
|
||||
ExitVal = EX_UNAVAILABLE;
|
||||
break;
|
||||
@ -1647,15 +1638,6 @@ mkstemp(path)
|
||||
return (_gettemp(path, &fd) ? fd : -1);
|
||||
}
|
||||
|
||||
# if 0
|
||||
char *
|
||||
mktemp(path)
|
||||
char *path;
|
||||
{
|
||||
return(_gettemp(path, (int *)NULL) ? path : (char *)NULL);
|
||||
}
|
||||
# endif /* 0 */
|
||||
|
||||
static
|
||||
_gettemp(path, doopen)
|
||||
char *path;
|
||||
|
@ -21,7 +21,7 @@ static char copyright[] =
|
||||
#endif /* ! lint */
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: mailstats.c,v 8.53.16.11 2000/09/17 17:04:26 gshapiro Exp $";
|
||||
static char id[] = "@(#)$Id: mailstats.c,v 8.53.16.12 2001/02/15 20:52:36 geir Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
|
||||
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
|
||||
All rights reserved.\n\
|
||||
Copyright (c) 1983 Eric P. Allman. All rights reserved.\n\
|
||||
Copyright (c) 1988, 1993\n\
|
||||
@ -21,7 +21,7 @@ static char copyright[] =
|
||||
#endif /* ! lint */
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: praliases.c,v 8.59.4.15 2000/10/24 00:42:59 geir Exp $";
|
||||
static char id[] = "@(#)$Id: praliases.c,v 8.59.4.18 2001/01/22 19:00:18 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -274,6 +274,21 @@ praliases(filename, argc, argv)
|
||||
db_name++;
|
||||
}
|
||||
|
||||
/* Skip non-file based DB types */
|
||||
if (db_type != NULL && *db_type != '\0')
|
||||
{
|
||||
if (db_type != SMDB_TYPE_DEFAULT &&
|
||||
strcmp(db_type, "hash") != 0 &&
|
||||
strcmp(db_type, "btree") != 0 &&
|
||||
strcmp(db_type, "dbm") != 0)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"praliases: Skipping non-file based alias type %s\n",
|
||||
db_type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (*db_name == '\0' || (db_type != NULL && *db_type == '\0'))
|
||||
{
|
||||
if (colon != NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -19,7 +19,7 @@ static char copyright[] =
|
||||
#endif /* ! lint */
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: rmail.c,v 8.39.4.9 2000/11/17 08:42:56 gshapiro Exp $";
|
||||
static char id[] = "@(#)$Id: rmail.c,v 8.39.4.11 2001/02/14 04:07:25 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -99,9 +99,9 @@ static char id[] = "@(#)$Id: rmail.c,v 8.39.4.9 2000/11/17 08:42:56 gshapiro Exp
|
||||
# define memmove(d, s, l) (bcopy((s), (d), (l)))
|
||||
#endif /* defined(sun) && !defined(BSD) && !defined(SOLARIS) && !defined(__svr4__) && !defined(__SVR4) */
|
||||
|
||||
#if !HASSNPRINTF
|
||||
#if !HASSNPRINTF && !SFIO
|
||||
extern int snprintf __P((char *, size_t, const char *, ...));
|
||||
#endif /* !HASSNPRINTF */
|
||||
#endif /* !HASSNPRINTF && !SFIO */
|
||||
|
||||
#if defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__) || defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
|
||||
# ifndef HASSTRERROR
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1993 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1993
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
|
||||
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
|
||||
All rights reserved.\n\
|
||||
Copyright (c) 1993 Eric P. Allman. All rights reserved.\n\
|
||||
Copyright (c) 1993\n\
|
||||
@ -21,7 +21,7 @@ static char copyright[] =
|
||||
#endif /* ! lint */
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.6 2000/10/09 20:37:16 gshapiro Exp $";
|
||||
static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.8 2001/01/22 19:00:26 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -78,9 +78,9 @@ static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.6 2000/10/09 20:37:16 gshapiro Exp
|
||||
#ifndef CMDDIR
|
||||
# if defined(HPUX10) || defined(HPUX11) || SOLARIS >= 20800
|
||||
# define CMDDIR "/var/adm/sm.bin"
|
||||
# else /* HPUX10 || HPUX11 || SOLARIS > 20800 */
|
||||
# else /* HPUX10 || HPUX11 || SOLARIS >= 20800 */
|
||||
# define CMDDIR "/usr/libexec/sm.bin"
|
||||
# endif /* HPUX10 || HPUX11 || SOLARIS > 20800 */
|
||||
# endif /* HPUX10 || HPUX11 || SOLARIS >= 20800 */
|
||||
#endif /* ! CMDDIR */
|
||||
|
||||
/* characters disallowed in the shell "-c" argument */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.61 2000/12/28 23:46:41 gshapiro Exp $";
|
||||
static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.69 2001/02/27 19:50:11 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -4360,7 +4360,7 @@ getipnodebyname(name, family, flags, err)
|
||||
resv6 = bitset(RES_USE_INET6, _res.options);
|
||||
_res.options |= RES_USE_INET6;
|
||||
}
|
||||
h_errno = 0;
|
||||
SM_SET_H_ERRNO(0);
|
||||
h = gethostbyname(name);
|
||||
*err = h_errno;
|
||||
if (family == AF_INET6 && !resv6)
|
||||
@ -4377,7 +4377,7 @@ getipnodebyaddr(addr, len, family, err)
|
||||
{
|
||||
struct hostent *h;
|
||||
|
||||
h_errno = 0;
|
||||
SM_SET_H_ERRNO(0);
|
||||
h = gethostbyaddr(addr, len, family);
|
||||
*err = h_errno;
|
||||
return h;
|
||||
@ -4403,6 +4403,7 @@ sm_gethostbyname(name, family)
|
||||
char *name;
|
||||
int family;
|
||||
{
|
||||
int save_errno;
|
||||
struct hostent *h = NULL;
|
||||
#if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4))
|
||||
# if SOLARIS == 20300 || SOLARIS == 203
|
||||
@ -4413,12 +4414,14 @@ sm_gethostbyname(name, family)
|
||||
if (tTd(61, 10))
|
||||
dprintf("_switch_gethostbyname_r(%s)... ", name);
|
||||
h = _switch_gethostbyname_r(name, &hp, buf, sizeof(buf), &h_errno);
|
||||
save_errno = errno;
|
||||
# else /* SOLARIS == 20300 || SOLARIS == 203 */
|
||||
extern struct hostent *__switch_gethostbyname();
|
||||
|
||||
if (tTd(61, 10))
|
||||
dprintf("__switch_gethostbyname(%s)... ", name);
|
||||
h = __switch_gethostbyname(name);
|
||||
save_errno = errno;
|
||||
# endif /* SOLARIS == 20300 || SOLARIS == 203 */
|
||||
#else /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4)) */
|
||||
int nmaps;
|
||||
@ -4426,7 +4429,6 @@ sm_gethostbyname(name, family)
|
||||
int flags = AI_DEFAULT|AI_ALL;
|
||||
int err;
|
||||
# endif /* NETINET6 */
|
||||
int save_errno;
|
||||
char *maptype[MAXMAPSTACK];
|
||||
short mapreturn[MAXMAPACTIONS];
|
||||
char hbuf[MAXNAME];
|
||||
@ -4439,7 +4441,7 @@ sm_gethostbyname(name, family)
|
||||
flags &= ~AI_ADDRCONFIG;
|
||||
# endif /* ADDRCONFIG_IS_BROKEN */
|
||||
h = getipnodebyname(name, family, flags, &err);
|
||||
h_errno = err;
|
||||
SM_SET_H_ERRNO(err);
|
||||
# else /* NETINET6 */
|
||||
h = gethostbyname(name);
|
||||
# endif /* NETINET6 */
|
||||
@ -4467,7 +4469,7 @@ sm_gethostbyname(name, family)
|
||||
return NULL;
|
||||
}
|
||||
(void) strlcpy(hbuf, name, sizeof hbuf);
|
||||
shorten_hostname(hbuf);
|
||||
(void) shorten_hostname(hbuf);
|
||||
|
||||
/* if it hasn't been shortened, there's no point */
|
||||
if (strcmp(hbuf, name) != 0)
|
||||
@ -4480,7 +4482,7 @@ sm_gethostbyname(name, family)
|
||||
h = getipnodebyname(hbuf, family,
|
||||
AI_V4MAPPED|AI_ALL,
|
||||
&err);
|
||||
h_errno = err;
|
||||
SM_SET_H_ERRNO(err);
|
||||
save_errno = errno;
|
||||
# else /* NETINET6 */
|
||||
h = gethostbyname(hbuf);
|
||||
@ -4543,26 +4545,42 @@ sm_gethostbyaddr(addr, len, type)
|
||||
int type;
|
||||
{
|
||||
struct hostent *hp;
|
||||
|
||||
#if NETINET6
|
||||
if (type == AF_INET6 &&
|
||||
IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *) addr))
|
||||
{
|
||||
/* Avoid reverse lookup for IPv6 unspecified address */
|
||||
SM_SET_H_ERRNO(HOST_NOT_FOUND);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* NETINET6 */
|
||||
|
||||
#if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204)
|
||||
# if SOLARIS == 20300 || SOLARIS == 203
|
||||
static struct hostent he;
|
||||
static char buf[1000];
|
||||
extern struct hostent *_switch_gethostbyaddr_r();
|
||||
{
|
||||
static struct hostent he;
|
||||
static char buf[1000];
|
||||
extern struct hostent *_switch_gethostbyaddr_r();
|
||||
|
||||
hp = _switch_gethostbyaddr_r(addr, len, type, &he, buf, sizeof(buf), &h_errno);
|
||||
hp = _switch_gethostbyaddr_r(addr, len, type, &he,
|
||||
buf, sizeof(buf), &h_errno);
|
||||
}
|
||||
# else /* SOLARIS == 20300 || SOLARIS == 203 */
|
||||
extern struct hostent *__switch_gethostbyaddr();
|
||||
{
|
||||
extern struct hostent *__switch_gethostbyaddr();
|
||||
|
||||
hp = __switch_gethostbyaddr(addr, len, type);
|
||||
hp = __switch_gethostbyaddr(addr, len, type);
|
||||
}
|
||||
# endif /* SOLARIS == 20300 || SOLARIS == 203 */
|
||||
#else /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) */
|
||||
# if NETINET6
|
||||
int err;
|
||||
# endif /* NETINET6 */
|
||||
{
|
||||
int err;
|
||||
|
||||
# if NETINET6
|
||||
hp = getipnodebyaddr(addr, len, type, &err);
|
||||
h_errno = err;
|
||||
hp = getipnodebyaddr(addr, len, type, &err);
|
||||
SM_SET_H_ERRNO(err);
|
||||
}
|
||||
# else /* NETINET6 */
|
||||
hp = gethostbyaddr(addr, len, type);
|
||||
# endif /* NETINET6 */
|
||||
@ -4937,18 +4955,21 @@ load_if_names()
|
||||
switch (af)
|
||||
{
|
||||
case AF_INET6:
|
||||
ia6 = sa->sin6.sin6_addr;
|
||||
# ifdef __KAME__
|
||||
/* convert into proper scoped address - */
|
||||
if ((IN6_IS_ADDR_LINKLOCAL(&ia6) ||
|
||||
IN6_IS_ADDR_SITELOCAL(&ia6)) &&
|
||||
# ifdef __KAME__
|
||||
/* convert into proper scoped address */
|
||||
if ((IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr) ||
|
||||
IN6_IS_ADDR_SITELOCAL(&sa->sin6.sin6_addr)) &&
|
||||
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;
|
||||
struct in6_addr *ia6p;
|
||||
|
||||
ia6p = &sa->sin6.sin6_addr;
|
||||
sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
|
||||
((unsigned int)ia6p->s6_addr[2] << 8));
|
||||
ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
|
||||
}
|
||||
# endif /* __KAME__ */
|
||||
# endif /* __KAME__ */
|
||||
ia6 = sa->sin6.sin6_addr;
|
||||
if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
|
||||
{
|
||||
addr = anynet_ntop(&ia6, buf6, sizeof buf6);
|
||||
@ -5131,6 +5152,20 @@ load_if_names()
|
||||
|
||||
# if NETINET6
|
||||
case AF_INET6:
|
||||
# ifdef __KAME__
|
||||
/* convert into proper scoped address */
|
||||
if ((IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr) ||
|
||||
IN6_IS_ADDR_SITELOCAL(&sa->sin6.sin6_addr)) &&
|
||||
sa->sin6.sin6_scope_id == 0)
|
||||
{
|
||||
struct in6_addr *ia6p;
|
||||
|
||||
ia6p = &sa->sin6.sin6_addr;
|
||||
sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
|
||||
((unsigned int)ia6p->s6_addr[2] << 8));
|
||||
ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
|
||||
}
|
||||
# endif /* __KAME__ */
|
||||
ia6 = sa->sin6.sin6_addr;
|
||||
if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -10,7 +10,7 @@
|
||||
* the sendmail distribution.
|
||||
*
|
||||
*
|
||||
* $Id: conf.h,v 8.496.4.32 2000/12/15 19:20:53 gshapiro Exp $
|
||||
* $Id: conf.h,v 8.496.4.37 2001/02/12 21:40:16 gshapiro Exp $
|
||||
*/
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -490,6 +490,9 @@ typedef int pid_t;
|
||||
# endif /* ! __svr4__ */
|
||||
# define GIDSET_T gid_t
|
||||
# define USE_SA_SIGACTION 1 /* use sa_sigaction field */
|
||||
# if _FFR_MILTER
|
||||
# define BROKEN_PTHREAD_SLEEP 1 /* sleep after pthread_create() fails */
|
||||
# endif /* _FFR_MILTER */
|
||||
# ifndef _PATH_UNIX
|
||||
# define _PATH_UNIX "/dev/ksyms"
|
||||
# endif /* ! _PATH_UNIX */
|
||||
@ -1006,6 +1009,12 @@ typedef int pid_t;
|
||||
# define HASSTRL 0 /* strlcat(3) is broken in 2.5 and earlier */
|
||||
# else /* OpenBSD < 199912 */
|
||||
# define HASSTRL 1 /* has strlc{py,at}(3) functions */
|
||||
# if OpenBSD >= 200006
|
||||
# define HASSRANDOMDEV 1 /* has srandomdev(3) */
|
||||
# endif
|
||||
# if OpenBSD >= 200012
|
||||
# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */
|
||||
# endif
|
||||
# endif /* OpenBSD < 199912 */
|
||||
# endif /* defined(__OpenBSD__) */
|
||||
#endif /* defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
|
||||
@ -1729,6 +1738,9 @@ typedef int pid_t;
|
||||
# define _PATH_SENDMAILPID "/etc/sendmail.pid"
|
||||
# endif /* ! _PATH_SENDMAILPID */
|
||||
# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
|
||||
#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
|
||||
# define SM_SET_H_ERRNO(err) set_h_errno((err))
|
||||
#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
|
||||
#endif /* __svr5__ */
|
||||
|
||||
/* ###################################################################### */
|
||||
@ -2724,6 +2736,10 @@ typedef void (*sigfunc_t) __P((int));
|
||||
# define FORK fork /* function to call to fork mailer */
|
||||
#endif /* ! FORK */
|
||||
|
||||
/* setting h_errno */
|
||||
#ifndef SM_SET_H_ERRNO
|
||||
# define SM_SET_H_ERRNO(err) h_errno = (err)
|
||||
#endif /* SM_SET_H_ERRNO */
|
||||
|
||||
/* random routine -- set above using #ifdef _osname_ or in Makefile */
|
||||
#if HASRANDOM
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: headers.c,v 8.203.4.10 2000/10/13 17:54:30 gshapiro Exp $";
|
||||
static char id[] = "@(#)$Id: headers.c,v 8.203.4.12 2001/01/22 19:00:22 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -310,7 +310,7 @@ hse:
|
||||
dp = qval;
|
||||
l = 0;
|
||||
dp[l++] = '"';
|
||||
for (sp = fvalue; *sp != '\0' && l < MAXNAME - 2; sp++)
|
||||
for (sp = fvalue; *sp != '\0' && l < MAXNAME - 3; sp++)
|
||||
{
|
||||
switch(*sp)
|
||||
{
|
||||
@ -339,7 +339,7 @@ hse:
|
||||
if (LogLevel > 9)
|
||||
sm_syslog(LOG_WARNING, e->e_id,
|
||||
"Warning: truncated header '%s' before check with '%s' len=%d max=%d",
|
||||
fname, rs, l, MAXNAME);
|
||||
fname, rs, l, MAXNAME - 1);
|
||||
}
|
||||
if ((sp = macvalue(macid("{currHeader}", NULL), e)) !=
|
||||
NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
|
||||
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char id[] = "@(#)$Id: savemail.c,v 8.212.4.11 2000/12/18 18:00:44 ca Exp $";
|
||||
static char id[] = "@(#)$Id: savemail.c,v 8.212.4.12 2001/01/07 19:31:05 gshapiro Exp $";
|
||||
#endif /* ! lint */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
@ -1017,7 +1017,8 @@ errbody(mci, e, separator)
|
||||
}
|
||||
|
||||
/* Reporting-MTA: is us (required) */
|
||||
(void) snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s", MyHostName);
|
||||
(void) snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s",
|
||||
MyHostName);
|
||||
putline(buf, mci);
|
||||
|
||||
/* DSN-Gateway: not relevant since we are not translating */
|
||||
|
Loading…
x
Reference in New Issue
Block a user