summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/include
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2002-02-17 21:56:45 +0000
committergshapiro <gshapiro@FreeBSD.org>2002-02-17 21:56:45 +0000
commit8449595fe97f4474b9b9a7e4edee1ef35dcff393 (patch)
treee7a33b132264d449a512ddf4a8685df097669c1d /contrib/sendmail/include
parent289b381b31415647269c7520d881017e2dcb27f1 (diff)
downloadFreeBSD-src-8449595fe97f4474b9b9a7e4edee1ef35dcff393.zip
FreeBSD-src-8449595fe97f4474b9b9a7e4edee1ef35dcff393.tar.gz
Import sendmail 8.12.2
Diffstat (limited to 'contrib/sendmail/include')
-rw-r--r--contrib/sendmail/include/libmilter/mfapi.h82
-rw-r--r--contrib/sendmail/include/libmilter/mfdef.h84
-rw-r--r--contrib/sendmail/include/libmilter/milter.h60
-rw-r--r--contrib/sendmail/include/libsmdb/smdb.h135
-rw-r--r--contrib/sendmail/include/sendmail/mailstats.h11
-rw-r--r--contrib/sendmail/include/sendmail/pathnames.h64
-rw-r--r--contrib/sendmail/include/sendmail/sendmail.h103
-rw-r--r--contrib/sendmail/include/sm/assert.h113
-rw-r--r--contrib/sendmail/include/sm/bitops.h57
-rw-r--r--contrib/sendmail/include/sm/cdefs.h142
-rw-r--r--contrib/sendmail/include/sm/cf.h29
-rw-r--r--contrib/sendmail/include/sm/clock.h81
-rw-r--r--contrib/sendmail/include/sm/conf.h2803
-rw-r--r--contrib/sendmail/include/sm/config.h146
-rw-r--r--contrib/sendmail/include/sm/debug.h141
-rw-r--r--contrib/sendmail/include/sm/errstring.h79
-rw-r--r--contrib/sendmail/include/sm/exc.h186
-rw-r--r--contrib/sendmail/include/sm/fdset.h19
-rw-r--r--contrib/sendmail/include/sm/gen.h79
-rw-r--r--contrib/sendmail/include/sm/heap.h101
-rw-r--r--contrib/sendmail/include/sm/io.h382
-rw-r--r--contrib/sendmail/include/sm/ldap.h112
-rw-r--r--contrib/sendmail/include/sm/limits.h55
-rw-r--r--contrib/sendmail/include/sm/mbdb.h43
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_aix.h35
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_freebsd.h41
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_hp.h34
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_irix.h55
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_linux.h42
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_mpeix.h34
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_next.h29
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_openbsd.h30
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_openunix.h25
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_osf1.h18
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_sunos.h70
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_ultrix.h18
-rw-r--r--contrib/sendmail/include/sm/os/sm_os_unixware.h32
-rw-r--r--contrib/sendmail/include/sm/path.h32
-rw-r--r--contrib/sendmail/include/sm/rpool.h185
-rw-r--r--contrib/sendmail/include/sm/setjmp.h46
-rw-r--r--contrib/sendmail/include/sm/shm.h42
-rw-r--r--contrib/sendmail/include/sm/signal.h81
-rw-r--r--contrib/sendmail/include/sm/string.h135
-rw-r--r--contrib/sendmail/include/sm/sysexits.h109
-rw-r--r--contrib/sendmail/include/sm/test.h46
-rw-r--r--contrib/sendmail/include/sm/types.h65
-rw-r--r--contrib/sendmail/include/sm/varargs.h45
-rw-r--r--contrib/sendmail/include/sm/xtrap.h38
48 files changed, 6137 insertions, 257 deletions
diff --git a/contrib/sendmail/include/libmilter/mfapi.h b/contrib/sendmail/include/libmilter/mfapi.h
index 2a64da7..506fcf3 100644
--- a/contrib/sendmail/include/libmilter/mfapi.h
+++ b/contrib/sendmail/include/libmilter/mfapi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -7,7 +7,7 @@
* the sendmail distribution.
*
*
- * $Id: mfapi.h,v 8.13.4.12 2000/09/09 02:11:48 ca Exp $
+ * $Id: mfapi.h,v 8.35 2001/10/09 19:05:24 gshapiro Exp $
*/
/*
@@ -17,13 +17,14 @@
#ifndef _LIBMILTER_MFAPI_H
# define _LIBMILTER_MFAPI_H 1
-# define LIBMILTER_API extern
+# include <sys/socket.h>
+# include "libmilter/mfdef.h"
+# define LIBMILTER_API extern
# include <sys/types.h>
#ifndef _SOCK_ADDR
-# include <sys/socket.h>
# define _SOCK_ADDR struct sockaddr
#endif /* ! _SOCK_ADDR */
@@ -42,24 +43,6 @@ typedef struct smfi_str *SMFICTX_PTR;
typedef struct smfiDesc smfiDesc_str;
typedef struct smfiDesc *smfiDesc_ptr;
-#define SMFI_VERSION 2 /* version number */
-
-/*
-** What the filter might do -- values to be ORed together for
-** smfiDesc.xxfi_flags.
-*/
-
-#define SMFIF_ADDHDRS 0x00000001L /* filter may add headers */
-#define SMFIF_CHGBODY 0x00000002L /* filter may replace body */
-#define SMFIF_MODBODY SMFIF_CHGBODY /* backwards compatible */
-#define SMFIF_ADDRCPT 0x00000004L /* filter may add recipients */
-#define SMFIF_DELRCPT 0x00000008L /* filter may delete recipients */
-#define SMFIF_CHGHDRS 0x00000010L /* filter may change/delete headers */
-
-#define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */
-#define SMFI_V2_ACTS 0x0000001FL /* The actions of V2 filter */
-#define SMFI_CURR_ACTS SMFI_V2_ACTS /* The current version */
-
/*
** Type which callbacks should return to indicate message status.
** This may take on one of the SMFIS_* values listed below.
@@ -67,10 +50,6 @@ typedef struct smfiDesc *smfiDesc_ptr;
typedef int sfsistat;
-/*
-** structure describing one milter
-*/
-
#if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8
# define SM__P(X) __PMT(X)
#else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */
@@ -86,11 +65,15 @@ typedef int sfsistat;
# endif /* __STDC__ */
#endif /* __P */
+/*
+** structure describing one milter
+*/
+
struct smfiDesc
{
char *xxfi_name; /* filter name */
int xxfi_version; /* version code -- do not change */
- u_long xxfi_flags; /* flags */
+ unsigned long xxfi_flags; /* flags */
/* connection info filter */
sfsistat (*xxfi_connect) SM__P((SMFICTX *, char *, _SOCK_ADDR *));
@@ -111,7 +94,7 @@ struct smfiDesc
sfsistat (*xxfi_eoh) SM__P((SMFICTX *));
/* body block */
- sfsistat (*xxfi_body) SM__P((SMFICTX *, u_char *, size_t));
+ sfsistat (*xxfi_body) SM__P((SMFICTX *, unsigned char *, size_t));
/* end of message */
sfsistat (*xxfi_eom) SM__P((SMFICTX *));
@@ -130,6 +113,24 @@ LIBMILTER_API int smfi_settimeout __P((int));
LIBMILTER_API int smfi_setconn __P((char *));
LIBMILTER_API int smfi_stop __P((void));
+#define SMFI_VERSION 2 /* version number */
+
+/*
+** What the filter might do -- values to be ORed together for
+** smfiDesc.xxfi_flags.
+*/
+
+#define SMFIF_NONE 0x00000000L /* no flags */
+#define SMFIF_ADDHDRS 0x00000001L /* filter may add headers */
+#define SMFIF_CHGBODY 0x00000002L /* filter may replace body */
+#define SMFIF_MODBODY SMFIF_CHGBODY /* backwards compatible */
+#define SMFIF_ADDRCPT 0x00000004L /* filter may add recipients */
+#define SMFIF_DELRCPT 0x00000008L /* filter may delete recipients */
+#define SMFIF_CHGHDRS 0x00000010L /* filter may change/delete headers */
+#if _FFR_QUARANTINE
+# define SMFIF_QUARANTINE 0x00000020L /* filter may quarantine envelope */
+#endif /* _FFR_QUARANTINE */
+
/*
** Continue processing message/connection.
*/
@@ -244,14 +245,14 @@ extern sfsistat xxfi_eoh __P((SMFICTX *));
*/
/* body block */
-extern sfsistat xxfi_body __P((SMFICTX *, u_char *, size_t));
+extern sfsistat xxfi_body __P((SMFICTX *, unsigned char *, size_t));
/*
** xxfi_body(ctx, bodyp, bodylen) Invoked for each body chunk. There may
** be multiple body chunks passed to the filter. End-of-lines are
** represented as received from SMTP (normally Carriage-Return/Line-Feed).
**
-** u_char *bodyp; Pointer to body data
+** unsigned char *bodyp; Pointer to body data
** size_t bodylen; Length of body data
*/
@@ -305,6 +306,15 @@ LIBMILTER_API char * smfi_getsymval __P((SMFICTX *, char *));
LIBMILTER_API int smfi_setreply __P((SMFICTX *, char *, char *, char *));
+#if _FFR_MULTILINE
+/*
+** Alternatively, smfi_setmlreply can be called if a multi-line SMTP reply
+** is needed.
+*/
+
+LIBMILTER_API int smfi_setmlreply __P((SMFICTX *, const char *, const char *, ...));
+#endif /* _FFR_MULTILINE */
+
/*
** Set the specific reply code to be used in response to the active
** command. If not specified, a generic reply code is used.
@@ -370,7 +380,7 @@ LIBMILTER_API int smfi_delrcpt __P((SMFICTX *, char *));
** not be deleted.
*/
-LIBMILTER_API int smfi_replacebody __P((SMFICTX *, u_char *, int));
+LIBMILTER_API int smfi_replacebody __P((SMFICTX *, unsigned char *, int));
/*
** Replace the body of the message. This routine may be called multiple
@@ -387,6 +397,16 @@ LIBMILTER_API int smfi_replacebody __P((SMFICTX *, u_char *, int));
** xxfi_abort is called. This can be used to reset state.
*/
+#if _FFR_QUARANTINE
+/*
+** Quarantine an envelope
+**
+** SMFICTX *ctx; Opaque context structure
+** char *reason: explanation
+*/
+
+LIBMILTER_API int smfi_quarantine __P((SMFICTX *ctx, char *reason));
+#endif /* _FFR_QUARANTINE */
/*
** Connection-private data (specific to an SMTP connection) can be
diff --git a/contrib/sendmail/include/libmilter/mfdef.h b/contrib/sendmail/include/libmilter/mfdef.h
new file mode 100644
index 0000000..649e98d
--- /dev/null
+++ b/contrib/sendmail/include/libmilter/mfdef.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ *
+ * $Id: mfdef.h,v 8.11 2001/09/12 18:02:19 gshapiro Exp $
+ */
+
+/*
+** mfdef.h -- Global definitions for mail filter and MTA.
+*/
+
+#ifndef _LIBMILTER_MFDEF_H
+# define _LIBMILTER_MFDEF_H 1
+
+/* Shared protocol constants */
+# define MILTER_LEN_BYTES 4 /* length of 32 bit integer in bytes */
+# define MILTER_OPTLEN (MILTER_LEN_BYTES * 3) /* length of options */
+# define MILTER_CHUNK_SIZE 65535 /* body chunk size */
+
+/* These apply to SMFIF_* flags */
+#define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */
+#if _FFR_QUARANTINE
+# define SMFI_V2_ACTS 0x0000003FL /* The actions of V2 filter */
+#else /* _FFR_QUARANTINE */
+# define SMFI_V2_ACTS 0x0000001FL /* The actions of V2 filter */
+#endif /* _FFR_QUARANTINE */
+#define SMFI_CURR_ACTS SMFI_V2_ACTS /* The current version */
+
+/* address families */
+# define SMFIA_UNKNOWN 'U' /* unknown */
+# define SMFIA_UNIX 'L' /* unix/local */
+# define SMFIA_INET '4' /* inet */
+# define SMFIA_INET6 '6' /* inet6 */
+
+/* commands: don't use anything smaller than ' ' */
+# define SMFIC_ABORT 'A' /* Abort */
+# define SMFIC_BODY 'B' /* Body chunk */
+# define SMFIC_CONNECT 'C' /* Connection information */
+# define SMFIC_MACRO 'D' /* Define macro */
+# define SMFIC_BODYEOB 'E' /* final body chunk (End) */
+# define SMFIC_HELO 'H' /* HELO/EHLO */
+# define SMFIC_HEADER 'L' /* Header */
+# define SMFIC_MAIL 'M' /* MAIL from */
+# define SMFIC_EOH 'N' /* EOH */
+# define SMFIC_OPTNEG 'O' /* Option negotiation */
+# define SMFIC_QUIT 'Q' /* QUIT */
+# define SMFIC_RCPT 'R' /* RCPT to */
+
+/* actions (replies) */
+# define SMFIR_ADDRCPT '+' /* add recipient */
+# define SMFIR_DELRCPT '-' /* remove recipient */
+# define SMFIR_ACCEPT 'a' /* accept */
+# define SMFIR_REPLBODY 'b' /* replace body (chunk) */
+# define SMFIR_CONTINUE 'c' /* continue */
+# define SMFIR_DISCARD 'd' /* discard */
+# define SMFIR_CHGHEADER 'm' /* change header */
+# define SMFIR_PROGRESS 'p' /* progress */
+# define SMFIR_REJECT 'r' /* reject */
+# define SMFIR_TEMPFAIL 't' /* tempfail */
+# define SMFIR_ADDHEADER 'h' /* add header */
+# define SMFIR_REPLYCODE 'y' /* reply code etc */
+# if _FFR_QUARANTINE
+# define SMFIR_QUARANTINE 'q' /* quarantine */
+# endif /* _FFR_QUARANTINE */
+
+/* What the MTA can send/filter wants in protocol */
+# define SMFIP_NOCONNECT 0x00000001L /* MTA should not send connect info */
+# define SMFIP_NOHELO 0x00000002L /* MTA should not send HELO info */
+# define SMFIP_NOMAIL 0x00000004L /* MTA should not send MAIL info */
+# define SMFIP_NORCPT 0x00000008L /* MTA should not send RCPT info */
+# define SMFIP_NOBODY 0x00000010L /* MTA should not send body */
+# define SMFIP_NOHDRS 0x00000020L /* MTA should not send headers */
+# define SMFIP_NOEOH 0x00000040L /* MTA should not send EOH */
+
+# define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */
+# define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */
+# define SMFI_CURR_PROT SMFI_V2_PROT /* The current version */
+
+#endif /* !_LIBMILTER_MFDEF_H */
diff --git a/contrib/sendmail/include/libmilter/milter.h b/contrib/sendmail/include/libmilter/milter.h
index ef54852..b714c3e 100644
--- a/contrib/sendmail/include/libmilter/milter.h
+++ b/contrib/sendmail/include/libmilter/milter.h
@@ -7,70 +7,18 @@
* the sendmail distribution.
*
*
- * $Id: milter.h,v 8.24.16.10 2001/07/20 04:19:35 gshapiro Exp $
+ * $Id: milter.h,v 8.35 2001/06/27 21:46:44 gshapiro Exp $
*/
/*
-** MILTER.H -- Global definitions for mail filter and MTA.
+** MILTER.H -- Global definitions for mail filter.
*/
#ifndef _LIBMILTER_MILTER_H
# define _LIBMILTER_MILTER_H 1
-#include "libmilter/mfapi.h"
#include "sendmail.h"
-
-/* Shared protocol constants */
-# define MILTER_LEN_BYTES 4 /* length of 32 bit integer in bytes */
-# define MILTER_OPTLEN (MILTER_LEN_BYTES * 3) /* length of options */
-# define MILTER_CHUNK_SIZE 65535 /* body chunk size */
-
-/* address families */
-# define SMFIA_UNKNOWN 'U' /* unknown */
-# define SMFIA_UNIX 'L' /* unix/local */
-# define SMFIA_INET '4' /* inet */
-# define SMFIA_INET6 '6' /* inet6 */
-
-/* commands: don't use anything smaller than ' ' */
-# define SMFIC_ABORT 'A' /* Abort */
-# define SMFIC_BODY 'B' /* Body chunk */
-# define SMFIC_CONNECT 'C' /* Connection information */
-# define SMFIC_MACRO 'D' /* Define macro */
-# define SMFIC_BODYEOB 'E' /* final body chunk (End) */
-# define SMFIC_HELO 'H' /* HELO/EHLO */
-# define SMFIC_HEADER 'L' /* Header */
-# define SMFIC_MAIL 'M' /* MAIL from */
-# define SMFIC_EOH 'N' /* EOH */
-# define SMFIC_OPTNEG 'O' /* Option negotiation */
-# define SMFIC_QUIT 'Q' /* QUIT */
-# define SMFIC_RCPT 'R' /* RCPT to */
-
-/* actions (replies) */
-# define SMFIR_ADDRCPT '+' /* add recipient */
-# define SMFIR_DELRCPT '-' /* remove recipient */
-# define SMFIR_ACCEPT 'a' /* accept */
-# define SMFIR_REPLBODY 'b' /* replace body (chunk) */
-# define SMFIR_CONTINUE 'c' /* continue */
-# define SMFIR_DISCARD 'd' /* discard */
-# define SMFIR_CHGHEADER 'm' /* change header */
-# define SMFIR_PROGRESS 'p' /* progress */
-# define SMFIR_REJECT 'r' /* reject */
-# define SMFIR_TEMPFAIL 't' /* tempfail */
-# define SMFIR_ADDHEADER 'h' /* add header */
-# define SMFIR_REPLYCODE 'y' /* reply code etc */
-
-/* What the MTA can send/filter wants in protocol */
-# define SMFIP_NOCONNECT 0x00000001L /* MTA should not send connect info */
-# define SMFIP_NOHELO 0x00000002L /* MTA should not send HELO info */
-# define SMFIP_NOMAIL 0x00000004L /* MTA should not send MAIL info */
-# define SMFIP_NORCPT 0x00000008L /* MTA should not send RCPT info */
-# define SMFIP_NOBODY 0x00000010L /* MTA should not send body */
-# define SMFIP_NOHDRS 0x00000020L /* MTA should not send headers */
-# define SMFIP_NOEOH 0x00000040L /* MTA should not send EOH */
-
-# define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */
-# define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */
-# define SMFI_CURR_PROT SMFI_V2_PROT /* The current version */
+#include "libmilter/mfapi.h"
/* socket and thread portability */
# include <pthread.h>
@@ -97,7 +45,7 @@ struct smfi_str
time_t ctx_timeout; /* timeout */
int ctx_state; /* state */
smfiDesc_ptr ctx_smfi; /* filter description */
- u_long ctx_pflags; /* protocol flags */
+ unsigned long ctx_pflags; /* protocol flags */
char **ctx_mac_ptr[MAX_MACROS_ENTRIES];
char *ctx_mac_buf[MAX_MACROS_ENTRIES];
char *ctx_reply; /* reply code */
diff --git a/contrib/sendmail/include/libsmdb/smdb.h b/contrib/sendmail/include/libsmdb/smdb.h
index db7fe8f..2315e32 100644
--- a/contrib/sendmail/include/libsmdb/smdb.h
+++ b/contrib/sendmail/include/libsmdb/smdb.h
@@ -1,28 +1,22 @@
/*
-** Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
-** All rights reserved.
-**
-** 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.
-**
-** $Id: smdb.h,v 8.29.2.1.2.2 2000/10/05 22:23:55 gshapiro Exp $
-*/
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: smdb.h,v 8.38 2001/11/19 19:30:03 gshapiro Exp $
+ *
+ */
#ifndef _SMDB_H_
# define _SMDB_H_
# include <sys/types.h>
# include <sys/stat.h>
-# ifndef __P
-# include "sendmail/cdefs.h"
-# endif /* __P */
-
-# ifndef NDBM
-# ifndef NEWDB
-ERROR NDBM or NEWDB must be defined.
-# endif /* ! NEWDB */
-# endif /* ! NDBM */
+# include <sm/gen.h>
+# include <sm/errstring.h>
# ifdef NDBM
# include <ndbm.h>
@@ -36,28 +30,28 @@ ERROR NDBM or NEWDB must be defined.
# endif /* NEWDB */
/*
-** Some size constants
+** Some size constants
*/
+
#define SMDB_MAX_USER_NAME_LEN 1024
#define SMDB_MAX_NAME_LEN 1024
/*
-** This file defines the abstraction for database lookups. It is pretty
-** much a copy of the db2 interface with the exception that every function
-** returns 0 on success and non-zero on failure. The non-zero return code
-** is meaningful.
+** This file defines the abstraction for database lookups. It is pretty
+** much a copy of the db2 interface with the exception that every function
+** returns 0 on success and non-zero on failure. The non-zero return code
+** is meaningful.
**
-** I'm going to put the function comments in this file since the interface
-** MUST be the same for all inheritors of this interface.
+** I'm going to put the function comments in this file since the interface
+** MUST be the same for all inheritors of this interface.
*/
typedef struct database_struct SMDB_DATABASE;
typedef struct cursor_struct SMDB_CURSOR;
typedef struct entry_struct SMDB_DBENT;
-
/*
-** DB_CLOSE_FUNC -- close the database
+** DB_CLOSE_FUNC -- close the database
**
** Parameters:
** db -- The database to close.
@@ -66,12 +60,11 @@ typedef struct entry_struct SMDB_DBENT;
** 0 - Success, otherwise errno.
**
*/
-typedef int (*db_close_func) __P((SMDB_DATABASE *db));
+typedef int (*db_close_func) __P((SMDB_DATABASE *db));
-
/*
-** DB_DEL_FUNC -- removes a key and data pair from the database
+** DB_DEL_FUNC -- removes a key and data pair from the database
**
** Parameters:
** db -- The database to close.
@@ -83,13 +76,12 @@ typedef int (*db_close_func) __P((SMDB_DATABASE *db));
** 0 - Success, otherwise errno.
**
*/
-typedef int (*db_del_func) __P((SMDB_DATABASE *db,
- SMDB_DBENT *key, u_int flags));
+typedef int (*db_del_func) __P((SMDB_DATABASE *db,
+ SMDB_DBENT *key, unsigned int flags));
-
/*
-** DB_FD_FUNC -- Returns a pointer to a file used for the database.
+** DB_FD_FUNC -- Returns a pointer to a file used for the database.
**
** Parameters:
** db -- The database to close.
@@ -99,12 +91,11 @@ typedef int (*db_del_func) __P((SMDB_DATABASE *db,
** 0 - Success, otherwise errno.
**
*/
-typedef int (*db_fd_func) __P((SMDB_DATABASE *db, int* fd));
+typedef int (*db_fd_func) __P((SMDB_DATABASE *db, int* fd));
-
/*
-** DB_GET_FUNC -- Gets the data associated with a key.
+** DB_GET_FUNC -- Gets the data associated with a key.
**
** Parameters:
** db -- The database to close.
@@ -117,14 +108,13 @@ typedef int (*db_fd_func) __P((SMDB_DATABASE *db, int* fd));
** 0 - Success, otherwise errno.
**
*/
+
typedef int (*db_get_func) __P((SMDB_DATABASE *db,
SMDB_DBENT *key,
- SMDB_DBENT *data, u_int flags));
-
+ SMDB_DBENT *data, unsigned int flags));
-
/*
-** DB_PUT_FUNC -- Sets some data according to the key.
+** DB_PUT_FUNC -- Sets some data according to the key.
**
** Parameters:
** db -- The database to close.
@@ -139,13 +129,13 @@ typedef int (*db_get_func) __P((SMDB_DATABASE *db,
** 0 - Success, otherwise errno.
**
*/
+
typedef int (*db_put_func) __P((SMDB_DATABASE *db,
SMDB_DBENT *key,
- SMDB_DBENT *data, u_int flags));
+ SMDB_DBENT *data, unsigned int flags));
-
/*
-** DB_SYNC_FUNC -- Flush any cached information to disk.
+** DB_SYNC_FUNC -- Flush any cached information to disk.
**
** Parameters:
** db -- The database to sync.
@@ -155,11 +145,11 @@ typedef int (*db_put_func) __P((SMDB_DATABASE *db,
** 0 - Success, otherwise errno.
**
*/
-typedef int (*db_sync_func) __P((SMDB_DATABASE *db, u_int flags));
-
+typedef int (*db_sync_func) __P((SMDB_DATABASE *db, unsigned int flags));
+
/*
-** DB_SET_OWNER_FUNC -- Set the owner and group of the database files.
+** DB_SET_OWNER_FUNC -- Set the owner and group of the database files.
**
** Parameters:
** db -- The database to set.
@@ -170,12 +160,11 @@ typedef int (*db_sync_func) __P((SMDB_DATABASE *db, u_int flags));
** 0 - Success, otherwise errno.
**
*/
-typedef int (*db_set_owner_func) __P((SMDB_DATABASE *db, uid_t uid,
- gid_t gid));
-
+typedef int (*db_set_owner_func) __P((SMDB_DATABASE *db, uid_t uid, gid_t gid));
+
/*
-** DB_CURSOR -- Obtain a cursor for sequential access
+** DB_CURSOR -- Obtain a cursor for sequential access
**
** Parameters:
** db -- The database to use.
@@ -186,8 +175,9 @@ typedef int (*db_set_owner_func) __P((SMDB_DATABASE *db, uid_t uid,
** 0 - Success, otherwise errno.
**
*/
+
typedef int (*db_cursor_func) __P((SMDB_DATABASE *db,
- SMDB_CURSOR **cursor, u_int flags));
+ SMDB_CURSOR **cursor, unsigned int flags));
typedef int (*db_lockfd_func) __P((SMDB_DATABASE *db));
@@ -204,11 +194,8 @@ struct database_struct
db_lockfd_func smdb_lockfd;
void *smdb_impl;
};
-
-
-
/*
-** DB_CURSOR_CLOSE -- Close a cursor
+** DB_CURSOR_CLOSE -- Close a cursor
**
** Parameters:
** cursor -- The cursor to close.
@@ -217,11 +204,11 @@ struct database_struct
** 0 - Success, otherwise errno.
**
*/
+
typedef int (*db_cursor_close_func) __P((SMDB_CURSOR *cursor));
-
/*
-** DB_CURSOR_DEL -- Delete the key/value pair of this cursor
+** DB_CURSOR_DEL -- Delete the key/value pair of this cursor
**
** Parameters:
** cursor -- The cursor.
@@ -231,11 +218,12 @@ typedef int (*db_cursor_close_func) __P((SMDB_CURSOR *cursor));
** 0 - Success, otherwise errno.
**
*/
-typedef int (*db_cursor_del_func) __P((SMDB_CURSOR *cursor, u_int flags));
-
+typedef int (*db_cursor_del_func) __P((SMDB_CURSOR *cursor,
+ unsigned int flags));
+
/*
-** DB_CURSOR_GET -- Get the key/value of this cursor.
+** DB_CURSOR_GET -- Get the key/value of this cursor.
**
** Parameters:
** cursor -- The cursor.
@@ -250,22 +238,23 @@ typedef int (*db_cursor_del_func) __P((SMDB_CURSOR *cursor, u_int flags));
** database is hit.
**
*/
+
typedef int (*db_cursor_get_func) __P((SMDB_CURSOR *cursor,
SMDB_DBENT *key,
SMDB_DBENT *data,
- u_int flags));
+ unsigned int flags));
/*
-** Flags for DB_CURSOR_GET
+** Flags for DB_CURSOR_GET
*/
+
#define SMDB_CURSOR_GET_FIRST 0
#define SMDB_CURSOR_GET_LAST 1
#define SMDB_CURSOR_GET_NEXT 2
#define SMDB_CURSOR_GET_RANGE 3
-
/*
-** DB_CURSOR_PUT -- Put the key/value at this cursor.
+** DB_CURSOR_PUT -- Put the key/value at this cursor.
**
** Parameters:
** cursor -- The cursor.
@@ -277,10 +266,11 @@ typedef int (*db_cursor_get_func) __P((SMDB_CURSOR *cursor,
** 0 - Success, otherwise errno.
**
*/
+
typedef int (*db_cursor_put_func) __P((SMDB_CURSOR *cursor,
SMDB_DBENT *key,
SMDB_DBENT *data,
- u_int flags));
+ unsigned int flags));
@@ -296,9 +286,9 @@ struct cursor_struct
struct database_params_struct
{
- u_int smdbp_num_elements;
- u_int smdbp_cache_size;
- bool smdbp_allow_dup;
+ unsigned int smdbp_num_elements;
+ unsigned int smdbp_cache_size;
+ bool smdbp_allow_dup;
};
typedef struct database_params_struct SMDB_DBPARAMS;
@@ -319,10 +309,10 @@ struct entry_struct
};
typedef char *SMDB_DBTYPE;
-typedef u_int SMDB_FLAG;
+typedef unsigned int SMDB_FLAG;
/*
-** These are types of databases.
+** These are types of databases.
*/
# define SMDB_TYPE_DEFAULT NULL
@@ -335,8 +325,9 @@ typedef u_int SMDB_FLAG;
# define SMDB_TYPE_NDBM_LEN 4
/*
-** These are flags
+** These are flags
*/
+
/* Flags for put */
# define SMDBF_NO_OVERWRITE 0x00000001
# define SMDBF_ALLOW_DUP 0x00000002
diff --git a/contrib/sendmail/include/sendmail/mailstats.h b/contrib/sendmail/include/sendmail/mailstats.h
index 830061d..9a8a635 100644
--- a/contrib/sendmail/include/sendmail/mailstats.h
+++ b/contrib/sendmail/include/sendmail/mailstats.h
@@ -10,10 +10,14 @@
* the sendmail distribution.
*
*
- * $Id: mailstats.h,v 8.13 1999/05/22 02:29:10 ca Exp $
+ * $Id: mailstats.h,v 8.18 2001/11/21 13:39:10 gshapiro Exp $
*/
-#define STAT_VERSION 3
+#if _FFR_QUARANTINE
+# define STAT_VERSION 4
+#else /* _FFR_QUARANTINE */
+# define STAT_VERSION 3
+#endif /* _FFR_QUARANTINE */
#define STAT_MAGIC 0x1B1DE
/*
@@ -35,4 +39,7 @@ struct statistics
long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
long stat_nr[MAXMAILERS]; /* # rejects by each mailer */
long stat_nd[MAXMAILERS]; /* # discards by each mailer */
+#if _FFR_QUARANTINE
+ long stat_nq[MAXMAILERS]; /* # quarantines by each mailer */
+#endif /* _FFR_QUARANTINE */
};
diff --git a/contrib/sendmail/include/sendmail/pathnames.h b/contrib/sendmail/include/sendmail/pathnames.h
index 9f99f6c..54efd32 100644
--- a/contrib/sendmail/include/sendmail/pathnames.h
+++ b/contrib/sendmail/include/sendmail/pathnames.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -9,28 +9,54 @@
* the sendmail distribution.
*
*
- * $Id: pathnames.h,v 8.16.8.8 2000/09/28 21:26:39 gshapiro Exp $
+ * $Id: pathnames.h,v 8.35 2001/03/23 22:09:44 ca Exp $
*/
+#ifndef SM_PATHNAMES_H
+# define SM_PATHNAMES_H
-# ifndef _PATH_SENDMAILCF
-# if defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF)
-# define _PATH_SENDMAILCF _PATH_VENDOR_CF
-# else /* defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF) */
-# define _PATH_SENDMAILCF "/etc/mail/sendmail.cf"
-# endif /* defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF) */
-# endif /* ! _PATH_SENDMAILCF */
-# ifndef _PATH_SENDMAILPID
-# ifdef BSD4_4
-# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
-# else /* BSD4_4 */
-# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
-# endif /* BSD4_4 */
-# endif /* ! _PATH_SENDMAILPID */
+# ifndef _PATH_SENDMAILCF
+# if defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF)
+# define _PATH_SENDMAILCF _PATH_VENDOR_CF
+# else /* defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF) */
+# define _PATH_SENDMAILCF "/etc/mail/sendmail.cf"
+# endif /* defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF) */
+# endif /* ! _PATH_SENDMAILCF */
-# ifndef _PATH_HOSTS
-# define _PATH_HOSTS "/etc/hosts"
-# endif /* ! _PATH_HOSTS */
+# ifndef _PATH_SENDMAILPID
+# ifdef BSD4_4
+# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
+# else /* BSD4_4 */
+# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
+# endif /* BSD4_4 */
+# endif /* ! _PATH_SENDMAILPID */
+# ifndef _PATH_SENDMAIL
+# define _PATH_SENDMAIL "/usr/lib/sendmail"
+# endif /* ! _PATH_SENDMAIL */
+# ifndef _PATH_MAILDIR
+# define _PATH_MAILDIR "/var/spool/mail"
+# endif /* ! _PATH_MAILDIR */
+
+# ifndef _PATH_LOCTMP
+# define _PATH_LOCTMP "/tmp/local.XXXXXX"
+# endif /* ! _PATH_LOCTMP */
+
+# ifndef _PATH_HOSTS
+# define _PATH_HOSTS "/etc/hosts"
+# endif /* ! _PATH_HOSTS */
+
+
+
+# ifndef _DIR_SENDMAILCF
+# define _DIR_SENDMAILCF "/etc/mail/"
+# endif /* ! _DIR_SENDMAILCF */
+
+# define SM_GET_RIGHT_CF 0 /* get "right" .cf */
+# define SM_GET_SENDMAIL_CF 1 /* always use sendmail.cf */
+# define SM_GET_SUBMIT_CF 2 /* always use submit.cf */
+
+extern char *getcfname __P((int, int, int, char *));
+#endif /* ! SM_PATHNAMES_H */
diff --git a/contrib/sendmail/include/sendmail/sendmail.h b/contrib/sendmail/include/sendmail/sendmail.h
index 395b895..bbd3177 100644
--- a/contrib/sendmail/include/sendmail/sendmail.h
+++ b/contrib/sendmail/include/sendmail/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -10,23 +10,18 @@
* the sendmail distribution.
*
*
- * $Id: sendmail.h,v 8.34.4.8 2001/06/01 05:06:51 gshapiro Exp $
+ * $Id: sendmail.h,v 8.67 2001/09/08 01:20:57 gshapiro Exp $
*/
/*
** SENDMAIL.H -- Global definitions for sendmail.
*/
-#if SFIO
-# include <sfio/stdio.h>
-#else /* SFIO */
-# include <stdio.h>
-#endif /* SFIO */
-#include <string.h>
+#include <stdio.h>
+#include <sm/bitops.h>
+#include <sm/io.h>
+#include <sm/string.h>
#include "conf.h"
-#include "sendmail/errstring.h"
-#include "sendmail/useful.h"
-
/**********************************************************************
** Table sizes, etc....
@@ -37,45 +32,6 @@
#endif /* ! MAXMAILERS */
/*
-** 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.
-*/
-
-#define BITMAPBITS 256 /* number of bits in a bit map */
-#define BYTEBITS 8 /* number of bits in a byte */
-#define BITMAPBYTES (BITMAPBITS / BYTEBITS) /* number of bytes in bit map */
-
-/* internal macros */
-#define _BITWORD(bit) ((bit) / (BYTEBITS * sizeof (int)))
-#define _BITBIT(bit) ((unsigned int)1 << ((bit) % (BYTEBITS * sizeof (int))))
-
-typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)];
-
-/* properly case and truncate bit */
-#define bitidx(bit) ((unsigned int) (bit) & 0xff)
-
-/* 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) memset((char *) map, '\0', BITMAPBYTES)
-
-
-/*
-** Utility macros
-*/
-
-/* return number of bytes left in a buffer */
-#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
-/*
** Flags passed to safefile/safedirpath.
*/
@@ -85,7 +41,7 @@ typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)];
#define SFF_ROOTOK 0x00000004L /* ok for root to own this file */
#define SFF_RUNASREALUID 0x00000008L /* if no ctladdr, run as real uid */
#define SFF_NOPATHCHECK 0x00000010L /* don't bother checking dir path */
-#define SFF_SETUIDOK 0x00000020L /* setuid files are ok */
+#define SFF_SETUIDOK 0x00000020L /* set-user-ID files are ok */
#define SFF_CREAT 0x00000040L /* ok to create file if necessary */
#define SFF_REGONLY 0x00000080L /* regular files only */
#define SFF_SAFEDIRPATH 0x00000100L /* no writable directories allowed */
@@ -108,6 +64,7 @@ typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)];
extern int safefile __P((char *, UID_T, GID_T, char *, long, int, struct stat *));
extern int safedirpath __P((char *, UID_T, GID_T, char *, long, int, int));
extern int safeopen __P((char *, int, int, long));
+extern SM_FILE_T*safefopen __P((char *, int, int, long));
extern int dfopen __P((char *, int, int, long));
extern bool filechanged __P((char *, int, struct stat *));
@@ -116,6 +73,7 @@ extern bool filechanged __P((char *, int, struct stat *));
**
** Hopefully nobody uses these.
*/
+
#define DBS_SAFE 0
#define DBS_ASSUMESAFECHOWN 1
#define DBS_GROUPWRITABLEDIRPATHSAFE 2
@@ -144,42 +102,33 @@ extern bool filechanged __P((char *, int, struct stat *));
#define DBS_HELPFILEINUNSAFEDIRPATH 25
#define DBS_FORWARDFILEINUNSAFEDIRPATHSAFE 26
#define DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE 27
-#define DBS_RUNPROGRAMINUNSAFEDIRPATH 28 /* Not used yet */
+#define DBS_RUNPROGRAMINUNSAFEDIRPATH 28
#define DBS_RUNWRITABLEPROGRAM 29
#define DBS_INCLUDEFILEINUNSAFEDIRPATH 30
#define DBS_NONROOTSAFEADDR 31
#define DBS_TRUSTSTICKYBIT 32
#define DBS_DONTWARNFORWARDFILEINUNSAFEDIRPATH 33
#define DBS_INSUFFICIENTENTROPY 34
-#if _FFR_UNSAFE_SASL
-# define DBS_GROUPREADABLESASLFILE 35
-#endif /* _FFR_UNSAFE_SASL */
-#if _FFR_UNSAFE_WRITABLE_INCLUDE
-# define DBS_GROUPWRITABLEFORWARDFILE 36
-# define DBS_GROUPWRITABLEINCLUDEFILE 37
-# define DBS_WORLDWRITABLEFORWARDFILE 38
-# define DBS_WORLDWRITABLEINCLUDEFILE 39
-#endif /* _FFR_UNSAFE_WRITABLE_INCLUDE */
+#define DBS_GROUPREADABLESASLDBFILE 35
+#define DBS_GROUPWRITABLESASLDBFILE 36
+#define DBS_GROUPWRITABLEFORWARDFILE 37
+#define DBS_GROUPWRITABLEINCLUDEFILE 38
+#define DBS_WORLDWRITABLEFORWARDFILE 39
+#define DBS_WORLDWRITABLEINCLUDEFILE 40
+#define DBS_GROUPREADABLEKEYFILE 41
+#if _FFR_GROUPREADABLEAUTHINFOFILE
+# define DBS_GROUPREADABLEAUTHINFOFILE 42
+#endif /* _FFR_GROUPREADABLEAUTHINFOFILE */
/* struct defining such things */
struct dbsval
{
- char *dbs_name; /* name of DontBlameSendmail flag */
- u_char dbs_flag; /* numeric level */
+ char *dbs_name; /* name of DontBlameSendmail flag */
+ unsigned char dbs_flag; /* numeric level */
};
-#if _FFR_DPRINTF
-extern void dprintf __P((const char *, ...));
-extern int dflush __P((void));
-#else /* _FFR_DPRINTF */
-#define dprintf printf
-#define dflush() fflush(stdout)
-#endif /* _FFR_DPRINTF */
-
-extern int sm_snprintf __P((char *, size_t, const char *, ...));
-extern int sm_vsnprintf __P((char *, size_t, const char *, va_list));
-extern char *quad_to_string __P((QUAD_T));
-
-extern size_t strlcpy __P((char *, const char *, size_t));
-extern size_t strlcat __P((char *, const char *, size_t));
+/* 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 */
diff --git a/contrib/sendmail/include/sm/assert.h b/contrib/sendmail/include/sm/assert.h
new file mode 100644
index 0000000..6b86536
--- /dev/null
+++ b/contrib/sendmail/include/sm/assert.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: assert.h,v 1.10 2001/06/07 20:04:53 ca Exp $
+ */
+
+/*
+** libsm abnormal program termination and assertion checking
+** See libsm/assert.html for documentation.
+*/
+
+#ifndef SM_ASSERT_H
+# define SM_ASSERT_H
+
+# include <sm/gen.h>
+# include <sm/debug.h>
+
+/*
+** abnormal program termination
+*/
+
+typedef void (*SM_ABORT_HANDLER_T) __P((const char *, int, const char *));
+
+extern SM_DEAD(void
+sm_abort_at __P((
+ const char *,
+ int,
+ const char *)));
+
+extern void
+sm_abort_sethandler __P((
+ SM_ABORT_HANDLER_T));
+
+extern SM_DEAD(void PRINTFLIKE(1, 2)
+sm_abort __P((
+ char *,
+ ...)));
+
+/*
+** assertion checking
+*/
+
+# ifndef SM_CHECK_ALL
+# define SM_CHECK_ALL 1
+# endif /* ! SM_CHECK_ALL */
+
+# ifndef SM_CHECK_REQUIRE
+# define SM_CHECK_REQUIRE SM_CHECK_ALL
+# endif /* ! SM_CHECK_REQUIRE */
+
+# ifndef SM_CHECK_ENSURE
+# define SM_CHECK_ENSURE SM_CHECK_ALL
+# endif /* ! SM_CHECK_ENSURE */
+
+# ifndef SM_CHECK_ASSERT
+# define SM_CHECK_ASSERT SM_CHECK_ALL
+# endif /* ! SM_CHECK_ASSERT */
+
+# if SM_CHECK_REQUIRE
+# if defined(__STDC__) || defined(__cplusplus)
+# define SM_REQUIRE(cond) \
+ ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
+ "SM_REQUIRE(" #cond ") failed"), 0)))
+# else /* defined(__STDC__) || defined(__cplusplus) */
+# define SM_REQUIRE(cond) \
+ ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
+ "SM_REQUIRE(cond) failed"), 0)))
+# endif /* defined(__STDC__) || defined(__cplusplus) */
+# else /* SM_CHECK_REQUIRE */
+# define SM_REQUIRE(cond) ((void) 0)
+# endif /* SM_CHECK_REQUIRE */
+
+# define SM_REQUIRE_ISA(obj, magic) \
+ SM_REQUIRE((obj) != NULL && (obj)->sm_magic == (magic))
+
+# if SM_CHECK_ENSURE
+# if defined(__STDC__) || defined(__cplusplus)
+# define SM_ENSURE(cond) \
+ ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
+ "SM_ENSURE(" #cond ") failed"), 0)))
+# else /* defined(__STDC__) || defined(__cplusplus) */
+# define SM_ENSURE(cond) \
+ ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
+ "SM_ENSURE(cond) failed"), 0)))
+# endif /* defined(__STDC__) || defined(__cplusplus) */
+# else /* SM_CHECK_ENSURE */
+# define SM_ENSURE(cond) ((void) 0)
+# endif /* SM_CHECK_ENSURE */
+
+# if SM_CHECK_ASSERT
+# if defined(__STDC__) || defined(__cplusplus)
+# define SM_ASSERT(cond) \
+ ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
+ "SM_ASSERT(" #cond ") failed"), 0)))
+# else /* defined(__STDC__) || defined(__cplusplus) */
+# define SM_ASSERT(cond) \
+ ((void) ((cond) || (sm_abort_at(__FILE__, __LINE__, \
+ "SM_ASSERT(cond) failed"), 0)))
+# endif /* defined(__STDC__) || defined(__cplusplus) */
+# else /* SM_CHECK_ASSERT */
+# define SM_ASSERT(cond) ((void) 0)
+# endif /* SM_CHECK_ASSERT */
+
+extern SM_DEBUG_T SmExpensiveRequire;
+extern SM_DEBUG_T SmExpensiveEnsure;
+extern SM_DEBUG_T SmExpensiveAssert;
+
+#endif /* ! SM_ASSERT_H */
diff --git a/contrib/sendmail/include/sm/bitops.h b/contrib/sendmail/include/sm/bitops.h
new file mode 100644
index 0000000..44778ba
--- /dev/null
+++ b/contrib/sendmail/include/sm/bitops.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ *
+ *
+ * $Id: bitops.h,v 1.2 2001/09/22 22:05:42 ca Exp $
+ */
+
+#ifndef SM_BITOPS_H
+# define SM_BITOPS_H
+
+/*
+** 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.
+*/
+
+# define BITMAPBITS 256 /* number of bits in a bit map */
+# define BYTEBITS 8 /* number of bits in a byte */
+# define BITMAPBYTES (BITMAPBITS / BYTEBITS) /* number of bytes in bit map */
+# define BITMAPMAX ((BITMAPBYTES / sizeof (int)) - 1)
+
+/* internal macros */
+
+/* make sure this index never leaves the allowed range: 0 to BITMAPMAX */
+# define _BITWORD(bit) (((unsigned char)(bit) / (BYTEBITS * sizeof (int))) & BITMAPMAX)
+# define _BITBIT(bit) ((unsigned int)1 << ((unsigned char)(bit) % (BYTEBITS * sizeof (int))))
+
+typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)];
+
+/* properly case and truncate bit */
+# define bitidx(bit) ((unsigned int) (bit) & 0xff)
+
+/* 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) memset((char *) map, '\0', BITMAPBYTES)
+
+/* bit hacking */
+# define bitset(bit, word) (((word) & (bit)) != 0)
+
+#endif /* ! SM_BITOPS_H */
diff --git a/contrib/sendmail/include/sm/cdefs.h b/contrib/sendmail/include/sm/cdefs.h
new file mode 100644
index 0000000..b8597d9
--- /dev/null
+++ b/contrib/sendmail/include/sm/cdefs.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: cdefs.h,v 1.14 2001/06/07 20:04:53 ca Exp $
+ */
+
+/*
+** libsm C language portability macros
+** See libsm/cdefs.html for documentation.
+*/
+
+#ifndef SM_CDEFS_H
+# define SM_CDEFS_H
+
+# include <sm/config.h>
+
+/*
+** BSD and Linux have <sys/cdefs.h> which defines a set of C language
+** portability macros that are a defacto standard in the open source
+** community.
+*/
+
+# if SM_CONF_SYS_CDEFS_H
+# include <sys/cdefs.h>
+# endif /* SM_CONF_SYS_CDEFS_H */
+
+/*
+** Define the standard C language portability macros
+** for platforms that lack <sys/cdefs.h>.
+*/
+
+# if !SM_CONF_SYS_CDEFS_H
+# if defined(__cplusplus)
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS };
+# else /* defined(__cplusplus) */
+# define __BEGIN_DECLS
+# define __END_DECLS
+# endif /* defined(__cplusplus) */
+# if defined(__STDC__) || defined(__cplusplus)
+# define __P(protos) protos
+# define __CONCAT(x,y) x ## y
+# define __STRING(x) #x
+# else /* defined(__STDC__) || defined(__cplusplus) */
+# define __P(protos) ()
+# define __CONCAT(x,y) x/**/y
+# define __STRING(x) "x"
+# define const
+# define signed
+# define volatile
+# endif /* defined(__STDC__) || defined(__cplusplus) */
+# endif /* !SM_CONF_SYS_CDEFS_H */
+
+/*
+** Define SM_DEAD, a macro used to declare functions that do not return
+** to their caller.
+*/
+
+# ifndef SM_DEAD
+# if __GNUC__ >= 2
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 5
+# define SM_DEAD(proto) volatile proto
+# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
+# define SM_DEAD(proto) proto __attribute__((__noreturn__))
+# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
+# else /* __GNUC__ >= 2 */
+# define SM_DEAD(proto) proto
+# endif /* __GNUC__ >= 2 */
+# endif /* SM_DEAD */
+
+/*
+** Define SM_UNUSED, a macro used to declare variables that may be unused.
+*/
+
+# ifndef SM_UNUSED
+# if __GNUC__ >= 2
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+# define SM_UNUSED(decl) decl
+# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
+# define SM_UNUSED(decl) decl __attribute__((__unused__))
+# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
+# else /* __GNUC__ >= 2 */
+# define SM_UNUSED(decl) decl
+# endif /* __GNUC__ >= 2 */
+# endif /* SM_UNUSED */
+
+/*
+** The SM_NONVOLATILE macro is used to declare variables that are not
+** volatile, but which must be declared volatile when compiling with
+** gcc -O -Wall in order to suppress bogus warning messages.
+**
+** Variables that actually are volatile should be declared volatile
+** using the "volatile" keyword. If a variable actually is volatile,
+** then SM_NONVOLATILE should not be used.
+**
+** To compile sendmail with gcc and see all non-bogus warnings,
+** you should use
+** gcc -O -Wall -DSM_OMIT_BOGUS_WARNINGS ...
+** Do not use -DSM_OMIT_BOGUS_WARNINGS when compiling the production
+** version of sendmail, because there is a performance hit.
+*/
+
+# ifdef SM_OMIT_BOGUS_WARNINGS
+# define SM_NONVOLATILE volatile
+# else /* SM_OMIT_BOGUS_WARNINGS */
+# define SM_NONVOLATILE
+# endif /* SM_OMIT_BOGUS_WARNINGS */
+
+/*
+** Turn on format string argument checking.
+*/
+
+# ifndef SM_CONF_FORMAT_TEST
+# if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+# define SM_CONF_FORMAT_TEST 1
+# else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
+# define SM_CONF_FORMAT_TEST 0
+# endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
+# endif /* SM_CONF_FORMAT_TEST */
+
+# ifndef PRINTFLIKE
+# if SM_CONF_FORMAT_TEST
+# define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
+# else /* SM_CONF_FORMAT_TEST */
+# define PRINTFLIKE(x,y)
+# endif /* SM_CONF_FORMAT_TEST */
+# endif /* ! PRINTFLIKE */
+
+# ifndef SCANFLIKE
+# if SM_CONF_FORMAT_TEST
+# define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y)))
+# else /* SM_CONF_FORMAT_TEST */
+# define SCANFLIKE(x,y)
+# endif /* SM_CONF_FORMAT_TEST */
+# endif /* ! SCANFLIKE */
+
+#endif /* ! SM_CDEFS_H */
diff --git a/contrib/sendmail/include/sm/cf.h b/contrib/sendmail/include/sm/cf.h
new file mode 100644
index 0000000..3869210
--- /dev/null
+++ b/contrib/sendmail/include/sm/cf.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: cf.h,v 1.2 2001/03/08 03:23:07 ca Exp $
+ */
+
+#ifndef SM_CF_H
+# define SM_CF_H
+
+#include <sm/gen.h>
+
+typedef struct
+{
+ char *opt_name;
+ char *opt_val;
+} SM_CF_OPT_T;
+
+extern int
+sm_cf_getopt __P((
+ char *path,
+ int optc,
+ SM_CF_OPT_T *optv));
+
+#endif /* ! SM_CF_H */
diff --git a/contrib/sendmail/include/sm/clock.h b/contrib/sendmail/include/sm/clock.h
new file mode 100644
index 0000000..b0dfb43
--- /dev/null
+++ b/contrib/sendmail/include/sm/clock.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: clock.h,v 1.11 2001/05/14 23:25:37 gshapiro Exp $
+ */
+
+/*
+** CLOCK.H -- for co-ordinating timed events
+*/
+
+#ifndef _SM_CLOCK_H
+# define _SM_CLOCK_H 1
+
+# include <sm/signal.h>
+# if SM_CONF_SETITIMER
+# include <sys/time.h>
+# endif /* SM_CONF_SETITIMER */
+
+/*
+** STRUCT SM_EVENT -- event queue.
+**
+** Maintained in sorted order.
+**
+** We store the pid of the process that set this event to insure
+** that when we fork we will not take events intended for the parent.
+*/
+
+struct sm_event
+{
+# if SM_CONF_SETITIMER
+ struct timeval ev_time; /* time of the call (microseconds) */
+# else /* SM_CONF_SETITIMER */
+ time_t ev_time; /* time of the call (seconds) */
+# endif /* SM_CONF_SETITIMER */
+ void (*ev_func)__P((int));
+ /* function to call */
+ int ev_arg; /* argument to ev_func */
+ pid_t ev_pid; /* pid that set this event */
+ struct sm_event *ev_link; /* link to next item */
+};
+
+typedef struct sm_event SM_EVENT;
+
+/* functions */
+extern void sm_clrevent __P((SM_EVENT *));
+extern void sm_clear_events __P((void));
+extern SM_EVENT *sm_setevent __P((time_t, void(*)(), int));
+extern SM_EVENT *sm_seteventm __P((int, void(*)(), int));
+extern SM_EVENT *sm_sigsafe_seteventm __P((int, void(*)(), int));
+extern SIGFUNC_DECL sm_tick __P((int));
+
+/*
+** SM_SETEVENT -- set an event to happen at a specific time in seconds.
+**
+** Translates the seconds into millseconds and calls sm_seteventm()
+** to get a specific event to happen in the future at a specific time.
+**
+** Parameters:
+** t -- intvl until next event occurs (seconds).
+** f -- function to call on event.
+** a -- argument to func on event.
+**
+** Returns:
+** result of sm_seteventm().
+**
+** Side Effects:
+** Any that sm_seteventm() have.
+*/
+
+#define sm_setevent(t, f, a) sm_seteventm((int)((t) * 1000), (f), (a))
+#define sm_sigsafe_setevent(t, f, a) sm_sigsafe_seteventm((int)((t) * 1000), (f), (a))
+
+#endif /* _SM_CLOCK_H */
diff --git a/contrib/sendmail/include/sm/conf.h b/contrib/sendmail/include/sm/conf.h
new file mode 100644
index 0000000..f54cd96
--- /dev/null
+++ b/contrib/sendmail/include/sm/conf.h
@@ -0,0 +1,2803 @@
+/*
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ *
+ *
+ * $Id: conf.h,v 1.82 2001/12/20 16:14:48 ca Exp $
+ */
+
+/*
+** CONF.H -- All user-configurable parameters for sendmail
+**
+** Send updates to sendmail@Sendmail.ORG so they will be
+** included in the next release.
+*/
+
+#ifndef SM_CONF_H
+# define SM_CONF_H 1
+
+
+# include <sm/config.h>
+# include <sm/varargs.h>
+
+/*
+** General "standard C" defines.
+**
+** These may be undone later, to cope with systems that claim to
+** be Standard C but aren't. Gcc is the biggest offender -- it
+** doesn't realize that the library is part of the language.
+**
+** Life would be much easier if we could get rid of this sort
+** of bozo problems.
+*/
+
+# ifdef __STDC__
+# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
+# endif /* __STDC__ */
+
+/*
+** Assume you have standard calls; can be #undefed below if necessary.
+*/
+
+# ifndef HASLSTAT
+# define HASLSTAT 1 /* has lstat(2) call */
+# endif /* ! HASLSTAT */
+
+# ifndef HASNICE
+# define HASNICE 1 /* has nice(2) call */
+# endif /* ! HASNICE */
+
+# ifndef HASRRESVPORT
+# define HASRRESVPORT 1 /* has rrsevport(3) call */
+# endif /* ! HASRRESVPORT */
+
+/**********************************************************************
+** "Hard" compilation options.
+** #define these if they are available; comment them out otherwise.
+** These cannot be overridden from the Makefile, and should really not
+** be turned off unless absolutely necessary.
+**********************************************************************/
+
+#define LOG 1 /* enable logging -- don't turn off */
+
+/**********************************************************************
+** Operating system configuration.
+**
+** Unless you are porting to a new OS, you shouldn't have to
+** change these.
+**********************************************************************/
+
+/*
+** HP-UX -- tested for 8.07, 9.00, and 9.01.
+**
+** If V4FS is defined, compile for HP-UX 10.0.
+** 11.x support from Richard Allen <ra@hp.is>.
+*/
+
+# ifdef __hpux
+ /* common definitions for HP-UX 9.x and 10.x */
+# undef m_flags /* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
+# define SYSTEM5 1 /* include all the System V defines */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASSETRESGID 1 /* use setresgid(2) to set saved gid */
+# define BOGUS_O_EXCL 1 /* exclusive open follows symlinks */
+# define seteuid(e) setresuid(-1, e, -1)
+# define IP_SRCROUTE 1 /* can check IP source routing */
+# define LA_TYPE LA_HPUX
+# define SPT_TYPE SPT_PSTAT
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# define GIDSET_T gid_t
+# define LDA_USE_LOCKF 1
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps */
+# endif /* ! HASGETUSERSHELL */
+# ifdef HPUX10
+# define _PATH_SENDMAIL "/usr/sbin/sendmail"
+# define SMRSH_CMDDIR "/var/adm/sm.bin"
+# endif /* HPUX10 */
+# ifdef HPUX11
+# define HASFCHOWN 1 /* has fchown(2) */
+# ifndef BROKEN_RES_SEARCH
+# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
+# endif /* ! BROKEN_RES_SEARCH */
+# define SMRSH_CMDDIR "/var/adm/sm.bin"
+# define _PATH_SENDMAIL "/usr/sbin/sendmail"
+# else /* HPUX11 */
+# ifndef NOT_SENDMAIL
+# define syslog hard_syslog
+# endif /* ! NOT_SENDMAIL */
+# endif /* HPUX11 */
+# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
+
+# ifdef V4FS
+ /* HP-UX 10.x */
+# define _PATH_UNIX "/stand/vmunix"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# ifndef IDENTPROTO
+# define IDENTPROTO 1 /* TCP/IP implementation fixed in 10.0 */
+# endif /* ! IDENTPROTO */
+# include <sys/mpctl.h> /* for mpctl() in get_num_procs_online() */
+# else /* V4FS */
+ /* HP-UX 9.x */
+# define _PATH_UNIX "/hp-ux"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# ifdef __STDC__
+extern void hard_syslog(int, char *, ...);
+# else /* __STDC__ */
+extern void hard_syslog();
+# endif /* __STDC__ */
+# define FDSET_CAST (int *) /* cast for fd_set parameters to select */
+# endif /* V4FS */
+
+# endif /* __hpux */
+
+/*
+** IBM AIX 5.x
+*/
+
+# ifdef _AIX5
+# define _AIX4 40300
+# endif /* _AIX5 */
+
+/*
+** IBM AIX 4.x
+*/
+
+# ifdef _AIX4
+# define _AIX3 1 /* pull in AIX3 stuff */
+# define BSD4_4_SOCKADDR /* has sa_len */
+# define USESETEUID 1 /* seteuid(2) works */
+# define TZ_TYPE TZ_NAME /* use tzname[] vector */
+# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
+# if _AIX4 >= 40200
+# define HASSETREUID 1 /* setreuid(2) works as of AIX 4.2 */
+# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
+# endif /* _AIX4 >= 40200 */
+# if defined(_ILS_MACROS) /* IBM versions aren't side-effect clean */
+# undef isascii
+# define isascii(c) !(c & ~0177)
+# undef isdigit
+# define isdigit(__a) (_IS(__a,_ISDIGIT))
+# undef isspace
+# define isspace(__a) (_IS(__a,_ISSPACE))
+# endif /* defined(_ILS_MACROS) */
+# endif /* _AIX4 */
+
+
+/*
+** IBM AIX 3.x -- actually tested for 3.2.3
+*/
+
+# ifdef _AIX3
+# include <paths.h>
+# include <sys/machine.h> /* to get byte order */
+# include <sys/select.h>
+# define HASFCHOWN 1 /* has fchown(2) */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
+# define GIDSET_T gid_t
+# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# define LA_TYPE LA_INT
+# define FSHIFT 16
+# define LA_AVENRUN "avenrun"
+# if !defined(_AIX4) || _AIX4 < 40300
+# ifndef __BIT_TYPES_DEFINED__
+# define SM_INT32 int
+# endif /* __BIT_TYPES_DEFINED__ */
+# endif /* !defined(_AIX4) || _AIX4 < 40300 */
+# if !defined(_AIX4) || _AIX4 < 40200
+# define SM_CONF_SYSLOG 0
+# endif /* !defined(_AIX4) || _AIX4 < 40200 */
+# endif /* _AIX3 */
+
+
+/*
+** IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
+**
+** From Mark Whetzel <markw@wg.waii.com>.
+*/
+
+# ifdef AIX /* AIX/RT compiler pre-defines this */
+# include <paths.h>
+# include <sys/time.h> /* AIX/RT resource.h does NOT include this */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define HASFCHMOD 0 /* does not have fchmod(2) syscall */
+# define HASSETREUID 1 /* use setreuid(2) -lbsd system call */
+# define HASSETVBUF 1 /* use setvbuf(2) system call */
+# define HASSETRLIMIT 0 /* does not have setrlimit call */
+# define HASFLOCK 0 /* does not have flock call - use fcntl */
+# define HASULIMIT 1 /* use ulimit instead of setrlimit call */
+# define SM_CONF_GETOPT 0 /* Do we need theirs or ours */
+# define SYS5SETPGRP 1 /* don't have setpgid on AIX/RT */
+# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
+# define BSD4_3 1 /* NOT bsd 4.4 or posix signals */
+# define GIDSET_T int
+# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# define LA_TYPE LA_SUBR /* use our ported loadavgd daemon */
+# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
+# define ARBPTR_T int *
+# define void int
+typedef int pid_t;
+/* RTisms for BSD compatibility, specified in the Makefile
+ define BSD 1
+ define BSD_INCLUDES 1
+ define BSD_REMAP_SIGNAL_TO_SIGVEC
+ RTisms needed above */
+/* make this sendmail in a completely different place */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/local/newmail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/usr/local/newmail/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# endif /* AIX */
+
+# if defined(_AIX)
+# define LDA_USE_LOCKF 1
+# define LDA_USE_SETEUID 1
+# endif /* defined(_AIX) */
+
+/*
+** Silicon Graphics IRIX
+**
+** Compiles on 4.0.1.
+**
+** Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
+** Use IRIX5 instead of IRIX for IRIX 5.x.
+**
+** IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
+** IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
+*/
+
+# ifdef IRIX
+# define SYSTEM5 1 /* this is a System-V derived system */
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define IP_SRCROUTE 1 /* can check IP source routing */
+# define setpgid BSDsetpgrp
+# define GIDSET_T gid_t
+# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define SYSLOG_BUFSIZE 512
+# ifdef IRIX6
+# define STAT64 1
+# define QUAD_T unsigned long long
+# define LA_TYPE LA_IRIX6 /* figure out at run time */
+# define SAFENFSPATHCONF 0 /* pathconf(2) lies on NFS filesystems */
+# else /* IRIX6 */
+# define LA_TYPE LA_INT
+
+# ifdef IRIX64
+# define STAT64 1
+# define QUAD_T unsigned long long
+# define NAMELISTMASK 0x7fffffffffffffff /* mask for nlist() values */
+# else /* IRIX64 */
+# define STAT64 0
+# define NAMELISTMASK 0x7fffffff /* mask for nlist() values */
+# endif /* IRIX64 */
+# endif /* IRIX6 */
+# if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
+# include <sys/cdefs.h>
+# include <paths.h>
+# define ARGV_T char *const *
+# define HASFCHOWN 1 /* has fchown(2) */
+# define HASSETRLIMIT 1 /* has setrlimit(2) syscall */
+# define HASGETDTABLESIZE 1 /* has getdtablesize(2) syscall */
+# define HASSTRERROR 1 /* has strerror(3) */
+# else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
+# define ARGV_T const char **
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+# endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
+# endif /* IRIX */
+
+
+/*
+** SunOS and Solaris
+**
+** Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
+** Solaris 2.4 (a.k.a. SunOS 5.4).
+*/
+
+# if defined(sun) && !defined(BSD)
+
+# include <sys/time.h>
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define IP_SRCROUTE 1 /* can check IP source routing */
+# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
+# ifndef HASFCHOWN
+# define HASFCHOWN 1 /* fchown(2) */
+# endif /* ! HASFCHOWN */
+
+# ifdef __svr4__
+# define LDA_USE_LOCKF 1
+# define LDA_USE_SETEUID 1
+# define _PATH_MAILDIR "/var/mail"
+# endif /* __svr4__ */
+
+# ifdef SOLARIS_2_3
+# define SOLARIS 20300 /* for back compat only -- use -DSOLARIS=20300 */
+# endif /* SOLARIS_2_3 */
+
+# if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
+# define SOLARIS 1 /* unknown Solaris version */
+# endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
+
+# ifdef SOLARIS
+ /* Solaris 2.x (a.k.a. SunOS 5.x) */
+# ifndef __svr4__
+# define __svr4__ /* use all System V Release 4 defines below */
+# endif /* ! __svr4__ */
+# define GIDSET_T gid_t
+# define USE_SA_SIGACTION 1 /* use sa_sigaction field */
+# define BROKEN_PTHREAD_SLEEP 1 /* sleep after pthread_create() fails */
+# define HASSTRERROR 1 /* has strerror(3) */
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/dev/ksyms"
+# endif /* ! _PATH_UNIX */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# ifndef _PATH_HOSTS
+# define _PATH_HOSTS "/etc/inet/hosts"
+# endif /* ! _PATH_HOSTS */
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 1024 /* allow full size syslog buffer */
+# endif /* ! SYSLOG_BUFSIZE */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_TZNAME
+# endif /* ! TZ_TYPE */
+# if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
+# define USESETEUID 1 /* seteuid works as of 2.3 */
+# define LDA_CONTENTLENGTH 1 /* Needs the Content-Length header */
+# endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
+# if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
+# define HASSETREUID 1 /* setreuid works as of 2.5 */
+# define HASSETREGID 1 /* use setregid(2) to set saved gid */
+# if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
+# ifndef LA_TYPE
+# define LA_TYPE LA_KSTAT /* use kstat(3k) -- may work in < 2.5 */
+# endif /* ! LA_TYPE */
+# ifndef RANDOMSHIFT /* random() doesn't work well (sometimes) */
+# define RANDOMSHIFT 8
+# endif /* ! RANDOMSHIFT */
+# endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
+# else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
+# ifndef HASRANDOM
+# define HASRANDOM 0 /* doesn't have random(3) */
+# endif /* ! HASRANDOM */
+# endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
+# if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
+# define SM_INT32 int /* 32bit integer */
+# endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
+# if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
+# ifndef LA_TYPE
+# include <sys/loadavg.h>
+# if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
+# include <sys/pset.h>
+# define LA_TYPE LA_PSET /* pset_getloadavg(3c) appears in 2.9 */
+# else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
+# define LA_TYPE LA_SUBR /* getloadavg(3c) appears in 2.7 */
+# endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
+# endif /* ! LA_TYPE */
+# define HASGETUSERSHELL 1 /* getusershell(3c) bug fixed in 2.7 */
+# endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
+# if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
+# undef _PATH_SENDMAILPID /* tmpfs /var/run added in 2.8 */
+# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
+# define SMRSH_CMDDIR "/var/adm/sm.bin"
+# define SL_FUDGE 34 /* fudge offset for SyslogPrefixLen */
+# endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
+# if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
+# define HASURANDOMDEV 1 /* /dev/[u]random added in S9 */
+# endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps pre-2.7 */
+# endif /* ! HASGETUSERSHELL */
+
+# else /* SOLARIS */
+ /* SunOS 4.0.3 or 4.1.x */
+# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
+# define HASSETREUID 1 /* has setreuid(2) call */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone */
+# include <memory.h>
+# include <vfork.h>
+# ifdef __GNUC__
+# define strtoul strtol /* gcc library bogosity */
+# endif /* __GNUC__ */
+# define memmove(d, s, l) (bcopy((s), (d), (l)))
+# define atexit(f) on_exit((f), 0) /* ugly hack for SunOS */
+# define SM_INT32 int /* 32bit integer */
+# define SM_ALIGN_SIZE (sizeof(long))
+# define GIDSET_T int
+# define SM_CONF_SYSLOG 0
+
+# ifdef SUNOS403
+ /* special tweaking for SunOS 4.0.3 */
+# include <malloc.h>
+# define BSD4_3 1 /* 4.3 BSD-based */
+# define NEEDSTRSTR 1 /* need emulation of strstr(3) routine */
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+# undef WIFEXITED
+# undef WEXITSTATUS
+# undef HASUNAME
+# define setpgid setpgrp
+# define MODE_T int
+typedef int pid_t;
+extern char *getenv();
+
+# else /* SUNOS403 */
+ /* 4.1.x specifics */
+# define HASSETSID 1 /* has Posix setsid(2) call */
+# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
+
+# endif /* SUNOS403 */
+# endif /* SOLARIS */
+
+# ifndef LA_TYPE
+# define LA_TYPE LA_INT
+# endif /* ! LA_TYPE */
+
+# endif /* defined(sun) && !defined(BSD) */
+
+/*
+** DG/UX
+**
+** Tested on 5.4.2 and 5.4.3. Use DGUX_5_4_2 to get the
+** older support.
+** 5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
+*/
+
+# ifdef DGUX_5_4_2
+# define DGUX 1
+# endif /* DGUX_5_4_2 */
+
+# ifdef DGUX
+# define SYSTEM5 1
+# define LA_TYPE LA_DGUX
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASSETSID 1 /* has Posix setsid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define IP_SRCROUTE 0 /* does not have <netinet/ip_var.h> */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) */
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# define SPT_TYPE SPT_NONE /* don't use setproctitle */
+# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
+# define LDA_USE_LOCKF 1
+
+/* these include files must be included early on DG/UX */
+# include <netinet/in.h>
+# include <arpa/inet.h>
+
+/* compiler doesn't understand const? */
+# define const
+
+# ifdef DGUX_5_4_2
+# define inet_addr dgux_inet_addr
+extern long dgux_inet_addr();
+# endif /* DGUX_5_4_2 */
+# endif /* DGUX */
+
+
+/*
+** Digital Ultrix 4.2 - 4.5
+**
+** Apparently, fcntl locking is broken on 4.2A, in that locks are
+** not dropped when the process exits. This causes major problems,
+** so flock is the only alternative.
+*/
+
+# ifdef ultrix
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASFCHOWN 1 /* has fchown(2) syscall */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# ifndef BROKEN_RES_SEARCH
+# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
+# endif /* ! BROKEN_RES_SEARCH */
+# if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
+# define NEEDLOCAL_HOSTNAME_LENGTH 1 /* see sendmail/README */
+# endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
+# ifdef vax
+# define LA_TYPE LA_FLOAT
+# else /* vax */
+# define LA_TYPE LA_INT
+# define LA_AVENRUN "avenrun"
+# endif /* vax */
+# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* pre-4.4 TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# define SYSLOG_BUFSIZE 256
+# define SM_CONF_SYSLOG 0
+# endif /* ultrix */
+
+
+/*
+** OSF/1 for KSR.
+**
+** Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
+*/
+
+# ifdef __ksr__
+# define __osf__ 1 /* get OSF/1 defines below */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
+# endif /* ! TZ_TYPE */
+# endif /* __ksr__ */
+
+
+/*
+** OSF/1 for Intel Paragon.
+**
+** Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
+** of Intel Scalable Systems Divison.
+*/
+
+# ifdef __PARAGON__
+# define __osf__ 1 /* get OSF/1 defines below */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
+# endif /* ! TZ_TYPE */
+# define GIDSET_T gid_t
+# define MAXNAMLEN NAME_MAX
+# endif /* __PARAGON__ */
+
+
+/*
+** Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
+**
+** Tested for 3.2 and 4.0.
+*/
+
+# ifdef __osf__
+# define HASUNAME 1 /* has uname(2) call */
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASFCHOWN 1 /* has fchown(2) syscall */
+# define HASSETLOGIN 1 /* has setlogin(2) */
+# define IP_SRCROUTE 1 /* can check IP source routing */
+# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
+# define GIDSET_T gid_t
+# define SM_INT32 int /* 32bit integer */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define LA_TYPE LA_ALPHAOSF
+# define SFS_TYPE SFS_STATVFS /* use <sys/statvfs.h> statfs() impl */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/var/adm/sendmail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# endif /* __osf__ */
+
+
+/*
+** NeXTstep
+*/
+
+# ifdef NeXT
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define NEEDPUTENV 2 /* need putenv(3) call; no setenv(3) call */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define UID_T int /* compiler gripes on uid_t */
+# define GID_T int /* ditto for gid_t */
+# define MODE_T int /* and mode_t */
+# define setpgid setpgrp
+# ifndef NOT_SENDMAIL
+# define sleep sleepX
+# endif /* ! NOT_SENDMAIL */
+# ifndef LA_TYPE
+# define LA_TYPE LA_MACH
+# endif /* ! LA_TYPE */
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# ifdef _POSIX_SOURCE
+extern struct passwd *getpwent();
+# else /* _POSIX_SOURCE */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+typedef int pid_t;
+# undef WEXITSTATUS
+# undef WIFEXITED
+# undef WIFSTOPPED
+# undef WTERMSIG
+# endif /* _POSIX_SOURCE */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/etc/sendmail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# define SM_INT32 int /* 32bit integer */
+
+# ifdef TCPWRAPPERS
+# ifndef HASUNSETENV
+# define HASUNSETENV 1
+# endif /* ! HASUNSETENV */
+# undef NEEDPUTENV
+# endif /* TCPWRAPPERS */
+# ifndef __APPLE__
+# include <libc.h>
+# ifndef S_IRUSR
+# define S_IRUSR S_IREAD
+# endif /* ! S_IRUSR */
+# ifndef S_IWUSR
+# define S_IWUSR S_IWRITE
+# endif /* ! S_IWUSR */
+# define _PATH_MAILDIR "/usr/spool/mail"
+# endif /* ! __APPLE__ */
+# ifndef isascii
+# define isascii(c) ((unsigned)(c) <= 0177)
+# endif /* ! isascii */
+# endif /* NeXT */
+
+/*
+** Apple Rhapsody
+** Contributed by Wilfredo Sanchez <wsanchez@apple.com>
+**
+** Also used for Apple Darwin support.
+*/
+
+# if defined(DARWIN)
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASFLOCK 1 /* has flock(2) syscall */
+# define HASUNAME 1 /* has uname(2) syscall */
+# define HASUNSETENV 1
+# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
+# define HASINITGROUPS 1
+# define HASSETVBUF 1
+# define HASSETREUID 0
+# define HASSETEUID 1
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASLSTAT 1
+# define HASSETRLIMIT 1
+# define HASWAITPID 1
+# define HASSTRERROR 1 /* has strerror(3) */
+# define HASGETDTABLESIZE 1
+# define HASGETUSERSHELL 1
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define BSD4_4_SOCKADDR /* has sa_len */
+# define NETLINK 1 /* supports AF_LINK */
+# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
+# define GIDSET_T gid_t
+# define LA_TYPE LA_SUBR /* use getloadavg(3) */
+# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
+# define SPT_TYPE SPT_PSSTRINGS
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# endif /* defined(DARWIN) */
+
+
+/*
+** 4.4 BSD
+**
+** See also BSD defines.
+*/
+
+# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__)
+# include <paths.h>
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASFCHOWN 1 /* has fchown(2) syscall */
+# define HASSTRERROR 1 /* has strerror(3) */
+# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
+# include <sys/cdefs.h>
+# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR /* has sa_len */
+# define NEED_PRINTF_PERCENTQ 1 /* doesn't have %lld */
+# define NETLINK 1 /* supports AF_LINK */
+# ifndef LA_TYPE
+# define LA_TYPE LA_SUBR
+# endif /* ! LA_TYPE */
+# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
+# define SPT_TYPE SPT_PSSTRINGS /* use PS_STRINGS pointer */
+# endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) */
+
+
+/*
+** BSD/OS (was BSD/386) (all versions)
+** From Tony Sanders, BSDI
+*/
+
+# ifdef __bsdi__
+# include <paths.h>
+# define HASUNSETENV 1 /* has the unsetenv(3) call */
+# define HASSETREUID 0 /* BSD-OS has broken setreuid(2) emulation */
+# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASSETLOGIN 1 /* has setlogin(2) */
+# define HASUNAME 1 /* has uname(2) syscall */
+# define HASSTRERROR 1 /* has strerror(3) */
+# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
+# include <sys/cdefs.h>
+# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR /* has sa_len */
+# define NETLINK 1 /* supports AF_LINK */
+# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
+# ifndef LA_TYPE
+# define LA_TYPE LA_SUBR
+# endif /* ! LA_TYPE */
+# define GIDSET_T gid_t
+# define QUAD_T quad_t
+# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
+ /* version 1.1 or later */
+# undef SPT_TYPE
+# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
+# else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
+ /* version 1.0 or earlier */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
+# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 /* on 3.x */
+# define HASSETUSERCONTEXT 1 /* has setusercontext */
+# endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
+# if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 /* 3.1 and earlier */
+# define MODE_T int /* va_arg() can't handle less than int */
+# endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
+# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 /* on 4.x */
+# define HASURANDOMDEV 1 /* has /dev/urandom(4) */
+# endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
+# endif /* __bsdi__ */
+
+
+/*
+** QNX 4.2x
+** Contributed by Glen McCready <glen@qnx.com>.
+**
+** Should work with all versions of QNX.
+*/
+
+# if defined(__QNX__)
+# include <unix.h>
+# include <sys/select.h>
+# undef NGROUPS_MAX
+# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define HASSTRERROR 1 /* has strerror(3) */
+# define HASFLOCK 0
+# undef HASINITGROUPS /* has initgroups(3) call */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define IP_SRCROUTE 1 /* can check IP source routing */
+# define TZ_TYPE TZ_TMNAME /* use tmname variable */
+# define GIDSET_T gid_t
+# define LA_TYPE LA_ZERO
+# define SFS_TYPE SFS_NONE
+# define SPT_TYPE SPT_REUSEARGV
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# define HASGETUSERSHELL 0
+# define E_PSEUDOBASE 512
+# define _FILE_H_INCLUDED
+# endif /* defined(__QNX__) */
+
+
+/*
+** FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
+**
+** 4.3BSD clone, closer to 4.4BSD for FreeBSD 1.x and NetBSD 0.9x
+** 4.4BSD-Lite based for FreeBSD 2.x and NetBSD 1.x
+**
+** See also BSD defines.
+*/
+
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# include <paths.h>
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASFCHOWN 1 /* fchown(2) */
+# define HASUNAME 1 /* has uname(2) syscall */
+# define HASSTRERROR 1 /* has strerror(3) */
+# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
+# define NEED_PRINTF_PERCENTQ 1 /* doesn't have %lld */
+# include <sys/cdefs.h>
+# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR /* has sa_len */
+# define NETLINK 1 /* supports AF_LINK */
+# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
+# define GIDSET_T gid_t
+# define QUAD_T unsigned long long
+# ifndef LA_TYPE
+# define LA_TYPE LA_SUBR
+# endif /* ! LA_TYPE */
+# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
+# if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
+# undef SPT_TYPE
+# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
+# endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
+# if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
+# define HASURANDOMDEV 1 /* has /dev/urandom(4) */
+# endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
+# if defined(__FreeBSD__)
+# define HASSETLOGIN 1 /* has setlogin(2) */
+# if __FreeBSD_version >= 227001
+# define HASSRANDOMDEV 1 /* has srandomdev(3) */
+# define HASURANDOMDEV 1 /* has /dev/urandom(4) */
+# endif /* __FreeBSD_version >= 227001 */
+# undef SPT_TYPE
+# if __FreeBSD__ >= 2
+# include <osreldate.h>
+# if __FreeBSD_version >= 199512 /* 2.2-current when it appeared */
+# include <libutil.h>
+# define SPT_TYPE SPT_BUILTIN
+# endif /* __FreeBSD_version >= 199512 */
+# if __FreeBSD_version >= 222000 /* 2.2.2-release and later */
+# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */
+# endif /* __FreeBSD_version >= 222000 */
+# if __FreeBSD_version >= 330000 /* 3.3.0-release and later */
+# define SMRSH_CMDDIR "/usr/libexec/sm.bin"
+# define SMRSH_PATH "/bin:/usr/bin"
+# endif /* __FreeBSD_version >= 330000 */
+# define USESYSCTL 1 /* use sysctl(3) for getting ncpus */
+# include <sys/sysctl.h>
+# endif /* __FreeBSD__ >= 2 */
+# ifndef SPT_TYPE
+# define SPT_TYPE SPT_REUSEARGV
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# endif /* ! SPT_TYPE */
+# endif /* defined(__FreeBSD__) */
+# if defined(__OpenBSD__)
+# undef SPT_TYPE
+# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
+# define HASSETLOGIN 1 /* has setlogin(2) */
+# define HASSETREUID 0 /* OpenBSD has broken setreuid(2) emulation */
+# define HASSETEGID 1 /* use setegid(2) to set saved gid */
+# define HASURANDOMDEV 1 /* has /dev/urandom(4) */
+# if OpenBSD >= 200006
+# define HASSRANDOMDEV 1 /* has srandomdev(3) */
+# endif /* OpenBSD >= 200006 */
+# if OpenBSD >= 200012
+# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */
+# endif /* OpenBSD >= 200012 */
+# endif /* defined(__OpenBSD__) */
+# endif /* defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
+
+
+/*
+** Mach386
+**
+** For mt Xinu's Mach386 system.
+*/
+
+# if defined(MACH) && defined(i386) && !defined(__GNU__)
+# define MACH386 1
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define NEEDSTRTOL 1 /* need the strtol() function */
+# define setpgid setpgrp
+# ifndef LA_TYPE
+# define LA_TYPE LA_FLOAT
+# endif /* ! LA_TYPE */
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# undef HASSETVBUF /* don't actually have setvbuf(3) */
+# undef WEXITSTATUS
+# undef WIFEXITED
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
+
+
+
+/*
+** GNU OS (hurd)
+** Largely BSD & posix compatible.
+** Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
+** Updated by Mark Kettenis <kettenis@wins.uva.nl>.
+*/
+
+# if defined(__GNU__) && !defined(NeXT)
+# include <paths.h>
+# define HASFCHMOD 1 /* has fchmod(2) call */
+# define HASFCHOWN 1 /* has fchown(2) call */
+# define HASUNAME 1 /* has uname(2) call */
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
+# define HASSTRERROR 1 /* has strerror(3) */
+# define GIDSET_T gid_t
+# define SOCKADDR_LEN_T socklen_t
+# define SOCKOPT_LEN_T socklen_t
+# if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
+# define LA_TYPE LA_SUBR
+# else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
+# define LA_TYPE LA_MACH
+ /* GNU uses mach[34], which renames some rpcs from mach2.x. */
+# define host_self mach_host_self
+# endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
+# define SFS_TYPE SFS_STATFS
+# define SPT_TYPE SPT_CHANGEARGV
+# define ERRLIST_PREDEFINED 1 /* don't declare sys_errlist */
+# define BSD4_4_SOCKADDR 1 /* has sa_len */
+# define SIOCGIFCONF_IS_BROKEN 1 /* SIOCGFCONF doesn't work */
+# define HAS_IN_H 1 /* GNU has netinet/in.h. */
+/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
+# define MAXPATHLEN 2048
+# endif /* defined(__GNU__) && !defined(NeXT) */
+
+/*
+** 4.3 BSD -- this is for very old systems
+**
+** Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
+**
+** You'll also have to install a new resolver library.
+** I don't guarantee that support for this environment is complete.
+*/
+
+# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
+# define NEEDVPRINTF 1 /* need a replacement for vprintf(3) */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define ARBPTR_T char *
+# define setpgid setpgrp
+# ifndef LA_TYPE
+# define LA_TYPE LA_FLOAT
+# endif /* ! LA_TYPE */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# undef WEXITSTATUS
+# undef WIFEXITED
+typedef short pid_t;
+# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
+
+
+/*
+** SCO Unix
+**
+** This includes three parts:
+**
+** The first is for SCO OpenServer 5.
+** (Contributed by Keith Reynolds <keithr@sco.COM>).
+**
+** SCO OpenServer 5 has a compiler version number macro,
+** which we can use to figure out what version we're on.
+** This may have to change in future releases.
+**
+** The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
+** (Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
+**
+** The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
+*/
+
+/* SCO OpenServer 5 */
+# if _SCO_DS >= 1
+# include <paths.h>
+# define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM returns bogus value */
+# define HASFCHMOD 1 /* has fchmod(2) call */
+# define HASFCHOWN 1 /* has fchown(2) call */
+# define HASSETRLIMIT 1 /* has setrlimit(2) call */
+# define USESETEUID 1 /* has seteuid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
+# define RLIMIT_NEEDS_SYS_TIME_H 1
+# define LDA_USE_LOCKF 1
+# ifndef LA_TYPE
+# define LA_TYPE LA_DEVSHORT
+# endif /* ! LA_TYPE */
+# define _PATH_AVENRUN "/dev/table/avenrun"
+# ifndef _SCO_unix_4_2
+# define _SCO_unix_4_2
+# else /* ! _SCO_unix_4_2 */
+# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
+# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
+# endif /* ! _SCO_unix_4_2 */
+# endif /* _SCO_DS >= 1 */
+
+/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
+# ifdef _SCO_unix_4_2
+# define _SCO_unix_
+# define HASSETREUID 1 /* has setreuid(2) call */
+# endif /* _SCO_unix_4_2 */
+
+/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
+# ifdef _SCO_unix_
+# include <sys/stream.h> /* needed for IP_SRCROUTE */
+# define SYSTEM5 1 /* include all the System V defines */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define NOFTRUNCATE 0 /* has (simulated) ftruncate call */
+# ifndef USE_SIGLONGJMP
+# define USE_SIGLONGJMP 1 /* sigsetjmp needed for signal handling */
+# endif /* ! USE_SIGLONGJMP */
+# define MAXPATHLEN PATHSIZE
+# define SFS_TYPE SFS_4ARGS /* use <sys/statfs.h> 4-arg impl */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define SPT_TYPE SPT_SCO /* write kernel u. area */
+# define TZ_TYPE TZ_TM_NAME /* use tm->tm_name */
+# define UID_T uid_t
+# define GID_T gid_t
+# define GIDSET_T gid_t
+# define _PATH_UNIX "/unix"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+
+/* stuff fixed in later releases */
+# ifndef _SCO_unix_4_2
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# endif /* ! _SCO_unix_4_2 */
+
+# ifndef _SCO_DS
+# define ftruncate chsize /* use chsize(2) to emulate ftruncate */
+# define NEEDFSYNC 1 /* needs the fsync(2) call stub */
+# define NETUNIX 0 /* no unix domain socket support */
+# define LA_TYPE LA_SHORT
+# endif /* ! _SCO_DS */
+
+# endif /* _SCO_unix_ */
+
+/*
+** ISC (SunSoft) Unix.
+**
+** Contributed by J.J. Bailey <jjb@jagware.bcc.com>
+*/
+
+# ifdef ISC_UNIX
+# include <net/errno.h>
+# include <sys/stream.h> /* needed for IP_SRCROUTE */
+# include <sys/bsdtypes.h>
+# define SYSTEM5 1 /* include all the System V defines */
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define NEEDFSYNC 1 /* needs the fsync(2) call stub */
+# define NETUNIX 0 /* no unix domain socket support */
+# define MAXPATHLEN 1024
+# define LA_TYPE LA_SHORT
+# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define _PATH_UNIX "/unix"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# endif /* ISC_UNIX */
+
+
+/*
+** Altos System V (5.3.1)
+** Contributed by Tim Rice <tim@trr.metro.net>.
+*/
+
+# ifdef ALTOS_SYSTEM_V
+# include <sys/stream.h>
+# include <limits.h>
+# define SYSTEM5 1 /* include all the System V defines */
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+# define NEEDFSYNC 1 /* no fsync(2) in system library */
+# define NEEDSTRSTR 1 /* need emulation of the strstr(3) call */
+# define NOFTRUNCATE 1 /* do not have ftruncate(2) */
+# define MAXPATHLEN PATH_MAX
+# define LA_TYPE LA_SHORT
+# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
+# define NETUNIX 0 /* no unix domain socket support */
+# undef WIFEXITED
+# undef WEXITSTATUS
+# define strtoul strtol /* gcc library bogosity */
+
+typedef unsigned short uid_t;
+typedef unsigned short gid_t;
+typedef short pid_t;
+typedef unsigned long mode_t;
+
+/* some stuff that should have been in the include files */
+extern char *malloc();
+extern struct passwd *getpwent();
+extern struct passwd *getpwnam();
+extern struct passwd *getpwuid();
+extern char *getenv();
+extern struct group *getgrgid();
+extern struct group *getgrnam();
+
+# endif /* ALTOS_SYSTEM_V */
+
+
+/*
+** ConvexOS 11.0 and later
+**
+** "Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
+** works on 9.1 as well.
+**
+** ConvexOS 11.5 and later, should work on 11.0 as defined.
+** For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
+**
+** Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
+** (now the CONVEX Technologies Center of Hewlett Packard)
+*/
+
+# ifdef _CONVEX_SOURCE
+# define HASGETDTABLESIZE 1 /* has getdtablesize(2) */
+# define HASINITGROUPS 1 /* has initgroups(3) */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASSETSID 1 /* has POSIX setsid(2) call */
+# define HASUNSETENV 1 /* has unsetenv(3) */
+# define HASFLOCK 1 /* has flock(2) */
+# define HASSETRLIMIT 1 /* has setrlimit(2) */
+# define HASSETREUID 1 /* has setreuid(2) */
+# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_error=0 */
+# define NEEDPUTENV 1 /* needs putenv (written in terms of setenv) */
+# define SM_CONF_GETOPT 1 /* need a replacement for getopt(3) */
+# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
+# define LA_TYPE LA_FLOAT
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef S_IREAD
+# define S_IREAD _S_IREAD
+# define S_IWRITE _S_IWRITE
+# define S_IEXEC _S_IEXEC
+# define S_IFMT _S_IFMT
+# define S_IFCHR _S_IFCHR
+# define S_IFBLK _S_IFBLK
+# endif /* ! S_IREAD */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_TIMEZONE
+# endif /* ! TZ_TYPE */
+# ifndef IDENTPROTO
+# define IDENTPROTO 1
+# endif /* ! IDENTPROTO */
+# ifndef SHARE_V1
+# define SHARE_V1 1 /* version 1 of the fair share scheduler */
+# endif /* ! SHARE_V1 */
+# if !defined(__GNUC__ )
+# define UID_T int /* GNUC gets it right, ConvexC botches */
+# define GID_T int /* GNUC gets it right, ConvexC botches */
+# endif /* !defined(__GNUC__ ) */
+# if SECUREWARE
+# define FORK fork /* SecureWare wants the real fork! */
+# else /* SECUREWARE */
+# define FORK vfork /* the rest of the OS versions don't care */
+# endif /* SECUREWARE */
+# endif /* _CONVEX_SOURCE */
+
+
+/*
+** RISC/os 4.52
+**
+** Gives a ton of warning messages, but otherwise compiles.
+*/
+
+# ifdef RISCOS
+
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define NEEDPUTENV 1 /* need putenv(3) call */
+# define NEEDSTRSTR 1 /* need emulation of the strstr(3) call */
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# define LA_TYPE LA_INT
+# define LA_AVENRUN "avenrun"
+# define _PATH_UNIX "/unix"
+# undef WIFEXITED
+
+# define setpgid setpgrp
+
+typedef int pid_t;
+# define SIGFUNC_DEFINED
+# define SIGFUNC_RETURN (0)
+# define SIGFUNC_DECL int
+typedef int (*sigfunc_t)();
+extern char *getenv();
+extern void *malloc();
+
+/* added for RISC/os 4.01...which is dumber than 4.50 */
+# ifdef RISCOS_4_0
+# ifndef ARBPTR_T
+# define ARBPTR_T char *
+# endif /* ! ARBPTR_T */
+# undef HASFLOCK
+# define HASFLOCK 0
+# endif /* RISCOS_4_0 */
+
+# include <sys/time.h>
+
+# endif /* RISCOS */
+
+
+/*
+** Linux 0.99pl10 and above...
+**
+** Thanks to, in reverse order of contact:
+**
+** John Kennedy <warlock@csuchico.edu>
+** Andrew Pam <avatar@aus.xanadu.com>
+** Florian La Roche <rzsfl@rz.uni-sb.de>
+** Karl London <karl@borg.demon.co.uk>
+**
+** Last compiled against: [07/21/98 @ 11:47:34 AM (Tuesday)]
+** sendmail 8.9.1 bind-8.1.2 db-2.4.14
+** gcc-2.8.1 glibc-2.0.94 linux-2.1.109
+**
+** NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
+** file locking is no longer allowed. In particular, make sure
+** your DBM library and sendmail are both using either flock(2)
+** *or* fcntl(2) file locking, but not both.
+*/
+
+# ifdef __linux__
+# include <linux/version.h>
+# if !defined(KERNEL_VERSION) /* not defined in 2.0.x kernel series */
+# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+# endif /* !defined(KERNEL_VERSION) */
+# define BSD 1 /* include BSD defines */
+# define HASSETREGID 1 /* use setregid(2) to set saved gid */
+# ifndef REQUIRES_DIR_FSYNC
+# define REQUIRES_DIR_FSYNC 1 /* requires fsync() on directory */
+# endif /* REQUIRES_DIR_FSYNC */
+# ifndef USESETEUID
+# define USESETEUID 0 /* has it due to POSIX, but doesn't work */
+# endif /* USESETEUID */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASUNSETENV 1 /* has unsetenv(3) call */
+# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
+# define GIDSET_T gid_t /* from <linux/types.h> */
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* getusershell(3) broken in Slackware 2.0 */
+# endif /* HASGETUSERSHELL */
+# ifndef IP_SRCROUTE
+# define IP_SRCROUTE 0 /* linux <= 1.2.8 doesn't support IP_OPTIONS */
+# endif /* ! IP_SRCROUTE */
+# ifndef HAS_IN_H
+# define HAS_IN_H 1 /* use netinet/in.h */
+# endif /* ! HAS_IN_H */
+# ifndef USE_SIGLONGJMP
+# define USE_SIGLONGJMP 1 /* sigsetjmp needed for signal handling */
+# endif /* ! USE_SIGLONGJMP */
+# ifndef HASFLOCK
+# if LINUX_VERSION_CODE < 66399
+# define HASFLOCK 0 /* flock(2) is broken after 0.99.13 */
+# else /* LINUX_VERSION_CODE < 66399 */
+# define HASFLOCK 1 /* flock(2) fixed after 1.3.95 */
+# endif /* LINUX_VERSION_CODE < 66399 */
+# endif /* ! HASFLOCK */
+# ifndef LA_TYPE
+# define LA_TYPE LA_PROCSTR
+# endif /* ! LA_TYPE */
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() impl */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
+# ifndef HASURANDOMDEV
+# define HASURANDOMDEV 1 /* 2.0 (at least) has linux/drivers/char/random.c */
+# endif /* ! HASURANDOMDEV */
+# endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_NONE /* no standard for Linux */
+# endif /* ! TZ_TYPE */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# include <sys/sysmacros.h>
+# undef atol /* wounded in <stdlib.h> */
+# if NETINET6
+ /*
+ ** Linux doesn't have a good way to tell userland what interfaces are
+ ** IPv6-capable. Therefore, the BIND resolver can not determine if there
+ ** are IPv6 interfaces to honor AI_ADDRCONFIG. Unfortunately, it assumes
+ ** that none are present. (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
+ */
+# define ADDRCONFIG_IS_BROKEN 1
+
+ /*
+ ** Indirectly included from glibc's <feature.h>. IPv6 support is native
+ ** in 2.1 and later, but the APIs appear before the functions.
+ */
+# if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
+# define HASSTRERROR 1 /* has strerror(3) */
+# define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
+# if (GLIBC_VERSION >= 0x201)
+# undef IPPROTO_ICMPV6 /* linux #defines, glibc enums */
+# else /* (GLIBC_VERSION >= 0x201) */
+# include <linux/in6.h> /* IPv6 support */
+# endif /* (GLIBC_VERSION >= 0x201) */
+# if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
+ /* Have APIs in <netdb.h>, but no support in glibc */
+# define NEEDSGETIPNODE 1
+# endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
+# undef GLIBC_VERSION
+# endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
+# endif /* NETINET6 */
+# ifndef HASFCHOWN
+# define HASFCHOWN 1 /* fchown(2) */
+# endif /* ! HASFCHOWN */
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
+# define HASFCHMOD 1 /* fchmod(2) */
+# endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
+# endif /* __linux__ */
+
+
+/*
+** DELL SVR4 Issue 2.2, and others
+** From Kimmo Suominen <kim@grendel.lut.fi>
+**
+** It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
+** defined, and the definitions conflict.
+**
+** Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
+** trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
+** (SVR4.0/386 version 3.0).
+*/
+
+# ifdef DELL_SVR4
+ /* no changes necessary */
+ /* see general __svr4__ defines below */
+# endif /* DELL_SVR4 */
+
+
+/*
+** Apple A/UX 3.0
+*/
+
+# ifdef _AUX_SOURCE
+# include <sys/sysmacros.h>
+# define BSD /* has BSD routines */
+# define HASSETRLIMIT 0 /* ... but not setrlimit(2) */
+# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
+# define BOGUS_O_EXCL 1 /* exclusive open follows symlinks */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASSETVBUF 1 /* has setvbuf(3) in libc */
+# define HASSTRERROR 1 /* has strerror(3) */
+# define SIGFUNC_DEFINED /* sigfunc_t already defined */
+# define SIGFUNC_RETURN /* POSIX-mode */
+# define SIGFUNC_DECL void /* POSIX-mode */
+# define ERRLIST_PREDEFINED 1
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# ifndef LA_TYPE
+# define LA_TYPE LA_INT
+# define FSHIFT 16
+# endif /* ! LA_TYPE */
+# define LA_AVENRUN "avenrun"
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# define TZ_TYPE TZ_TZNAME
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/unix" /* should be in <paths.h> */
+# endif /* ! _PATH_UNIX */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# undef WIFEXITED
+# undef WEXITSTATUS
+# endif /* _AUX_SOURCE */
+
+
+/*
+** Encore UMAX V
+**
+** Not extensively tested.
+*/
+
+# ifdef UMAXV
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */
+# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
+# define MAXPATHLEN PATH_MAX
+extern struct passwd *getpwent(), *getpwnam(), *getpwuid();
+extern struct group *getgrent(), *getgrnam(), *getgrgid();
+# undef WIFEXITED
+# undef WEXITSTATUS
+# endif /* UMAXV */
+
+
+/*
+** Stardent Titan 3000 running TitanOS 4.2.
+**
+** Must be compiled in "cc -43" mode.
+**
+** From Kate Hedstrom <kate@ahab.rutgers.edu>.
+**
+** Note the tweaking below after the BSD defines are set.
+*/
+
+# ifdef titan
+# define setpgid setpgrp
+typedef int pid_t;
+# undef WIFEXITED
+# undef WEXITSTATUS
+# endif /* titan */
+
+
+/*
+** Sequent DYNIX 3.2.0
+**
+** From Jim Davis <jdavis@cs.arizona.edu>.
+*/
+
+# ifdef sequent
+
+# define BSD 1
+# define HASUNSETENV 1
+# define BSD4_3 1 /* to get signal() in conf.c */
+# define WAITUNION 1
+# define LA_TYPE LA_FLOAT
+# ifdef _POSIX_VERSION
+# undef _POSIX_VERSION /* set in <unistd.h> */
+# endif /* _POSIX_VERSION */
+# undef HASSETVBUF /* don't actually have setvbuf(3) */
+# define setpgid setpgrp
+
+/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
+# undef WIFEXITED
+# define WIFEXITED(s) (((union wait*)&(s))->w_stopval != WSTOPPED && \
+ ((union wait*)&(s))->w_termsig == 0)
+# define WEXITSTATUS(s) (((union wait*)&(s))->w_retcode)
+typedef int pid_t;
+# define isgraph(c) (isprint(c) && (c != ' '))
+
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/dynix"
+# endif /* ! _PATH_UNIX */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# endif /* sequent */
+
+
+/*
+** Sequent DYNIX/ptx v2.0 (and higher)
+**
+** For DYNIX/ptx v1.x, undefine HASSETREUID.
+**
+** From Tim Wright <timw@sequent.com>.
+** Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
+** for DYNIX/ptx 4.0.2.
+*/
+
+# ifdef _SEQUENT_
+# include <sys/stream.h>
+# define SYSTEM5 1 /* include all the System V defines */
+# define HASSETSID 1 /* has POSIX setsid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define GIDSET_T gid_t
+# define LA_TYPE LA_INT
+# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
+# define SPT_TYPE SPT_NONE /* don't use setproctitle */
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# endif /* _SEQUENT_ */
+
+
+/*
+** Cray Unicos
+**
+** Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
+*/
+
+# ifdef UNICOS
+# define SYSTEM5 1 /* include all the System V defines */
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# define MAXPATHLEN PATHSIZE
+# define LA_TYPE LA_ZERO
+# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# endif /* UNICOS */
+
+
+/*
+** Apollo DomainOS
+**
+** From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
+**
+** 15 Jan 1994; updated 2 Aug 1995
+**
+*/
+
+# ifdef apollo
+# define HASSETREUID 1 /* has setreuid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(2) call */
+# define IP_SRCROUTE 0 /* does not have <netinet/ip_var.h> */
+# define SPT_TYPE SPT_NONE /* don't use setproctitle */
+# define LA_TYPE LA_SUBR /* use getloadavg.c */
+# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define TZ_TYPE TZ_TZNAME
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# undef S_IFSOCK /* S_IFSOCK and S_IFIFO are the same */
+# undef S_IFIFO
+# define S_IFIFO 0010000
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# define RLIMIT_NEEDS_SYS_TIME_H 1
+# if defined(NGROUPS_MAX) && !NGROUPS_MAX
+# undef NGROUPS_MAX
+# endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
+# endif /* apollo */
+
+/*
+** MPE-iX
+**
+** Requires MPE 6.0 or greater. See sendmail/README for more info.
+**
+** From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
+*/
+
+# ifdef MPE
+
+# include <sys/sysmacros.h>
+# include <fcntl.h>
+
+/* Sendmail stuff */
+# define HASFCHOWN 0 /* lacks fchown() */
+# define HASGETUSERSHELL 0 /* lacks getusershell() */
+# ifdef HASNICE
+# undef HASNICE
+# endif /* HASNICE */
+# define HASNICE 0 /* lacks nice() */
+# define HASRANDOM 0 /* lacks random() */
+# ifdef HASRRESVPORT
+# undef HASRRESVPORT
+# endif /* HASRRESVPORT */
+# define HASRRESVPORT 0 /* lacks rresvport() */
+# define IP_SRCROUTE 0 /* lacks IP source routing fields */
+# ifdef MATCHGECOS
+# undef MATCHGECOS
+# endif /* MATCHGECOS */
+# define MATCHGECOS 0 /* lacks an initialized GECOS field */
+# define NEEDFSYNC 1 /* use sendmail's fsync() */
+# define NEEDLINK 1 /* use sendmail's link() */
+# define NOFTRUNCATE 1 /* lacks ftruncate() */
+# define SFS_TYPE SFS_NONE /* can't determine disk space */
+# define SM_CONF_SYSLOG 0 /* use sendmail decl of syslog() */
+# define USE_DOUBLE_FORK 0 /* don't fork an intermediate zombie */
+# define USE_ENVIRON 1 /* use environ instead of envp */
+
+/* Missing header stuff */
+# define AF_UNSPEC 0
+# define AF_MAX AF_INET
+# define IFF_LOOPBACK 0x8
+# define IN_LOOPBACKNET 127
+# define MAXNAMLEN NAME_MAX
+# define S_IEXEC S_IXUSR
+# define S_IREAD S_IRUSR
+# define S_IWRITE S_IWUSR
+
+/* Present header stuff that needs to be missing */
+# undef NGROUPS_MAX
+
+/* Shadow functions */
+# define bind sendmail_mpe_bind
+# define _exit sendmail_mpe__exit
+# define exit sendmail_mpe_exit
+# define fcntl sendmail_mpe_fcntl
+# define getegid sendmail_mpe_getegid
+# define geteuid sendmail_mpe_geteuid
+# define getpwnam sendmail_mpe_getpwnam
+# define getpwuid sendmail_mpe_getpwuid
+# define setgid sendmail_mpe_setgid
+# define setuid sendmail_mpe_setuid
+extern int sendmail_mpe_fcntl __P((int, int, ...));
+extern struct passwd * sendmail_mpe_getpwnam __P((const char *));
+extern struct passwd * sendmail_mpe_getpwuid __P((uid_t));
+# endif /* MPE */
+
+/*
+** System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
+**
+** Contributed by Paul Gampe <paulg@apnic.net>
+*/
+
+# ifdef __svr5__
+# include <sys/mkdev.h>
+# define __svr4__
+# define SYS5SIGNALS 1
+# define HASFCHOWN 1 /* has fchown(2) call */
+# define HASSETSID 1
+# define HASSETREUID 1
+# define HASWAITPID 1
+# define HASGETDTABLESIZE 1
+# define GIDSET_T gid_t
+# define SOCKADDR_LEN_T size_t
+# define SOCKOPT_LEN_T size_t
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/stand/unix"
+# endif /* ! _PATH_UNIX */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 1024 /* unsure */
+# endif /* ! SYSLOG_BUFSIZE */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/etc/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
+#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
+# define SM_SET_H_ERRNO(err) set_h_errno((err))
+#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
+# endif /* __svr5__ */
+
+/* ###################################################################### */
+
+/*
+** UnixWare 2.x
+*/
+
+# ifdef UNIXWARE2
+# define UNIXWARE 1
+# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
+# endif /* UNIXWARE2 */
+
+
+/*
+** UnixWare 1.1.2.
+**
+** Updated by Petr Lampa <lampa@fee.vutbr.cz>.
+** From Evan Champion <evanc@spatial.synapse.org>.
+*/
+
+# ifdef UNIXWARE
+# include <sys/mkdev.h>
+# define SYSTEM5 1
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# define HASSETREUID 1
+# define HASSETSID 1
+# define HASINITGROUPS 1
+# define GIDSET_T gid_t
+# define SLEEP_T unsigned
+# define SFS_TYPE SFS_STATVFS
+# define LA_TYPE LA_ZERO
+# undef WIFEXITED
+# undef WEXITSTATUS
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/unix"
+# endif /* ! _PATH_UNIX */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# define SYSLOG_BUFSIZE 128
+# endif /* UNIXWARE */
+
+
+/*
+** Intergraph CLIX 3.1
+**
+** From Paul Southworth <pauls@locust.cic.net>
+*/
+
+# ifdef CLIX
+# define SYSTEM5 1 /* looks like System V */
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# endif /* ! HASGETUSERSHELL */
+# define DEV_BSIZE 512 /* device block size not defined */
+# define GIDSET_T gid_t
+# undef LOG /* syslog not available */
+# define NEEDFSYNC 1 /* no fsync in system library */
+# define GETSHORT _getshort
+# endif /* CLIX */
+
+
+/*
+** NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
+**
+** From Kevin Darcy <kevin@tech.mis.cfc.com>.
+*/
+
+# ifdef NCR_MP_RAS2
+# include <sys/sockio.h>
+# define __svr4__
+# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
+# define SYSLOG_BUFSIZE 1024
+# define SPT_TYPE SPT_NONE
+# endif /* NCR_MP_RAS2 */
+
+
+/*
+** NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
+**
+** From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
+*/
+
+# ifdef NCR_MP_RAS3
+# define __svr4__
+# define HASFCHOWN 1 /* has fchown(2) call */
+# define LDA_USE_LOCKF 1
+# define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM has non-std interface */
+# define SO_REUSEADDR_IS_BROKEN 1 /* doesn't work if accept() fails */
+# define SYSLOG_BUFSIZE 1024
+# define SPT_TYPE SPT_NONE
+# define _PATH_MAILDIR "/var/mail"
+# ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE
+# define _XOPEN_SOURCE_EXTENDED 1
+# include <sys/resource.h>
+# undef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE_EXTENDED
+# endif /* ! _XOPEN_SOURCE */
+# endif /* NCR_MP_RAS3 */
+
+
+/*
+** Tandem NonStop-UX SVR4
+**
+** From Rick McCarty <mccarty@mpd.tandem.com>.
+*/
+
+# ifdef NonStop_UX_BXX
+# define __svr4__
+# endif /* NonStop_UX_BXX */
+
+
+/*
+** Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
+**
+** Tested for 1.04, 1.03
+** From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
+**
+** Tested for 4.02, 6.10 and 7.10
+** From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
+*/
+
+# if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
+# define SYSTEM5 1 /* include all the System V defines */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define setreuid(r, e) setresuid(r, e, -1)
+# define LA_TYPE LA_FLOAT
+# define SPT_TYPE SPT_PSTAT
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# ifndef HASSETVBUF
+# define HASSETVBUF /* HI-UX has no setlinebuf */
+# endif /* ! HASSETVBUF */
+# ifndef GIDSET_T
+# define GIDSET_T gid_t
+# endif /* ! GIDSET_T */
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/HI-UX"
+# endif /* ! _PATH_UNIX */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps */
+# endif /* ! HASGETUSERSHELL */
+# define FDSET_CAST (int *) /* cast for fd_set parameters to select */
+
+/*
+** avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
+** on HIUX 3050
+*/
+# undef m_flags
+
+# define SM_CONF_SYSLOG 0
+
+# endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
+
+
+/*
+** Amdahl UTS System V 2.1.5 (SVr3-based)
+**
+** From: Janet Jackson <janet@dialix.oz.au>.
+*/
+
+# ifdef _UTS
+# include <sys/sysmacros.h>
+# undef HASLSTAT /* has symlinks, but they cause problems */
+# define NEEDFSYNC 1 /* system fsync(2) fails on non-EFS filesys */
+# define SYS5SIGNALS 1 /* System V signal semantics */
+# define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define HASINITGROUPS 1 /* has initgroups(3) function */
+# define HASSETVBUF 1 /* has setvbuf(3) function */
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) function */
+# endif /* ! HASGETUSERSHELL */
+# define GIDSET_T gid_t /* type of 2nd arg to getgroups(2) isn't int */
+# define LA_TYPE LA_ZERO /* doesn't have load average */
+# define SFS_TYPE SFS_4ARGS /* use 4-arg statfs() */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define _PATH_UNIX "/unix"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# endif /* _UTS */
+
+/*
+** Cray Computer Corporation's CSOS
+**
+** From Scott Bolte <scott@craycos.com>.
+*/
+
+# ifdef _CRAYCOM
+# define SYSTEM5 1 /* include all the System V defines */
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# define NEEDFSYNC 1 /* no fsync in system library */
+# define MAXPATHLEN PATHSIZE
+# define LA_TYPE LA_ZERO
+# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
+# define SFS_BAVAIL f_bfree /* alternate field name */
+# define _POSIX_CHOWN_RESTRICTED -1
+extern struct group *getgrent(), *getgrnam(), *getgrgid();
+# endif /* _CRAYCOM */
+
+
+/*
+** Sony NEWS-OS 4.2.1R and 6.0.3
+**
+** From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
+*/
+
+# ifdef sony_news
+# ifndef __svr4
+ /* NEWS-OS 4.2.1R */
+# ifndef BSD
+# define BSD /* has BSD routines */
+# endif /* ! BSD */
+# define HASUNSETENV 1 /* has unsetenv(2) call */
+# undef HASSETVBUF /* don't actually have setvbuf(3) */
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+# define LA_TYPE LA_INT
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# define setpgid setpgrp
+# undef WIFEXITED
+# undef WEXITSTATUS
+# define MODE_T int /* system include files have no mode_t */
+typedef int pid_t;
+typedef int (*sigfunc_t)();
+# define SIGFUNC_DEFINED
+# define SIGFUNC_RETURN (0)
+# define SIGFUNC_DECL int
+
+# else /* ! __svr4 */
+ /* NEWS-OS 6.0.3 with /bin/cc */
+# ifndef __svr4__
+# define __svr4__ /* use all System V Release 4 defines below */
+# endif /* ! __svr4__ */
+# define HASSETSID 1 /* has Posix setsid(2) call */
+# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
+# define LA_TYPE LA_READKSYM /* use MIOC_READKSYM ioctl */
+# ifndef SPT_TYPE
+# define SPT_TYPE SPT_SYSMIPS /* use sysmips() (OS 6.0.2 or later) */
+# endif /* ! SPT_TYPE */
+# define GIDSET_T gid_t
+# undef WIFEXITED
+# undef WEXITSTATUS
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 256
+# endif /* ! SYSLOG_BUFSIZE */
+# define _PATH_UNIX "/stand/unix"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+
+# endif /* ! __svr4 */
+# endif /* sony_news */
+
+
+/*
+** Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
+**
+** From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
+*/
+
+# ifdef luna
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# define HASUNSETENV 1 /* has unsetenv(2) call */
+# define NEEDPUTENV 1 /* need putenv(3) call */
+# define SM_CONF_GETOPT 0 /* need a replacement for getopt(3) */
+# define NEEDSTRSTR 1 /* need emulation of the strstr(3) call */
+# define WAITUNION 1 /* use "union wait" as wait argument type */
+# ifdef uniosb
+# include <sys/time.h>
+# define NEEDVPRINTF 1 /* need a replacement for vprintf(3) */
+# define LA_TYPE LA_INT
+# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone */
+# endif /* uniosb */
+# ifdef luna2
+# define LA_TYPE LA_SUBR
+# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone */
+# endif /* luna2 */
+# ifdef luna88k
+# define LA_TYPE LA_INT
+# endif /* luna88k */
+# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
+# define setpgid setpgrp
+# undef WIFEXITED
+# undef WEXITSTATUS
+typedef int pid_t;
+typedef int (*sigfunc_t)();
+# define SIGFUNC_DEFINED
+# define SIGFUNC_RETURN (0)
+# define SIGFUNC_DECL int
+extern char *getenv();
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# endif /* luna */
+
+
+/*
+** NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
+**
+** From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
+*/
+
+# if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
+# ifndef __svr4__
+# define __svr4__ /* use all System V Release 4 defines below */
+# endif /* ! __svr4__ */
+# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
+# define HASSETSID 1 /* has Posix setsid(2) call */
+# define LA_TYPE LA_READKSYM /* use MIOC_READSYM ioctl */
+# define SFS_TYPE SFS_USTAT /* use System V ustat(2) syscall */
+# define GIDSET_T gid_t
+# undef WIFEXITED
+# undef WEXITSTATUS
+# define NAMELISTMASK 0x7fffffff /* mask for nlist() values */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 1024 /* allow full size syslog buffer */
+# endif /* ! SYSLOG_BUFSIZE */
+# endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
+
+
+/*
+** Fujitsu/ICL UXP/DS (For the DS/90 Series)
+**
+** From Diego R. Lopez <drlopez@cica.es>.
+** Additional changes from Fumio Moriya and Toshiaki Nomura of the
+** Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
+*/
+
+# ifdef __uxp__
+# include <arpa/nameser.h>
+# include <sys/sysmacros.h>
+# include <sys/mkdev.h>
+# define __svr4__
+# define HASGETUSERSHELL 0
+# define HASFLOCK 0
+# define _PATH_UNIX "/stand/unix"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# endif /* __uxp__ */
+
+/*
+** Pyramid DC/OSx
+**
+** From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
+*/
+
+# ifdef DCOSx
+# define GIDSET_T gid_t
+# ifndef IDENTPROTO
+# define IDENTPROTO 0 /* TCP/IP implementation is broken */
+# endif /* ! IDENTPROTO */
+# endif /* DCOSx */
+
+/*
+** Concurrent Computer Corporation Maxion
+**
+** From Donald R. Laster Jr. <laster@access.digex.net>.
+*/
+
+# ifdef __MAXION__
+
+# include <sys/stream.h>
+# define __svr4__ 1 /* SVR4.2MP */
+# define HASSETREUID 1 /* have setreuid(2) */
+# define HASLSTAT 1 /* have lstat(2) */
+# define HASSETRLIMIT 1 /* have setrlimit(2) */
+# define HASGETDTABLESIZE 1 /* have getdtablesize(2) */
+# define HASGETUSERSHELL 1 /* have getusershell(3) */
+# define NOFTRUNCATE 1 /* do not have ftruncate(2) */
+# define SLEEP_T unsigned
+# define SFS_TYPE SFS_STATVFS
+# define SFS_BAVAIL f_bavail
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 256 /* Use 256 bytes */
+# endif /* ! SYSLOG_BUFSIZE */
+
+# undef WUNTRACED
+# undef WIFEXITED
+# undef WIFSIGNALED
+# undef WIFSTOPPED
+# undef WEXITSTATUS
+# undef WTERMSIG
+# undef WSTOPSIG
+
+# endif /* __MAXION__ */
+
+/*
+** Harris Nighthawk PowerUX (nh6000 box)
+**
+** Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
+*/
+
+# ifdef _PowerUX
+# ifndef __svr4__
+# define __svr4__
+# endif /* ! __svr4__ */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# define SYSLOG_BUFSIZE 1024
+# define LA_TYPE LA_ZERO
+typedef struct msgb mblk_t;
+# undef offsetof /* avoid stddefs.h and sys/sysmacros.h conflict */
+# endif /* _PowerUX */
+
+/*
+** Siemens Nixdorf Informationssysteme AG SINIX
+**
+** Contributed by Gerald Rinske of Siemens Business Services VAS.
+*/
+# ifdef sinix
+# define HASRANDOM 0 /* has random(3) */
+# define SYSLOG_BUFSIZE 1024
+# define SM_INT32 int /* 32bit integer */
+# endif /* sinix */
+
+/*
+** CRAY T3E
+**
+** Contributed by Manu Mahonen <mailadm@csc.fi>
+** of Center for Scientific Computing.
+*/
+# ifdef _CRAY
+# define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
+# define _PATH_MAILDIR "/usr/spool/mail"
+# if !defined(MAXPATHLEN)
+# define MAXPATHLEN PATHSIZE
+# endif /* !defined(MAXPATHLEN) */
+# endif /* _CRAY */
+
+/*
+** Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
+**
+** Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
+*/
+
+# ifdef MOTO
+# define HASFCHMOD 1
+# define HASSETRLIMIT 0
+# define HASSETSID 1
+# define HASSETREUID 1
+# define HASULIMIT 1
+# define HASWAITPID 1
+# define HASGETDTABLESIZE 1
+# define HASGETUSERSHELL 1
+# define IP_SRCROUTE 0
+# define IDENTPROTO 0
+# define RES_DNSRCH_VARIABLE _res_dnsrch
+# define _PATH_UNIX "/unix"
+# define _PATH_VENDOR_CF "/etc/sendmail.cf"
+# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
+# endif /* MOTO */
+
+
+/**********************************************************************
+** End of Per-Operating System defines
+**********************************************************************/
+/**********************************************************************
+** More general defines
+**********************************************************************/
+
+/* general BSD defines */
+# ifdef BSD
+# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
+# ifndef HASSETREUID
+# define HASSETREUID 1 /* has setreuid(2) call */
+# endif /* ! HASSETREUID */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# ifndef IP_SRCROUTE
+# define IP_SRCROUTE 1 /* can check IP source routing */
+# endif /* ! IP_SRCROUTE */
+# ifndef HASSETRLIMIT
+# define HASSETRLIMIT 1 /* has setrlimit(2) call */
+# endif /* ! HASSETRLIMIT */
+# ifndef HASFLOCK
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* ! HASFLOCK */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone variable */
+# endif /* ! TZ_TYPE */
+# endif /* BSD */
+
+/* general System V Release 4 defines */
+# ifdef __svr4__
+# define SYSTEM5 1
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# define HASINITGROUPS 1 /* has initgroups(3) call */
+# define BSD_COMP 1 /* get BSD ioctl calls */
+# ifndef HASSETRLIMIT
+# define HASSETRLIMIT 1 /* has setrlimit(2) call */
+# endif /* ! HASSETRLIMIT */
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
+# endif /* ! HASGETUSERSHELL */
+# ifndef HASFCHMOD
+# define HASFCHMOD 1 /* most (all?) SVr4s seem to have fchmod(2) */
+# endif /* ! HASFCHMOD */
+
+# ifndef _PATH_UNIX
+# define _PATH_UNIX "/unix"
+# endif /* ! _PATH_UNIX */
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
+# endif /* ! _PATH_VENDOR_CF */
+# ifndef _PATH_SENDMAILPID
+# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
+# endif /* ! _PATH_SENDMAILPID */
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 128
+# endif /* ! SYSLOG_BUFSIZE */
+# ifndef SFS_TYPE
+# define SFS_TYPE SFS_STATVFS
+# endif /* ! SFS_TYPE */
+
+# ifndef USE_SIGLONGJMP
+# define USE_SIGLONGJMP 1 /* sigsetjmp needed for signal handling */
+# endif /* ! USE_SIGLONGJMP */
+# endif /* __svr4__ */
+
+# ifdef __SVR4
+# define LDA_USE_LOCKF 1
+# define LDA_USE_SETEUID 1
+# define _PATH_MAILDIR "/var/mail"
+# endif /* __SVR4 */
+
+/* general System V defines */
+# ifdef SYSTEM5
+# include <sys/sysmacros.h>
+# define HASUNAME 1 /* use System V uname(2) system call */
+# define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */
+# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
+# ifndef HASULIMIT
+# define HASULIMIT 1 /* has the ulimit(2) syscall */
+# endif /* ! HASULIMIT */
+# ifndef LA_TYPE
+# ifdef MIOC_READKSYM
+# define LA_TYPE LA_READKSYM /* use MIOC_READKSYM ioctl */
+# else /* MIOC_READKSYM */
+# define LA_TYPE LA_INT /* assume integer load average */
+# endif /* MIOC_READKSYM */
+# endif /* ! LA_TYPE */
+# ifndef SFS_TYPE
+# define SFS_TYPE SFS_USTAT /* use System V ustat(2) syscall */
+# endif /* ! SFS_TYPE */
+# ifndef TZ_TYPE
+# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
+# endif /* ! TZ_TYPE */
+# endif /* SYSTEM5 */
+
+/* general POSIX defines */
+# ifdef _POSIX_VERSION
+# define HASSETSID 1 /* has Posix setsid(2) call */
+# define HASWAITPID 1 /* has Posix waitpid(2) call */
+# if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
+# define USESETEUID 1 /* has usable seteuid(2) call */
+# endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
+# endif /* _POSIX_VERSION */
+/*
+** Tweaking for systems that (for example) claim to be BSD or POSIX
+** but don't have all the standard BSD or POSIX routines (boo hiss).
+*/
+
+# ifdef titan
+# undef HASINITGROUPS /* doesn't have initgroups(3) call */
+# endif /* titan */
+
+# ifdef _CRAYCOM
+# undef HASSETSID /* despite POSIX claim, doesn't have setsid */
+# endif /* _CRAYCOM */
+
+# ifdef MOTO
+# undef USESETEUID
+# endif /* MOTO */
+
+/*
+** Due to a "feature" in some operating systems such as Ultrix 4.3 and
+** HPUX 8.0, if you receive a "No route to host" message (ICMP message
+** ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
+** are closed. Some firewalls return this error if you try to connect
+** to the IDENT port (113), so you can't receive email from these hosts
+** on these systems. The firewall really should use a more specific
+** message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB. If
+** not explicitly set to zero above, default it on.
+*/
+
+# ifndef IDENTPROTO
+# define IDENTPROTO 1 /* use IDENT proto (RFC 1413) */
+# endif /* ! IDENTPROTO */
+
+# ifndef IP_SRCROUTE
+# define IP_SRCROUTE 1 /* Detect IP source routing */
+# endif /* ! IP_SRCROUTE */
+
+# ifndef HASGETUSERSHELL
+# define HASGETUSERSHELL 1 /* libc has getusershell(3) call */
+# endif /* ! HASGETUSERSHELL */
+
+# ifndef NETUNIX
+# define NETUNIX 1 /* include unix domain support */
+# endif /* ! NETUNIX */
+
+# ifndef HASRANDOM
+# define HASRANDOM 1 /* has random(3) support */
+# endif /* ! HASRANDOM */
+
+# ifndef HASFLOCK
+# define HASFLOCK 0 /* assume no flock(2) support */
+# endif /* ! HASFLOCK */
+
+# ifndef HASSETREUID
+# define HASSETREUID 0 /* assume no setreuid(2) call */
+# endif /* ! HASSETREUID */
+
+# ifndef HASFCHMOD
+# define HASFCHMOD 0 /* assume no fchmod(2) syscall */
+# endif /* ! HASFCHMOD */
+
+# ifndef USESETEUID
+# define USESETEUID 0 /* assume no seteuid(2) call or no saved ids */
+# endif /* ! USESETEUID */
+
+# ifndef HASSETRLIMIT
+# define HASSETRLIMIT 0 /* assume no setrlimit(2) support */
+# endif /* ! HASSETRLIMIT */
+
+# ifndef HASULIMIT
+# define HASULIMIT 0 /* assume no ulimit(2) support */
+# endif /* ! HASULIMIT */
+
+# ifndef SECUREWARE
+# define SECUREWARE 0 /* assume no SecureWare C2 auditing hooks */
+# endif /* ! SECUREWARE */
+
+# ifndef USE_DOUBLE_FORK
+# define USE_DOUBLE_FORK 1 /* avoid intermediate zombies */
+# endif /* ! USE_DOUBLE_FORK */
+
+# ifndef USE_ENVIRON
+# define USE_ENVIRON 0 /* use main() envp instead of extern environ */
+# endif /* ! USE_ENVIRON */
+
+# ifndef USE_SIGLONGJMP
+# define USE_SIGLONGJMP 0 /* assume setjmp handles signals properly */
+# endif /* ! USE_SIGLONGJMP */
+
+# ifndef FDSET_CAST
+# define FDSET_CAST /* (empty) cast for fd_set arg to select */
+# endif /* ! FDSET_CAST */
+
+/*
+** Pick a mailer setuid method for changing the current uid
+*/
+
+# define USE_SETEUID 0
+# define USE_SETREUID 1
+# define USE_SETUID 2
+
+# if USESETEUID
+# define MAILER_SETUID_METHOD USE_SETEUID
+# else /* USESETEUID */
+# if HASSETREUID
+# define MAILER_SETUID_METHOD USE_SETREUID
+# else /* HASSETREUID */
+# define MAILER_SETUID_METHOD USE_SETUID
+# endif /* HASSETREUID */
+# endif /* USESETEUID */
+
+/*
+** If no type for argument two of getgroups call is defined, assume
+** it's an integer -- unfortunately, there seem to be several choices
+** here.
+*/
+
+# ifndef GIDSET_T
+# define GIDSET_T int
+# endif /* ! GIDSET_T */
+
+# ifndef UID_T
+# define UID_T uid_t
+# endif /* ! UID_T */
+
+# ifndef GID_T
+# define GID_T gid_t
+# endif /* ! GID_T */
+
+# ifndef MODE_T
+# define MODE_T mode_t
+# endif /* ! MODE_T */
+
+# ifndef ARGV_T
+# define ARGV_T char **
+# endif /* ! ARGV_T */
+
+# ifndef SOCKADDR_LEN_T
+# define SOCKADDR_LEN_T int
+# endif /* ! SOCKADDR_LEN_T */
+
+# ifndef SOCKOPT_LEN_T
+# define SOCKOPT_LEN_T int
+# endif /* ! SOCKOPT_LEN_T */
+
+# ifndef QUAD_T
+# define QUAD_T unsigned long
+# endif /* ! QUAD_T */
+/**********************************************************************
+** Remaining definitions should never have to be changed. They are
+** primarily to provide back compatibility for older systems -- for
+** example, it includes some POSIX compatibility definitions
+**********************************************************************/
+
+/* System 5 compatibility */
+# ifndef S_ISREG
+# define S_ISREG(foo) ((foo & S_IFMT) == S_IFREG)
+# endif /* ! S_ISREG */
+# ifndef S_ISDIR
+# define S_ISDIR(foo) ((foo & S_IFMT) == S_IFDIR)
+# endif /* ! S_ISDIR */
+# if !defined(S_ISLNK) && defined(S_IFLNK)
+# define S_ISLNK(foo) ((foo & S_IFMT) == S_IFLNK)
+# endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
+# if !defined(S_ISFIFO)
+# if defined(S_IFIFO)
+# define S_ISFIFO(foo) ((foo & S_IFMT) == S_IFIFO)
+# else /* defined(S_IFIFO) */
+# define S_ISFIFO(foo) false
+# endif /* defined(S_IFIFO) */
+# endif /* !defined(S_ISFIFO) */
+# ifndef S_IRUSR
+# define S_IRUSR 0400
+# endif /* ! S_IRUSR */
+# ifndef S_IWUSR
+# define S_IWUSR 0200
+# endif /* ! S_IWUSR */
+# ifndef S_IRGRP
+# define S_IRGRP 0040
+# endif /* ! S_IRGRP */
+# ifndef S_IWGRP
+# define S_IWGRP 0020
+# endif /* ! S_IWGRP */
+# ifndef S_IROTH
+# define S_IROTH 0004
+# endif /* ! S_IROTH */
+# ifndef S_IWOTH
+# define S_IWOTH 0002
+# endif /* ! S_IWOTH */
+
+/* close-on-exec flag */
+# ifndef FD_CLOEXEC
+# define FD_CLOEXEC 1
+# endif /* ! FD_CLOEXEC */
+
+/*
+** Older systems don't have this error code -- it should be in
+** /usr/include/sysexits.h.
+*/
+
+# ifndef EX_CONFIG
+# define EX_CONFIG 78 /* configuration error */
+# endif /* ! EX_CONFIG */
+
+/* pseudo-codes */
+# define EX_QUIT 22 /* drop out of server immediately */
+# define EX_RESTART 23 /* restart sendmail daemon */
+# define EX_SHUTDOWN 24 /* shutdown sendmail daemon */
+
+#ifndef EX_NOTFOUND
+# define EX_NOTFOUND EX_NOHOST
+#endif /* ! EX_NOTFOUND */
+
+/* pseudo-code used for mci_setstat */
+# define EX_NOTSTICKY -5 /* don't save persistent status */
+
+
+/*
+** An "impossible" file mode to indicate that the file does not exist.
+*/
+
+# define ST_MODE_NOFILE 0171147 /* unlikely to occur */
+
+
+/* type of arbitrary pointer */
+# ifndef ARBPTR_T
+# define ARBPTR_T void *
+# endif /* ! ARBPTR_T */
+
+# ifndef __P
+# include "sm/cdefs.h"
+# endif /* ! __P */
+
+# if HESIOD && !defined(NAMED_BIND)
+# define NAMED_BIND 1 /* not one without the other */
+# endif /* HESIOD && !defined(NAMED_BIND) */
+
+# if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
+extern int h_errno;
+# endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
+
+# if NEEDPUTENV
+extern int putenv __P((char *));
+# endif /* NEEDPUTENV */
+
+#if !HASUNSETENV
+extern void unsetenv __P((char *));
+#endif /* !HASUNSETENV */
+
+# ifdef LDAPMAP
+# include <sys/time.h>
+# include <lber.h>
+# include <ldap.h>
+
+/* Some LDAP constants */
+# define LDAPMAP_FALSE 0
+# define LDAPMAP_TRUE 1
+
+/*
+** ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
+** Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
+** and assume (falsely) that all old API implementations are broken.
+** (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
+*/
+
+# if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
+# define USE_LDAP_INIT 1
+# endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
+
+/*
+** LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
+** hence ldap_set_option() must not exist.
+*/
+
+# if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
+# define USE_LDAP_SET_OPTION 1
+# endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
+
+# endif /* LDAPMAP */
+
+# if HASUNAME
+# include <sys/utsname.h>
+# ifdef newstr
+# undef newstr
+# endif /* newstr */
+# else /* HASUNAME */
+# define NODE_LENGTH 32
+struct utsname
+{
+ char nodename[NODE_LENGTH + 1];
+};
+# endif /* HASUNAME */
+
+# if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
+# define MAXHOSTNAMELEN 256
+# endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
+
+# if !defined(SIGCHLD) && defined(SIGCLD)
+# define SIGCHLD SIGCLD
+# endif /* !defined(SIGCHLD) && defined(SIGCLD) */
+
+# ifndef STDIN_FILENO
+# define STDIN_FILENO 0
+# endif /* ! STDIN_FILENO */
+
+# ifndef STDOUT_FILENO
+# define STDOUT_FILENO 1
+# endif /* ! STDOUT_FILENO */
+
+# ifndef STDERR_FILENO
+# define STDERR_FILENO 2
+# endif /* ! STDERR_FILENO */
+
+# ifndef LOCK_SH
+# define LOCK_SH 0x01 /* shared lock */
+# define LOCK_EX 0x02 /* exclusive lock */
+# define LOCK_NB 0x04 /* non-blocking lock */
+# define LOCK_UN 0x08 /* unlock */
+# endif /* ! LOCK_SH */
+
+# ifndef S_IXOTH
+# define S_IXOTH (S_IEXEC >> 6)
+# endif /* ! S_IXOTH */
+
+# ifndef S_IXGRP
+# define S_IXGRP (S_IEXEC >> 3)
+# endif /* ! S_IXGRP */
+
+# ifndef S_IXUSR
+# define S_IXUSR (S_IEXEC)
+# endif /* ! S_IXUSR */
+
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif /* ! O_ACCMODE */
+
+# ifndef SEEK_SET
+# define SEEK_SET 0
+# define SEEK_CUR 1
+# define SEEK_END 2
+# endif /* ! SEEK_SET */
+
+# ifndef SIG_ERR
+# define SIG_ERR ((void (*)()) -1)
+# endif /* ! SIG_ERR */
+
+# ifndef WEXITSTATUS
+# define WEXITSTATUS(st) (((st) >> 8) & 0377)
+# endif /* ! WEXITSTATUS */
+# ifndef WIFEXITED
+# define WIFEXITED(st) (((st) & 0377) == 0)
+# endif /* ! WIFEXITED */
+# ifndef WIFSTOPPED
+# define WIFSTOPPED(st) (((st) & 0100) == 0)
+# endif /* ! WIFSTOPPED */
+# ifndef WCOREDUMP
+# define WCOREDUMP(st) (((st) & 0200) != 0)
+# endif /* ! WCOREDUMP */
+# ifndef WTERMSIG
+# define WTERMSIG(st) (((st) & 0177))
+# endif /* ! WTERMSIG */
+
+# ifndef SIGFUNC_DEFINED
+typedef void (*sigfunc_t) __P((int));
+# endif /* ! SIGFUNC_DEFINED */
+# ifndef SIGFUNC_RETURN
+# define SIGFUNC_RETURN
+# endif /* ! SIGFUNC_RETURN */
+# ifndef SIGFUNC_DECL
+# define SIGFUNC_DECL void
+# endif /* ! SIGFUNC_DECL */
+
+/* size of syslog buffer */
+# ifndef SYSLOG_BUFSIZE
+# define SYSLOG_BUFSIZE 1024
+# endif /* ! SYSLOG_BUFSIZE */
+
+/*
+** Size of prescan buffer.
+** Despite comments in the _sendmail_ book, this probably should
+** not be changed; there are some hard-to-define dependencies.
+*/
+
+# define PSBUFSIZE (MAXNAME + MAXATOM) /* size of prescan buffer */
+
+/* fork routine -- set above using #ifdef _osname_ or in Makefile */
+# ifndef FORK
+# define FORK fork /* function to call to fork mailer */
+# endif /* ! FORK */
+
+/* setting h_errno */
+# ifndef SM_SET_H_ERRNO
+# define SM_SET_H_ERRNO(err) h_errno = (err)
+# endif /* SM_SET_H_ERRNO */
+
+# ifndef SM_CONF_GETOPT
+# define SM_CONF_GETOPT 1
+# endif /* ! SM_CONF_GETOPT */
+
+/* random routine -- set above using #ifdef _osname_ or in Makefile */
+# if HASRANDOM
+# define get_random() random()
+# else /* HASRANDOM */
+# define get_random() ((long) rand())
+# ifndef RANDOMSHIFT
+# define RANDOMSHIFT 8
+# endif /* ! RANDOMSHIFT */
+# endif /* HASRANDOM */
+
+/*
+** Default to using scanf in readcf.
+*/
+
+# ifndef SCANF
+# define SCANF 1
+# endif /* ! SCANF */
+
+/* XXX 32 bit type */
+# ifndef SM_INT32
+# define SM_INT32 int32_t
+# endif /* ! SM_INT32 */
+
+/*
+** SVr4 and similar systems use different routines for setjmp/longjmp
+** with signal support
+*/
+
+# if USE_SIGLONGJMP
+# ifdef jmp_buf
+# undef jmp_buf
+# endif /* jmp_buf */
+# define jmp_buf sigjmp_buf
+# ifdef setjmp
+# undef setjmp
+# endif /* setjmp */
+# define setjmp(env) sigsetjmp(env, 1)
+# ifdef longjmp
+# undef longjmp
+# endif /* longjmp */
+# define longjmp(env, val) siglongjmp(env, val)
+# endif /* USE_SIGLONGJMP */
+
+# if !defined(NGROUPS_MAX) && defined(NGROUPS)
+# define NGROUPS_MAX NGROUPS /* POSIX naming convention */
+# endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
+
+/*
+** Some snprintf() implementations are rumored not to NUL terminate.
+*/
+# if SNPRINTF_IS_BROKEN
+# ifdef snprintf
+# undef snprintf
+# endif /* snprintf */
+# define snprintf sm_snprintf
+# ifdef vsnprintf
+# undef vsnprintf
+# endif /* vsnprintf */
+# define vsnprintf sm_vsnprintf
+# endif /* SNPRINTF_IS_BROKEN */
+
+/*
+** If we don't have a system syslog, simulate it.
+*/
+
+# if !LOG
+# define LOG_EMERG 0 /* system is unusable */
+# define LOG_ALERT 1 /* action must be taken immediately */
+# define LOG_CRIT 2 /* critical conditions */
+# define LOG_ERR 3 /* error conditions */
+# define LOG_WARNING 4 /* warning conditions */
+# define LOG_NOTICE 5 /* normal but significant condition */
+# define LOG_INFO 6 /* informational */
+# define LOG_DEBUG 7 /* debug-level messages */
+# endif /* !LOG */
+
+# ifndef SM_CONF_SYSLOG
+# define SM_CONF_SYSLOG 1 /* syslog.h has prototype for syslog() */
+# endif /* SM_CONF_SYSLOG */
+
+# if !SM_CONF_SYSLOG
+# ifdef __STDC__
+extern void syslog(int, const char *, ...);
+# else /* __STDC__ */
+extern void syslog();
+# endif /* __STDC__ */
+# endif /* !SM_CONF_SYSLOG */
+
+/* portable(?) definition for alignment */
+# ifndef SM_ALIGN_SIZE
+struct sm_align
+{
+ char al_c;
+ union
+ {
+ long al_l;
+ void *al_p;
+ double al_d;
+ void (*al_f)();
+ } al_u;
+};
+# define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
+# endif /* ! SM_ALIGN_SIZE */
+# define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
+
+#endif /* ! SM_CONF_H */
diff --git a/contrib/sendmail/include/sm/config.h b/contrib/sendmail/include/sm/config.h
new file mode 100644
index 0000000..de34a76
--- /dev/null
+++ b/contrib/sendmail/include/sm/config.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: config.h,v 1.42 2001/06/17 21:31:11 ca Exp $
+ */
+
+/*
+** libsm configuration macros.
+** The values of these macros are platform dependent.
+** The default values are given here.
+** If the default is incorrect, then the correct value can be specified
+** in the m4 configuration file in devtools/OS.
+*/
+
+#ifndef SM_CONFIG_H
+# define SM_CONFIG_H
+
+# include "sm_os.h"
+
+/*
+** SM_CONF_STDBOOL_H is 1 if <stdbool.h> exists
+*/
+
+# ifndef SM_CONF_STDBOOL_H
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# define SM_CONF_STDBOOL_H 1
+# else /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
+# define SM_CONF_STDBOOL_H 0
+# endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
+# endif /* ! SM_CONF_STDBOOL_H */
+
+/*
+** Configuration macros that specify how __P is defined.
+*/
+
+# ifndef SM_CONF_SYS_CDEFS_H
+# define SM_CONF_SYS_CDEFS_H 0
+# endif /* ! SM_CONF_SYS_CDEFS_H */
+
+/*
+** SM_CONF_STDDEF_H is 1 if <stddef.h> exists
+*/
+
+# ifndef SM_CONF_STDDEF_H
+# define SM_CONF_STDDEF_H 1
+# endif /* ! SM_CONF_STDDEF_H */
+
+/*
+** Configuration macro that specifies whether strlcpy/strlcat are available.
+** Note: this is the default so that the libsm version (optimized) will
+** be used by default (sm_strlcpy/sm_strlcat).
+*/
+
+# ifndef SM_CONF_STRL
+# define SM_CONF_STRL 0
+# endif /* ! SM_CONF_STRL */
+
+/*
+** Configuration macro indicating that setitimer is available
+*/
+
+# ifndef SM_CONF_SETITIMER
+# define SM_CONF_SETITIMER 1
+# endif /* ! SM_CONF_SETITIMER */
+
+/*
+** Does <sys/types.h> define uid_t and gid_t?
+*/
+
+# ifndef SM_CONF_UID_GID
+# define SM_CONF_UID_GID 1
+# endif /* ! SM_CONF_UID_GID */
+
+/*
+** Does <sys/types.h> define ssize_t?
+*/
+# ifndef SM_CONF_SSIZE_T
+# define SM_CONF_SSIZE_T 1
+# endif /* ! SM_CONF_SSIZE_T */
+
+/*
+** Does the C compiler support long long?
+*/
+
+# ifndef SM_CONF_LONGLONG
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# define SM_CONF_LONGLONG 1
+# else /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
+# if defined(__GNUC__)
+# define SM_CONF_LONGLONG 1
+# else /* defined(__GNUC__) */
+# define SM_CONF_LONGLONG 0
+# endif /* defined(__GNUC__) */
+# endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L */
+# endif /* ! SM_CONF_LONGLONG */
+
+/*
+** Does <sys/types.h> define quad_t and u_quad_t?
+** We only care if long long is not available.
+*/
+
+# ifndef SM_CONF_QUAD_T
+# define SM_CONF_QUAD_T 0
+# endif /* ! SM_CONF_QUAD_T */
+
+/*
+** Configuration macro indicating that shared memory is available
+*/
+
+# ifndef SM_CONF_SHM
+# define SM_CONF_SHM 0
+# endif /* ! SM_CONF_SHM */
+
+/*
+** Does <setjmp.h> define sigsetjmp?
+*/
+
+# ifndef SM_CONF_SIGSETJMP
+# define SM_CONF_SIGSETJMP 1
+# endif /* ! SM_CONF_SIGSETJMP */
+
+/*
+** Does <sysexits.h> exist, and define the EX_* macros with values
+** that differ from the default BSD values in <sm/sysexits.h>?
+*/
+
+# ifndef SM_CONF_SYSEXITS_H
+# define SM_CONF_SYSEXITS_H 0
+# endif /* ! SM_CONF_SYSEXITS_H */
+
+/* has memchr() prototype? (if not: needs memory.h) */
+# ifndef SM_CONF_MEMCHR
+# define SM_CONF_MEMCHR 1
+# endif /* ! SM_CONF_MEMCHR */
+
+/* try LLONG tests in libsm/t-types.c? */
+# ifndef SM_CONF_TEST_LLONG
+# define SM_CONF_TEST_LLONG 1
+# endif /* !SM_CONF_TEST_LLONG */
+
+#endif /* ! SM_CONFIG_H */
diff --git a/contrib/sendmail/include/sm/debug.h b/contrib/sendmail/include/sm/debug.h
new file mode 100644
index 0000000..eba29ad
--- /dev/null
+++ b/contrib/sendmail/include/sm/debug.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: debug.h,v 1.15 2001/03/08 03:23:07 ca Exp $
+ */
+
+/*
+** libsm debugging and tracing
+** See libsm/debug.html for documentation.
+*/
+
+#ifndef SM_DEBUG_H
+# define SM_DEBUG_H
+
+# include <sm/gen.h>
+# include <sm/io.h>
+
+/*
+** abstractions for printing trace messages
+*/
+
+extern SM_FILE_T *
+sm_debug_file __P((void));
+
+extern void
+sm_debug_setfile __P((
+ SM_FILE_T *));
+
+extern void PRINTFLIKE(1, 2)
+sm_dprintf __P((
+ char *_fmt,
+ ...));
+
+extern void
+sm_dflush __P((void));
+
+/*
+** abstractions for setting and testing debug activation levels
+*/
+
+extern void
+sm_debug_addsettings_x __P((
+ const char *));
+
+extern void
+sm_debug_addsetting_x __P((
+ const char *,
+ int));
+
+# define SM_DEBUG_UNKNOWN ((SM_ATOMIC_UINT_T)(-1))
+
+extern const char SmDebugMagic[];
+
+typedef struct sm_debug SM_DEBUG_T;
+struct sm_debug
+{
+ const char *sm_magic; /* points to SmDebugMagic */
+
+ /*
+ ** debug_level is the activation level of this debug
+ ** object. Level 0 means no debug activity.
+ ** It is initialized to SM_DEBUG_UNKNOWN, which indicates
+ ** that the true value is unknown. If debug_level ==
+ ** SM_DEBUG_UNKNOWN, then the access functions will look up
+ ** its true value in the internal table of debug settings.
+ */
+
+ SM_ATOMIC_UINT_T debug_level;
+
+ /*
+ ** debug_name is the name used to reference this SM_DEBUG
+ ** structure via the sendmail -d option.
+ */
+
+ char *debug_name;
+
+ /*
+ ** debug_desc is a literal character string of the form
+ ** "@(#)$Debug: <name> - <short description> $"
+ */
+
+ char *debug_desc;
+
+ /*
+ ** We keep a linked list of initialized SM_DEBUG structures
+ ** so that when sm_debug_addsetting is called, we can reset
+ ** them all back to the uninitialized state.
+ */
+
+ SM_DEBUG_T *debug_next;
+};
+
+# ifndef SM_DEBUG_CHECK
+# define SM_DEBUG_CHECK 1
+# endif /* ! SM_DEBUG_CHECK */
+
+# if SM_DEBUG_CHECK
+/*
+** This macro is cleverly designed so that if the debug object is below
+** the specified level, then the only overhead is a single comparison
+** (except for the first time this macro is invoked).
+*/
+
+# define sm_debug_active(debug, level) \
+ ((debug)->debug_level >= (level) && \
+ ((debug)->debug_level != SM_DEBUG_UNKNOWN || \
+ sm_debug_loadactive(debug, level)))
+
+# define sm_debug_level(debug) \
+ ((debug)->debug_level == SM_DEBUG_UNKNOWN \
+ ? sm_debug_loadlevel(debug) : (debug)->debug_level)
+
+# define sm_debug_unknown(debug) ((debug)->debug_level == SM_DEBUG_UNKNOWN)
+# else /* SM_DEBUG_CHECK */
+# define sm_debug_active(debug, level) 0
+# define sm_debug_level(debug) 0
+# define sm_debug_unknown(debug) 0
+# endif /* SM_DEBUG_CHECK */
+
+extern bool
+sm_debug_loadactive __P((
+ SM_DEBUG_T *,
+ int));
+
+extern int
+sm_debug_loadlevel __P((
+ SM_DEBUG_T *));
+
+# define SM_DEBUG_INITIALIZER(name, desc) { \
+ SmDebugMagic, \
+ SM_DEBUG_UNKNOWN, \
+ name, \
+ desc, \
+ NULL}
+
+#endif /* ! SM_DEBUG_H */
diff --git a/contrib/sendmail/include/sm/errstring.h b/contrib/sendmail/include/sm/errstring.h
new file mode 100644
index 0000000..c5447d1
--- /dev/null
+++ b/contrib/sendmail/include/sm/errstring.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ *
+ * $Id: errstring.h,v 1.4 2001/06/07 20:04:53 ca Exp $
+ */
+
+/*
+** Error codes.
+*/
+
+#ifndef SM_ERRSTRING_H
+# define SM_ERRSTRING_H
+
+#include <errno.h>
+extern int errno;
+
+/*
+** These are used in a few cases where we need some special
+** error codes, but where the system doesn't provide something
+** reasonable. They are printed in sm_errstring.
+*/
+
+#ifndef E_PSEUDOBASE
+# define E_PSEUDOBASE 256
+#endif /* ! E_PSEUDOBASE */
+
+#define E_SM_OPENTIMEOUT (E_PSEUDOBASE + 0) /* Timeout on file open */
+#define E_SM_NOSLINK (E_PSEUDOBASE + 1) /* Symbolic links not allowed */
+#define E_SM_NOHLINK (E_PSEUDOBASE + 2) /* Hard links not allowed */
+#define E_SM_REGONLY (E_PSEUDOBASE + 3) /* Regular files only */
+#define E_SM_ISEXEC (E_PSEUDOBASE + 4) /* Executable files not allowed */
+#define E_SM_WWDIR (E_PSEUDOBASE + 5) /* World writable directory */
+#define E_SM_GWDIR (E_PSEUDOBASE + 6) /* Group writable directory */
+#define E_SM_FILECHANGE (E_PSEUDOBASE + 7) /* File changed after open */
+#define E_SM_WWFILE (E_PSEUDOBASE + 8) /* World writable file */
+#define E_SM_GWFILE (E_PSEUDOBASE + 9) /* Group writable file */
+#define E_SM_GRFILE (E_PSEUDOBASE + 10) /* g readable file */
+#define E_SM_WRFILE (E_PSEUDOBASE + 11) /* o readable file */
+#define E_DNSBASE (E_PSEUDOBASE + 20) /* base for DNS h_errno */
+#define E_SMDBBASE (E_PSEUDOBASE + 40) /* base for libsmdb errors */
+#define E_LDAPBASE (E_PSEUDOBASE + 70) /* base for LDAP errors */
+
+/* libsmdb */
+#define SMDBE_OK 0
+#define SMDBE_MALLOC (E_SMDBBASE + 1)
+#define SMDBE_GDBM_IS_BAD (E_SMDBBASE + 2)
+#define SMDBE_UNSUPPORTED (E_SMDBBASE + 3)
+#define SMDBE_DUPLICATE (E_SMDBBASE + 4)
+#define SMDBE_BAD_OPEN (E_SMDBBASE + 5)
+#define SMDBE_NOT_FOUND (E_SMDBBASE + 6)
+#define SMDBE_UNKNOWN_DB_TYPE (E_SMDBBASE + 7)
+#define SMDBE_UNSUPPORTED_DB_TYPE (E_SMDBBASE + 8)
+#define SMDBE_INCOMPLETE (E_SMDBBASE + 9)
+#define SMDBE_KEY_EMPTY (E_SMDBBASE + 10)
+#define SMDBE_KEY_EXIST (E_SMDBBASE + 11)
+#define SMDBE_LOCK_DEADLOCK (E_SMDBBASE + 12)
+#define SMDBE_LOCK_NOT_GRANTED (E_SMDBBASE + 13)
+#define SMDBE_LOCK_NOT_HELD (E_SMDBBASE + 14)
+#define SMDBE_RUN_RECOVERY (E_SMDBBASE + 15)
+#define SMDBE_IO_ERROR (E_SMDBBASE + 16)
+#define SMDBE_READ_ONLY (E_SMDBBASE + 17)
+#define SMDBE_DB_NAME_TOO_LONG (E_SMDBBASE + 18)
+#define SMDBE_INVALID_PARAMETER (E_SMDBBASE + 19)
+#define SMDBE_ONLY_SUPPORTS_ONE_CURSOR (E_SMDBBASE + 20)
+#define SMDBE_NOT_A_VALID_CURSOR (E_SMDBBASE + 21)
+#define SMDBE_LAST_ENTRY (E_SMDBBASE + 22)
+#define SMDBE_OLD_VERSION (E_SMDBBASE + 23)
+
+extern const char *
+sm_errstring __P((
+ int _errno));
+
+#endif /* SM_ERRSTRING_H */
diff --git a/contrib/sendmail/include/sm/exc.h b/contrib/sendmail/include/sm/exc.h
new file mode 100644
index 0000000..afcb125
--- /dev/null
+++ b/contrib/sendmail/include/sm/exc.h
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: exc.h,v 1.23 2001/06/07 20:04:53 ca Exp $
+ */
+
+/*
+** libsm exception handling
+** See libsm/exc.html for documentation.
+*/
+
+#ifndef SM_EXC_H
+# define SM_EXC_H
+
+#include <sm/setjmp.h>
+#include <sm/io.h>
+#include <sm/gen.h>
+#include <sm/assert.h>
+
+typedef struct sm_exc SM_EXC_T;
+typedef struct sm_exc_type SM_EXC_TYPE_T;
+typedef union sm_val SM_VAL_T;
+
+/*
+** Exception types
+*/
+
+extern const char SmExcTypeMagic[];
+
+struct sm_exc_type
+{
+ const char *sm_magic;
+ const char *etype_category;
+ const char *etype_argformat;
+ void (*etype_print) __P((SM_EXC_T *, SM_FILE_T *));
+ const char *etype_printcontext;
+};
+
+extern const SM_EXC_TYPE_T SmEtypeOs;
+extern const SM_EXC_TYPE_T SmEtypeErr;
+
+extern void
+sm_etype_printf __P((
+ SM_EXC_T *_exc,
+ SM_FILE_T *_stream));
+
+/*
+** Exception objects
+*/
+
+extern const char SmExcMagic[];
+
+union sm_val
+{
+ int v_int;
+ long v_long;
+ char *v_str;
+ SM_EXC_T *v_exc;
+};
+
+struct sm_exc
+{
+ const char *sm_magic;
+ size_t exc_refcount;
+ const SM_EXC_TYPE_T *exc_type;
+ SM_VAL_T *exc_argv;
+};
+
+# define SM_EXC_INITIALIZER(type, argv) \
+ { \
+ SmExcMagic, \
+ 0, \
+ type, \
+ argv, \
+ }
+
+extern SM_EXC_T *
+sm_exc_new_x __P((
+ const SM_EXC_TYPE_T *_type,
+ ...));
+
+extern SM_EXC_T *
+sm_exc_addref __P((
+ SM_EXC_T *_exc));
+
+extern void
+sm_exc_free __P((
+ SM_EXC_T *_exc));
+
+extern bool
+sm_exc_match __P((
+ SM_EXC_T *_exc,
+ const char *_pattern));
+
+extern void
+sm_exc_write __P((
+ SM_EXC_T *_exc,
+ SM_FILE_T *_stream));
+
+extern void
+sm_exc_print __P((
+ SM_EXC_T *_exc,
+ SM_FILE_T *_stream));
+
+extern SM_DEAD(void
+sm_exc_raise_x __P((
+ SM_EXC_T *_exc)));
+
+extern SM_DEAD(void
+sm_exc_raisenew_x __P((
+ const SM_EXC_TYPE_T *_type,
+ ...)));
+
+/*
+** Exception handling
+*/
+
+typedef void (*SM_EXC_DEFAULT_HANDLER_T) __P((SM_EXC_T *));
+
+extern void
+sm_exc_newthread __P((
+ SM_EXC_DEFAULT_HANDLER_T _handle));
+
+typedef struct sm_exc_handler SM_EXC_HANDLER_T;
+struct sm_exc_handler
+{
+ SM_EXC_T *eh_value;
+ SM_JMPBUF_T eh_context;
+ SM_EXC_HANDLER_T *eh_parent;
+ int eh_state;
+};
+
+/* values for eh_state */
+enum
+{
+ SM_EH_PUSHED = 2,
+ SM_EH_POPPED = 0,
+ SM_EH_HANDLED = 1
+};
+
+extern SM_EXC_HANDLER_T *SmExcHandler;
+
+# define SM_TRY { SM_EXC_HANDLER_T _h; \
+ do { \
+ _h.eh_value = NULL; \
+ _h.eh_parent = SmExcHandler; \
+ _h.eh_state = SM_EH_PUSHED; \
+ SmExcHandler = &_h; \
+ if (sm_setjmp_nosig(_h.eh_context) == 0) {
+
+# define SM_FINALLY SM_ASSERT(SmExcHandler == &_h); \
+ } \
+ if (sm_setjmp_nosig(_h.eh_context) == 0) {
+
+# define SM_EXCEPT(e,pat) } \
+ if (_h.eh_state == SM_EH_HANDLED) \
+ break; \
+ if (_h.eh_state == SM_EH_PUSHED) { \
+ SM_ASSERT(SmExcHandler == &_h); \
+ SmExcHandler = _h.eh_parent; \
+ } \
+ _h.eh_state = sm_exc_match(_h.eh_value,pat) \
+ ? SM_EH_HANDLED : SM_EH_POPPED; \
+ if (_h.eh_state == SM_EH_HANDLED) { \
+ SM_UNUSED(SM_EXC_T *e) = _h.eh_value;
+
+# define SM_END_TRY } \
+ } while (0); \
+ if (_h.eh_state == SM_EH_PUSHED) { \
+ SM_ASSERT(SmExcHandler == &_h); \
+ SmExcHandler = _h.eh_parent; \
+ if (_h.eh_value != NULL) \
+ sm_exc_raise_x(_h.eh_value); \
+ } else if (_h.eh_state == SM_EH_POPPED) { \
+ if (_h.eh_value != NULL) \
+ sm_exc_raise_x(_h.eh_value); \
+ } else \
+ sm_exc_free(_h.eh_value); \
+ }
+
+#endif /* SM_EXC_H */
diff --git a/contrib/sendmail/include/sm/fdset.h b/contrib/sendmail/include/sm/fdset.h
new file mode 100644
index 0000000..6f13411
--- /dev/null
+++ b/contrib/sendmail/include/sm/fdset.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: fdset.h,v 1.3 2001/03/30 23:45:31 geir Exp $
+ */
+
+#ifndef SM_FDSET_H
+# define SM_FDSET_H
+
+# define SM_FD_SET(fd, pfdset) FD_SET(fd, pfdset)
+# define SM_FD_ISSET(fd, pfdset) FD_ISSET(fd, pfdset)
+# define SM_FD_SETSIZE FD_SETSIZE
+
+#endif /* SM_FDSET_H */
diff --git a/contrib/sendmail/include/sm/gen.h b/contrib/sendmail/include/sm/gen.h
new file mode 100644
index 0000000..b250705
--- /dev/null
+++ b/contrib/sendmail/include/sm/gen.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: gen.h,v 1.19 2001/09/11 04:04:43 gshapiro Exp $
+ */
+
+/*
+** libsm general definitions
+** See libsm/gen.html for documentation.
+*/
+
+#ifndef SM_GEN_H
+# define SM_GEN_H
+
+# include <sm/config.h>
+# include <sm/cdefs.h>
+# include <sm/types.h>
+
+/*
+** Define SM_RCSID and SM_IDSTR,
+** macros used to embed RCS and SCCS identification strings in object files.
+*/
+
+# ifdef lint
+# define SM_RCSID(str)
+# define SM_IDSTR(id,str)
+# else /* lint */
+# define SM_RCSID(str) SM_UNUSED(static const char RcsId[]) = str;
+# define SM_IDSTR(id,str) SM_UNUSED(static const char id[]) = str;
+# endif /* lint */
+
+/*
+** Define NULL and offsetof (from the C89 standard)
+*/
+
+# if SM_CONF_STDDEF_H
+# include <stddef.h>
+# else /* SM_CONF_STDDEF_H */
+# ifndef NULL
+# define NULL 0
+# endif
+# define offsetof(type, member) ((size_t)(&((type *)0)->member))
+# endif /* SM_CONF_STDDEF_H */
+
+/*
+** Define bool, true, false (from the C99 standard)
+*/
+
+# if SM_CONF_STDBOOL_H
+# include <stdbool.h>
+# else /* SM_CONF_STDBOOL_H */
+# ifndef __cplusplus
+ typedef int bool;
+# define false 0
+# define true 1
+# endif
+# endif /* SM_CONF_STDBOOL_H */
+
+/*
+** Define SM_MAX and SM_MIN
+*/
+
+# define SM_MAX(a, b) ((a) > (b) ? (a) : (b))
+# define SM_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+/* Define SM_SUCCESS and SM_FAILURE */
+# define SM_SUCCESS 0
+# define SM_FAILURE (-1)
+
+/* XXX This needs to be fixed when we start to use threads: */
+typedef int SM_ATOMIC_INT_T;
+typedef unsigned int SM_ATOMIC_UINT_T;
+
+#endif /* SM_GEN_H */
diff --git a/contrib/sendmail/include/sm/heap.h b/contrib/sendmail/include/sm/heap.h
new file mode 100644
index 0000000..8b56370
--- /dev/null
+++ b/contrib/sendmail/include/sm/heap.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: heap.h,v 1.22 2001/09/04 22:41:55 ca Exp $
+ */
+
+/*
+** Sendmail debugging memory allocation package.
+** See libsm/heap.html for documentation.
+*/
+
+#ifndef SM_HEAP_H
+# define SM_HEAP_H
+
+# include <sm/io.h>
+# include <stdlib.h>
+# include <sm/debug.h>
+# include <sm/exc.h>
+
+/* change default to 0 for production? */
+# ifndef SM_HEAP_CHECK
+# define SM_HEAP_CHECK 1
+# endif /* ! SM_HEAP_CHECK */
+
+# if SM_HEAP_CHECK
+# define sm_malloc_x(sz) sm_malloc_tagged_x(sz, __FILE__, __LINE__, SmHeapGroup)
+# define sm_malloc(size) sm_malloc_tagged(size, __FILE__, __LINE__, SmHeapGroup)
+# define sm_free(ptr) sm_free_tagged(ptr, __FILE__, __LINE__)
+
+extern void *sm_malloc_tagged __P((size_t, char *, int, int));
+extern void *sm_malloc_tagged_x __P((size_t, char *, int, int));
+extern void sm_free_tagged __P((void *, char *, int));
+extern void *sm_realloc_x __P((void *, size_t));
+extern bool sm_heap_register __P((void *, size_t, char *, int, int));
+extern void sm_heap_checkptr_tagged __P((void *, char *, int));
+extern void sm_heap_report __P((SM_FILE_T *, int));
+
+# else /* SM_HEAP_CHECK */
+# define sm_malloc_tagged(size, file, line, grp) sm_malloc(size)
+# define sm_malloc_tagged_x(size, file, line, grp) sm_malloc_x(size)
+# define sm_free_tagged(ptr, file, line) sm_free(ptr)
+# define sm_heap_register(ptr, size, file, line, grp) (true)
+# define sm_heap_checkptr_tagged(ptr, tag, num) ((void)0)
+# define sm_heap_report(file, verbose) ((void)0)
+
+extern void *sm_malloc __P((size_t));
+extern void *sm_malloc_x __P((size_t));
+extern void *sm_realloc_x __P((void *, size_t));
+extern void sm_free __P((void *));
+# endif /* SM_HEAP_CHECK */
+
+extern void *sm_realloc __P((void *, size_t));
+
+# define sm_heap_checkptr(ptr) sm_heap_checkptr_tagged(ptr, __FILE__, __LINE__)
+
+#if 0
+/*
+** sm_f[mc]alloc are plug in replacements for malloc and calloc
+** which can be used in a context requiring a function pointer,
+** and which are compatible with sm_free. Warning: sm_heap_report
+** cannot report where storage leaked by sm_f[mc]alloc was allocated.
+*/
+
+/* XXX unused right now */
+
+extern void *
+sm_fmalloc __P((
+ size_t));
+
+extern void *
+sm_fcalloc __P((
+ size_t,
+ size_t));
+#endif /* 0 */
+
+/*
+** Allocate 'permanent' storage that can be freed but may still be
+** allocated when the process exits. sm_heap_report will not complain
+** about a storage leak originating from a call to sm_pmalloc.
+*/
+
+# define sm_pmalloc(size) sm_malloc_tagged(size, __FILE__, __LINE__, 0)
+# define sm_pmalloc_x(size) sm_malloc_tagged_x(size, __FILE__, __LINE__, 0)
+
+# define sm_heap_group() SmHeapGroup
+# define sm_heap_setgroup(g) (SmHeapGroup = (g))
+# define sm_heap_newgroup() (SmHeapGroup = ++SmHeapMaxGroup)
+
+extern int SmHeapGroup;
+extern int SmHeapMaxGroup;
+
+extern SM_DEBUG_T SmHeapTrace;
+extern SM_DEBUG_T SmHeapCheck;
+extern SM_EXC_T SmHeapOutOfMemory;
+
+#endif /* ! SM_HEAP_H */
diff --git a/contrib/sendmail/include/sm/io.h b/contrib/sendmail/include/sm/io.h
new file mode 100644
index 0000000..b95ede5
--- /dev/null
+++ b/contrib/sendmail/include/sm/io.h
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ * Copyright (c) 1990
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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.
+ *
+ * $Id: io.h,v 1.19 2001/07/10 21:56:46 gshapiro Exp $
+ */
+
+/*-
+ * @(#)stdio.h 5.17 (Berkeley) 6/3/91
+ */
+
+#ifndef SM_IO_H
+#define SM_IO_H
+
+#include <stdio.h>
+#include <sm/gen.h>
+#include <sm/varargs.h>
+
+/* mode for sm io (exposed) */
+#define SM_IO_RDWR 1 /* read-write */
+#define SM_IO_RDONLY 2 /* read-only */
+#define SM_IO_WRONLY 3 /* write-only */
+#define SM_IO_APPEND 4 /* write-only from eof */
+#define SM_IO_APPENDRW 5 /* read-write from eof */
+#define SM_IO_RDWRTR 6 /* read-write with truncation indicated */
+
+/* for sm_io_fseek, et al api's (exposed) */
+#define SM_IO_SEEK_SET 0
+#define SM_IO_SEEK_CUR 1
+#define SM_IO_SEEK_END 2
+
+/* flags for info what's with different types (exposed) */
+#define SM_IO_WHAT_MODE 1
+#define SM_IO_WHAT_VECTORS 2
+#define SM_IO_WHAT_FD 3
+#define SM_IO_WHAT_TYPE 4
+#define SM_IO_WHAT_ISTYPE 5
+#define SM_IO_IS_READABLE 6
+#define SM_IO_WHAT_TIMEOUT 7
+
+/* info flags (exposed) */
+#define SM_IO_FTYPE_CREATE 1
+#define SM_IO_FTYPE_MODIFY 2
+#define SM_IO_FTYPE_DELETE 3
+
+#define SM_IO_SL_PRIO 1
+
+#define SM_IO_OPEN_MAX 20
+
+/* for internal buffers */
+struct smbuf
+{
+ unsigned char *smb_base;
+ int smb_size;
+};
+
+/*
+** sm I/O state variables (internal only).
+**
+** The following always hold:
+**
+** if (flags&(SMLBF|SMWR)) == (SMLBF|SMWR),
+** lbfsize is -bf.size, else lbfsize is 0
+** if flags&SMRD, w is 0
+** if flags&SMWR, r is 0
+**
+** This ensures that the getc and putc macros (or inline functions) never
+** try to write or read from a file that is in `read' or `write' mode.
+** (Moreover, they can, and do, automatically switch from read mode to
+** write mode, and back, on "r+" and "w+" files.)
+**
+** lbfsize is used only to make the inline line-buffered output stream
+** code as compact as possible.
+**
+** ub, up, and ur are used when ungetc() pushes back more characters
+** than fit in the current bf, or when ungetc() pushes back a character
+** that does not match the previous one in bf. When this happens,
+** ub.base becomes non-nil (i.e., a stream has ungetc() data iff
+** ub.base!=NULL) and up and ur save the current values of p and r.
+*/
+
+typedef struct sm_file SM_FILE_T;
+
+struct sm_file
+{
+ const char *sm_magic; /* This SM_FILE_T is free when NULL */
+ unsigned char *f_p; /* current position in (some) buffer */
+ int f_r; /* read space left for getc() */
+ int f_w; /* write space left for putc() */
+ long f_flags; /* flags, below */
+ short f_file; /* fileno, if Unix fd, else -1 */
+ struct smbuf f_bf; /* the buffer (>= 1 byte, if !NULL) */
+ int f_lbfsize; /* 0 or -bf.size, for inline putc */
+
+ /* These can be used for any purpose by a file type implementation: */
+ void *f_cookie;
+ int f_ival;
+
+ /* operations */
+ int (*f_close) __P((SM_FILE_T *));
+ ssize_t (*f_read) __P((SM_FILE_T *, char *, size_t));
+ off_t (*f_seek) __P((SM_FILE_T *, off_t, int));
+ ssize_t (*f_write) __P((SM_FILE_T *, const char *, size_t));
+ int (*f_open) __P((SM_FILE_T *, const void *, int,
+ const void *));
+ int (*f_setinfo) __P((SM_FILE_T *, int , void *));
+ int (*f_getinfo) __P((SM_FILE_T *, int , void *));
+ int f_timeout;
+ int f_timeoutstate; /* either blocking or non-blocking */
+ char *f_type; /* for by-type lookups */
+ void *f_self; /* self for reference */
+ struct sm_file *f_flushfp; /* flush this before reading parent */
+ struct sm_file *f_modefp; /* sync mode with this fp */
+
+ /* separate buffer for long sequences of ungetc() */
+ struct smbuf f_ub; /* ungetc buffer */
+ unsigned char *f_up; /* saved f_p when f_p is doing ungetc */
+ int f_ur; /* saved f_r when f_r is counting ungetc */
+
+ /* tricks to meet minimum requirements even when malloc() fails */
+ unsigned char f_ubuf[3]; /* guarantee an ungetc() buffer */
+ unsigned char f_nbuf[1]; /* guarantee a getc() buffer */
+
+ /* separate buffer for fgetln() when line crosses buffer boundary */
+ struct smbuf f_lb; /* buffer for fgetln() */
+
+ /* Unix stdio files get aligned to block boundaries on fseek() */
+ int f_blksize; /* stat.st_blksize (may be != bf.size) */
+ off_t f_lseekoff; /* current lseek offset */
+ int f_dup_cnt; /* count file dup'd */
+};
+
+__BEGIN_DECLS
+extern SM_FILE_T SmIoF[];
+extern const char SmFileMagic[];
+extern SM_FILE_T SmFtStdio_def;
+extern SM_FILE_T SmFtStdiofd_def;
+extern SM_FILE_T SmFtString_def;
+extern SM_FILE_T SmFtSyslog_def;
+extern SM_FILE_T SmFtRealStdio_def;
+
+#define SMIOIN_FILENO 0
+#define SMIOOUT_FILENO 1
+#define SMIOERR_FILENO 2
+#define SMIOSTDIN_FILENO 3
+#define SMIOSTDOUT_FILENO 4
+#define SMIOSTDERR_FILENO 5
+
+/* Common predefined and already (usually) open files (exposed) */
+#define smioin (&SmIoF[SMIOIN_FILENO])
+#define smioout (&SmIoF[SMIOOUT_FILENO])
+#define smioerr (&SmIoF[SMIOERR_FILENO])
+#define smiostdin (&SmIoF[SMIOSTDIN_FILENO])
+#define smiostdout (&SmIoF[SMIOSTDOUT_FILENO])
+#define smiostderr (&SmIoF[SMIOSTDERR_FILENO])
+
+#define SmFtStdio (&SmFtStdio_def)
+#define SmFtStdiofd (&SmFtStdiofd_def)
+#define SmFtString (&SmFtString_def)
+#define SmFtSyslog (&SmFtSyslog_def)
+#define SmFtRealStdio (&SmFtRealStdio_def)
+
+#ifdef __STDC__
+# define SM_IO_SET_TYPE(f, name, open, close, read, write, seek, get, set, timeout) \
+ (f) = {SmFileMagic, (unsigned char *) 0, 0, 0, 0L, -1, {0}, 0, (void *) 0,\
+ 0, (close), (read), (seek), (write), (open), (set), (get), (timeout),\
+ 0, (name)}
+# define SM_IO_INIT_TYPE(f, name, open, close, read, write, seek, get, set, timeout)
+
+#else /* __STDC__ */
+# define SM_IO_SET_TYPE(f, name, open, close, read, write, seek, get, set, timeout) (f)
+# define SM_IO_INIT_TYPE(f, name, open, close, read, write, seek, get, set, timeout) \
+ (f).sm_magic = SmFileMagic; \
+ (f).f_p = (unsigned char *) 0; \
+ (f).f_r = 0; \
+ (f).f_w = 0; \
+ (f).f_flags = 0L; \
+ (f).f_file = 0; \
+ (f).f_bf.smb_base = (unsigned char *) 0; \
+ (f).f_bf.smb_size = 0; \
+ (f).f_lbfsize = 0; \
+ (f).f_cookie = (void *) 0; \
+ (f).f_ival = 0; \
+ (f).f_close = (close); \
+ (f).f_read = (read); \
+ (f).f_seek = (seek); \
+ (f).f_write = (write); \
+ (f).f_open = (open); \
+ (f).f_setinfo = (set); \
+ (f).f_getinfo = (get); \
+ (f).f_timeout = (timeout); \
+ (f).f_timeoutstate = 0; \
+ (f).f_type = (name);
+
+#endif /* __STDC__ */
+
+__END_DECLS
+
+/* Internal flags */
+#define SMFBF 0x000001 /* XXXX fully buffered */
+#define SMLBF 0x000002 /* line buffered */
+#define SMNBF 0x000004 /* unbuffered */
+#define SMNOW 0x000008 /* Flush each write; take read now */
+#define SMRD 0x000010 /* OK to read */
+#define SMWR 0x000020 /* OK to write */
+ /* RD and WR are never simultaneously asserted */
+#define SMRW 0x000040 /* open for reading & writing */
+#define SMFEOF 0x000080 /* found EOF */
+#define SMERR 0x000100 /* found error */
+#define SMMBF 0x000200 /* buf is from malloc */
+#define SMAPP 0x000400 /* fdopen()ed in append mode */
+#define SMSTR 0x000800 /* this is an snprintf string */
+#define SMOPT 0x001000 /* do fseek() optimisation */
+#define SMNPT 0x002000 /* do not do fseek() optimisation */
+#define SMOFF 0x004000 /* set iff offset is in fact correct */
+#define SMALC 0x010000 /* allocate string space dynamically */
+
+#define SMACCESSMASK 0x0070
+#define SMMODEMASK 0x011C
+
+/* defines for timeout constants */
+#define SM_TIME_IMMEDIATE (0)
+#define SM_TIME_FOREVER (-1)
+#define SM_TIME_DEFAULT (-2)
+
+/* timeout state for blocking */
+#define SM_TIME_BLOCK (0) /* XXX just bool? */
+#define SM_TIME_NONBLOCK (1)
+
+/* Exposed buffering type flags */
+#define SM_IO_FBF 0 /* setvbuf should set fully buffered */
+#define SM_IO_LBF 1 /* setvbuf should set line buffered */
+#define SM_IO_NBF 2 /* setvbuf should set unbuffered */
+
+/* setvbuf buffered, but through at lower file type layers */
+#define SM_IO_NOW 3
+
+/*
+** size of buffer used by setbuf.
+** If underlying filesystem blocksize is discoverable that is used instead
+*/
+
+#define SM_IO_BUFSIZ 4096
+
+#define SM_IO_EOF (-1)
+
+/* Functions defined in ANSI C standard. */
+__BEGIN_DECLS
+SM_FILE_T *sm_io_autoflush __P((SM_FILE_T *, SM_FILE_T *));
+void sm_io_automode __P((SM_FILE_T *, SM_FILE_T *));
+void sm_io_clearerr __P((SM_FILE_T *));
+int sm_io_close __P((SM_FILE_T *, int SM_NONVOLATILE));
+SM_FILE_T *sm_io_dup __P((SM_FILE_T *));
+int sm_io_eof __P((SM_FILE_T *));
+int sm_io_error __P((SM_FILE_T *));
+char *sm_io_fgets __P((SM_FILE_T *, int, char *, int));
+int sm_io_flush __P((SM_FILE_T *, int SM_NONVOLATILE));
+
+int PRINTFLIKE(3, 4)
+sm_io_fprintf __P((SM_FILE_T *, int, const char *, ...));
+
+int sm_io_fputs __P((SM_FILE_T *, int, const char *));
+
+int SCANFLIKE(3, 4)
+sm_io_fscanf __P((SM_FILE_T *, int, const char *, ...));
+
+int sm_io_getc __P((SM_FILE_T *, int));
+int sm_io_getinfo __P((SM_FILE_T *, int, void *));
+SM_FILE_T *sm_io_open __P((const SM_FILE_T *, int SM_NONVOLATILE, const void *,
+ int, const void *));
+int sm_io_purge __P((SM_FILE_T *));
+int sm_io_putc __P((SM_FILE_T *, int, int));
+size_t sm_io_read __P((SM_FILE_T *, int, void *, size_t));
+SM_FILE_T *sm_io_reopen __P((const SM_FILE_T *, int SM_NONVOLATILE,
+ const void *, int, const void *, SM_FILE_T *));
+void sm_io_rewind __P((SM_FILE_T *, int));
+int sm_io_seek __P((SM_FILE_T *, int SM_NONVOLATILE, long SM_NONVOLATILE,
+ int SM_NONVOLATILE));
+int sm_io_setinfo __P((SM_FILE_T *, int, void *));
+int sm_io_setvbuf __P((SM_FILE_T *, int, char *, int, size_t));
+
+int SCANFLIKE(2, 3)
+sm_io_sscanf __P((const char *, char const *, ...));
+
+long sm_io_tell __P((SM_FILE_T *, int SM_NONVOLATILE));
+int sm_io_ungetc __P((SM_FILE_T *, int, int));
+int sm_io_vfprintf __P((SM_FILE_T *, int, const char *, va_list));
+size_t sm_io_write __P((SM_FILE_T *, int, const void *, size_t));
+
+void sm_strio_init __P((SM_FILE_T *, char *, size_t));
+
+extern SM_FILE_T *
+sm_io_fopen __P((
+ char *_pathname,
+ int _flags,
+ ...));
+
+extern SM_FILE_T *
+sm_io_stdioopen __P((
+ FILE *_stream,
+ char *_mode));
+
+extern int
+sm_vasprintf __P((
+ char **_str,
+ const char *_fmt,
+ va_list _ap));
+
+extern int
+sm_vsnprintf __P((
+ char *,
+ size_t,
+ const char *,
+ va_list));
+
+extern void
+sm_perror __P((
+ const char *));
+
+__END_DECLS
+
+/*
+** Functions internal to the implementation.
+*/
+
+__BEGIN_DECLS
+int sm_rget __P((SM_FILE_T *, int));
+int sm_vfscanf __P((SM_FILE_T *, int SM_NONVOLATILE, const char *,
+ va_list SM_NONVOLATILE));
+int sm_wbuf __P((SM_FILE_T *, int, int));
+__END_DECLS
+
+/*
+** The macros are here so that we can
+** define function versions in the library.
+*/
+
+#define sm_getc(f, t) \
+ (--(f)->f_r < 0 ? \
+ sm_rget(f, t) : \
+ (int)(*(f)->f_p++))
+
+/*
+** This has been tuned to generate reasonable code on the vax using pcc.
+** (It also generates reasonable x86 code using gcc.)
+*/
+
+#define sm_putc(f, t, c) \
+ (--(f)->f_w < 0 ? \
+ (f)->f_w >= (f)->f_lbfsize ? \
+ (*(f)->f_p = (c)), *(f)->f_p != '\n' ? \
+ (int)*(f)->f_p++ : \
+ sm_wbuf(f, t, '\n') : \
+ sm_wbuf(f, t, (int)(c)) : \
+ (*(f)->f_p = (c), (int)*(f)->f_p++))
+
+#define sm_eof(p) (((p)->f_flags & SMFEOF) != 0)
+#define sm_error(p) (((p)->f_flags & SMERR) != 0)
+#define sm_clearerr(p) ((void)((p)->f_flags &= ~(SMERR|SMFEOF)))
+
+#define sm_io_eof(p) sm_eof(p)
+#define sm_io_error(p) sm_error(p)
+
+#define sm_io_clearerr(p) sm_clearerr(p)
+
+#ifndef lint
+# ifndef _POSIX_SOURCE
+# define sm_io_getc(fp, t) sm_getc(fp, t)
+# define sm_io_putc(fp, t, x) sm_putc(fp, t, x)
+# endif /* _POSIX_SOURCE */
+#endif /* lint */
+
+#endif /* SM_IO_H */
diff --git a/contrib/sendmail/include/sm/ldap.h b/contrib/sendmail/include/sm/ldap.h
new file mode 100644
index 0000000..7deec8b
--- /dev/null
+++ b/contrib/sendmail/include/sm/ldap.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: ldap.h,v 1.9 2002/01/11 22:06:50 gshapiro Exp $
+ */
+
+#ifndef SM_LDAP_H
+# define SM_LDAP_H
+
+# include <sm/conf.h>
+# include <sm/rpool.h>
+
+# ifndef LDAPMAP_MAX_ATTR
+# define LDAPMAP_MAX_ATTR 64
+# endif /* ! LDAPMAP_MAX_ATTR */
+# ifndef LDAPMAP_MAX_FILTER
+# define LDAPMAP_MAX_FILTER 1024
+# endif /* ! LDAPMAP_MAX_FILTER */
+# ifndef LDAPMAP_MAX_PASSWD
+# define LDAPMAP_MAX_PASSWD 256
+# endif /* ! LDAPMAP_MAX_PASSWD */
+
+# if LDAPMAP
+
+# if _FFR_LDAP_RECURSION
+
+/* Attribute types */
+# define LDAPMAP_ATTR_NORMAL 0
+# define LDAPMAP_ATTR_DN 1
+# define LDAPMAP_ATTR_FILTER 2
+# define LDAPMAP_ATTR_URL 3
+# define LDAPMAP_ATTR_FINAL 4
+
+/* sm_ldap_results() flags */
+# define SM_LDAP_SINGLEMATCH 0x0001
+# define SM_LDAP_MATCHONLY 0x0002
+# endif /* _FFR_LDAP_RECURSION */
+
+struct sm_ldap_struct
+{
+ /* needed for ldap_open or ldap_init */
+ char *ldap_host;
+ int ldap_port;
+ pid_t ldap_pid;
+
+ /* 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];
+# if _FFR_LDAP_RECURSION
+ int ldap_attr_type[LDAPMAP_MAX_ATTR + 1];
+ char *ldap_attr_final[LDAPMAP_MAX_ATTR + 1];
+# endif /* _FFR_LDAP_RECURSION */
+ bool ldap_attrsonly;
+
+ /* args for ldap_result */
+ struct timeval ldap_timeout;
+ LDAPMessage *ldap_res;
+
+ /* ldapmap_lookup options */
+ char ldap_attrsep;
+
+ /* Linked list of maps sharing the same LDAP binding */
+ void *ldap_next;
+};
+
+typedef struct sm_ldap_struct SM_LDAP_STRUCT;
+
+# if _FFR_LDAP_RECURSION
+struct sm_ldap_recurse_list
+{
+ char *lr_search;
+ int lr_type;
+ struct sm_ldap_recurse_list *lr_next;
+};
+
+typedef struct sm_ldap_recurse_list SM_LDAP_RECURSE_LIST;
+# endif /* _FFR_LDAP_RECURSION */
+
+/* functions */
+extern void sm_ldap_clear __P((SM_LDAP_STRUCT *));
+extern bool sm_ldap_start __P((char *, SM_LDAP_STRUCT *));
+extern int sm_ldap_search __P((SM_LDAP_STRUCT *, char *));
+# if _FFR_LDAP_RECURSION
+extern int sm_ldap_results __P((SM_LDAP_STRUCT *, int, int, char,
+ SM_RPOOL_T *, char **,
+ SM_LDAP_RECURSE_LIST *));
+# endif /* _FFR_LDAP_RECURSION */
+extern void sm_ldap_setopts __P((LDAP *, SM_LDAP_STRUCT *));
+extern int sm_ldap_geterrno __P((LDAP *));
+extern void sm_ldap_close __P((SM_LDAP_STRUCT *));
+# endif /* LDAPMAP */
+
+#endif /* ! SM_LDAP_H */
diff --git a/contrib/sendmail/include/sm/limits.h b/contrib/sendmail/include/sm/limits.h
new file mode 100644
index 0000000..5041db3
--- /dev/null
+++ b/contrib/sendmail/include/sm/limits.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: limits.h,v 1.6 2001/03/08 03:23:08 ca Exp $
+ */
+
+/*
+** <sm/limits.h>
+** This header file is a portability wrapper for <limits.h>.
+** It includes <limits.h>, then it ensures that the following macros
+** from the C 1999 standard for <limits.h> are defined:
+** LLONG_MIN, LLONG_MAX
+** ULLONG_MAX
+*/
+
+#ifndef SM_LIMITS_H
+# define SM_LIMITS_H
+
+# include <limits.h>
+# include <sm/types.h>
+# include <sys/param.h>
+
+/*
+** The following assumes two's complement binary arithmetic.
+*/
+
+# ifndef LLONG_MIN
+# define LLONG_MIN ((LONGLONG_T)(~(ULLONG_MAX >> 1)))
+# endif /* ! LLONG_MIN */
+# ifndef LLONG_MAX
+# define LLONG_MAX ((LONGLONG_T)(ULLONG_MAX >> 1))
+# endif /* ! LLONG_MAX */
+# ifndef ULLONG_MAX
+# define ULLONG_MAX ((ULONGLONG_T)(-1))
+# endif /* ! ULLONG_MAX */
+
+/*
+** PATH_MAX is defined by the POSIX standard. All modern systems
+** provide it. Older systems define MAXPATHLEN in <sys/param.h> instead.
+*/
+
+# ifndef PATH_MAX
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else /* MAXPATHLEN */
+# define PATH_MAX 2048
+# endif /* MAXPATHLEN */
+# endif /* ! PATH_MAX */
+
+#endif /* ! SM_LIMITS_H */
diff --git a/contrib/sendmail/include/sm/mbdb.h b/contrib/sendmail/include/sm/mbdb.h
new file mode 100644
index 0000000..7ec71c5
--- /dev/null
+++ b/contrib/sendmail/include/sm/mbdb.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: mbdb.h,v 1.4 2001/03/08 03:23:08 ca Exp $
+ */
+
+#ifndef SM_MBDB_H
+# define SM_MBDB_H
+
+#include <pwd.h>
+#include <sm/types.h>
+#include <sm/limits.h>
+
+/*
+** This is an abstract interface for looking up local mail recipients.
+*/
+
+#define MBDB_MAXNAME 256
+#define SM_NO_UID ((uid_t)(-1))
+#define SM_NO_GID ((gid_t)(-1))
+
+typedef struct
+{
+ uid_t mbdb_uid;
+ gid_t mbdb_gid;
+ char mbdb_name[MBDB_MAXNAME];
+ char mbdb_fullname[MBDB_MAXNAME];
+ char mbdb_homedir[PATH_MAX + 1];
+ char mbdb_shell[PATH_MAX + 1];
+} SM_MBDB_T;
+
+extern int sm_mbdb_initialize __P((char *));
+extern void sm_mbdb_terminate __P((void));
+extern int sm_mbdb_lookup __P((char *, SM_MBDB_T *));
+extern void sm_mbdb_frompw __P((SM_MBDB_T *, struct passwd *));
+extern void sm_pwfullname __P((char *, char *, char *, size_t));
+
+#endif /* ! SM_MBDB_H */
diff --git a/contrib/sendmail/include/sm/os/sm_os_aix.h b/contrib/sendmail/include/sm/os/sm_os_aix.h
new file mode 100644
index 0000000..6dc4a54
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_aix.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_aix.h,v 1.9 2001/10/09 23:12:13 ca Exp $
+ */
+
+/*
+** sm_os_aix.h -- platform definitions for AIX
+*/
+
+#define SM_OS_NAME "aix"
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM 2
+#endif /* SM_CONF_SEM */
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+#endif /* SM_CONF_MSG */
+
+/* AIX 3 doesn't have a prototype for syslog()? */
+#ifdef _AIX3
+# ifndef _AIX4
+# ifndef SM_CONF_SYSLOG
+# define SM_CONF_SYSLOG 0
+# endif /* SM_CONF_SYSLOG */
+# endif /* ! _AIX4 */
+#endif /* _AIX3 */
diff --git a/contrib/sendmail/include/sm/os/sm_os_freebsd.h b/contrib/sendmail/include/sm/os/sm_os_freebsd.h
new file mode 100644
index 0000000..8edc718
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_freebsd.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_freebsd.h,v 1.9 2001/06/27 21:46:48 gshapiro Exp $
+ */
+
+/*
+** Platform definitions for FreeBSD
+*/
+
+#define SM_OS_NAME "freebsd"
+
+#define SM_CONF_SYS_CDEFS_H 1
+
+#if __FreeBSD__ >= 2
+# include <osreldate.h> /* defines __FreeBSD_version */
+# if __FreeBSD_version >= 199512 /* 2.2-current when it appeared */
+# define MI_SOMAXCONN -1 /* listen() max backlog for milter */
+# endif /* __FreeBSD_version >= 199512 */
+# if __FreeBSD_version >= 330000
+ /* 3.3.0-release and later have strlcpy()/strlcat() */
+# ifndef SM_CONF_STRL
+# define SM_CONF_STRL 1
+# endif
+# endif
+#endif
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM 1
+#endif /* SM_CONF_SEM */
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+#endif /* SM_CONF_MSG */
diff --git a/contrib/sendmail/include/sm/os/sm_os_hp.h b/contrib/sendmail/include/sm/os/sm_os_hp.h
new file mode 100644
index 0000000..2cbcb57
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_hp.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_hp.h,v 1.8 2001/10/31 15:36:56 ca Exp $
+ */
+
+/*
+** sm_os_hp.h -- platform definitions for HP
+*/
+
+#define SM_OS_NAME "hp"
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM 2
+#endif /* SM_CONF_SEM */
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+#endif /* SM_CONF_MSG */
+
+/* max/min buffer size of other than regular files */
+#ifndef SM_IO_MAX_BUF
+# define SM_IO_MAX_BUF 8192
+#endif /* SM_IO_MAX_BUF */
+#ifndef SM_IO_MIN_BUF
+# define SM_IO_MIN_BUF 4096
+#endif /* SM_IO_MIN_BUF */
diff --git a/contrib/sendmail/include/sm/os/sm_os_irix.h b/contrib/sendmail/include/sm/os/sm_os_irix.h
new file mode 100644
index 0000000..185485a
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_irix.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_irix.h,v 1.7 2001/10/09 23:12:13 ca Exp $
+ */
+
+/*
+** Silicon Graphics IRIX
+**
+** Compiles on 4.0.1.
+**
+** Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
+** Use IRIX5 instead of IRIX for IRIX 5.x.
+**
+** This version tries to be adaptive using _MIPS_SIM:
+** _MIPS_SIM == _ABIO32 (= 1) Abi: -32 on IRIX 6.2
+** _MIPS_SIM == _ABIN32 (= 2) Abi: -n32 on IRIX 6.2
+** _MIPS_SIM == _ABI64 (= 3) Abi: -64 on IRIX 6.2
+**
+** _MIPS_SIM is 1 also on IRIX 5.3
+**
+** IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
+** IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
+** Adaptive changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
+*/
+
+#ifndef IRIX
+# define IRIX
+#endif /* ! IRIX */
+#if _MIPS_SIM > 0 && !defined(IRIX5)
+# define IRIX5 /* IRIX5 or IRIX6 */
+#endif /* _MIPS_SIM > 0 && !defined(IRIX5) */
+#if _MIPS_SIM > 1 && !defined(IRIX6) && !defined(IRIX64)
+# define IRIX6 /* IRIX6 */
+#endif /* _MIPS_SIM > 1 && !defined(IRIX6) && !defined(IRIX64) */
+
+#define SM_OS_NAME "irix"
+
+#if defined(IRIX6) || defined(IRIX64)
+# define SM_CONF_LONGLONG 1
+#endif /* defined(IRIX6) || defined(IRIX64) */
+
+#if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
+# define SM_CONF_SYS_CDEFS_H 1
+#endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
+
+/* try LLONG tests in libsm/t-types.c? */
+#ifndef SM_CONF_TEST_LLONG
+# define SM_CONF_TEST_LLONG 0
+#endif /* !SM_CONF_TEST_LLONG */
diff --git a/contrib/sendmail/include/sm/os/sm_os_linux.h b/contrib/sendmail/include/sm/os/sm_os_linux.h
new file mode 100644
index 0000000..f232c49
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_linux.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_linux.h,v 1.12 2001/10/05 01:52:41 ca Exp $
+ */
+
+/*
+** Platform definitions for Linux
+*/
+
+#define SM_OS_NAME "linux"
+
+/* to get version number */
+#include <linux/version.h>
+
+# if !defined(KERNEL_VERSION) /* not defined in 2.0.x kernel series */
+# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+# endif /* ! KERNEL_VERSION */
+
+/* doesn't seem to work on Linux */
+#ifndef SM_CONF_SETITIMER
+# define SM_CONF_SETITIMER 0
+#endif /* SM_CONF_SETITIMER */
+
+#ifndef SM_CONF_SHM
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,19))
+# define SM_CONF_SHM 1
+# endif /* LINUX_VERSION_CODE */
+#endif /* SM_CONF_SHM */
+
+#define SM_CONF_SYS_CDEFS_H 1
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM 2
+#endif /* SM_CONF_SEM */
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+#endif /* SM_CONF_MSG */
diff --git a/contrib/sendmail/include/sm/os/sm_os_mpeix.h b/contrib/sendmail/include/sm/os/sm_os_mpeix.h
new file mode 100644
index 0000000..385f1f4
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_mpeix.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_mpeix.h,v 1.2 2001/12/14 00:23:02 ca Exp $
+ */
+
+/*
+** sm_os_mpeix.h -- platform definitions for HP MPE/iX
+*/
+
+#define SM_OS_NAME "mpeix"
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
+
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM 2
+#endif /* SM_CONF_SEM */
+
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+#endif /* SM_CONF_MSG */
+
+#define SM_CONF_SETITIMER 0
+
+#ifndef SM_CONF_CANT_SETRGID
+# define SM_CONF_CANT_SETRGID 1
+#endif /* SM_CONF_CANT_SETRGID */
diff --git a/contrib/sendmail/include/sm/os/sm_os_next.h b/contrib/sendmail/include/sm/os/sm_os_next.h
new file mode 100644
index 0000000..03f886e
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_next.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_next.h,v 1.7 2001/04/03 01:53:06 gshapiro Exp $
+ */
+
+/*
+** Platform definitions for NeXT
+*/
+
+#define SM_OS_NAME "next"
+
+#define SM_CONF_SIGSETJMP 0
+#define SM_CONF_SSIZE_T 0
+#define SM_CONF_FORMAT_TEST 0
+
+/* doesn't seem to work on NeXT 3.x */
+#define SM_DEAD(proto) proto
+#define SM_UNUSED(decl) decl
+
+/* try LLONG tests in libsm/t-types.c? */
+#ifndef SM_CONF_TEST_LLONG
+# define SM_CONF_TEST_LLONG 0
+#endif /* !SM_CONF_TEST_LLONG */
diff --git a/contrib/sendmail/include/sm/os/sm_os_openbsd.h b/contrib/sendmail/include/sm/os/sm_os_openbsd.h
new file mode 100644
index 0000000..1acf12d
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_openbsd.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2000 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_openbsd.h,v 1.7 2000/12/05 19:00:47 dmoen Exp $
+ */
+
+/*
+** sm_os_openbsd.h -- platform definitions for OpenBSD
+**
+** Note: this header file cannot be called OpenBSD.h
+** because <sys/param.h> defines the macro OpenBSD.
+*/
+
+#define SM_OS_NAME "openbsd"
+
+#define SM_CONF_SYS_CDEFS_H 1
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
+#ifndef SM_CONF_SEM
+# define SM_CONF_SEM 1
+#endif /* SM_CONF_SEM */
+#ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+#endif /* SM_CONF_MSG */
diff --git a/contrib/sendmail/include/sm/os/sm_os_openunix.h b/contrib/sendmail/include/sm/os/sm_os_openunix.h
new file mode 100644
index 0000000..3e696ba
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_openunix.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_openunix.h,v 1.5 2001/11/11 16:32:00 ca Exp $
+ */
+
+#define SM_OS_NAME "openunix"
+
+/* needs alarm(), our sleep() otherwise hangs. */
+#define SM_CONF_SETITIMER 0
+
+/* long long seems to work */
+#define SM_CONF_LONGLONG 1
+
+/* don't use flock() in mail.local.c */
+#define LDA_USE_LOCKF 1
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
diff --git a/contrib/sendmail/include/sm/os/sm_os_osf1.h b/contrib/sendmail/include/sm/os/sm_os_osf1.h
new file mode 100644
index 0000000..eef239c
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_osf1.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_osf1.h,v 1.3 2001/10/09 23:12:13 ca Exp $
+ */
+
+/*
+** platform definitions for Digital UNIX
+*/
+
+#define SM_OS_NAME "osf1"
+
+#define SM_CONF_SETITIMER 0
diff --git a/contrib/sendmail/include/sm/os/sm_os_sunos.h b/contrib/sendmail/include/sm/os/sm_os_sunos.h
new file mode 100644
index 0000000..9d20b18
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_sunos.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_sunos.h,v 1.14 2001/08/14 18:09:42 ca Exp $
+ */
+
+/*
+** platform definitions for SunOS 4.0.3, SunOS 4.1.x and Solaris 2.x
+*/
+
+#define SM_OS_NAME "sunos"
+
+#ifdef SOLARIS
+/*
+** Solaris 2.x (aka SunOS 5.x)
+** M4 config file is devtools/OS/SunOS.5.x, which defines the SOLARIS macro.
+*/
+
+# define SM_CONF_LONGLONG 1
+# ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+# endif /* SM_CONF_SHM */
+# ifndef SM_CONF_SEM
+# define SM_CONF_SEM 2
+# endif /* SM_CONF_SEM */
+# ifndef SM_CONF_MSG
+# define SM_CONF_MSG 1
+# endif /* SM_CONF_MSG */
+
+#else /* SOLARIS */
+
+/*
+** SunOS 4.0.3 or 4.1.x
+*/
+
+# define SM_CONF_SSIZE_T 0
+# ifndef SM_CONF_BROKEN_SIZE_T
+# define SM_CONF_BROKEN_SIZE_T 1 /* size_t is signed? */
+# endif /* SM_CONF_BROKEN_SIZE_T */
+
+# ifndef SM_CONF_BROKEN_STRTOD
+# define SM_CONF_BROKEN_STRTOD 1
+# endif /* ! SM_CONF_BROKEN_STRTOD */
+
+/* has memchr() prototype? (if not: needs memory.h) */
+# ifndef SM_CONF_MEMCHR
+# define SM_CONF_MEMCHR 0
+# endif /* ! SM_CONF_MEMCHR */
+
+# ifdef SUNOS403
+
+/*
+** SunOS 4.0.3
+** M4 config file is devtools/OS/SunOS4.0, which defines the SUNOS403 macro.
+*/
+
+# else /* SUNOS403 */
+
+/*
+** SunOS 4.1.x
+** M4 config file is devtools/OS/SunOS, which defines no macros.
+*/
+
+# endif /* SUNOS403 */
+#endif /* SOLARIS */
diff --git a/contrib/sendmail/include/sm/os/sm_os_ultrix.h b/contrib/sendmail/include/sm/os/sm_os_ultrix.h
new file mode 100644
index 0000000..1ae2db1
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_ultrix.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_ultrix.h,v 1.3 2001/10/09 23:12:13 ca Exp $
+ */
+
+/*
+** platform definitions for Ultrix
+*/
+
+#define SM_OS_NAME "ultrix"
+
+#define SM_CONF_SSIZE_T 0
diff --git a/contrib/sendmail/include/sm/os/sm_os_unixware.h b/contrib/sendmail/include/sm/os/sm_os_unixware.h
new file mode 100644
index 0000000..2ff5ad0
--- /dev/null
+++ b/contrib/sendmail/include/sm/os/sm_os_unixware.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sm_os_unixware.h,v 1.7 2001/11/11 16:32:00 ca Exp $
+ */
+
+#define SM_OS_NAME "unixware"
+
+/* try LLONG tests in libsm/t-types.c? */
+#ifndef SM_CONF_TEST_LLONG
+# define SM_CONF_TEST_LLONG 0
+#endif /* !SM_CONF_TEST_LLONG */
+
+/* needs alarm(), our sleep() otherwise hangs. */
+#define SM_CONF_SETITIMER 0
+
+#ifndef SM_CONF_SHM
+# define SM_CONF_SHM 1
+#endif /* SM_CONF_SHM */
+
+/* size_t seems to be signed */
+#define SM_CONF_BROKEN_SIZE_T 1
+
+/* don't use flock() in mail.local.c */
+#ifndef LDA_USE_LOCKF
+# define LDA_USE_LOCKF 1
+#endif /* LDA_USE_LOCKF */
diff --git a/contrib/sendmail/include/sm/path.h b/contrib/sendmail/include/sm/path.h
new file mode 100644
index 0000000..29fc4ca
--- /dev/null
+++ b/contrib/sendmail/include/sm/path.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: path.h,v 1.6 2001/04/03 01:53:00 gshapiro Exp $
+ */
+
+/*
+** Portable names for standard filesystem paths
+** and macros for directories.
+*/
+
+#ifndef SM_PATH_H
+# define SM_PATH_H
+
+# include <sm/gen.h>
+
+# define SM_PATH_DEVNULL "/dev/null"
+# define SM_IS_DIR_DELIM(c) ((c) == '/')
+# define SM_FIRST_DIR_DELIM(s) strchr(s, '/')
+# define SM_LAST_DIR_DELIM(s) strrchr(s, '/')
+
+/* Warning: this must be accessible as array */
+# define SM_IS_DIR_START(s) ((s)[0] == '/')
+
+# define sm_path_isdevnull(path) (strcmp(path, "/dev/null") == 0)
+
+#endif /* ! SM_PATH_H */
diff --git a/contrib/sendmail/include/sm/rpool.h b/contrib/sendmail/include/sm/rpool.h
new file mode 100644
index 0000000..e750fcb
--- /dev/null
+++ b/contrib/sendmail/include/sm/rpool.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: rpool.h,v 1.15 2001/09/04 22:41:55 ca Exp $
+ */
+
+/*
+** libsm resource pools
+** See libsm/rpool.html for documentation.
+*/
+
+#ifndef SM_RPOOL_H
+# define SM_RPOOL_H
+
+# include <sm/gen.h>
+# include <sm/heap.h>
+# include <sm/string.h>
+
+/*
+** Each memory pool object consists of an SM_POOLLINK_T,
+** followed by a platform specific amount of padding,
+** followed by 'poolsize' bytes of pool data,
+** where 'poolsize' is the value of rpool->sm_poolsize at the time
+** the pool is allocated.
+*/
+
+typedef struct sm_poollink SM_POOLLINK_T;
+struct sm_poollink
+{
+ SM_POOLLINK_T *sm_pnext;
+};
+
+typedef void (*SM_RPOOL_RFREE_T) __P((void *_rcontext));
+
+typedef SM_RPOOL_RFREE_T *SM_RPOOL_ATTACH_T;
+
+typedef struct sm_resource SM_RESOURCE_T;
+struct sm_resource
+{
+ /*
+ ** Function for freeing this resource. It may be NULL,
+ ** meaning that this resource has already been freed.
+ */
+
+ SM_RPOOL_RFREE_T sm_rfree;
+ void *sm_rcontext; /* resource data */
+};
+
+# define SM_RLIST_MAX 511
+
+typedef struct sm_rlist SM_RLIST_T;
+struct sm_rlist
+{
+ SM_RESOURCE_T sm_rvec[SM_RLIST_MAX];
+ SM_RLIST_T *sm_rnext;
+};
+
+typedef struct
+{
+ /* Points to SmRpoolMagic, or is NULL if rpool is freed. */
+ const char *sm_magic;
+
+ /*
+ ** If this rpool object has no parent, then sm_parentlink
+ ** is NULL. Otherwise, we set *sm_parentlink = NULL
+ ** when this rpool is freed, so that it isn't freed a
+ ** second time when the parent is freed.
+ */
+
+ SM_RPOOL_RFREE_T *sm_parentlink;
+
+ /*
+ ** Memory pools
+ */
+
+ /* Size of the next pool to be allocated, not including the header. */
+ size_t sm_poolsize;
+
+ /*
+ ** If an sm_rpool_malloc_x request is too big to fit
+ ** in the current pool, and the request size > bigobjectsize,
+ ** then the object will be given its own malloc'ed block.
+ ** sm_bigobjectsize <= sm_poolsize. The maximum wasted space
+ ** at the end of a pool is maxpooledobjectsize - 1.
+ */
+
+ size_t sm_bigobjectsize;
+
+ /* Points to next free byte in the current pool. */
+ char *sm_poolptr;
+
+ /*
+ ** Number of bytes available in the current pool.
+ ** Initially 0. Set to 0 by sm_rpool_free.
+ */
+
+ size_t sm_poolavail;
+
+ /* Linked list of memory pools. Initially NULL. */
+ SM_POOLLINK_T *sm_pools;
+
+ /*
+ ** Resource lists
+ */
+
+ SM_RESOURCE_T *sm_rptr; /* Points to next free resource slot. */
+
+ /*
+ ** Number of available resource slots in current list.
+ ** Initially 0. Set to 0 by sm_rpool_free.
+ */
+
+ size_t sm_ravail;
+
+ /* Linked list of resource lists. Initially NULL. */
+ SM_RLIST_T *sm_rlists;
+
+#if _FFR_PERF_RPOOL
+ int sm_nbigblocks;
+ int sm_npools;
+#endif /* _FFR_PERF_RPOOL */
+
+} SM_RPOOL_T;
+
+extern SM_RPOOL_T *
+sm_rpool_new_x __P((
+ SM_RPOOL_T *_parent));
+
+extern void
+sm_rpool_free __P((
+ SM_RPOOL_T *_rpool));
+
+# if SM_HEAP_CHECK
+extern void *
+sm_rpool_malloc_tagged_x __P((
+ SM_RPOOL_T *_rpool,
+ size_t _size,
+ char *_file,
+ int _line,
+ int _group));
+# define sm_rpool_malloc_x(rpool, size) \
+ sm_rpool_malloc_tagged_x(rpool, size, __FILE__, __LINE__, SmHeapGroup)
+extern void *
+sm_rpool_malloc_tagged __P((
+ SM_RPOOL_T *_rpool,
+ size_t _size,
+ char *_file,
+ int _line,
+ int _group));
+# define sm_rpool_malloc(rpool, size) \
+ sm_rpool_malloc_tagged(rpool, size, __FILE__, __LINE__, SmHeapGroup)
+# else /* SM_HEAP_CHECK */
+extern void *
+sm_rpool_malloc_x __P((
+ SM_RPOOL_T *_rpool,
+ size_t _size));
+extern void *
+sm_rpool_malloc __P((
+ SM_RPOOL_T *_rpool,
+ size_t _size));
+# endif /* SM_HEAP_CHECK */
+
+# define sm_rpool_strdup_x(rpool, str) \
+ strcpy(sm_rpool_malloc_x(rpool, strlen(str) + 1), str)
+
+extern SM_RPOOL_ATTACH_T
+sm_rpool_attach_x __P((
+ SM_RPOOL_T *_rpool,
+ SM_RPOOL_RFREE_T _rfree,
+ void *_rcontext));
+
+# define sm_rpool_detach(a) ((void)(*(a) = NULL))
+
+extern void
+sm_rpool_setsizes __P((
+ SM_RPOOL_T *_rpool,
+ size_t _poolsize,
+ size_t _bigobjectsize));
+
+#endif /* ! SM_RPOOL_H */
diff --git a/contrib/sendmail/include/sm/setjmp.h b/contrib/sendmail/include/sm/setjmp.h
new file mode 100644
index 0000000..01bda02
--- /dev/null
+++ b/contrib/sendmail/include/sm/setjmp.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: setjmp.h,v 1.3 2001/03/08 03:23:08 ca Exp $
+ */
+
+#ifndef SM_SETJMP_H
+# define SM_SETJMP_H
+
+# include <sm/config.h>
+# include <setjmp.h>
+
+/*
+** sm_setjmp_sig is a setjmp that saves the signal mask.
+** sm_setjmp_nosig is a setjmp that does *not* save the signal mask.
+** SM_JMPBUF_T is used with both of the above macros.
+**
+** On most systems, these can be implemented using sigsetjmp.
+** Some old BSD systems do not have sigsetjmp, but they do have
+** setjmp and _setjmp, which are just as good.
+*/
+
+# if SM_CONF_SIGSETJMP
+
+typedef sigjmp_buf SM_JMPBUF_T;
+# define sm_setjmp_sig(buf) sigsetjmp(buf, 1)
+# define sm_setjmp_nosig(buf) sigsetjmp(buf, 0)
+# define sm_longjmp_sig(buf, val) siglongjmp(buf, val)
+# define sm_longjmp_nosig(buf, val) siglongjmp(buf, val)
+
+# else /* SM_CONF_SIGSETJMP */
+
+typedef jmp_buf SM_JMPBUF_T;
+# define sm_setjmp_sig(buf) setjmp(buf)
+# define sm_longjmp_sig(buf, val) longjmp(buf, val)
+# define sm_setjmp_nosig(buf) _setjmp(buf)
+# define sm_longjmp_nosig(buf, val) _longjmp(buf, val)
+
+# endif /* SM_CONF_SIGSETJMP */
+
+#endif /* ! SM_SETJMP_H */
diff --git a/contrib/sendmail/include/sm/shm.h b/contrib/sendmail/include/sm/shm.h
new file mode 100644
index 0000000..62ffe6e
--- /dev/null
+++ b/contrib/sendmail/include/sm/shm.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: shm.h,v 1.7 2001/04/20 15:21:55 ca Exp $
+ */
+
+#ifndef SM_SHM_H
+# define SM_SHM_H
+
+# if SM_CONF_SHM
+# include <sys/types.h>
+# include <sys/ipc.h>
+# include <sys/shm.h>
+
+/* # include "def.h" */
+
+/* key for shared memory */
+# define SM_SHM_KEY ((key_t) 42)
+
+/* return value for failed shmget() */
+# define SM_SHM_NULL ((void *) -1)
+# define SM_SHM_NO_ID (-1)
+# define SM_NO_SHM(id) ((id) < 0)
+
+extern void *sm_shmstart __P((key_t, int , int , int *, bool));
+extern int sm_shmstop __P((void *, int, bool));
+
+/* for those braindead systems... (e.g., SunOS 4) */
+# ifndef SHM_R
+# define SHM_R 0400
+# endif /* SHM_R */
+# ifndef SHM_W
+# define SHM_W 0200
+# endif /* SHM_W */
+
+# endif /* SM_CONF_SHM */
+#endif /* ! SM_SHM_H */
diff --git a/contrib/sendmail/include/sm/signal.h b/contrib/sendmail/include/sm/signal.h
new file mode 100644
index 0000000..3821deb
--- /dev/null
+++ b/contrib/sendmail/include/sm/signal.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: signal.h,v 1.16 2001/07/20 19:48:21 gshapiro Exp $
+ */
+
+/*
+** SIGNAL.H -- libsm (and sendmail) signal facilities
+** Extracted from sendmail/conf.h and focusing
+** on signal configuration.
+*/
+
+#ifndef SM_SIGNAL_H
+#define SM_SIGNAL_H 1
+
+#include <sys/types.h>
+#include <limits.h>
+#include <signal.h>
+#include <sm/cdefs.h>
+#include <sm/conf.h>
+
+/*
+** Critical signal sections
+*/
+
+#define PEND_SIGHUP 0x0001
+#define PEND_SIGINT 0x0002
+#define PEND_SIGTERM 0x0004
+#define PEND_SIGUSR1 0x0008
+
+#define ENTER_CRITICAL() InCriticalSection++
+
+#define LEAVE_CRITICAL() \
+do \
+{ \
+ if (InCriticalSection > 0) \
+ InCriticalSection--; \
+} while (0)
+
+#define CHECK_CRITICAL(sig) \
+do \
+{ \
+ if (InCriticalSection > 0 && (sig) != 0) \
+ { \
+ pend_signal((sig)); \
+ return SIGFUNC_RETURN; \
+ } \
+} while (0)
+
+/* variables */
+extern unsigned int volatile InCriticalSection; /* >0 if in critical section */
+extern int volatile PendingSignal; /* pending signal to resend */
+
+/* functions */
+extern void pend_signal __P((int));
+
+/* reset signal in case System V semantics */
+#ifdef SYS5SIGNALS
+# define FIX_SYSV_SIGNAL(sig, handler) \
+{ \
+ if ((sig) != 0) \
+ (void) sm_signal((sig), (handler)); \
+}
+#else /* SYS5SIGNALS */
+# define FIX_SYSV_SIGNAL(sig, handler) { /* EMPTY */ }
+#endif /* SYS5SIGNALS */
+
+extern void sm_allsignals __P((bool));
+extern int sm_blocksignal __P((int));
+extern int sm_releasesignal __P((int));
+extern sigfunc_t sm_signal __P((int, sigfunc_t));
+extern SIGFUNC_DECL sm_signal_noop __P((int));
+#endif /* SM_SIGNAL_H */
diff --git a/contrib/sendmail/include/sm/string.h b/contrib/sendmail/include/sm/string.h
new file mode 100644
index 0000000..c8cb59f
--- /dev/null
+++ b/contrib/sendmail/include/sm/string.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: string.h,v 1.36 2001/06/17 21:31:11 ca Exp $
+ */
+
+/*
+** libsm string manipulation
+*/
+
+#ifndef SM_STRING_H
+# define SM_STRING_H
+
+# include <sm/gen.h>
+# include <sm/varargs.h>
+# include <string.h> /* strlc{py,at}, strerror */
+
+/* return number of bytes left in a buffer */
+#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
+
+extern int PRINTFLIKE(3, 4)
+sm_snprintf __P((
+ char *,
+ size_t,
+ const char *,
+ ...));
+
+extern bool
+sm_match __P((
+ const char *_str,
+ const char *_pattern));
+
+extern char *
+sm_strdup __P((
+ char *));
+
+extern char *
+sm_strndup_x __P((
+ const char *_str,
+ size_t _len));
+
+/* for "normal" data (free'd before end of process) */
+# define sm_strdup_x(str) strcpy(sm_malloc_x(strlen(str) + 1), str)
+
+/* for data that is supposed to be persistent. */
+# define sm_pstrdup_x(str) strcpy(sm_pmalloc_x(strlen(str) + 1), str)
+
+# define sm_strdup_tagged_x(str, file, line, group) \
+ strcpy(sm_malloc_tagged_x(strlen(str) + 1, file, line, group), str)
+
+extern char *
+sm_stringf_x __P((
+ const char *_fmt,
+ ...));
+
+extern char *
+sm_vstringf_x __P((
+ const char *_fmt,
+ va_list _ap));
+
+extern size_t
+sm_strlcpy __P((
+ char *_dst,
+ const char *_src,
+ ssize_t _len));
+
+extern size_t
+sm_strlcat __P((
+ char *_dst,
+ const char *_src,
+ ssize_t _len));
+
+extern size_t
+sm_strlcat2 __P((
+ char *,
+ const char *,
+ const char *,
+ ssize_t));
+
+extern size_t
+#ifdef __STDC__
+sm_strlcpyn(char *dst, ssize_t len, int n, ...);
+#else /* __STDC__ */
+sm_strlcpyn __P((char *,
+ ssize_t,
+ int,
+ va_dcl));
+#endif /* __STDC__ */
+
+# if !HASSTRERROR
+extern char *
+strerror __P((
+ int _errno));
+# endif /* !HASSTRERROR */
+
+extern int
+sm_strrevcmp __P((
+ const char *,
+ const char *));
+
+extern int
+sm_strrevcasecmp __P((
+ const char *,
+ const char *));
+
+extern int
+sm_strcasecmp __P((
+ const char *,
+ const char *));
+
+extern int
+sm_strncasecmp __P((
+ const char *,
+ const char *,
+ size_t));
+
+extern LONGLONG_T
+sm_strtoll __P((
+ const char *,
+ char**, int));
+
+extern ULONGLONG_T
+sm_strtoull __P((
+ const char *,
+ char**, int));
+
+extern void
+stripquotes __P((char *));
+
+#endif /* SM_STRING_H */
diff --git a/contrib/sendmail/include/sm/sysexits.h b/contrib/sendmail/include/sm/sysexits.h
new file mode 100644
index 0000000..750def1
--- /dev/null
+++ b/contrib/sendmail/include/sm/sysexits.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: sysexits.h,v 1.5 2001/03/10 17:30:01 ca Exp $
+ * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef SM_SYSEXITS_H
+# define SM_SYSEXITS_H
+
+# include <sm/gen.h>
+
+/*
+** SYSEXITS.H -- Exit status codes for system programs.
+**
+** This include file attempts to categorize possible error
+** exit statuses for system programs, notably delivermail
+** and the Berkeley network.
+**
+** Error numbers begin at EX__BASE to reduce the possibility of
+** clashing with other exit statuses that random programs may
+** already return. The meaning of the codes is approximately
+** as follows:
+**
+** EX_USAGE -- The command was used incorrectly, e.g., with
+** the wrong number of arguments, a bad flag, a bad
+** syntax in a parameter, or whatever.
+** EX_DATAERR -- The input data was incorrect in some way.
+** This should only be used for user's data & not
+** system files.
+** EX_NOINPUT -- An input file (not a system file) did not
+** exist or was not readable. This could also include
+** errors like "No message" to a mailer (if it cared
+** to catch it).
+** EX_NOUSER -- The user specified did not exist. This might
+** be used for mail addresses or remote logins.
+** EX_NOHOST -- The host specified did not exist. This is used
+** in mail addresses or network requests.
+** EX_UNAVAILABLE -- A service is unavailable. This can occur
+** if a support program or file does not exist. This
+** can also be used as a catchall message when something
+** you wanted to do doesn't work, but you don't know
+** why.
+** EX_SOFTWARE -- An internal software error has been detected.
+** This should be limited to non-operating system related
+** errors as possible.
+** EX_OSERR -- An operating system error has been detected.
+** This is intended to be used for such things as "cannot
+** fork", "cannot create pipe", or the like. It includes
+** things like getuid returning a user that does not
+** exist in the passwd file.
+** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
+** etc.) does not exist, cannot be opened, or has some
+** sort of error (e.g., syntax error).
+** EX_CANTCREAT -- A (user specified) output file cannot be
+** created.
+** EX_IOERR -- An error occurred while doing I/O on some file.
+** EX_TEMPFAIL -- temporary failure, indicating something that
+** is not really an error. In sendmail, this means
+** that a mailer (e.g.) could not create a connection,
+** and the request should be reattempted later.
+** EX_PROTOCOL -- the remote system returned something that
+** was "not possible" during a protocol exchange.
+** EX_NOPERM -- You did not have sufficient permission to
+** perform the operation. This is not intended for
+** file system problems, which should use NOINPUT or
+** CANTCREAT, but rather for higher level permissions.
+*/
+
+# if SM_CONF_SYSEXITS_H
+# include <sysexits.h>
+# else /* SM_CONF_SYSEXITS_H */
+
+# define EX_OK 0 /* successful termination */
+
+# define EX__BASE 64 /* base value for error messages */
+
+# define EX_USAGE 64 /* command line usage error */
+# define EX_DATAERR 65 /* data format error */
+# define EX_NOINPUT 66 /* cannot open input */
+# define EX_NOUSER 67 /* addressee unknown */
+# define EX_NOHOST 68 /* host name unknown */
+# define EX_UNAVAILABLE 69 /* service unavailable */
+# define EX_SOFTWARE 70 /* internal software error */
+# define EX_OSERR 71 /* system error (e.g., can't fork) */
+# define EX_OSFILE 72 /* critical OS file missing */
+# define EX_CANTCREAT 73 /* can't create (user) output file */
+# define EX_IOERR 74 /* input/output error */
+# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
+# define EX_PROTOCOL 76 /* remote error in protocol */
+# define EX_NOPERM 77 /* permission denied */
+# define EX_CONFIG 78 /* configuration error */
+
+# define EX__MAX 78 /* maximum listed value */
+
+# endif /* SM_CONF_SYSEXITS_H */
+
+extern char *sm_strexit __P((int));
+extern char *sm_sysexitmsg __P((int));
+extern char *sm_sysexmsg __P((int));
+
+#endif /* ! SM_SYSEXITS_H */
diff --git a/contrib/sendmail/include/sm/test.h b/contrib/sendmail/include/sm/test.h
new file mode 100644
index 0000000..1d700d7
--- /dev/null
+++ b/contrib/sendmail/include/sm/test.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: test.h,v 1.6 2001/04/03 01:53:01 gshapiro Exp $
+ */
+
+/*
+** Abstractions for writing a libsm test program.
+*/
+
+#ifndef SM_TEST_H
+# define SM_TEST_H
+
+# include <sm/gen.h>
+
+# if defined(__STDC__) || defined(__cplusplus)
+# define SM_TEST(cond) sm_test(cond, #cond, __FILE__, __LINE__)
+# else /* defined(__STDC__) || defined(__cplusplus) */
+# define SM_TEST(cond) sm_test(cond, "cond", __FILE__, __LINE__)
+# endif /* defined(__STDC__) || defined(__cplusplus) */
+
+extern int SmTestIndex;
+extern int SmTestNumErrors;
+
+extern void
+sm_test_begin __P((
+ int _argc,
+ char **_argv,
+ char *_testname));
+
+extern bool
+sm_test __P((
+ bool _success,
+ char *_expr,
+ char *_filename,
+ int _lineno));
+
+extern int
+sm_test_end __P((void));
+
+#endif /* ! SM_TEST_H */
diff --git a/contrib/sendmail/include/sm/types.h b/contrib/sendmail/include/sm/types.h
new file mode 100644
index 0000000..625a90e
--- /dev/null
+++ b/contrib/sendmail/include/sm/types.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: types.h,v 1.13 2001/04/03 01:53:01 gshapiro Exp $
+ */
+
+/*
+** This header file defines standard integral types.
+** - It includes <sys/types.h>, and fixes portability problems that
+** exist on older Unix platforms.
+** - It defines LONGLONG_T and ULONGLONG_T, which are portable locutions
+** for 'long long' and 'unsigned long long'.
+*/
+
+#ifndef SM_TYPES_H
+# define SM_TYPES_H
+
+# include <sm/config.h>
+
+/*
+** On BSD 4.2 systems, <sys/types.h> was not idempotent.
+** This problem is circumvented by replacing all occurrences
+** of <sys/types.h> with <sm/types.h>, which is idempotent.
+*/
+
+# include <sys/types.h>
+
+/*
+** On some old Unix platforms, some of the standard types are missing.
+** We fix that here.
+*/
+
+# if !SM_CONF_UID_GID
+# define uid_t int
+# define gid_t int
+# endif /* !SM_CONF_UID_GID */
+
+# if !SM_CONF_SSIZE_T
+# define ssize_t int
+# endif /* !SM_CONF_SSIZE_T */
+
+/*
+** Define LONGLONG_T and ULONGLONG_T, which are portable locutions
+** for 'long long' and 'unsigned long long' from the C 1999 standard.
+*/
+
+# if SM_CONF_LONGLONG
+ typedef long long LONGLONG_T;
+ typedef unsigned long long ULONGLONG_T;
+# else /* SM_CONF_LONGLONG */
+# if SM_CONF_QUAD_T
+ typedef quad_t LONGLONG_T;
+ typedef u_quad_t ULONGLONG_T;
+# else /* SM_CONF_QUAD_T */
+ typedef long LONGLONG_T;
+ typedef unsigned long ULONGLONG_T;
+# endif /* SM_CONF_QUAD_T */
+# endif /* SM_CONF_LONGLONG */
+
+#endif /* ! SM_TYPES_H */
diff --git a/contrib/sendmail/include/sm/varargs.h b/contrib/sendmail/include/sm/varargs.h
new file mode 100644
index 0000000..7d2b5ca
--- /dev/null
+++ b/contrib/sendmail/include/sm/varargs.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: varargs.h,v 1.7 2001/09/13 16:45:40 ca Exp $
+ */
+
+/*
+** libsm variable argument lists
+*/
+
+#ifndef SM_VARARGS_H
+# define SM_VARARGS_H
+
+# if defined(__STDC__) || defined(__cplusplus)
+# define SM_VA_STD 1
+# include <stdarg.h>
+# define SM_VA_START(ap, f) va_start(ap, f)
+# else /* defined(__STDC__) || defined(__cplusplus) */
+# define SM_VA_STD 0
+# include <varargs.h>
+# define SM_VA_START(ap, f) va_start(ap)
+# endif /* defined(__STDC__) || defined(__cplusplus) */
+
+# if defined(va_copy)
+# define SM_VA_COPY(dst, src) va_copy((dst), (src))
+# elif defined(__va_copy)
+# define SM_VA_COPY(dst, src) __va_copy((dst), (src))
+# else
+# define SM_VA_COPY(dst, src) (dst) = (src)
+# endif
+
+/*
+** The following macros are useless, but are provided for symmetry.
+*/
+
+# define SM_VA_LOCAL_DECL va_list ap;
+# define SM_VA_ARG(ap, type) va_arg(ap, type)
+# define SM_VA_END(ap) va_end(ap)
+
+#endif /* ! SM_VARARGS_H */
diff --git a/contrib/sendmail/include/sm/xtrap.h b/contrib/sendmail/include/sm/xtrap.h
new file mode 100644
index 0000000..2e7e717
--- /dev/null
+++ b/contrib/sendmail/include/sm/xtrap.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $Id: xtrap.h,v 1.7 2001/04/03 01:53:01 gshapiro Exp $
+ */
+
+/*
+** scaffolding for testing exception handler code
+*/
+
+#ifndef SM_XTRAP_H
+# define SM_XTRAP_H
+
+# include <sm/debug.h>
+# include <sm/exc.h>
+
+extern SM_ATOMIC_UINT_T SmXtrapCount;
+extern SM_DEBUG_T SmXtrapDebug;
+extern SM_DEBUG_T SmXtrapReport;
+
+# if SM_DEBUG_CHECK
+# define sm_xtrap_check() (++SmXtrapCount == sm_debug_level(&SmXtrapDebug))
+# else /* SM_DEBUG_CHECK */
+# define sm_xtrap_check() (0)
+# endif /* SM_DEBUG_CHECK */
+
+# define sm_xtrap_raise_x(exc) \
+ if (sm_xtrap_check()) \
+ { \
+ sm_exc_raise_x(exc); \
+ } else
+
+#endif /* ! SM_XTRAP_H */
OpenPOWER on IntegriCloud