summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/sendmail.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/src/sendmail.h')
-rw-r--r--contrib/sendmail/src/sendmail.h2062
1 files changed, 1319 insertions, 743 deletions
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index ff2697e..e199d66 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -7,78 +8,128 @@
* 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.
- *
- *
- * @(#)sendmail.h 8.295 (Berkeley) 1/26/1999
*/
/*
-** SENDMAIL.H -- Global definitions for sendmail.
+** SENDMAIL.H -- MTA-specific definitions for sendmail.
*/
-# ifdef _DEFINE
+#ifndef _SENDMAIL_H
+#define _SENDMAIL_H 1
+
+#ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.295 1/26/1999";
-# endif
-# else /* _DEFINE */
+static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.28 2000/07/18 02:24:44 gshapiro Exp $";
+# endif /* ! lint */
+#else /* _DEFINE */
# define EXTERN extern
-# endif /* _DEFINE */
+#endif /* _DEFINE */
+
+
+#include <unistd.h>
+
+#if SFIO
+# include <sfio/stdio.h>
+# if defined(SFIO_VERSION) && SFIO_VERSION > 20000000L
+ ERROR README: SFIO 2000 does not work with sendmail, use SFIO 1999 instead.
+# endif /* defined(SFIO_VERSION) && SFIO_VERSION > 20000000L */
+#endif /* SFIO */
-# include <unistd.h>
-# include <stddef.h>
-# include <stdlib.h>
+#include <stddef.h>
+#include <stdlib.h>
+#if !SFIO
# include <stdio.h>
-# include <ctype.h>
-# include <setjmp.h>
-# include <string.h>
-# include <time.h>
-# include <errno.h>
+#endif /* !SFIO */
+#include <ctype.h>
+#include <setjmp.h>
+#include <string.h>
+#include <time.h>
# ifdef EX_OK
# undef EX_OK /* for SVr4.2 SMP */
-# endif
-# include <sysexits.h>
+# endif /* EX_OK */
+#include <sysexits.h>
-# include "conf.h"
-# include "useful.h"
+#include "sendmail/sendmail.h"
+#include "bf.h"
+#include "timers.h"
-# ifdef LOG
+#ifdef LOG
# include <syslog.h>
-# endif /* LOG */
+#endif /* LOG */
-# if NETINET || NETUNIX || NETISO || NETNS || NETX25
-# include <sys/socket.h>
-# endif
+
+
+# if NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25
+# include <sys/socket.h>
+# endif /* NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25 */
# if NETUNIX
-# include <sys/un.h>
-# endif
-# if NETINET
-# include <netinet/in.h>
-# endif
+# include <sys/un.h>
+# endif /* NETUNIX */
+# if NETINET || NETINET6
+# include <netinet/in.h>
+# endif /* NETINET || NETINET6 */
+# if NETINET6
+/*
+** There is no standard yet for IPv6 includes.
+** Specify OS specific implementation in conf.h
+*/
+# endif /* NETINET6 */
# if NETISO
-# include <netiso/iso.h>
-# endif
+# include <netiso/iso.h>
+# endif /* NETISO */
# if NETNS
-# include <netns/ns.h>
-# endif
+# include <netns/ns.h>
+# endif /* NETNS */
# if NETX25
-# include <netccitt/x25.h>
-# endif
-
-#if NAMED_BIND
-# include <arpa/nameser.h>
-# ifdef NOERROR
-# undef NOERROR /* avoid <sys/streams.h> conflict */
-# endif
-#endif
-
-#ifdef HESIOD
-# include <hesiod.h>
-# if !defined(HES_ER_OK) || defined(HESIOD_INTERFACES)
-# define HESIOD_INIT /* support for the new interface */
-EXTERN void *HesiodContext;
-# endif
-#endif
+# include <netccitt/x25.h>
+# endif /* NETX25 */
+
+# if NAMED_BIND
+# include <arpa/nameser.h>
+# ifdef NOERROR
+# undef NOERROR /* avoid <sys/streams.h> conflict */
+# endif /* NOERROR */
+# include <resolv.h>
+# endif /* NAMED_BIND */
+
+# ifdef HESIOD
+# include <hesiod.h>
+# if !defined(HES_ER_OK) || defined(HESIOD_INTERFACES)
+# define HESIOD_INIT /* support for the new interface */
+# endif /* !defined(HES_ER_OK) || defined(HESIOD_INTERFACES) */
+# endif /* HESIOD */
+
+#if STARTTLS
+# if !SFIO && !_FFR_TLS_TOREK
+ ERROR README: STARTTLS requires SFIO
+# endif /* !SFIO && !_FFR_TLS_TOREK */
+# if SFIO && _FFR_TLS_TOREK
+ ERROR README: Can not do both SFIO and _FFR_TLS_TOREK
+# endif /* SFIO && _FFR_TLS_TOREK */
+# include <openssl/ssl.h>
+#endif /* STARTTLS */
+
+#if SASL /* include the sasl include files if we have them */
+# include <sasl.h>
+# if defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP)
+# define SASL_VERSION (SASL_VERSION_MAJOR * 10000) + (SASL_VERSION_MINOR * 100) + SASL_VERSION_STEP
+# if SASL == 1
+# undef SASL
+# define SASL SASL_VERSION
+# else /* SASL == 1 */
+# if SASL != SASL_VERSION
+ ERROR README: -DSASL (SASL) does not agree with the version of the CYRUS_SASL library (SASL_VERSION)
+ ERROR README: see README!
+# endif /* SASL != SASL_VERSION */
+# endif /* SASL == 1 */
+# else /* defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP) */
+# if SASL == 1
+ ERROR README: please set -DSASL to the version of the CYRUS_SASL library
+ ERROR README: see README!
+# endif /* SASL == 1 */
+# endif /* defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP) */
+#endif /* SASL */
/*
** Following are "sort of" configuration constants, but they should
@@ -91,56 +142,30 @@ EXTERN void *HesiodContext;
#ifndef INADDRSZ
# define INADDRSZ 4 /* size of an IPv4 address in bytes */
-#endif
+#endif /* ! INADDRSZ */
+#ifndef IN6ADDRSZ
+# define IN6ADDRSZ 16 /* size of an IPv6 address in bytes */
+#endif /* ! IN6ADDRSZ */
#ifndef INT16SZ
# define INT16SZ 2 /* size of a 16 bit integer in bytes */
-#endif
+#endif /* ! INT16SZ */
#ifndef INT32SZ
# define INT32SZ 4 /* size of a 32 bit integer in bytes */
-#endif
-
-
-
-/* forward references for prototypes */
-typedef struct envelope ENVELOPE;
-typedef struct mailer MAILER;
-
+#endif /* ! INT32SZ */
/*
-** Data structure for bit maps.
-**
-** Each bit in this map can be referenced by an ascii character.
-** This is 256 possible bits, or 32 8-bit bytes.
+** Error return from inet_addr(3), in case not defined in /usr/include.
*/
-#define BITMAPBYTES 32 /* number of bytes in a bit map */
-#define BYTEBITS 8 /* number of bits in a byte */
-
-/* internal macros */
-#define _BITWORD(bit) ((bit) / (BYTEBITS * sizeof (int)))
-#define _BITBIT(bit) (1 << ((bit) % (BYTEBITS * sizeof (int))))
-
-typedef int BITMAP[BITMAPBYTES / sizeof (int)];
-
-/* test bit number N */
-#define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit))
-
-/* set bit number N */
-#define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit)
-
-/* clear bit number N */
-#define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit)
-
-/* clear an entire bit map */
-#define clrbitmap(map) bzero((char *) map, BITMAPBYTES)
+#ifndef INADDR_NONE
+# define INADDR_NONE 0xffffffff
+#endif /* ! INADDR_NONE */
-/*
-** Utility macros
-*/
+/* forward references for prototypes */
+typedef struct envelope ENVELOPE;
+typedef struct mailer MAILER;
-/* return number of bytes left in a buffer */
-#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
/*
** Address structure.
** Addresses are stored internally in this structure.
@@ -167,50 +192,97 @@ struct address
char *q_rstatus; /* remote status message for DSNs */
time_t q_statdate; /* date of status messages */
char *q_statmta; /* MTA generating q_rstatus */
+ short q_state; /* address state, see below */
short q_specificity; /* how "specific" this address is */
};
typedef struct address ADDRESS;
-# define QDONTSEND 0x00000001 /* don't send to this address */
-# define QBADADDR 0x00000002 /* this address is verified bad */
-# define QGOODUID 0x00000004 /* the q_uid q_gid fields are good */
-# define QPRIMARY 0x00000008 /* set from RCPT or argv */
-# define QQUEUEUP 0x00000010 /* queue for later transmission */
-# define QSENT 0x00000020 /* has been successfully delivered */
-# define QNOTREMOTE 0x00000040 /* address not for remote forwarding */
-# define QSELFREF 0x00000080 /* this address references itself */
-# define QVERIFIED 0x00000100 /* verified, but not expanded */
-# define QBOGUSSHELL 0x00000400 /* user has no valid shell listed */
-# define QUNSAFEADDR 0x00000800 /* address aquired via unsafe path */
-# define QPINGONSUCCESS 0x00001000 /* give return on successful delivery */
-# define QPINGONFAILURE 0x00002000 /* give return on failure */
-# define QPINGONDELAY 0x00004000 /* give return on message delay */
-# define QHASNOTIFY 0x00008000 /* propogate notify parameter */
-# define QRELAYED 0x00010000 /* DSN: relayed to non-DSN aware sys */
-# define QEXPANDED 0x00020000 /* DSN: undergone list expansion */
-# define QDELIVERED 0x00040000 /* DSN: successful final delivery */
-# define QDELAYED 0x00080000 /* DSN: message delayed */
-# define QTHISPASS 0x40000000 /* temp: address set this pass */
-# define QRCPTOK 0x80000000 /* recipient() processed address */
-
-# define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
-
-# define NULLADDR ((ADDRESS *) NULL)
+/* bit values for q_flags */
+#define QGOODUID 0x00000001 /* the q_uid q_gid fields are good */
+#define QPRIMARY 0x00000002 /* set from RCPT or argv */
+#define QNOTREMOTE 0x00000004 /* address not for remote forwarding */
+#define QSELFREF 0x00000008 /* this address references itself */
+#define QBOGUSSHELL 0x00000010 /* user has no valid shell listed */
+#define QUNSAFEADDR 0x00000020 /* address acquired via unsafe path */
+#define QPINGONSUCCESS 0x00000040 /* give return on successful delivery */
+#define QPINGONFAILURE 0x00000080 /* give return on failure */
+#define QPINGONDELAY 0x00000100 /* give return on message delay */
+#define QHASNOTIFY 0x00000200 /* propogate notify parameter */
+#define QRELAYED 0x00000400 /* DSN: relayed to non-DSN aware sys */
+#define QEXPANDED 0x00000800 /* DSN: undergone list expansion */
+#define QDELIVERED 0x00001000 /* DSN: successful final delivery */
+#define QDELAYED 0x00002000 /* DSN: message delayed */
+#define QALIAS 0x00004000 /* expanded alias */
+#define QTHISPASS 0x40000000 /* temp: address set this pass */
+#define QRCPTOK 0x80000000 /* recipient() processed address */
+
+#define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
+
+/* values for q_state */
+#define QS_OK 0 /* address ok (for now)/not yet tried */
+#define QS_SENT 1 /* good address, delivery complete */
+#define QS_BADADDR 2 /* illegal address */
+#define QS_QUEUEUP 3 /* save address in queue */
+#define QS_VERIFIED 4 /* verified, but not expanded */
+#define QS_DONTSEND 5 /* don't send to this address */
+#define QS_EXPANDED 6 /* expanded */
+#define QS_SENDER 7 /* message sender (MeToo) */
+#define QS_CLONED 8 /* addr cloned to a split envelope */
+#define QS_DISCARDED 9 /* recipient discarded (EF_DISCARD) */
+#define QS_REPLACED 10 /* maplocaluser()/UserDB replaced */
+#define QS_REMOVED 11 /* removed (removefromlist()) */
+#define QS_DUPLICATE 12 /* duplicate suppressed */
+#define QS_INCLUDED 13 /* :include: delivery */
+
+/* address state testing primitives */
+#define QS_IS_OK(s) ((s) == QS_OK)
+#define QS_IS_SENT(s) ((s) == QS_SENT)
+#define QS_IS_BADADDR(s) ((s) == QS_BADADDR)
+#define QS_IS_QUEUEUP(s) ((s) == QS_QUEUEUP)
+#define QS_IS_VERIFIED(s) ((s) == QS_VERIFIED)
+#define QS_IS_EXPANDED(s) ((s) == QS_EXPANDED)
+#define QS_IS_REMOVED(s) ((s) == QS_REMOVED)
+#define QS_IS_UNDELIVERED(s) ((s) == QS_OK || \
+ (s) == QS_QUEUEUP || \
+ (s) == QS_VERIFIED)
+#define QS_IS_SENDABLE(s) ((s) == QS_OK || \
+ (s) == QS_QUEUEUP)
+#define QS_IS_ATTEMPTED(s) ((s) == QS_QUEUEUP || \
+ (s) == QS_SENT)
+#define QS_IS_DEAD(s) ((s) == QS_DONTSEND || \
+ (s) == QS_CLONED || \
+ (s) == QS_SENDER || \
+ (s) == QS_DISCARDED || \
+ (s) == QS_REPLACED || \
+ (s) == QS_REMOVED || \
+ (s) == QS_DUPLICATE || \
+ (s) == QS_INCLUDED || \
+ (s) == QS_EXPANDED)
+
+
+#define NULLADDR ((ADDRESS *) NULL)
+
+extern ADDRESS NullAddress; /* a null (template) address [main.c] */
/* functions */
+extern void cataddr __P((char **, char **, char *, int, int));
+extern char *crackaddr __P((char *));
+extern bool emptyaddr __P((ADDRESS *));
+extern ADDRESS *getctladdr __P((ADDRESS *));
+extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
+extern bool invalidaddr __P((char *, char *));
extern ADDRESS *parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *));
-extern ADDRESS *buildaddr __P((char **, ADDRESS *, int, ENVELOPE *));
-extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern char **prescan __P((char *, int, char[], int, char **, u_char *));
-extern int rewrite __P((char **, int, int, ENVELOPE *));
+extern void printaddr __P((ADDRESS *, bool));
+extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *));
-extern ADDRESS *getctladdr __P((ADDRESS *));
+extern int rewrite __P((char **, int, int, ENVELOPE *));
extern bool sameaddr __P((ADDRESS *, ADDRESS *));
-extern bool emptyaddr __P((ADDRESS *));
-extern void printaddr __P((ADDRESS *, bool));
-extern void cataddr __P((char **, char **, char *, int, int));
extern int sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *));
+extern int removefromlist __P((char *, ADDRESS **, ENVELOPE *));
+extern void setsender __P((char *, ENVELOPE *, char **, int, bool));
+
/*
** Mailer definition structure.
** Every mailer known to the system is declared in this
@@ -230,7 +302,7 @@ struct mailer
char *m_mtatype; /* type of this MTA */
char *m_addrtype; /* type for addresses */
char *m_diagtype; /* type for diagnostics */
- BITMAP m_flags; /* status flags, see below */
+ BITMAP256 m_flags; /* status flags, see below */
short m_mno; /* mailer number internally */
short m_nice; /* niceness to run at (mostly for prog) */
char **m_argv; /* template argument vector */
@@ -241,92 +313,104 @@ struct mailer
char *m_eol; /* end of line string */
long m_maxsize; /* size limit on message to this mailer */
int m_linelimit; /* max # characters per line */
+ int m_maxdeliveries; /* max deliveries per mailer connection */
char *m_execdir; /* directory to chdir to before execv */
+ char *m_rootdir; /* directory to chroot to before execv */
uid_t m_uid; /* UID to run as */
gid_t m_gid; /* GID to run as */
char *m_defcharset; /* default character set */
+ time_t m_wait; /* timeout to wait for end */
+#if _FFR_DYNAMIC_TOBUF
+ int m_maxrcpt; /* max recipients per envelope client-side */
+#endif /* _FFR_DYNAMIC_TOBUF */
};
/* bits for m_flags */
-# define M_ESMTP 'a' /* run Extended SMTP protocol */
-# define M_ALIASABLE 'A' /* user can be LHS of an alias */
-# define M_BLANKEND 'b' /* ensure blank line at end of message */
-# define M_NOCOMMENT 'c' /* don't include comment part of address */
-# define M_CANONICAL 'C' /* make addresses canonical "u@dom" */
-# define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */
+#define M_ESMTP 'a' /* run Extended SMTP protocol */
+#define M_ALIASABLE 'A' /* user can be LHS of an alias */
+#define M_BLANKEND 'b' /* ensure blank line at end of message */
+#define M_NOCOMMENT 'c' /* don't include comment part of address */
+#define M_CANONICAL 'C' /* make addresses canonical "u@dom" */
+#define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */
/* 'D' CF: include Date: */
-# define M_EXPENSIVE 'e' /* it costs to use this mailer.... */
-# define M_ESCFROM 'E' /* escape From lines to >From */
-# define M_FOPT 'f' /* mailer takes picky -f flag */
+#define M_EXPENSIVE 'e' /* it costs to use this mailer.... */
+#define M_ESCFROM 'E' /* escape From lines to >From */
+#define M_FOPT 'f' /* mailer takes picky -f flag */
/* 'F' CF: include From: or Resent-From: */
-# define M_NO_NULL_FROM 'g' /* sender of errors should be $g */
-# define M_HST_UPPER 'h' /* preserve host case distinction */
-# define M_PREHEAD 'H' /* MAIL11V3: preview headers */
-# define M_UDBENVELOPE 'i' /* do udbsender rewriting on envelope */
-# define M_INTERNAL 'I' /* SMTP to another sendmail site */
-# define M_UDBRECIPIENT 'j' /* do udbsender rewriting on recipient lines */
-# define M_NOLOOPCHECK 'k' /* don't check for loops in HELO command */
-# define M_CHUNKING 'K' /* CHUNKING: reserved for future use */
-# define M_LOCALMAILER 'l' /* delivery is to this host */
-# define M_LIMITS 'L' /* must enforce SMTP line limits */
-# define M_MUSER 'm' /* can handle multiple users at once */
+#define M_NO_NULL_FROM 'g' /* sender of errors should be $g */
+#define M_HST_UPPER 'h' /* preserve host case distinction */
+#define M_PREHEAD 'H' /* MAIL11V3: preview headers */
+#define M_UDBENVELOPE 'i' /* do udbsender rewriting on envelope */
+#define M_INTERNAL 'I' /* SMTP to another sendmail site */
+#define M_UDBRECIPIENT 'j' /* do udbsender rewriting on recipient lines */
+#define M_NOLOOPCHECK 'k' /* don't check for loops in HELO command */
+#define M_CHUNKING 'K' /* CHUNKING: reserved for future use */
+#define M_LOCALMAILER 'l' /* delivery is to this host */
+#define M_LIMITS 'L' /* must enforce SMTP line limits */
+#define M_MUSER 'm' /* can handle multiple users at once */
/* 'M' CF: include Message-Id: */
-# define M_NHDR 'n' /* don't insert From line */
-# define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */
-# define M_RUNASRCPT 'o' /* always run mailer as recipient */
-# define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */
+#define M_NHDR 'n' /* don't insert From line */
+#define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */
+#define M_RUNASRCPT 'o' /* always run mailer as recipient */
+#define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */
/* 'P' CF: include Return-Path: */
-# define M_VRFY250 'q' /* VRFY command returns 250 instead of 252 */
-# define M_ROPT 'r' /* mailer takes picky -r flag */
-# define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */
-# define M_STRIPQ 's' /* strip quote chars from user/host */
-# define M_SPECIFIC_UID 'S' /* run as specific uid/gid */
-# define M_USR_UPPER 'u' /* preserve user case distinction */
-# define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */
-# define M_CONTENT_LEN 'v' /* add Content-Length: header (SVr4) */
+#define M_VRFY250 'q' /* VRFY command returns 250 instead of 252 */
+#define M_ROPT 'r' /* mailer takes picky -r flag */
+#define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */
+#define M_STRIPQ 's' /* strip quote chars from user/host */
+#define M_SPECIFIC_UID 'S' /* run as specific uid/gid */
+#define M_USR_UPPER 'u' /* preserve user case distinction */
+#define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */
+#define M_CONTENT_LEN 'v' /* add Content-Length: header (SVr4) */
/* 'V' UIUC: !-relativize all addresses */
-# define M_HASPWENT 'w' /* check for /etc/passwd entry */
+#define M_HASPWENT 'w' /* check for /etc/passwd entry */
/* 'x' CF: include Full-Name: */
-# define M_XDOT 'X' /* use hidden-dot algorithm */
-# define M_LMTP 'z' /* run Local Mail Transport Protocol */
-# define M_NOMX '0' /* turn off MX lookups */
-# define M_NONULLS '1' /* don't send null bytes */
-# define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
-# define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
-# define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
-# define M_7BITS '7' /* use 7-bit path */
-# define M_8BITS '8' /* force "just send 8" behaviour */
-# define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */
-# define M_CHECKINCLUDE ':' /* check for :include: files */
-# define M_CHECKPROG '|' /* check for |program addresses */
-# define M_CHECKFILE '/' /* check for /file addresses */
-# define M_CHECKUDB '@' /* user can be user database key */
-# define M_CHECKHDIR '~' /* SGI: check for valid home directory */
-
-EXTERN MAILER *Mailer[MAXMAILERS+1];
-
-EXTERN MAILER *LocalMailer; /* ptr to local mailer */
-EXTERN MAILER *ProgMailer; /* ptr to program mailer */
-EXTERN MAILER *FileMailer; /* ptr to *file* mailer */
-EXTERN MAILER *InclMailer; /* ptr to *include* mailer */
+#define M_XDOT 'X' /* use hidden-dot algorithm */
+#define M_LMTP 'z' /* run Local Mail Transport Protocol */
+#define M_NOMX '0' /* turn off MX lookups */
+#define M_NONULLS '1' /* don't send null bytes */
+#define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
+#define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
+#define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
+#define M_7BITS '7' /* use 7-bit path */
+#define M_8BITS '8' /* force "just send 8" behaviour */
+#define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */
+#define M_CHECKINCLUDE ':' /* check for :include: files */
+#define M_CHECKPROG '|' /* check for |program addresses */
+#define M_CHECKFILE '/' /* check for /file addresses */
+#define M_CHECKUDB '@' /* user can be user database key */
+#define M_CHECKHDIR '~' /* SGI: check for valid home directory */
+#define M_HOLD '%' /* Hold delivery until ETRN/-qI/-qR/-qS */
+#define M_PLUS '+' /* Reserved: Used in mc for adding new flags */
+#define M_MINUS '-' /* Reserved: Used in mc for removing flags */
+
+/* functions */
+extern void initerrmailers __P((void));
+extern void makemailer __P((char *));
+
/*
** Information about currently open connections to mailers, or to
** hosts that we have looked up recently.
*/
-# define MCI struct mailer_con_info
+#define MCI struct mailer_con_info
MCI
{
- short mci_flags; /* flag bits, see below */
+ u_long mci_flags; /* flag bits, see below */
short mci_errno; /* error number on last connection */
short mci_herrno; /* h_errno from last DNS lookup */
short mci_exitstat; /* exit status from last connection */
short mci_state; /* SMTP state */
- off_t mci_contentlen; /* body length for Content-Length: */
+ int mci_deliveries; /* delivery attempts for connection */
long mci_maxsize; /* max size this server will accept */
+#if SFIO
+ Sfio_t *mci_in; /* input side of connection */
+ Sfio_t *mci_out; /* output side of connection */
+#else /* SFIO */
FILE *mci_in; /* input side of connection */
FILE *mci_out; /* output side of connection */
+#endif /* SFIO */
pid_t mci_pid; /* process id of subordinate proc */
char *mci_phase; /* SMTP phase string */
struct mailer *mci_mailer; /* ptr to the mailer for this conn */
@@ -335,25 +419,46 @@ MCI
char *mci_rstatus; /* SMTP status to be copied to addrs */
time_t mci_lastuse; /* last usage time */
FILE *mci_statfile; /* long term status file */
+ char *mci_heloname; /* name to use as HELO arg */
+#if SASL
+ bool mci_sasl_auth; /* authenticated? */
+ int mci_sasl_string_len;
+ char *mci_sasl_string; /* sasl reply string */
+ char *mci_saslcap; /* SASL list of mechanisms */
+ sasl_conn_t *mci_conn; /* SASL connection */
+#endif /* SASL */
+#if STARTTLS
+ SSL *mci_ssl; /* SSL connection */
+#endif /* STARTTLS */
};
/* flag bits */
-#define MCIF_VALID 0x0001 /* this entry is valid */
-#define MCIF_TEMP 0x0002 /* don't cache this connection */
-#define MCIF_CACHED 0x0004 /* currently in open cache */
-#define MCIF_ESMTP 0x0008 /* this host speaks ESMTP */
-#define MCIF_EXPN 0x0010 /* EXPN command supported */
-#define MCIF_SIZE 0x0020 /* SIZE option supported */
-#define MCIF_8BITMIME 0x0040 /* BODY=8BITMIME supported */
-#define MCIF_7BIT 0x0080 /* strip this message to 7 bits */
-#define MCIF_MULTSTAT 0x0100 /* MAIL11V3: handles MULT status */
-#define MCIF_INHEADER 0x0200 /* currently outputing header */
-#define MCIF_CVT8TO7 0x0400 /* convert from 8 to 7 bits */
-#define MCIF_DSN 0x0800 /* DSN extension supported */
-#define MCIF_8BITOK 0x1000 /* OK to send 8 bit characters */
-#define MCIF_CVT7TO8 0x2000 /* convert from 7 to 8 bits */
-#define MCIF_INMIME 0x4000 /* currently reading MIME header */
+#define MCIF_VALID 0x00000001 /* this entry is valid */
+#define MCIF_TEMP 0x00000002 /* don't cache this connection */
+#define MCIF_CACHED 0x00000004 /* currently in open cache */
+#define MCIF_ESMTP 0x00000008 /* this host speaks ESMTP */
+#define MCIF_EXPN 0x00000010 /* EXPN command supported */
+#define MCIF_SIZE 0x00000020 /* SIZE option supported */
+#define MCIF_8BITMIME 0x00000040 /* BODY=8BITMIME supported */
+#define MCIF_7BIT 0x00000080 /* strip this message to 7 bits */
+#define MCIF_MULTSTAT 0x00000100 /* MAIL11V3: handles MULT status */
+#define MCIF_INHEADER 0x00000200 /* currently outputing header */
+#define MCIF_CVT8TO7 0x00000400 /* convert from 8 to 7 bits */
+#define MCIF_DSN 0x00000800 /* DSN extension supported */
+#define MCIF_8BITOK 0x00001000 /* OK to send 8 bit characters */
+#define MCIF_CVT7TO8 0x00002000 /* convert from 7 to 8 bits */
+#define MCIF_INMIME 0x00004000 /* currently reading MIME header */
+#define MCIF_AUTH 0x00008000 /* AUTH= supported */
+#define MCIF_AUTHACT 0x00010000 /* SASL (AUTH) active */
+#define MCIF_ENHSTAT 0x00020000 /* ENHANCEDSTATUSCODES supported */
+#if STARTTLS
+#define MCIF_TLS 0x00100000 /* STARTTLS supported */
+#define MCIF_TLSACT 0x00200000 /* STARTTLS active */
+#define MCIF_EXTENS (MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT | MCIF_TLS)
+#else /* STARTTLS */
+#define MCIF_EXTENS (MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT)
+#endif /* STARTTLS */
/* states */
#define MCIS_CLOSED 0 /* no traffic on this connection */
@@ -365,20 +470,21 @@ MCI
#define MCIS_ERROR 6 /* I/O error on connection */
/* functions */
-extern MCI *mci_get __P((char *, MAILER *));
extern void mci_cache __P((MCI *));
-extern void mci_flush __P((bool, MCI *));
extern void mci_dump __P((MCI *, bool));
extern void mci_dump_all __P((bool));
-extern MCI **mci_scan __P((MCI *));
-extern int mci_traverse_persistent __P((int (*)(), char *));
+extern void mci_flush __P((bool, MCI *));
+extern MCI *mci_get __P((char *, MAILER *));
+extern int mci_lock_host __P((MCI *));
+extern bool mci_match __P((char *, MAILER *));
extern int mci_print_persistent __P((char *, char *));
extern int mci_purge_persistent __P((char *, char *));
-extern int mci_lock_host __P((MCI *));
+extern MCI **mci_scan __P((MCI *));
+extern void mci_setstat __P((MCI *, int, char *, char *));
+extern void mci_store_persistent __P((MCI *));
+extern int mci_traverse_persistent __P((int (*)(), char *));
extern void mci_unlock_host __P((MCI *));
-extern int mci_lock_host_statfile __P((MCI *));
-extern void mci_store_persistent __P((MCI *));
-extern int mci_read_persistent __P((FILE *, MCI *));
+
/*
** Header structure.
** This structure is used internally to store header items.
@@ -389,8 +495,9 @@ struct header
char *h_field; /* the name of the field */
char *h_value; /* the value of that field */
struct header *h_link; /* the next header */
- u_short h_flags; /* status bits, see below */
- BITMAP h_mflags; /* m_flags bits needed */
+ u_char h_macro; /* include header if macro defined */
+ u_long h_flags; /* status bits, see below */
+ BITMAP256 h_mflags; /* m_flags bits needed */
};
typedef struct header HDR;
@@ -404,37 +511,64 @@ typedef struct header HDR;
struct hdrinfo
{
char *hi_field; /* the name of the field */
- u_short hi_flags; /* status bits, see below */
+ u_long hi_flags; /* status bits, see below */
char *hi_ruleset; /* validity check ruleset */
};
extern struct hdrinfo HdrInfo[];
/* bits for h_flags and hi_flags */
-# define H_EOH 0x0001 /* this field terminates header */
-# define H_RCPT 0x0002 /* contains recipient addresses */
-# define H_DEFAULT 0x0004 /* if another value is found, drop this */
-# define H_RESENT 0x0008 /* this address is a "Resent-..." address */
-# define H_CHECK 0x0010 /* check h_mflags against m_flags */
-# define H_ACHECK 0x0020 /* ditto, but always (not just default) */
-# define H_FORCE 0x0040 /* force this field, even if default */
-# define H_TRACE 0x0080 /* this field contains trace information */
-# define H_FROM 0x0100 /* this is a from-type field */
-# define H_VALID 0x0200 /* this field has a validated value */
-# define H_RECEIPTTO 0x0400 /* this field has return receipt info */
-# define H_ERRORSTO 0x0800 /* this field has error address info */
-# define H_CTE 0x1000 /* this field is a content-transfer-encoding */
-# define H_CTYPE 0x2000 /* this is a content-type field */
-# define H_BCC 0x4000 /* Bcc: header: strip value or delete */
-# define H_ENCODABLE 0x8000 /* field can be RFC 1522 encoded */
+#define H_EOH 0x00000001 /* field terminates header */
+#define H_RCPT 0x00000002 /* contains recipient addresses */
+#define H_DEFAULT 0x00000004 /* if another value is found, drop this */
+#define H_RESENT 0x00000008 /* this address is a "Resent-..." address */
+#define H_CHECK 0x00000010 /* check h_mflags against m_flags */
+#define H_ACHECK 0x00000020 /* ditto, but always (not just default) */
+#define H_FORCE 0x00000040 /* force this field, even if default */
+#define H_TRACE 0x00000080 /* this field contains trace information */
+#define H_FROM 0x00000100 /* this is a from-type field */
+#define H_VALID 0x00000200 /* this field has a validated value */
+#define H_RECEIPTTO 0x00000400 /* field has return receipt info */
+#define H_ERRORSTO 0x00000800 /* field has error address info */
+#define H_CTE 0x00001000 /* field is a content-transfer-encoding */
+#define H_CTYPE 0x00002000 /* this is a content-type field */
+#define H_BCC 0x00004000 /* Bcc: header: strip value or delete */
+#define H_ENCODABLE 0x00008000 /* field can be RFC 1522 encoded */
+#define H_STRIPCOMM 0x00010000 /* header check: strip comments */
+#define H_BINDLATE 0x00020000 /* only expand macros at deliver */
+#define H_USER 0x00040000 /* header came from the user/SMTP */
+
+/* bits for chompheader() */
+#define CHHDR_DEF 0x0001 /* default header */
+#define CHHDR_CHECK 0x0002 /* call ruleset for header */
+#define CHHDR_USER 0x0004 /* header from user */
/* functions */
-extern void addheader __P((char *, char *, HDR **));
-extern char *hvalue __P((char *, HDR *));
+extern void addheader __P((char *, char *, int, HDR **));
+extern u_long chompheader __P((char *, int, HDR **, ENVELOPE *));
extern void commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *));
-extern void put_vanilla_header __P((HDR *, char *, MCI *));
+extern HDR *copyheader __P((HDR *));
extern void eatheader __P((ENVELOPE *, bool));
-extern int chompheader __P((char *, bool, HDR **, ENVELOPE *));
+extern char *hvalue __P((char *, HDR *));
+extern bool isheader __P((char *));
+extern void putfromline __P((MCI *, ENVELOPE *));
+extern void setupheaders __P((void));
+
+ /*
+** Performance monitoring
+*/
+
+#define TIMERS struct sm_timers
+
+TIMERS
+{
+ TIMER ti_overall; /* the whole process */
+};
+
+
+#define PUSHTIMER(l, t) { if (tTd(98, l)) pushtimer(&t); }
+#define POPTIMER(l, t) { if (tTd(98, l)) poptimer(&t); }
+
/*
** Envelope structure.
** This structure defines the message itself. There is usually
@@ -468,11 +602,12 @@ struct envelope
/* function to put header of message */
void (*e_putbody)__P((MCI *, ENVELOPE *, char *));
/* function to put body of message */
- struct envelope *e_parent; /* the message this one encloses */
- struct envelope *e_sibling; /* the next envelope of interest */
+ ENVELOPE *e_parent; /* the message this one encloses */
+ ENVELOPE *e_sibling; /* the next envelope of interest */
char *e_bodytype; /* type of message body */
- FILE *e_dfp; /* temporary file */
+ FILE *e_dfp; /* data file */
char *e_id; /* code for this entry in queue */
+ int e_queuedir; /* index into queue directories */
FILE *e_xfp; /* transcript file */
FILE *e_lockfp; /* the lock file for this message */
char *e_message; /* error message */
@@ -486,44 +621,53 @@ struct envelope
dev_t e_dfdev; /* df file's device, for crash recov */
ino_t e_dfino; /* df file's ino, for crash recovery */
char *e_macro[256]; /* macro definitions */
+ char *e_if_macros[2]; /* HACK: incoming interface info */
+ char *e_auth_param;
+ TIMERS e_timers; /* per job timers */
+#if _FFR_QUEUEDELAY
+ int e_queuealg; /* algorithm for queue delay */
+ time_t e_queuedelay; /* current delay */
+#endif /* _FFR_QUEUEDELAY */
};
/* values for e_flags */
-#define EF_OLDSTYLE 0x0000001 /* use spaces (not commas) in hdrs */
-#define EF_INQUEUE 0x0000002 /* this message is fully queued */
-#define EF_NO_BODY_RETN 0x0000004 /* omit message body on error */
-#define EF_CLRQUEUE 0x0000008 /* disk copy is no longer needed */
-#define EF_SENDRECEIPT 0x0000010 /* send a return receipt */
-#define EF_FATALERRS 0x0000020 /* fatal errors occured */
-#define EF_DELETE_BCC 0x0000040 /* delete Bcc: headers entirely */
-#define EF_RESPONSE 0x0000080 /* this is an error or return receipt */
-#define EF_RESENT 0x0000100 /* this message is being forwarded */
-#define EF_VRFYONLY 0x0000200 /* verify only (don't expand aliases) */
-#define EF_WARNING 0x0000400 /* warning message has been sent */
-#define EF_QUEUERUN 0x0000800 /* this envelope is from queue */
-#define EF_GLOBALERRS 0x0001000 /* treat errors as global */
-#define EF_PM_NOTIFY 0x0002000 /* send return mail to postmaster */
-#define EF_METOO 0x0004000 /* send to me too */
-#define EF_LOGSENDER 0x0008000 /* need to log the sender */
-#define EF_NORECEIPT 0x0010000 /* suppress all return-receipts */
-#define EF_HAS8BIT 0x0020000 /* at least one 8-bit char in body */
-#define EF_NL_NOT_EOL 0x0040000 /* don't accept raw NL as EOLine */
-#define EF_CRLF_NOT_EOL 0x0080000 /* don't accept CR-LF as EOLine */
-#define EF_RET_PARAM 0x0100000 /* RCPT command had RET argument */
-#define EF_HAS_DF 0x0200000 /* set when df file is instantiated */
-#define EF_IS_MIME 0x0400000 /* really is a MIME message */
-#define EF_DONT_MIME 0x0800000 /* never MIME this message */
-#define EF_DISCARD 0x1000000 /* discard the message */
-
-EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */
+#define EF_OLDSTYLE 0x0000001L /* use spaces (not commas) in hdrs */
+#define EF_INQUEUE 0x0000002L /* this message is fully queued */
+#define EF_NO_BODY_RETN 0x0000004L /* omit message body on error */
+#define EF_CLRQUEUE 0x0000008L /* disk copy is no longer needed */
+#define EF_SENDRECEIPT 0x0000010L /* send a return receipt */
+#define EF_FATALERRS 0x0000020L /* fatal errors occurred */
+#define EF_DELETE_BCC 0x0000040L /* delete Bcc: headers entirely */
+#define EF_RESPONSE 0x0000080L /* this is an error or return receipt */
+#define EF_RESENT 0x0000100L /* this message is being forwarded */
+#define EF_VRFYONLY 0x0000200L /* verify only (don't expand aliases) */
+#define EF_WARNING 0x0000400L /* warning message has been sent */
+#define EF_QUEUERUN 0x0000800L /* this envelope is from queue */
+#define EF_GLOBALERRS 0x0001000L /* treat errors as global */
+#define EF_PM_NOTIFY 0x0002000L /* send return mail to postmaster */
+#define EF_METOO 0x0004000L /* send to me too */
+#define EF_LOGSENDER 0x0008000L /* need to log the sender */
+#define EF_NORECEIPT 0x0010000L /* suppress all return-receipts */
+#define EF_HAS8BIT 0x0020000L /* at least one 8-bit char in body */
+#define EF_NL_NOT_EOL 0x0040000L /* don't accept raw NL as EOLine */
+#define EF_CRLF_NOT_EOL 0x0080000L /* don't accept CR-LF as EOLine */
+#define EF_RET_PARAM 0x0100000L /* RCPT command had RET argument */
+#define EF_HAS_DF 0x0200000L /* set when df file is instantiated */
+#define EF_IS_MIME 0x0400000L /* really is a MIME message */
+#define EF_DONT_MIME 0x0800000L /* never MIME this message */
+#define EF_DISCARD 0x1000000L /* discard the message */
+
+/* values for e_if_macros */
+#define EIF_ADDR 0 /* ${if_addr} */
/* functions */
-extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *));
-extern void dropenvelope __P((ENVELOPE *, bool));
extern void clearenvelope __P((ENVELOPE *, bool));
-
-extern void putheader __P((MCI *, HDR *, ENVELOPE *, int));
+extern void dropenvelope __P((ENVELOPE *, bool));
+extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *));
+extern void printenvflags __P((ENVELOPE *));
extern void putbody __P((MCI *, ENVELOPE *, char *));
+extern void putheader __P((MCI *, HDR *, ENVELOPE *, int));
+
/*
** Message priority classes.
**
@@ -554,8 +698,6 @@ struct priority
int pri_val; /* internal value for same */
};
-EXTERN struct priority Priorities[MAXPRIORITIES];
-EXTERN int NumPriorities; /* pointer into Priorities */
/*
** Rewrite rules.
*/
@@ -565,10 +707,9 @@ struct rewrite
char **r_lhs; /* pattern match */
char **r_rhs; /* substitution value */
struct rewrite *r_next;/* next in chain */
+ int r_line; /* rule line in sendmail.cf */
};
-EXTERN struct rewrite *RewriteRules[MAXRWSETS];
-
/*
** Special characters in rewriting rules.
** These are used internally only.
@@ -578,38 +719,38 @@ EXTERN struct rewrite *RewriteRules[MAXRWSETS];
*/
/* left hand side items */
-# define MATCHZANY ((u_char)0220) /* match zero or more tokens */
-# define MATCHANY ((u_char)0221) /* match one or more tokens */
-# define MATCHONE ((u_char)0222) /* match exactly one token */
-# define MATCHCLASS ((u_char)0223) /* match one token in a class */
-# define MATCHNCLASS ((u_char)0224) /* match anything not in class */
-# define MATCHREPL ((u_char)0225) /* replacement on RHS for above */
+#define MATCHZANY ((u_char)0220) /* match zero or more tokens */
+#define MATCHANY ((u_char)0221) /* match one or more tokens */
+#define MATCHONE ((u_char)0222) /* match exactly one token */
+#define MATCHCLASS ((u_char)0223) /* match one token in a class */
+#define MATCHNCLASS ((u_char)0224) /* match anything not in class */
+#define MATCHREPL ((u_char)0225) /* replacement on RHS for above */
/* right hand side items */
-# define CANONNET ((u_char)0226) /* canonical net, next token */
-# define CANONHOST ((u_char)0227) /* canonical host, next token */
-# define CANONUSER ((u_char)0230) /* canonical user, next N tokens */
-# define CALLSUBR ((u_char)0231) /* call another rewriting set */
+#define CANONNET ((u_char)0226) /* canonical net, next token */
+#define CANONHOST ((u_char)0227) /* canonical host, next token */
+#define CANONUSER ((u_char)0230) /* canonical user, next N tokens */
+#define CALLSUBR ((u_char)0231) /* call another rewriting set */
/* conditionals in macros */
-# define CONDIF ((u_char)0232) /* conditional if-then */
-# define CONDELSE ((u_char)0233) /* conditional else */
-# define CONDFI ((u_char)0234) /* conditional fi */
+#define CONDIF ((u_char)0232) /* conditional if-then */
+#define CONDELSE ((u_char)0233) /* conditional else */
+#define CONDFI ((u_char)0234) /* conditional fi */
/* bracket characters for host name lookup */
-# define HOSTBEGIN ((u_char)0235) /* hostname lookup begin */
-# define HOSTEND ((u_char)0236) /* hostname lookup end */
+#define HOSTBEGIN ((u_char)0235) /* hostname lookup begin */
+#define HOSTEND ((u_char)0236) /* hostname lookup end */
/* bracket characters for generalized lookup */
-# define LOOKUPBEGIN ((u_char)0205) /* generalized lookup begin */
-# define LOOKUPEND ((u_char)0206) /* generalized lookup end */
+#define LOOKUPBEGIN ((u_char)0205) /* generalized lookup begin */
+#define LOOKUPEND ((u_char)0206) /* generalized lookup end */
/* macro substitution character */
-# define MACROEXPAND ((u_char)0201) /* macro expansion */
-# define MACRODEXPAND ((u_char)0202) /* deferred macro expansion */
+#define MACROEXPAND ((u_char)0201) /* macro expansion */
+#define MACRODEXPAND ((u_char)0202) /* deferred macro expansion */
/* to make the code clearer */
-# define MATCHZERO CANONHOST
+#define MATCHZERO CANONHOST
/* external <==> internal mapping table */
struct metamac
@@ -619,14 +760,20 @@ struct metamac
};
/* values for macros with external names only */
-# define MID_OPMODE 0202 /* operation mode */
+#define MID_OPMODE 0202 /* operation mode */
/* functions */
-extern void expand __P((char *, char *, size_t, ENVELOPE *));
extern void define __P((int, char *, ENVELOPE *));
-extern char *macvalue __P((int, ENVELOPE *));
-extern char *macname __P((int));
+extern void expand __P((char *, char *, size_t, ENVELOPE *));
extern int macid __P((char *, char **));
+extern char *macname __P((int));
+extern char *macvalue __P((int, ENVELOPE *));
+extern int rscheck __P((char *, char *, char *, ENVELOPE *, bool, bool, int));
+extern void setclass __P((int, char *));
+extern int strtorwset __P((char *, char **, int));
+extern void translate_dollars __P((char *));
+extern bool wordinclass __P((char *, int));
+
/*
** Name canonification short circuit.
**
@@ -650,6 +797,11 @@ NAMECANON
/* values for nc_flags */
#define NCF_VALID 0x0001 /* entry valid */
+
+/* functions */
+extern bool getcanonname __P((char *, int, bool));
+extern int getmxrr __P((char *, char **, u_short *, bool, int *));
+
/*
** Mapping functions
**
@@ -657,9 +809,9 @@ NAMECANON
** (albeit not the implementation) comes from IDA sendmail.
*/
-# define MAPCLASS struct _mapclass
-# define MAP struct _map
-# define MAXMAPACTIONS 3 /* size of map_actions array */
+#define MAPCLASS struct _mapclass
+#define MAP struct _map
+#define MAXMAPACTIONS 5 /* size of map_actions array */
/*
@@ -679,6 +831,7 @@ MAP
u_char map_keycolno; /* key column number */
u_char map_valcolno; /* value column number */
char map_coldelim; /* column delimiter */
+ char map_spacesub; /* spacesub */
char *map_app; /* to append to successful matches */
char *map_tapp; /* to append to "tempfail" matches */
char *map_domain; /* the (nominal) NIS domain */
@@ -691,31 +844,43 @@ MAP
short map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */
};
+
/* bit values for map_mflags */
-# define MF_VALID 0x00000001 /* this entry is valid */
-# define MF_INCLNULL 0x00000002 /* include null byte in key */
-# define MF_OPTIONAL 0x00000004 /* don't complain if map not found */
-# define MF_NOFOLDCASE 0x00000008 /* don't fold case in keys */
-# define MF_MATCHONLY 0x00000010 /* don't use the map value */
-# define MF_OPEN 0x00000020 /* this entry is open */
-# define MF_WRITABLE 0x00000040 /* open for writing */
-# define MF_ALIAS 0x00000080 /* this is an alias file */
-# define MF_TRY0NULL 0x00000100 /* try with no null byte */
-# define MF_TRY1NULL 0x00000200 /* try with the null byte */
-# define MF_LOCKED 0x00000400 /* this map is currently locked */
-# define MF_ALIASWAIT 0x00000800 /* alias map in aliaswait state */
-# define MF_IMPL_HASH 0x00001000 /* implicit: underlying hash database */
-# define MF_IMPL_NDBM 0x00002000 /* implicit: underlying NDBM database */
-# define MF_UNSAFEDB 0x00004000 /* this map is world writable */
-# define MF_APPEND 0x00008000 /* append new entry on rebuiled */
-# define MF_KEEPQUOTES 0x00010000 /* don't dequote key before lookup */
-# define MF_NODEFER 0x00020000 /* don't defer if map lookup fails */
-# define MF_REGEX_NOT 0x00040000 /* regular expression negation */
+#define MF_VALID 0x00000001 /* this entry is valid */
+#define MF_INCLNULL 0x00000002 /* include null byte in key */
+#define MF_OPTIONAL 0x00000004 /* don't complain if map not found */
+#define MF_NOFOLDCASE 0x00000008 /* don't fold case in keys */
+#define MF_MATCHONLY 0x00000010 /* don't use the map value */
+#define MF_OPEN 0x00000020 /* this entry is open */
+#define MF_WRITABLE 0x00000040 /* open for writing */
+#define MF_ALIAS 0x00000080 /* this is an alias file */
+#define MF_TRY0NULL 0x00000100 /* try with no null byte */
+#define MF_TRY1NULL 0x00000200 /* try with the null byte */
+#define MF_LOCKED 0x00000400 /* this map is currently locked */
+#define MF_ALIASWAIT 0x00000800 /* alias map in aliaswait state */
+#define MF_IMPL_HASH 0x00001000 /* implicit: underlying hash database */
+#define MF_IMPL_NDBM 0x00002000 /* implicit: underlying NDBM database */
+#define MF_UNSAFEDB 0x00004000 /* this map is world writable */
+#define MF_APPEND 0x00008000 /* append new entry on rebuild */
+#define MF_KEEPQUOTES 0x00010000 /* don't dequote key before lookup */
+#define MF_NODEFER 0x00020000 /* don't defer if map lookup fails */
+#define MF_REGEX_NOT 0x00040000 /* regular expression negation */
+#define MF_DEFER 0x00080000 /* don't lookup map in defer mode */
+#define MF_SINGLEMATCH 0x00100000 /* successful only if match one key */
+#define MF_NOREWRITE 0x00200000 /* don't rewrite result, return as-is */
+#define MF_SHARED 0x00400000 /* map connection is shared */
+
+#define DYNOPENMAP(map) if (!bitset(MF_OPEN, (map)->map_mflags)) \
+ { \
+ if (!openmap(map)) \
+ return NULL; \
+ }
+
/* indices for map_actions */
-# define MA_NOTFOUND 0 /* member map returned "not found" */
-# define MA_UNAVAIL 1 /* member map is not available */
-# define MA_TRYAGAIN 2 /* member map returns temp failure */
+#define MA_NOTFOUND 0 /* member map returned "not found" */
+#define MA_UNAVAIL 1 /* member map is not available */
+#define MA_TRYAGAIN 2 /* member map returns temp failure */
/*
** The class of a map -- essentially the functions to call
@@ -745,9 +910,134 @@ MAPCLASS
#define MCF_OPTFILE 0x0008 /* file name is optional */
/* functions */
-extern char *map_rewrite __P((MAP *, const char *, size_t, char **));
+extern void closemaps __P((void));
+extern bool impl_map_open __P((MAP *, int));
+extern void initmaps __P((void));
extern MAP *makemapentry __P((char *));
-extern void initmaps __P((bool, ENVELOPE *));
+extern void maplocaluser __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
+extern char *map_rewrite __P((MAP *, const char *, size_t, char **));
+#if NETINFO
+extern char *ni_propval __P((char *, char *, char *, char *, int));
+#endif /* NETINFO */
+extern bool openmap __P((MAP *));
+#if USERDB
+extern void _udbx_close __P((void));
+extern int udbexpand __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
+extern char *udbsender __P((char *));
+#endif /* USERDB */
+ /*
+** LDAP related items
+*/
+#ifdef LDAPMAP
+struct ldapmap_struct
+{
+ /* needed for ldap_open or ldap_init */
+ char *ldap_host;
+ int ldap_port;
+
+ /* options set in ld struct before ldap_bind_s */
+ int ldap_deref;
+ time_t ldap_timelimit;
+ int ldap_sizelimit;
+ int ldap_options;
+
+ /* args for ldap_bind_s */
+ LDAP *ldap_ld;
+ char *ldap_binddn;
+ char *ldap_secret;
+ int ldap_method;
+
+ /* args for ldap_search */
+ char *ldap_base;
+ int ldap_scope;
+ char *ldap_filter;
+ char *ldap_attr[LDAPMAP_MAX_ATTR + 1];
+ bool ldap_attrsonly;
+
+ /* args for ldap_result */
+ struct timeval ldap_timeout;
+ LDAPMessage *ldap_res;
+};
+
+typedef struct ldapmap_struct LDAPMAP_STRUCT;
+
+/* struct defining LDAP Auth Methods */
+struct lamvalues
+{
+ char *lam_name; /* name of LDAP auth method */
+ int lam_code; /* numeric code */
+};
+
+/* struct defining LDAP Alias Dereferencing */
+struct ladvalues
+{
+ char *lad_name; /* name of LDAP alias dereferencing method */
+ int lad_code; /* numeric code */
+};
+
+/* struct defining LDAP Search Scope */
+struct lssvalues
+{
+ char *lss_name; /* name of LDAP search scope */
+ int lss_code; /* numeric code */
+};
+
+/* functions */
+extern bool ldapmap_parseargs __P((MAP *, char *));
+extern void ldapmap_set_defaults __P((char *));
+#endif /* LDAPMAP */
+
+ /*
+** PH related items
+*/
+
+#ifdef PH_MAP
+struct ph_map_struct
+{
+ char *ph_servers; /* list of ph servers */
+ char *ph_field_list; /* list of fields to search for match */
+ FILE *ph_to_server;
+ FILE *ph_from_server;
+ int ph_sockfd;
+ time_t ph_timeout;
+};
+typedef struct ph_map_struct PH_MAP_STRUCT;
+
+# define DEFAULT_PH_MAP_FIELDS "alias callsign name spacedname"
+#endif /* PH_MAP */
+ /*
+** Process List (proclist)
+*/
+
+struct procs
+{
+ pid_t proc_pid;
+ char *proc_task;
+ int proc_type;
+};
+
+#define NO_PID ((pid_t) 0)
+#ifndef PROC_LIST_SEG
+# define PROC_LIST_SEG 32 /* number of pids to alloc at a time */
+#endif /* ! PROC_LIST_SEG */
+
+/* process types */
+#define PROC_NONE 0
+#define PROC_DAEMON 1
+#define PROC_DAEMON_CHILD 2
+#define PROC_QUEUE 3
+#define PROC_QUEUE_CHILD 3
+#define PROC_CONTROL 4
+#define PROC_CONTROL_CHILD 5
+
+/* functions */
+extern void proc_list_add __P((pid_t, char *, int));
+extern void proc_list_clear __P((void));
+extern void proc_list_display __P((FILE *));
+extern int proc_list_drop __P((pid_t));
+extern void proc_list_probe __P((void));
+extern void proc_list_set __P((pid_t, char *));
+
/*
** Symbol table definitions
*/
@@ -760,7 +1050,7 @@ struct symtab
struct symtab *s_next; /* pointer to next in chain */
union
{
- BITMAP sv_class; /* bit-map of word classes */
+ BITMAP256 sv_class; /* bit-map of word classes */
ADDRESS *sv_addr; /* pointer to address header */
MAILER *sv_mailer; /* pointer to mailer */
char *sv_alias; /* alias */
@@ -773,47 +1063,67 @@ struct symtab
int sv_ruleset; /* ruleset index */
struct hdrinfo sv_header; /* header metainfo */
char *sv_service[MAXMAPSTACK]; /* service switch */
+#ifdef LDAPMAP
+ LDAP *sv_ldap; /* LDAP connection */
+#endif /* LDAPMAP */
+#if _FFR_MILTER
+ struct milter *sv_milter; /* milter filter name */
+#endif /* _FFR_MILTER */
} s_value;
};
typedef struct symtab STAB;
/* symbol types */
-# define ST_UNDEF 0 /* undefined type */
-# define ST_CLASS 1 /* class map */
-# define ST_ADDRESS 2 /* an address in parsed format */
-# define ST_MAILER 3 /* a mailer header */
-# define ST_ALIAS 4 /* an alias */
-# define ST_MAPCLASS 5 /* mapping function class */
-# define ST_MAP 6 /* mapping function */
-# define ST_HOSTSIG 7 /* host signature */
-# define ST_NAMECANON 8 /* cached canonical name */
-# define ST_MACRO 9 /* macro name to id mapping */
-# define ST_RULESET 10 /* ruleset index */
-# define ST_SERVICE 11 /* service switch entry */
-# define ST_HEADER 12 /* special header flags */
-# define ST_MCI 16 /* mailer connection info (offset) */
-
-# define s_class s_value.sv_class
-# define s_address s_value.sv_addr
-# define s_mailer s_value.sv_mailer
-# define s_alias s_value.sv_alias
-# define s_mci s_value.sv_mci
-# define s_mapclass s_value.sv_mapclass
-# define s_hostsig s_value.sv_hostsig
-# define s_map s_value.sv_map
-# define s_namecanon s_value.sv_namecanon
-# define s_macro s_value.sv_macro
-# define s_ruleset s_value.sv_ruleset
-# define s_service s_value.sv_service
-# define s_header s_value.sv_header
-
-extern STAB *stab __P((char *, int, int));
-extern void stabapply __P((void (*)(STAB *, int), int));
+#define ST_UNDEF 0 /* undefined type */
+#define ST_CLASS 1 /* class map */
+#define ST_ADDRESS 2 /* an address in parsed format */
+#define ST_MAILER 3 /* a mailer header */
+#define ST_ALIAS 4 /* an alias */
+#define ST_MAPCLASS 5 /* mapping function class */
+#define ST_MAP 6 /* mapping function */
+#define ST_HOSTSIG 7 /* host signature */
+#define ST_NAMECANON 8 /* cached canonical name */
+#define ST_MACRO 9 /* macro name to id mapping */
+#define ST_RULESET 10 /* ruleset index */
+#define ST_SERVICE 11 /* service switch entry */
+#define ST_HEADER 12 /* special header flags */
+#ifdef LDAPMAP
+# define ST_LDAP 13 /* LDAP connection */
+#endif /* LDAPMAP */
+#if _FFR_MILTER
+# define ST_MILTER 14 /* milter filter */
+#endif /* _FFR_MILTER */
+#define ST_MCI 16 /* mailer connection info (offset) */
+
+#define s_class s_value.sv_class
+#define s_address s_value.sv_addr
+#define s_mailer s_value.sv_mailer
+#define s_alias s_value.sv_alias
+#define s_mci s_value.sv_mci
+#define s_mapclass s_value.sv_mapclass
+#define s_hostsig s_value.sv_hostsig
+#define s_map s_value.sv_map
+#define s_namecanon s_value.sv_namecanon
+#define s_macro s_value.sv_macro
+#define s_ruleset s_value.sv_ruleset
+#define s_service s_value.sv_service
+#define s_header s_value.sv_header
+#ifdef LDAPMAP
+# define s_ldap s_value.sv_ldap
+#endif /* LDAPMAP */
+#if _FFR_MILTER
+# define s_milter s_value.sv_milter
+#endif /* _FFR_MILTER */
/* opcodes to stab */
-# define ST_FIND 0 /* find entry */
-# define ST_ENTER 1 /* enter if not there */
+#define ST_FIND 0 /* find entry */
+#define ST_ENTER 1 /* enter if not there */
+
+/* functions */
+extern STAB *stab __P((char *, int, int));
+extern void stabapply __P((void (*)(STAB *, int), int));
+
/*
** STRUCT EVENT -- event queue.
**
@@ -835,11 +1145,11 @@ struct event
typedef struct event EVENT;
-EXTERN EVENT *EventQueue; /* head of event queue */
-
/* functions */
-extern EVENT *setevent __P((time_t, void(*)(), int));
extern void clrevent __P((EVENT *));
+extern void clear_events __P((void));
+extern EVENT *setevent __P((time_t, void(*)(), int));
+
/*
** Operation, send, error, and MIME modes
**
@@ -856,8 +1166,6 @@ extern void clrevent __P((EVENT *));
** The error mode tells how to return errors.
*/
-EXTERN char OpMode; /* operation mode, see below */
-
#define MD_DELIVER 'm' /* be a mail sender */
#define MD_SMTP 's' /* run SMTP on standard input */
#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */
@@ -870,6 +1178,7 @@ EXTERN char OpMode; /* operation mode, see below */
#define MD_FREEZE 'z' /* freeze the configuration file */
#define MD_HOSTSTAT 'h' /* print persistent host stat info */
#define MD_PURGESTAT 'H' /* purge persistent host stat info */
+#define MD_QUEUERUN 'q' /* queue run */
/* values for e_sendmode -- send modes */
#define SM_DELIVER 'i' /* interactive delivery */
@@ -878,9 +1187,12 @@ EXTERN char OpMode; /* operation mode, see below */
#define SM_DEFER 'd' /* defer map lookups as well as queue */
#define SM_VERIFY 'v' /* verify only (used internally) */
+
/* used only as a parameter to sendall */
#define SM_DEFAULT '\0' /* unspecified, use SendMode */
+/* functions */
+extern void set_delivery_mode __P((int, ENVELOPE *));
/* values for e_errormode -- error handling modes */
#define EM_PRINT 'p' /* print errors */
@@ -890,25 +1202,13 @@ EXTERN char OpMode; /* operation mode, see below */
#define EM_QUIET 'q' /* don't print messages (stat only) */
-/* MIME processing mode */
-EXTERN int MimeMode;
-
/* bit values for MimeMode */
#define MM_CVTMIME 0x0001 /* convert 8 to 7 bit MIME */
#define MM_PASS8BIT 0x0002 /* just send 8 bit data blind */
#define MM_MIME8BIT 0x0004 /* convert 8-bit data to MIME */
-/* queue sorting order algorithm */
-EXTERN int QueueSortOrder;
-
-#define QS_BYPRIORITY 0 /* sort by message priority */
-#define QS_BYHOST 1 /* sort by first host name */
-#define QS_BYTIME 2 /* sort by submission time */
-
/* how to handle messages without any recipient addresses */
-EXTERN int NoRecipientAction;
-
#define NRA_NO_ACTION 0 /* just leave it as is */
#define NRA_ADD_TO 1 /* add To: header */
#define NRA_ADD_APPARENTLY_TO 2 /* add Apparently-To: header */
@@ -921,10 +1221,6 @@ EXTERN int NoRecipientAction;
#define PXLF_MAPFROM 0x0001 /* map From_ to >From_ */
#define PXLF_STRIP8BIT 0x0002 /* strip 8th bit */
#define PXLF_HEADER 0x0004 /* map newlines in headers */
- /*
-** Additional definitions
-*/
-
/*
** Privacy flags
@@ -939,17 +1235,20 @@ EXTERN int NoRecipientAction;
#define PRIV_NOVRFY 0x0010 /* disallow VRFY command entirely */
#define PRIV_AUTHWARNINGS 0x0020 /* flag possible authorization probs */
#define PRIV_NORECEIPTS 0x0040 /* disallow return receipts */
-#define PRIV_NOETRN 0x0080 /* disallow ETRN command entirely */
#define PRIV_NOVERB 0x0100 /* disallow VERB command entirely */
#define PRIV_RESTRICTMAILQ 0x1000 /* restrict mailq command */
#define PRIV_RESTRICTQRUN 0x2000 /* restrict queue run */
-#define PRIV_GOAWAY 0x0fff /* don't give no info, anyway, anyhow */
+#define PRIV_NOETRN 0x4000 /* disallow ETRN command entirely */
+#define PRIV_NOBODYRETN 0x8000 /* do not return bodies on bounces */
+
+/* don't give no info, anyway, anyhow */
+#define PRIV_GOAWAY (0x0fff & ~PRIV_NORECEIPTS)
/* struct defining such things */
struct prival
{
char *pv_name; /* name of privacy flag */
- int pv_flag; /* numeric level */
+ u_short pv_flag; /* numeric level */
};
@@ -968,42 +1267,7 @@ struct prival
/*
-** Flags passed to safefile/safedirpath.
-*/
-
-#define SFF_ANYFILE 0 /* no special restrictions */
-#define SFF_MUSTOWN 0x0001 /* user must own this file */
-#define SFF_NOSLINK 0x0002 /* file cannot be a symbolic link */
-#define SFF_ROOTOK 0x0004 /* ok for root to own this file */
-#define SFF_RUNASREALUID 0x0008 /* if no ctladdr, run as real uid */
-#define SFF_NOPATHCHECK 0x0010 /* don't bother checking dir path */
-#define SFF_SETUIDOK 0x0020 /* setuid files are ok */
-#define SFF_CREAT 0x0040 /* ok to create file if necessary */
-#define SFF_REGONLY 0x0080 /* regular files only */
-#define SFF_SAFEDIRPATH 0x0100 /* no writable directories allowed */
-#define SFF_NOHLINK 0x0200 /* file cannot have hard links */
-#define SFF_NOWLINK 0x0400 /* links only in non-writable dirs */
-#define SFF_NOGWFILES 0x0800 /* disallow world writable files */
-#define SFF_NOWWFILES 0x1000 /* disallow group writable files */
-
-/* flags that are actually specific to safeopen/safefopen/dfopen */
-#define SFF_OPENASROOT 0x2000 /* open as root instead of real user */
-#define SFF_NOLOCK 0x4000 /* don't lock the file */
-
-/* pseudo-flags */
-#define SFF_NOLINK (SFF_NOHLINK|SFF_NOSLINK)
-
-/* functions */
-extern int safefile __P((char *, UID_T, GID_T, char *, int, int, struct stat *));
-extern int safedirpath __P((char *, UID_T, GID_T, char *, int));
-extern int safeopen __P((char *, int, int, int));
-extern FILE *safefopen __P((char *, int, int, int));
-extern int dfopen __P((char *, int, int, int));
-extern bool filechanged __P((char *, int, struct stat *));
-
-
-/*
-** Flags passed to mime8to7.
+** Flags passed to mime8to7 and putheader.
*/
#define M87F_OUTER 0 /* outer context */
@@ -1011,6 +1275,9 @@ extern bool filechanged __P((char *, int, struct stat *));
#define M87F_DIGEST 0x0002 /* processing multipart/digest */
#define M87F_NO8TO7 0x0004 /* don't do 8->7 bit conversions */
+/* functions */
+extern void mime7to8 __P((MCI *, HDR *, ENVELOPE *));
+extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int));
/*
** Flags passed to returntosender.
@@ -1020,45 +1287,96 @@ extern bool filechanged __P((char *, int, struct stat *));
#define RTSF_SEND_BODY 0x0001 /* include body of message in return */
#define RTSF_PM_BOUNCE 0x0002 /* this is a postmaster bounce */
+/* functions */
+extern int returntosender __P((char *, ADDRESS *, int, ENVELOPE *));
/*
** Regular UNIX sockaddrs are too small to handle ISO addresses, so
** we are forced to declare a supertype here.
*/
-# if NETINET || NETUNIX || NETISO || NETNS || NETX25
+#if NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25
union bigsockaddr
{
struct sockaddr sa; /* general version */
-#if NETUNIX
+# if NETUNIX
struct sockaddr_un sunix; /* UNIX family */
-#endif
-#if NETINET
+# endif /* NETUNIX */
+# if NETINET
struct sockaddr_in sin; /* INET family */
-#endif
-#if NETISO
+# endif /* NETINET */
+# if NETINET6
+ struct sockaddr_in6 sin6; /* INET/IPv6 */
+# endif /* NETINET6 */
+# if NETISO
struct sockaddr_iso siso; /* ISO family */
-#endif
-#if NETNS
+# endif /* NETISO */
+# if NETNS
struct sockaddr_ns sns; /* XNS family */
-#endif
-#if NETX25
+# endif /* NETNS */
+# if NETX25
struct sockaddr_x25 sx25; /* X.25 family */
-#endif
+# endif /* NETX25 */
};
-#define SOCKADDR union bigsockaddr
-
-EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */
+# define SOCKADDR union bigsockaddr
-extern char *hostnamebyanyaddr __P((SOCKADDR *));
+/* functions */
extern char *anynet_ntoa __P((SOCKADDR *));
+# if NETINET6
+extern char *anynet_ntop __P((struct in6_addr *, char *, size_t));
+# endif /* NETINET6 */
+extern char *hostnamebyanyaddr __P((SOCKADDR *));
# if DAEMON
extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
-# endif
+# endif /* DAEMON */
+
+#endif /* NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25 */
+
+#if _FFR_MILTER
+ /*
+** Mail Filters (milter)
+*/
+
+#include <libmilter/milter.h>
+
+#define SMFTO_WRITE 0 /* Timeout for sending information */
+#define SMFTO_READ 1 /* Timeout waiting for a response */
+#define SMFTO_EOM 2 /* Timeout for ACK/NAK to EOM */
+
+#define SMFTO_NUM_TO 3 /* Total number of timeouts */
+
+struct milter
+{
+ char *mf_name; /* filter name */
+ BITMAP256 mf_flags; /* MTA flags */
+ u_long mf_fvers; /* filter version */
+ u_long mf_fflags; /* filter flags */
+ u_long mf_pflags; /* protocol flags */
+ char *mf_conn; /* connection info */
+ int mf_sock; /* connected socket */
+ char mf_state; /* state of filter */
+ time_t mf_timeout[SMFTO_NUM_TO]; /* timeouts */
+};
+
+/* MTA flags */
+# define SMF_REJECT 'R' /* Reject connection on filter fail */
+# define SMF_TEMPFAIL 'T' /* tempfail connection on failure */
-#endif
+/* states */
+# define SMFS_CLOSED 'C' /* closed for all further actions */
+# define SMFS_OPEN 'O' /* connected to remote milter filter */
+# define SMFS_INMSG 'M' /* currently servicing a message */
+# define SMFS_DONE 'D' /* done with current message */
+# define SMFS_ERROR 'E' /* error state */
+# define SMFS_READY 'R' /* ready for action */
+
+/* 32-bit type used by milter */
+typedef SM_INT32 mi_int32;
+EXTERN struct milter *InputFilters[MAXFILTERS];
+EXTERN char *InputFilterList;
+#endif /* _FFR_MILTER */
/*
** Vendor codes
@@ -1071,7 +1389,7 @@ extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
** -DVENDOR_DEFAULT=VENDOR_xxx
** in the Makefile.
**
-** Vendors should apply to sendmail@CS.Berkeley.EDU for
+** Vendors should apply to sendmail@sendmail.org for
** unique vendor codes.
*/
@@ -1081,57 +1399,10 @@ extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
#define VENDOR_IBM 4 /* IBM specific config syntax */
#define VENDOR_SENDMAIL 5 /* Sendmail, Inc. specific config syntax */
-EXTERN int VendorCode; /* vendor-specific operation enhancements */
-
/* prototypes for vendor-specific hook routines */
-extern void vendor_set_uid __P((UID_T));
extern void vendor_daemon_setup __P((ENVELOPE *));
+extern void vendor_set_uid __P((UID_T));
-/*
-** DontBlameSendmail options
-**
-** Hopefully nobody uses these.
-*/
-#define DBS_SAFE 0
-#define DBS_ASSUMESAFECHOWN 0x00000001
-#define DBS_GROUPWRITABLEDIRPATHSAFE 0x00000002
-#define DBS_GROUPWRITABLEFORWARDFILESAFE 0x00000004
-#define DBS_GROUPWRITABLEINCLUDEFILESAFE 0x00000008
-#define DBS_GROUPWRITABLEALIASFILE 0x00000010
-#define DBS_WORLDWRITABLEALIASFILE 0x00000020
-#define DBS_FORWARDFILEINUNSAFEDIRPATH 0x00000040
-#define DBS_MAPINUNSAFEDIRPATH 0x00000080
-#define DBS_LINKEDALIASFILEINWRITABLEDIR 0x00000100
-#define DBS_LINKEDCLASSFILEINWRITABLEDIR 0x00000200
-#define DBS_LINKEDFORWARDFILEINWRITABLEDIR 0x00000400
-#define DBS_LINKEDINCLUDEFILEINWRITABLEDIR 0x00000800
-#define DBS_LINKEDMAPINWRITABLEDIR 0x00001000
-#define DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR 0x00002000
-#define DBS_FILEDELIVERYTOHARDLINK 0x00004000
-#define DBS_FILEDELIVERYTOSYMLINK 0x00008000
-#define DBS_WRITEMAPTOHARDLINK 0x00010000
-#define DBS_WRITEMAPTOSYMLINK 0x00020000
-#define DBS_WRITESTATSTOHARDLINK 0x00040000
-#define DBS_WRITESTATSTOSYMLINK 0x00080000
-#define DBS_FORWARDFILEINGROUPWRITABLEDIRPATH 0x00100000
-#define DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH 0x00200000
-#define DBS_CLASSFILEINUNSAFEDIRPATH 0x00400000
-#define DBS_ERRORHEADERINUNSAFEDIRPATH 0x00800000
-#define DBS_HELPFILEINUNSAFEDIRPATH 0x01000000
-#define DBS_FORWARDFILEINUNSAFEDIRPATHSAFE 0x02000000
-#define DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE 0x04000000
-#define DBS_RUNPROGRAMINUNSAFEDIRPATH 0x08000000
-#define DBS_RUNWRITABLEPROGRAM 0x10000000
-#define DBS_INCLUDEFILEINUNSAFEDIRPATH 0x20000000
-
-/* struct defining such things */
-struct dbsval
-{
- char *dbs_name; /* name of DontBlameSendmail flag */
- long dbs_flag; /* numeric level */
-};
-
-EXTERN long DontBlameSendmail; /* DontBlameSendmail option bits */
/*
** Terminal escape codes.
@@ -1145,159 +1416,120 @@ struct termescape
char *te_rv_off; /* turn reverse-video off */
};
-EXTERN struct termescape TermEscape;
-
+ /*
+** Additional definitions
+*/
-/*
-** Error return from inet_addr(3), in case not defined in /usr/include.
+/* d_flags, see daemon.c */
+/* generic rule: lower case: required, upper case: No */
+#define D_AUTHREQ 'a' /* authentication required */
+#define D_BINDIF 'b' /* use if_addr for outgoing connection */
+#define D_CANONREQ 'c' /* canonification required (cf) */
+#define D_IFNHELO 'h' /* use if name for HELO */
+#define D_FQMAIL 'f' /* fq sender address required (cf) */
+#define D_FQRCPT 'r' /* fq recipient address required (cf) */
+#define D_UNQUALOK 'u' /* unqualified address is ok (cf) */
+#define D_NOCANON 'C' /* no canonification (cf) */
+#define D_NOETRN 'E' /* no ETRN (MSA) */
+#define D_ETRNONLY ((char)0x01) /* allow only ETRN (disk low) */
+
+/* Flags for submitmode */
+#define SUBMIT_UNKNOWN 0x0000 /* unknown agent type */
+#define SUBMIT_MTA 0x0001 /* act like a message transfer agent */
+#define SUBMIT_MSA 0x0002 /* act like a message submission agent */
+
+#if SASL
+ /*
+** SASL
*/
-#ifndef INADDR_NONE
-# define INADDR_NONE 0xffffffff
-#endif
+/* authenticated? */
+# define SASL_NOT_AUTH 0 /* not authenticated */
+# define SASL_PROC_AUTH 1 /* in process of authenticating */
+# define SASL_IS_AUTH 2 /* authenticated */
+
+/* SASL options */
+# define SASL_AUTH_AUTH 0x1000 /* use auth= only if authenticated */
+# if _FFR_SASL_OPTS
+# define SASL_SEC_MASK 0x0fff /* mask for SASL_SEC_* values: sasl.h */
+# if (SASL_SEC_NOPLAINTEXT & SASL_SEC_MASK) == 0 || \
+ (SASL_SEC_NOACTIVE & SASL_SEC_MASK) == 0 || \
+ (SASL_SEC_NODICTIONARY & SASL_SEC_MASK) == 0 || \
+ (SASL_SEC_FORWARD_SECRECY & SASL_SEC_MASK) == 0 || \
+ (SASL_SEC_NOANONYMOUS & SASL_SEC_MASK) == 0 || \
+ (SASL_SEC_PASS_CREDENTIALS & SASL_SEC_MASK) == 0
+ERROR: change SASL_SEC_MASK_ notify sendmail.org!
+# endif
+# endif /* _FFR_SASL_OPTS */
+
+# define MAXOUTLEN 1024 /* length of output buffer */
+#endif /* SASL */
+
+#if STARTTLS
/*
-** Global variables.
+** TLS
*/
-EXTERN bool FromFlag; /* if set, "From" person is explicit */
-EXTERN bool MeToo; /* send to the sender also */
-EXTERN bool IgnrDot; /* don't let dot end messages */
-EXTERN bool SaveFrom; /* save leading "From" lines */
-EXTERN bool GrabTo; /* if set, get recipients from msg */
-EXTERN bool SuprErrs; /* set if we are suppressing errors */
-EXTERN bool HoldErrs; /* only output errors to transcript */
-EXTERN bool NoConnect; /* don't connect to non-local mailers */
-EXTERN bool SuperSafe; /* be extra careful, even if expensive */
-EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */
-EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */
-EXTERN bool CheckAliases; /* parse addresses during newaliases */
-EXTERN bool NoAlias; /* suppress aliasing */
-EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */
-EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */
-EXTERN bool SevenBitInput; /* force 7-bit data on input */
-EXTERN bool HasEightBits; /* has at least one eight bit input byte */
-EXTERN bool ConfigFileRead; /* configuration file has been read */
-EXTERN time_t SafeAlias; /* interval to wait until @:@ in alias file */
-EXTERN FILE *InChannel; /* input connection */
-EXTERN FILE *OutChannel; /* output connection */
-EXTERN char *RealUserName; /* real user name of caller */
-EXTERN uid_t RealUid; /* real uid of caller */
-EXTERN gid_t RealGid; /* real gid of caller */
-EXTERN uid_t DefUid; /* default uid to run as */
-EXTERN gid_t DefGid; /* default gid to run as */
-EXTERN char *DefUser; /* default user to run as (from DefUid) */
-EXTERN uid_t TrustedUid; /* uid of trusted user for files and startup */
-EXTERN MODE_T OldUmask; /* umask when sendmail starts up */
-EXTERN int Verbose; /* set if blow-by-blow desired */
-EXTERN int Errors; /* set if errors (local to single pass) */
-EXTERN int ExitStat; /* exit status code */
-EXTERN int LineNumber; /* line number in current input */
-EXTERN int LogLevel; /* level of logging to perform */
-EXTERN int FileMode; /* mode on files */
-EXTERN int QueueLA; /* load average starting forced queueing */
-EXTERN int RefuseLA; /* load average refusing connections are */
-EXTERN int CurrentLA; /* current load average */
-EXTERN long QueueFactor; /* slope of queue function */
-EXTERN time_t QueueIntvl; /* intervals between running the queue */
-EXTERN char *HelpFile; /* location of SMTP help file */
-EXTERN char *ErrMsgFile; /* file to prepend to all error messages */
-EXTERN char *StatFile; /* location of statistics summary */
-EXTERN char *QueueDir; /* location of queue directory */
-EXTERN char *FileName; /* name to print on error messages */
-EXTERN char *SmtpPhase; /* current phase in SMTP processing */
-EXTERN char *MyHostName; /* name of this host for SMTP messages */
-EXTERN char *RealHostName; /* name of host we are talking to */
-EXTERN char *CurHostName; /* current host we are dealing with */
-EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */
-EXTERN bool QuickAbort; /* .... but only if we want a quick abort */
-EXTERN bool OnlyOneError; /* .... or only want to give one SMTP reply */
-EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */
-EXTERN bool SendMIMEErrors; /* send error messages in MIME format */
-EXTERN bool MatchGecos; /* look for user names in gecos field */
-EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */
-EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */
-EXTERN bool InChild; /* true if running in an SMTP subprocess */
-EXTERN bool DisConnected; /* running with OutChannel redirected to xf */
-EXTERN bool ColonOkInAddr; /* single colon legal in address */
-EXTERN bool HasWildcardMX; /* don't use MX records when canonifying */
-EXTERN char SpaceSub; /* substitution for <lwsp> */
-EXTERN int PrivacyFlags; /* privacy flags */
-EXTERN char *ConfFile; /* location of configuration file [conf.c] */
-EXTERN char *PidFile; /* location of proc id file [conf.c] */
-EXTERN char *ControlSocketName; /* control socket filename [control.c] */
-extern ADDRESS NullAddress; /* a null (template) address [main.c] */
-EXTERN long WkClassFact; /* multiplier for message class -> priority */
-EXTERN long WkRecipFact; /* multiplier for # of recipients -> priority */
-EXTERN long WkTimeFact; /* priority offset each time this job is run */
-EXTERN char *UdbSpec; /* user database source spec */
-EXTERN int MaxHopCount; /* max # of hops until bounce */
-EXTERN int ConfigLevel; /* config file level */
-EXTERN char *TimeZoneSpec; /* override time zone specification */
-EXTERN char *ForwardPath; /* path to search for .forward files */
-EXTERN long MinBlocksFree; /* min # of blocks free on queue fs */
-EXTERN char *FallBackMX; /* fall back MX host */
-EXTERN long MaxMessageSize; /* advertised max size we will accept */
-EXTERN time_t MinQueueAge; /* min delivery interval */
-EXTERN time_t DialDelay; /* delay between dial-on-demand tries */
-EXTERN char *SafeFileEnv; /* chroot location for file delivery */
-EXTERN char *HostsFile; /* path to /etc/hosts file */
-EXTERN char *HostStatDir; /* location of host status information */
-EXTERN int MaxQueueRun; /* maximum number of jobs in one queue run */
-EXTERN int MaxChildren; /* maximum number of daemonic children */
-EXTERN int CurChildren; /* current number of daemonic children */
-EXTERN char *SmtpGreeting; /* SMTP greeting message (old $e macro) */
-EXTERN char *UnixFromLine; /* UNIX From_ line (old $l macro) */
-EXTERN char *OperatorChars; /* operators (old $o macro) */
-EXTERN bool DontInitGroups; /* avoid initgroups() because of NIS cost */
-EXTERN int DefaultNotify; /* default DSN notification flags */
-EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */
-EXTERN bool UserSubmission; /* initial (user) mail submission */
-EXTERN char *RunAsUserName; /* user to become for bulk of run */
-EXTERN uid_t RunAsUid; /* UID to become for bulk of run */
-EXTERN gid_t RunAsGid; /* GID to become for bulk of run */
-EXTERN int MaxRcptPerMsg; /* max recipients per SMTP message */
-EXTERN bool DoQueueRun; /* non-interrupt time queue run needed */
-EXTERN u_long ConnectOnlyTo; /* override connection address (for testing) */
-EXTERN int MaxHeadersLength; /* max length of headers */
-#if _FFR_DSN_RRT_OPTION
-EXTERN bool RrtImpliesDsn; /* turn Return-Receipt-To: into DSN */
-#endif
-EXTERN char *DeadLetterDrop; /* path to dead letter office */
-EXTERN bool DontProbeInterfaces; /* don't probe interfaces for names */
-EXTERN bool ChownAlwaysSafe; /* treat chown(2) as safe */
-EXTERN bool IgnoreHostStatus; /* ignore long term host status files */
-EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */
-EXTERN bool SingleLineFromHeader; /* force From: header to be one line */
-EXTERN bool DontLockReadFiles; /* don't read lock support files */
-EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */
-EXTERN int MaxAliasRecursion; /* maximum depth of alias recursion */
-EXTERN int MaxMacroRecursion; /* maximum depth of macro recursion */
-EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */
-EXTERN char *MustQuoteChars; /* quote these characters in phrases */
-EXTERN char *ServiceSwitchFile; /* backup service switch */
-EXTERN char *DefaultCharSet; /* default character set for MIME */
-EXTERN char *PostMasterCopy; /* address to get errs cc's */
-EXTERN int CheckpointInterval; /* queue file checkpoint interval */
-EXTERN bool DontPruneRoutes; /* don't prune source routes */
-EXTERN bool DontExpandCnames; /* do not $[...$] expand CNAMEs */
-EXTERN int MaxMciCache; /* maximum entries in MCI cache */
-EXTERN time_t ServiceCacheTime; /* time service switch was cached */
-EXTERN time_t ServiceCacheMaxAge; /* refresh interval for cache */
-EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */
-EXTERN time_t MciInfoTimeout; /* how long 'til we retry down hosts */
-EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */
-EXTERN char *DoubleBounceAddr; /* where to send double bounces */
-EXTERN char **ExternalEnviron; /* input environment */
-EXTERN char *UserEnviron[MAXUSERENVIRON + 1];
- /* saved user environment */
-EXTERN int MaxMimeHeaderLength; /* maximum MIME header length */
-EXTERN int MaxMimeFieldLength; /* maximum MIME field length */
+/* what to do in the TLS initialization */
+#define TLS_I_NONE 0x00000000 /* no requirements... */
+#define TLS_I_CERT_EX 0x00000001 /* CERT must exist */
+#define TLS_I_CERT_UNR 0x00000002 /* CERT must be g/o unreadable */
+#define TLS_I_KEY_EX 0x00000004 /* KEY must exist */
+#define TLS_I_KEY_UNR 0x00000008 /* KEY must be g/o unreadable */
+#define TLS_I_CERTP_EX 0x00000010 /* CA CERT PATH must exist */
+#define TLS_I_CERTP_UNR 0x00000020 /* CA CERT PATH must be g/o unreadable */
+#define TLS_I_CERTF_EX 0x00000040 /* CA CERT FILE must exist */
+#define TLS_I_CERTF_UNR 0x00000080 /* CA CERT FILE must be g/o unreadable */
+#define TLS_I_RSA_TMP 0x00000100 /* RSA TMP must be generated */
+#define TLS_I_USE_KEY 0x00000200 /* private key must usable */
+#define TLS_I_USE_CERT 0x00000400 /* certificate must be usable */
+#define TLS_I_VRFY_PATH 0x00000800 /* load verify path must succeed */
+#define TLS_I_VRFY_LOC 0x00001000 /* load verify default must succeed */
+#define TLS_I_CACHE 0x00002000 /* require cache */
+#define TLS_I_TRY_DH 0x00004000 /* try DH certificate */
+#define TLS_I_REQ_DH 0x00008000 /* require DH certificate */
+#define TLS_I_DHPAR_EX 0x00010000 /* require DH parameters */
+#define TLS_I_DHPAR_UNR 0x00020000 /* DH param. must be g/o unreadable */
+#define TLS_I_DH512 0x00040000 /* generate 512bit DH param */
+#define TLS_I_DH1024 0x00080000 /* generate 1024bit DH param */
+#define TLS_I_DH2048 0x00100000 /* generate 2048bit DH param */
+
+/* server requirements */
+#define TLS_I_SRV (TLS_I_CERT_EX | TLS_I_KEY_EX | TLS_I_KEY_UNR | \
+ TLS_I_CERTP_EX | TLS_I_CERTF_EX | TLS_I_RSA_TMP | \
+ TLS_I_USE_KEY | TLS_I_USE_CERT | TLS_I_VRFY_PATH | \
+ TLS_I_VRFY_LOC | TLS_I_TRY_DH | \
+ TLS_I_DH512)
+
+/* client requirements */
+#define TLS_I_CLT (TLS_I_KEY_UNR)
+
+#define TLS_AUTH_OK 0
+#define TLS_AUTH_NO 1
+#define TLS_AUTH_FAIL (-1)
+#endif /* STARTTLS */
-extern int errno;
-/*
-** Queue Run Limitations
+ /*
+** Queue related items
*/
+
+/* queue sort order */
+#define QSO_BYPRIORITY 0 /* sort by message priority */
+#define QSO_BYHOST 1 /* sort by first host name */
+#define QSO_BYTIME 2 /* sort by submission time */
+#define QSO_BYFILENAME 3 /* sort by file name only */
+
+#if _FFR_QUEUEDELAY
+#define QD_LINEAR 0 /* linear (old) delay alg */
+#define QD_EXP 1 /* exponential delay alg */
+#endif /* _FFR_QUEUEDELAY */
+
+#define NOQDIR (-1) /* no queue directory (yet) */
+
+#define NOW ((time_t) (-1)) /* queue return: now */
+
+/* Queue Run Limitations */
struct queue_char
{
char *queue_match; /* string to match */
@@ -1306,9 +1538,20 @@ struct queue_char
typedef struct queue_char QUEUE_CHAR;
-EXTERN QUEUE_CHAR *QueueLimitRecipient; /* limit queue runs to this recipient */
-EXTERN QUEUE_CHAR *QueueLimitSender; /* limit queue runs to this sender */
-EXTERN QUEUE_CHAR *QueueLimitId; /* limit queue runs to this id */
+/* functions */
+extern void assign_queueid __P((ENVELOPE *));
+extern ADDRESS *copyqueue __P((ADDRESS *));
+extern void initsys __P((ENVELOPE *));
+extern void loseqfile __P((ENVELOPE *, char *));
+extern void multiqueue_cache __P((void));
+extern char *qid_printname __P((ENVELOPE *));
+extern char *qid_printqueue __P((int));
+extern char *queuename __P((ENVELOPE *, int));
+extern void queueup __P((ENVELOPE *, bool));
+extern bool runqueue __P((bool, bool));
+extern void setnewqueue __P((ENVELOPE *));
+extern bool shouldqueue __P((long, time_t));
+extern void sync_queue_time __P((void));
/*
** Timeouts
@@ -1335,30 +1578,41 @@ EXTERN struct
time_t to_miscshort; /* misc short commands (NOOP, VERB, etc) */
time_t to_ident; /* IDENT protocol requests */
time_t to_fileopen; /* opening :include: and .forward files */
+ time_t to_control; /* process a control socket command */
/* following are per message */
time_t to_q_return[MAXTOCLASS]; /* queue return timeouts */
time_t to_q_warning[MAXTOCLASS]; /* queue warning timeouts */
+ time_t res_retrans[MAXRESTOTYPES]; /* resolver retransmit */
+ int res_retry[MAXRESTOTYPES]; /* resolver retry */
} TimeOuts;
/* timeout classes for return and warning timeouts */
-# define TOC_NORMAL 0 /* normal delivery */
-# define TOC_URGENT 1 /* urgent delivery */
-# define TOC_NONURGENT 2 /* non-urgent delivery */
+#define TOC_NORMAL 0 /* normal delivery */
+#define TOC_URGENT 1 /* urgent delivery */
+#define TOC_NONURGENT 2 /* non-urgent delivery */
+
+/* resolver timeout specifiers */
+#define RES_TO_FIRST 0 /* first attempt */
+#define RES_TO_NORMAL 1 /* subsequent attempts */
+#define RES_TO_DEFAULT 2 /* default value */
+/* functions */
+extern void inittimeouts __P((char *, bool));
/*
** Trace information
*/
-/* trace vector and macros for debugging flags */
-EXTERN u_char tTdvect[100];
-# define tTd(flag, level) (tTdvect[flag] >= level)
-# define tTdlevel(flag) (tTdvect[flag])
+/* macros for debugging flags */
+#define tTd(flag, level) (tTdvect[flag] >= (u_char)level)
+#define tTdlevel(flag) (tTdvect[flag])
+
+/* variables */
+extern u_char tTdvect[100]; /* trace vector */
/*
** Miscellaneous information.
*/
-
/*
** The "no queue id" queue id for sm_syslog
*/
@@ -1380,135 +1634,457 @@ EXTERN u_char tTdvect[100];
#define newstr(s) strcpy(xalloc(strlen(s) + 1), s)
#define STRUCTCOPY(s, d) d = s
+ /*
+** Global variables.
+*/
+
+EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */
+#if !_FFR_REMOVE_AUTOREBUILD
+EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */
+#endif /* !_FFR_REMOVE_AUTOREBUILD */
+EXTERN bool CheckAliases; /* parse addresses during newaliases */
+EXTERN bool ChownAlwaysSafe; /* treat chown(2) as safe */
+EXTERN bool ColonOkInAddr; /* single colon legal in address */
+EXTERN bool ConfigFileRead; /* configuration file has been read */
+EXTERN bool DataProgress; /* have we sent anything since last check */
+EXTERN bool DisConnected; /* running with OutChannel redirected to xf */
+EXTERN bool DoQueueRun; /* non-interrupt time queue run needed */
+EXTERN bool DontExpandCnames; /* do not $[...$] expand CNAMEs */
+EXTERN bool DontInitGroups; /* avoid initgroups() because of NIS cost */
+EXTERN bool DontLockReadFiles; /* don't read lock support files */
+EXTERN bool DontProbeInterfaces; /* don't probe interfaces for names */
+EXTERN bool DontPruneRoutes; /* don't prune source routes */
+EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */
+EXTERN bool FromFlag; /* if set, "From" person is explicit */
+EXTERN bool GrabTo; /* if set, get recipients from msg */
+EXTERN bool HasEightBits; /* has at least one eight bit input byte */
+EXTERN bool HasWildcardMX; /* don't use MX records when canonifying */
+EXTERN bool HoldErrs; /* only output errors to transcript */
+EXTERN bool IgnoreHostStatus; /* ignore long term host status files */
+EXTERN bool IgnrDot; /* don't let dot end messages */
+EXTERN bool InChild; /* true if running in an SMTP subprocess */
+EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */
+EXTERN bool MatchGecos; /* look for user names in gecos field */
+EXTERN bool MeToo; /* send to the sender also */
+EXTERN bool NoAlias; /* suppress aliasing */
+EXTERN bool NoConnect; /* don't connect to non-local mailers */
+EXTERN bool OnlyOneError; /* .... or only want to give one SMTP reply */
+EXTERN bool QuickAbort; /* .... but only if we want a quick abort */
+EXTERN bool RrtImpliesDsn; /* turn Return-Receipt-To: into DSN */
+EXTERN bool SaveFrom; /* save leading "From" lines */
+EXTERN bool SendMIMEErrors; /* send error messages in MIME format */
+EXTERN bool SevenBitInput; /* force 7-bit data on input */
+EXTERN bool SingleLineFromHeader; /* force From: header to be one line */
+EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */
+EXTERN bool SuperSafe; /* be extra careful, even if expensive */
+EXTERN bool SuprErrs; /* set if we are suppressing errors */
+EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */
+EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */
+EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */
+EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */
+EXTERN char InetMode; /* default network for daemon mode */
+EXTERN char OpMode; /* operation mode, see below */
+EXTERN char SpaceSub; /* substitution for <lwsp> */
+EXTERN int CheckpointInterval; /* queue file checkpoint interval */
+EXTERN int ConfigLevel; /* config file level */
+EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */
+EXTERN int CurChildren; /* current number of daemonic children */
+EXTERN int CurrentLA; /* current load average */
+EXTERN int DefaultNotify; /* default DSN notification flags */
+EXTERN int Errors; /* set if errors (local to single pass) */
+EXTERN int ExitStat; /* exit status code */
+EXTERN int FileMode; /* mode on files */
+EXTERN int LineNumber; /* line number in current input */
+EXTERN int LogLevel; /* level of logging to perform */
+EXTERN int MaxAliasRecursion; /* maximum depth of alias recursion */
+EXTERN int MaxChildren; /* maximum number of daemonic children */
+EXTERN int MaxForwardEntries; /* maximum number of forward entries */
+EXTERN int MaxHeadersLength; /* max length of headers */
+EXTERN int MaxHopCount; /* max # of hops until bounce */
+EXTERN int MaxMacroRecursion; /* maximum depth of macro recursion */
+EXTERN int MaxMciCache; /* maximum entries in MCI cache */
+EXTERN int MaxMimeFieldLength; /* maximum MIME field length */
+EXTERN int MaxMimeHeaderLength; /* maximum MIME header length */
+EXTERN int MaxQueueRun; /* maximum number of jobs in one queue run */
+EXTERN int MaxRcptPerMsg; /* max recipients per SMTP message */
+EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */
+EXTERN int MimeMode; /* MIME processing mode */
+EXTERN int NoRecipientAction;
+EXTERN int NumPriorities; /* pointer into Priorities */
+EXTERN u_short PrivacyFlags; /* privacy flags */
+#if _FFR_QUEUE_FILE_MODE
+EXTERN int QueueFileMode; /* mode on qf/tf/df files */
+#endif /* _FFR_QUEUE_FILE_MODE */
+EXTERN int QueueLA; /* load average starting forced queueing */
+EXTERN int QueueSortOrder; /* queue sorting order algorithm */
+EXTERN int RefuseLA; /* load average refusing connections are */
+EXTERN int VendorCode; /* vendor-specific operation enhancements */
+EXTERN int Verbose; /* set if blow-by-blow desired */
+EXTERN gid_t DefGid; /* default gid to run as */
+EXTERN gid_t RealGid; /* real gid of caller */
+EXTERN gid_t RunAsGid; /* GID to become for bulk of run */
+EXTERN uid_t DefUid; /* default uid to run as */
+EXTERN uid_t RealUid; /* real uid of caller */
+EXTERN uid_t RunAsUid; /* UID to become for bulk of run */
+EXTERN uid_t TrustedUid; /* uid of trusted user for files and startup */
+EXTERN size_t DataFileBufferSize; /* size of buffer for in-core df */
+EXTERN size_t XscriptFileBufferSize; /* size of buffer for in-core xf */
+EXTERN time_t DialDelay; /* delay between dial-on-demand tries */
+EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */
+EXTERN time_t MciInfoTimeout; /* how long 'til we retry down hosts */
+EXTERN time_t MinQueueAge; /* min delivery interval */
+EXTERN time_t QueueIntvl; /* intervals between running the queue */
+EXTERN time_t SafeAlias; /* interval to wait until @:@ in alias file */
+EXTERN time_t ServiceCacheMaxAge; /* refresh interval for cache */
+EXTERN time_t ServiceCacheTime; /* time service switch was cached */
+EXTERN MODE_T OldUmask; /* umask when sendmail starts up */
+EXTERN long MaxMessageSize; /* advertised max size we will accept */
+EXTERN long MinBlocksFree; /* min # of blocks free on queue fs */
+EXTERN long QueueFactor; /* slope of queue function */
+EXTERN long WkClassFact; /* multiplier for message class -> priority */
+EXTERN long WkRecipFact; /* multiplier for # of recipients -> priority */
+EXTERN long WkTimeFact; /* priority offset each time this job is run */
+#if SASL
+EXTERN char *AuthMechanisms; /* AUTH mechanisms */
+EXTERN char *SASLInfo; /* file with AUTH info */
+#endif /* SASL */
+EXTERN int SASLOpts; /* options for SASL */
+#if STARTTLS
+EXTERN char *CACERTpath; /* path to CA certificates (dir. with hashes) */
+EXTERN char *CACERTfile; /* file with CA certificate */
+EXTERN char *SrvCERTfile; /* file with server certificate */
+EXTERN char *Srvkeyfile; /* file with server private key */
+EXTERN char *CltCERTfile; /* file with client certificate */
+EXTERN char *Cltkeyfile; /* file with client private key */
+EXTERN char *DHParams; /* file with DH parameters */
+EXTERN char *RandFile; /* source of random data */
+# if _FFR_TLS_1
+EXTERN char *DHParams5; /* file with DH parameters (512) */
+EXTERN char *CipherList; /* list of ciphers */
+# endif /* _FFR_TLS_1 */
+#endif /* STARTTLS */
+EXTERN char *ConfFile; /* location of configuration file [conf.c] */
+EXTERN char *ControlSocketName; /* control socket filename [control.c] */
+EXTERN char *CurHostName; /* current host we are dealing with */
+EXTERN char *DeadLetterDrop; /* path to dead letter office */
+EXTERN char *DefUser; /* default user to run as (from DefUid) */
+EXTERN char *DefaultCharSet; /* default character set for MIME */
+EXTERN char *DoubleBounceAddr; /* where to send double bounces */
+EXTERN char *ErrMsgFile; /* file to prepend to all error messages */
+EXTERN char *FallBackMX; /* fall back MX host */
+EXTERN char *FileName; /* name to print on error messages */
+EXTERN char *ForwardPath; /* path to search for .forward files */
+EXTERN char *HelpFile; /* location of SMTP help file */
+EXTERN char *HostStatDir; /* location of host status information */
+EXTERN char *HostsFile; /* path to /etc/hosts file */
+EXTERN char *MustQuoteChars; /* quote these characters in phrases */
+EXTERN char *MyHostName; /* name of this host for SMTP messages */
+EXTERN char *OperatorChars; /* operators (old $o macro) */
+EXTERN char *PidFile; /* location of proc id file [conf.c] */
+EXTERN char *PostMasterCopy; /* address to get errs cc's */
+EXTERN char *ProcTitlePrefix; /* process title prefix */
+EXTERN char *QueueDir; /* location of queue directory */
+#if _FFR_QUEUEDELAY
+EXTERN int QueueAlg; /* algorithm for queue delays */
+EXTERN time_t QueueInitDelay; /* initial queue delay */
+EXTERN time_t QueueMaxDelay; /* maximum queue delay */
+#endif /* _FFR_QUEUEDELAY */
+EXTERN char *RealHostName; /* name of host we are talking to */
+EXTERN char *RealUserName; /* real user name of caller */
+EXTERN char *RunAsUserName; /* user to become for bulk of run */
+EXTERN char *SafeFileEnv; /* chroot location for file delivery */
+EXTERN char *ServiceSwitchFile; /* backup service switch */
+EXTERN char *SmtpGreeting; /* SMTP greeting message (old $e macro) */
+EXTERN char *SmtpPhase; /* current phase in SMTP processing */
+EXTERN char SmtpError[MAXLINE]; /* save failure error messages */
+EXTERN char *StatFile; /* location of statistics summary */
+EXTERN char *TimeZoneSpec; /* override time zone specification */
+EXTERN char *UdbSpec; /* user database source spec */
+EXTERN char *UnixFromLine; /* UNIX From_ line (old $l macro) */
+EXTERN char **ExternalEnviron; /* input environment */
+ /* saved user environment */
+EXTERN BITMAP256 DontBlameSendmail; /* DontBlameSendmail bits */
+#if SFIO
+EXTERN Sfio_t *InChannel; /* input connection */
+EXTERN Sfio_t *OutChannel; /* output connection */
+#else /* SFIO */
+EXTERN FILE *InChannel; /* input connection */
+EXTERN FILE *OutChannel; /* output connection */
+#endif /* SFIO */
+EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */
+#ifdef HESIOD
+EXTERN void *HesiodContext;
+#endif /* HESIOD */
+EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */
+EXTERN EVENT *EventQueue; /* head of event queue */
+EXTERN MAILER *LocalMailer; /* ptr to local mailer */
+EXTERN MAILER *ProgMailer; /* ptr to program mailer */
+EXTERN MAILER *FileMailer; /* ptr to *file* mailer */
+EXTERN MAILER *InclMailer; /* ptr to *include* mailer */
+EXTERN QUEUE_CHAR *QueueLimitRecipient; /* limit queue run to rcpt */
+EXTERN QUEUE_CHAR *QueueLimitSender; /* limit queue run to sender */
+EXTERN QUEUE_CHAR *QueueLimitId; /* limit queue run to id */
+EXTERN MAILER *Mailer[MAXMAILERS + 1];
+EXTERN struct rewrite *RewriteRules[MAXRWSETS];
+EXTERN char *RuleSetNames[MAXRWSETS]; /* ruleset number to name */
+EXTERN char *UserEnviron[MAXUSERENVIRON + 1];
+EXTERN struct priority Priorities[MAXPRIORITIES];
+EXTERN struct termescape TermEscape; /* terminal escape codes */
+EXTERN SOCKADDR ConnectOnlyTo; /* override connection address (for testing) */
+EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */
+EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */
+EXTERN TIMERS Timers;
/*
** Declarations of useful functions
*/
-extern char *xalloc __P((int));
-extern char *sfgets __P((char *, int, FILE *, time_t, char *));
-extern char *queuename __P((ENVELOPE *, int));
-extern time_t curtime __P((void));
-extern bool transienterror __P((int));
-extern char *fgetfolded __P((char *, int, FILE *));
-extern char *username __P((void));
-extern char *pintvl __P((time_t, bool));
-extern bool shouldqueue __P((long, time_t));
-extern bool lockfile __P((int, char *, char *, int));
-extern char *hostsignature __P((MAILER *, char *, ENVELOPE *));
-extern void openxscript __P((ENVELOPE *));
+#if SASL
+extern char *intersect __P((char *, char *));
+extern char *iteminlist __P((char *, char *, char *));
+extern int proxy_policy __P((void *, const char *, const char *, const char **, const char **));
+# if SASL > 10515
+extern int safesaslfile __P((void *, char *, int));
+# else /* SASL > 10515 */
+extern int safesaslfile __P((void *, char *));
+# endif /* SASL > 10515 */
+extern int sasl_decode64 __P((const char *, unsigned, char *, unsigned *));
+extern int sasl_encode64 __P((const char *, unsigned, char *, unsigned, unsigned *));
+#endif /* SASL */
+
+#if STARTTLS
+extern void apps_ssl_info_cb __P((SSL *, int , int));
+extern bool inittls __P((SSL_CTX **, u_long, bool, char *, char *, char *, char *, char *));
+extern bool initclttls __P((void));
+extern bool initsrvtls __P((void));
+extern int tls_get_info __P((SSL *, ENVELOPE *, bool, char *));
+extern int endtls __P((SSL *, char *));
+extern int endtlsclt __P((MCI *));
+extern void tlslogerr __P((void));
+extern void tls_rand_init __P((char *, int));
+#endif /* STARTTLS */
+
+/* Transcript file */
extern void closexscript __P((ENVELOPE *));
-extern char *shortenstring __P((const char *, int));
-extern bool usershellok __P((char *, char *));
-extern char *defcharset __P((ENVELOPE *));
-extern bool wordinclass __P((char *, int));
-extern char *denlstring __P((char *, bool, bool));
-extern void makelower __P((char *));
-extern bool rebuildaliases __P((MAP *, bool));
+extern void openxscript __P((ENVELOPE *));
+
+/* error related */
+extern void buffer_errors __P((void));
+extern void flush_errors __P((bool));
+extern void message __P((const char *, ...));
+extern void nmessage __P((const char *, ...));
+extern void syserr __P((const char *, ...));
+extern void usrerrenh __P((char *, const char *, ...));
+extern void usrerr __P((const char *, ...));
+extern int isenhsc __P((const char *, int));
+extern int extenhsc __P((const char *, int, char *));
+
+/* alias file */
+extern void alias __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
+extern bool aliaswait __P((MAP *, char *, bool));
+extern void forward __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern void readaliases __P((MAP *, FILE *, bool, bool));
-extern void finis __P((bool, volatile int));
-extern void setsender __P((char *, ENVELOPE *, char **, int, bool));
-extern void xputs __P((const char *));
+extern bool rebuildaliases __P((MAP *, bool));
+extern void setalias __P((char *));
+
+/* logging */
+extern void logdelivery __P((MAILER *, MCI *, char *, const char *, ADDRESS *, time_t, ENVELOPE *));
extern void logsender __P((ENVELOPE *, char *));
-extern void smtprset __P((MAILER *, MCI *, ENVELOPE *));
-extern void smtpquit __P((MAILER *, MCI *, ENVELOPE *));
-extern void setuserenv __P((const char *, const char *));
-extern char *getextenv __P((const char *));
-extern void disconnect __P((int, ENVELOPE *));
-extern void putxline __P((char *, size_t, MCI *, int));
-extern void dumpfd __P((int, bool, bool));
-extern void makemailer __P((char *));
-extern void putfromline __P((MCI *, ENVELOPE *));
-extern void setoption __P((int, char *, bool, bool, ENVELOPE *));
-extern void setclass __P((int, char *));
-extern void inittimeouts __P((char *));
-extern void logdelivery __P((MAILER *, MCI *, const char *, ADDRESS *, time_t, ENVELOPE *));
-extern void giveresponse __P((int, MAILER *, MCI *, ADDRESS *, time_t, ENVELOPE *));
-extern void buildfname __P((char *, char *, char *, int));
-extern void mci_setstat __P((MCI *, int, char *, char *));
+extern void sm_syslog __P((int, const char *, const char *, ...));
+
+/* SMTP */
+extern void giveresponse __P((int, char *, MAILER *, MCI *, ADDRESS *, time_t, ENVELOPE *));
+extern int reply __P((MAILER *, MCI *, ENVELOPE *, time_t, void (*)(), char **));
+extern void smtp __P((char *volatile, BITMAP256, ENVELOPE *volatile));
+#if SASL
+extern int smtpauth __P((MAILER *, MCI *, ENVELOPE *));
+#endif /* SASL */
+extern int smtpdata __P((MAILER *, MCI *, ENVELOPE *));
+extern int smtpgetstat __P((MAILER *, MCI *, ENVELOPE *));
+extern int smtpmailfrom __P((MAILER *, MCI *, ENVELOPE *));
+extern void smtpmessage __P((char *, MAILER *, MCI *, ...));
+extern void smtpinit __P((MAILER *, MCI *, ENVELOPE *, bool));
extern char *smtptodsn __P((int));
-extern int rscheck __P((char *, char *, char *, ENVELOPE *e));
-extern void mime7to8 __P((MCI *, HDR *, ENVELOPE *));
-extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int));
-extern void xfclose __P((FILE *, char *, char *));
-extern int switch_map_find __P((char *, char *[], short []));
-extern void shorten_hostname __P((char []));
-extern int waitfor __P((pid_t));
-extern void proc_list_add __P((pid_t, char *));
-extern void proc_list_set __P((pid_t, char *));
-extern void proc_list_drop __P((pid_t));
-extern void proc_list_clear __P((void));
-extern void proc_list_display __P((FILE *));
-extern void proc_list_probe __P((void));
-extern void buffer_errors __P((void));
-extern void flush_errors __P((bool));
-extern void putline __P((char *, MCI *));
-extern bool xtextok __P((char *));
-extern char *xtextify __P((char *, char *));
-extern char *xuntextify __P((char *));
-extern void cleanstrcpy __P((char *, char *, int));
-extern int getmxrr __P((char *, char **, bool, int *));
-extern int strtorwset __P((char *, char **, int));
-extern void printav __P((char **));
-extern void printopenfds __P((bool));
+extern int smtpprobe __P((MCI *));
+extern void smtpquit __P((MAILER *, MCI *, ENVELOPE *));
+extern int smtprcpt __P((ADDRESS *, MAILER *, MCI *, ENVELOPE *));
+extern void smtprset __P((MAILER *, MCI *, ENVELOPE *));
+
+#define ISSMTPCODE(c) (isascii(c[0]) && isdigit(c[0]) && \
+ isascii(c[1]) && isdigit(c[1]) && \
+ isascii(c[2]) && isdigit(c[2]))
+#define ISSMTPREPLY(c) (ISSMTPCODE(c) && \
+ (c[3] == ' ' || c[3] == '-' || c[3] == '\0'))
+
+/* delivery */
+extern pid_t dowork __P((int, char *, bool, bool, ENVELOPE *));
extern int endmailer __P((MCI *, ENVELOPE *, char **));
-extern void fixcrlf __P((char *, bool));
-extern int dofork __P((void));
-extern void initsys __P((ENVELOPE *));
-extern void collect __P((FILE *, bool, HDR **, ENVELOPE *));
-extern void stripquotes __P((char *));
-extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
-extern void unlockqueue __P((ENVELOPE *));
-extern void xunlink __P((char *));
-extern bool runqueue __P((bool, bool));
-extern int getla __P((void));
+extern int mailfile __P((char *volatile, MAILER *volatile, ADDRESS *, volatile long, ENVELOPE *));
extern void sendall __P((ENVELOPE *, int));
-extern void queueup __P((ENVELOPE *, bool));
-extern void checkfds __P((char *));
-extern int returntosender __P((char *, ADDRESS *, int, ENVELOPE *));
+
+/* stats */
extern void markstats __P((ENVELOPE *, ADDRESS *, bool));
+extern void clearstats __P((void));
extern void poststats __P((char *));
+
+/* control socket */
+extern void closecontrolsocket __P((bool));
+extern void clrcontrol __P((void));
+extern void control_command __P((int, ENVELOPE *));
+extern int opencontrolsocket __P((void));
+
+#if _FFR_MILTER
+/* milter functions */
+extern void milter_parse_list __P((char *, struct milter **, int));
+extern void milter_setup __P((char *));
+extern void milter_set_option __P((char *, char *, bool));
+extern bool milter_can_delrcpts __P((void));
+extern void milter_init __P((ENVELOPE *, char *));
+extern void milter_quit __P((ENVELOPE *));
+extern void milter_abort __P((ENVELOPE *));
+extern char *milter_connect __P((char *, SOCKADDR, ENVELOPE *, char *));
+extern char *milter_helo __P((char *, ENVELOPE *, char *));
+extern char *milter_envfrom __P((char **, ENVELOPE *, char *));
+extern char *milter_envrcpt __P((char **, ENVELOPE *, char *));
+extern char *milter_data __P((ENVELOPE *, char *));
+#endif /* _FFR_MILTER */
+
+extern char *addquotes __P((char *));
extern char *arpadate __P((char *));
-extern int mailfile __P((char *volatile, MAILER *volatile, ADDRESS *, volatile int, ENVELOPE *));
-extern void loseqfile __P((ENVELOPE *, char *));
-extern int prog_open __P((char **, int *, ENVELOPE *));
-extern bool getcanonname __P((char *, int, bool));
-extern bool path_is_dir __P((char *, bool));
-extern pid_t dowork __P((char *, bool, bool, ENVELOPE *));
+extern bool atobool __P((char *));
+extern int atooct __P((char *));
+extern void auth_warning __P((ENVELOPE *, const char *, ...));
+extern int blocksignal __P((int));
+extern bool bitintersect __P((BITMAP256, BITMAP256));
+extern bool bitzerop __P((BITMAP256));
+extern void buildfname __P((char *, char *, char *, int));
+extern int checkcompat __P((ADDRESS *, ENVELOPE *));
+#ifdef XDEBUG
+extern void checkfd012 __P((char *));
+extern void checkfdopen __P((int, char *));
+#endif /* XDEBUG */
+extern void checkfds __P((char *));
+extern bool chownsafe __P((int, bool));
+extern void cleanstrcpy __P((char *, char *, int));
+extern void clrdaemon __P((void));
+extern void collect __P((FILE *, bool, HDR **, ENVELOPE *));
+extern time_t convtime __P((char *, int));
+extern char **copyplist __P((char **, bool));
+extern void copy_class __P((int, int));
+extern time_t curtime __P((void));
+extern char *defcharset __P((ENVELOPE *));
+extern char *denlstring __P((char *, bool, bool));
+extern void disconnect __P((int, ENVELOPE *));
+extern bool dns_getcanonname __P((char *, int, bool, int *));
+extern int dofork __P((void));
extern int drop_privileges __P((bool));
+extern int dsntoexitstat __P((char *));
+extern void dumpfd __P((int, bool, bool));
+extern void dumpstate __P((char *));
+extern bool enoughdiskspace __P((long, bool));
+extern char *exitstat __P((char *));
+extern char *fgetfolded __P((char *, int, FILE *));
extern void fill_fd __P((int, char *));
-extern void closecontrolsocket __P((bool));
-extern void clrcontrol __P((void));
-
-extern const char *errstring __P((int));
+extern char *find_character __P((char *, int));
+extern struct passwd *finduser __P((char *, bool *));
+extern void finis __P((bool, volatile int));
+extern void fixcrlf __P((char *, bool));
+extern long freediskspace __P((char *, long *));
+extern char *get_column __P((char *, int, int, char *, int));
+extern char *getauthinfo __P((int, bool *));
+extern char *getcfname __P((void));
+extern char *getextenv __P((const char *));
+extern int getdtsize __P((void));
+extern BITMAP256 *getrequests __P((ENVELOPE *));
+extern char *getvendor __P((int));
+extern void help __P((char *, ENVELOPE *));
+extern void init_md __P((int, char **));
+extern void initdaemon __P((void));
+extern void inithostmaps __P((void));
+extern void initmacros __P((ENVELOPE *));
+extern void initsetproctitle __P((int, char **, char **));
+extern void init_vendor_macros __P((ENVELOPE *));
+extern SIGFUNC_DECL intindebug __P((int));
+extern SIGFUNC_DECL intsig __P((int));
+extern bool isloopback __P((SOCKADDR sa));
+extern void load_if_names __P((void));
+extern bool lockfile __P((int, char *, char *, int));
+extern void log_sendmail_pid __P((ENVELOPE *));
+extern char lower __P((int));
+extern void makelower __P((char *));
+extern int makeconnection_ds __P((char *, MCI *));
+extern int makeconnection __P((char *, volatile u_int, MCI *, ENVELOPE *));
+extern char * munchstring __P((char *, char **, int));
+extern struct hostent *myhostname __P((char *, int));
+extern char *nisplus_default_domain __P((void)); /* extern for Sun */
+extern bool path_is_dir __P((char *, bool));
+extern char *pintvl __P((time_t, bool));
+extern void printav __P((char **));
+extern void printmailer __P((MAILER *));
+extern void printopenfds __P((bool));
+extern void printqueue __P((void));
+extern void printrules __P((void));
+extern int prog_open __P((char **, int *, ENVELOPE *));
+extern void putline __P((char *, MCI *));
+extern void putxline __P((char *, size_t, MCI *, int));
+extern void queueup_macros __P((int, FILE *, ENVELOPE *));
+extern SIGFUNC_DECL quiesce __P((int));
+extern void readcf __P((char *, bool, ENVELOPE *));
+extern SIGFUNC_DECL reapchild __P((int));
+extern bool refuseconnections __P((char *, ENVELOPE *, int));
+extern int releasesignal __P((int));
+extern void resetlimits __P((void));
+extern bool rfc822_string __P((char *));
+extern void savemail __P((ENVELOPE *, bool));
+extern void seed_random __P((void));
+extern void sendtoargv __P((char **, ENVELOPE *));
+extern void setclientoptions __P((char *));
+extern bool setdaemonoptions __P((char *));
+extern void setdefaults __P((ENVELOPE *));
+extern void setdefuser __P((void));
+extern bool setvendor __P((char *));
+extern void setoption __P((int, char *, bool, bool, ENVELOPE *));
extern sigfunc_t setsignal __P((int, sigfunc_t));
-extern int blocksignal __P((int));
-extern int releasesignal __P((int));
-extern struct hostent *sm_gethostbyname __P((char *));
+extern void setuserenv __P((const char *, const char *));
+extern void settime __P((ENVELOPE *));
+extern char *sfgets __P((char *, int, FILE *, time_t, char *));
+extern char *shortenstring __P((const char *, int));
+extern void shorten_hostname __P((char []));
+extern bool shorten_rfc822_string __P((char *, size_t));
+extern SIGFUNC_DECL sigusr1 __P((int));
+extern SIGFUNC_DECL sighup __P((int));
+extern void sm_dopr __P((char *, const char *, va_list));
+extern struct hostent *sm_gethostbyname __P((char *, int));
extern struct hostent *sm_gethostbyaddr __P((char *, int, int));
+extern int sm_getla __P((ENVELOPE *));
extern struct passwd *sm_getpwnam __P((char *));
extern struct passwd *sm_getpwuid __P((UID_T));
-extern struct passwd *finduser __P((char *, bool *));
-
-#ifdef XDEBUG
-extern void checkfdopen __P((int, char *));
-extern void checkfd012 __P((char *));
-#endif
-
-/* ellipsis is a different case though */
-extern void auth_warning __P((ENVELOPE *, const char *, ...));
-extern void syserr __P((const char *, ...));
-extern void usrerr __P((const char *, ...));
-extern void message __P((const char *, ...));
-extern void nmessage __P((const char *, ...));
-extern void setproctitle __P((const char *, ...));
-extern void sm_setproctitle __P((bool, const char *, ...));
-extern void sm_syslog __P((int, const char *, const char *, ...));
-
-#if !HASSNPRINTF
-extern int snprintf __P((char *, size_t, const char *, ...));
-extern int vsnprintf __P((char *, size_t, const char *, va_list));
-#endif
-extern char *quad_to_string __P((QUAD_T));
+extern void sm_setproctitle __P((bool, ENVELOPE *, const char *, ...));
+extern int sm_strcasecmp __P((const char *, const char *));
+extern bool strcontainedin __P((char *, char *));
+extern void stripquotes __P((char *));
+extern int switch_map_find __P((char *, char *[], short []));
+extern bool transienterror __P((int));
+extern void tTflag __P((char *));
+extern void tTsetup __P((u_char *, int, char *));
+extern SIGFUNC_DECL tick __P((int));
+extern char *ttypath __P((void));
+extern void unlockqueue __P((ENVELOPE *));
+#if !HASUNSETENV
+extern void unsetenv __P((char *));
+#endif /* !HASUNSETENV */
+extern char *username __P((void));
+extern bool usershellok __P((char *, char *));
+extern void vendor_post_defaults __P((ENVELOPE *));
+extern void vendor_pre_defaults __P((ENVELOPE *));
+extern int waitfor __P((pid_t));
+extern bool writable __P((char *, ADDRESS *, long));
+extern char *xalloc __P((int));
+extern void xputs __P((const char *));
+extern char *xtextify __P((char *, char *));
+extern bool xtextok __P((char *));
+extern void xunlink __P((char *));
+extern char *xuntextify __P((char *));
+#endif /* _SENDMAIL_H */
OpenPOWER on IntegriCloud