summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/mail.local
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2005-02-14 02:39:14 +0000
committergshapiro <gshapiro@FreeBSD.org>2005-02-14 02:39:14 +0000
commite1f5440b9ed6c521a401bdddc4722b7ff5ef43a9 (patch)
treee109b48bd3a58abfa6dedd2be0e7f509d15c5b1d /contrib/sendmail/mail.local
parent59c6e3524b67debe90b8e7c57d4c84e7ea08a463 (diff)
downloadFreeBSD-src-e1f5440b9ed6c521a401bdddc4722b7ff5ef43a9.zip
FreeBSD-src-e1f5440b9ed6c521a401bdddc4722b7ff5ef43a9.tar.gz
Resolve conflicts from sendmail 8.13.3 import
MFC after: 4 days
Diffstat (limited to 'contrib/sendmail/mail.local')
-rw-r--r--contrib/sendmail/mail.local/mail.local.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c
index d623ac9..b5ccd5b 100644
--- a/contrib/sendmail/mail.local/mail.local.c
+++ b/contrib/sendmail/mail.local/mail.local.c
@@ -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
OpenPOWER on IntegriCloud