summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/main.c
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2010-01-26 04:41:15 +0000
committergshapiro <gshapiro@FreeBSD.org>2010-01-26 04:41:15 +0000
commit06af2946772550af5ad9eea974674de7bde4243b (patch)
tree6c6c3749a8b863bd3e7a5962fc9189f1a3e34f9c /contrib/sendmail/src/main.c
parentc1aec8d8e06eaf4b4e5066794fecde82622b6366 (diff)
downloadFreeBSD-src-06af2946772550af5ad9eea974674de7bde4243b.zip
FreeBSD-src-06af2946772550af5ad9eea974674de7bde4243b.tar.gz
Merge sendmail 8.14.4 to HEAD
MFC after: 4 days
Diffstat (limited to 'contrib/sendmail/src/main.c')
-rw-r--r--contrib/sendmail/src/main.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index d68d5b5..1bbb070 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008, 2009 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -26,7 +26,7 @@ SM_UNUSED(static char copyright[]) =
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
-SM_RCSID("@(#)$Id: main.c,v 8.967 2008/03/31 16:32:13 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.971 2009/12/18 17:08:01 ca Exp $")
#if NETINET || NETINET6
@@ -129,7 +129,7 @@ int SyslogPrefixLen; /* estimated length of syslog prefix */
{ \
if (extraprivs && \
OpMode != MD_DELIVER && OpMode != MD_SMTP && \
- OpMode != MD_ARPAFTP && \
+ OpMode != MD_ARPAFTP && OpMode != MD_CHECKCONFIG && \
OpMode != MD_VERIFY && OpMode != MD_TEST) \
{ \
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, \
@@ -401,6 +401,9 @@ main(argc, argv, envp)
case MD_HOSTSTAT:
case MD_PURGESTAT:
case MD_ARPAFTP:
+#if _FFR_CHECKCONFIG
+ case MD_CHECKCONFIG:
+#endif /* _FFR_CHECKCONFIG */
OpMode = j;
break;
@@ -1192,7 +1195,7 @@ main(argc, argv, envp)
}
/* if we've had errors so far, exit now */
- if ((ExitStat != EX_OK && OpMode != MD_TEST) ||
+ if ((ExitStat != EX_OK && OpMode != MD_TEST && OpMode != MD_CHECKCONFIG) ||
ExitStat == EX_OSERR)
{
finis(false, true, ExitStat);
@@ -1566,6 +1569,7 @@ main(argc, argv, envp)
break;
case MD_TEST:
+ case MD_CHECKCONFIG:
case MD_PRINT:
case MD_PRINTNQE:
case MD_FREEZE:
@@ -1626,6 +1630,9 @@ main(argc, argv, envp)
case MD_TEST:
/* don't have persistent host status in test mode */
HostStatDir = NULL;
+ /* FALLTHROUGH */
+
+ case MD_CHECKCONFIG:
if (Verbose == 0)
Verbose = 2;
BlankEnvelope.e_errormode = EM_PRINT;
@@ -1933,8 +1940,8 @@ main(argc, argv, envp)
}
}
- /* if we've had errors so far, exit now */
- if (ExitStat != EX_OK && OpMode != MD_TEST)
+ /* if checking config or have had errors so far, exit now */
+ if (OpMode == MD_CHECKCONFIG || (ExitStat != EX_OK && OpMode != MD_TEST))
{
finis(false, true, ExitStat);
/* NOTREACHED */
@@ -1958,7 +1965,7 @@ main(argc, argv, envp)
case MD_PRINT:
/* print the queue */
HoldErrs = false;
- dropenvelope(&BlankEnvelope, true, false);
+ (void) dropenvelope(&BlankEnvelope, true, false);
(void) sm_signal(SIGPIPE, sigpipe);
if (qgrp != NOQGRP)
{
@@ -1981,7 +1988,7 @@ main(argc, argv, envp)
case MD_PRINTNQE:
/* print number of entries in queue */
- dropenvelope(&BlankEnvelope, true, false);
+ (void) dropenvelope(&BlankEnvelope, true, false);
(void) sm_signal(SIGPIPE, sigpipe);
printnqe(smioout, NULL);
finis(false, true, EX_OK);
@@ -2133,8 +2140,8 @@ main(argc, argv, envp)
else if (OpMode == MD_DAEMON || OpMode == MD_FGDAEMON ||
OpMode == MD_SMTP)
{
- /* check whether STARTTLS is turned off for the server */
- if (chkdaemonmodifiers(D_NOTLS))
+ /* check whether STARTTLS is turned off */
+ if (chkdaemonmodifiers(D_NOTLS) && chkclientmodifiers(D_NOTLS))
tls_ok = false;
}
else /* other modes don't need STARTTLS */
@@ -2530,7 +2537,7 @@ main(argc, argv, envp)
}
}
}
- dropenvelope(&MainEnvelope, true, false);
+ (void) dropenvelope(&MainEnvelope, true, false);
#if STARTTLS
/* init TLS for server, ignore result for now */
@@ -2952,7 +2959,11 @@ finis(drop, cleanup, exitstat)
{
if (CurEnv->e_id != NULL)
{
- dropenvelope(CurEnv, true, false);
+ int r;
+
+ r = dropenvelope(CurEnv, true, false);
+ if (exitstat == EX_OK)
+ exitstat = r;
sm_rpool_free(CurEnv->e_rpool);
CurEnv->e_rpool = NULL;
OpenPOWER on IntegriCloud