diff options
Diffstat (limited to 'contrib/sendmail/include')
59 files changed, 8007 insertions, 0 deletions
diff --git a/contrib/sendmail/include/libmilter/mfapi.h b/contrib/sendmail/include/libmilter/mfapi.h new file mode 100644 index 0000000..8e3a173 --- /dev/null +++ b/contrib/sendmail/include/libmilter/mfapi.h @@ -0,0 +1,600 @@ +/* + * Copyright (c) 1999-2004, 2006, 2008 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: mfapi.h,v 8.80 2009/11/06 00:57:08 ca Exp $ + */ + +/* +** MFAPI.H -- Global definitions for mail filter library and mail filters. +*/ + +#ifndef _LIBMILTER_MFAPI_H +# define _LIBMILTER_MFAPI_H 1 + +#ifndef SMFI_VERSION +# if _FFR_MDS_NEGOTIATE +# define SMFI_VERSION 0x01000002 /* libmilter version number */ + + /* first libmilter version that has MDS support */ +# define SMFI_VERSION_MDS 0x01000002 +# else /* _FFR_MDS_NEGOTIATE */ +# define SMFI_VERSION 0x01000001 /* libmilter version number */ +# endif /* _FFR_MDS_NEGOTIATE */ +#endif /* ! SMFI_VERSION */ + +#define SM_LM_VRS_MAJOR(v) (((v) & 0x7f000000) >> 24) +#define SM_LM_VRS_MINOR(v) (((v) & 0x007fff00) >> 8) +#define SM_LM_VRS_PLVL(v) ((v) & 0x0000007f) + +# include <sys/types.h> +# include <sys/socket.h> + +#include "libmilter/mfdef.h" + +# define LIBMILTER_API extern + + +/* Only need to export C interface if used by C++ source code */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef _SOCK_ADDR +# define _SOCK_ADDR struct sockaddr +#endif /* ! _SOCK_ADDR */ + +/* +** libmilter functions return one of the following to indicate +** success/failure(/continue): +*/ + +#define MI_SUCCESS 0 +#define MI_FAILURE (-1) +#if _FFR_WORKERS_POOL +# define MI_CONTINUE 1 +#endif /* _FFR_WORKERS_POOL */ + +/* "forward" declarations */ +typedef struct smfi_str SMFICTX; +typedef struct smfi_str *SMFICTX_PTR; + +typedef struct smfiDesc smfiDesc_str; +typedef struct smfiDesc *smfiDesc_ptr; + +/* +** Type which callbacks should return to indicate message status. +** This may take on one of the SMFIS_* values listed below. +*/ + +typedef int sfsistat; + +#if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8 +# define SM__P(X) __PMT(X) +#else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ +# define SM__P(X) __P(X) +#endif /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ + +/* Some platforms don't define __P -- do it for them here: */ +#ifndef __P +# ifdef __STDC__ +# define __P(X) X +# else /* __STDC__ */ +# define __P(X) () +# endif /* __STDC__ */ +#endif /* __P */ + +#if SM_CONF_STDBOOL_H +# include <stdbool.h> +#else /* SM_CONF_STDBOOL_H */ +# ifndef __cplusplus +# ifndef bool +# ifndef __bool_true_false_are_defined +typedef int bool; +# define __bool_true_false_are_defined 1 +# endif /* ! __bool_true_false_are_defined */ +# endif /* bool */ +# endif /* ! __cplusplus */ +#endif /* SM_CONF_STDBOOL_H */ + +/* +** structure describing one milter +*/ + +struct smfiDesc +{ + char *xxfi_name; /* filter name */ + int xxfi_version; /* version code -- do not change */ + unsigned long xxfi_flags; /* flags */ + + /* connection info filter */ + sfsistat (*xxfi_connect) SM__P((SMFICTX *, char *, _SOCK_ADDR *)); + + /* SMTP HELO command filter */ + sfsistat (*xxfi_helo) SM__P((SMFICTX *, char *)); + + /* envelope sender filter */ + sfsistat (*xxfi_envfrom) SM__P((SMFICTX *, char **)); + + /* envelope recipient filter */ + sfsistat (*xxfi_envrcpt) SM__P((SMFICTX *, char **)); + + /* header filter */ + sfsistat (*xxfi_header) SM__P((SMFICTX *, char *, char *)); + + /* end of header */ + sfsistat (*xxfi_eoh) SM__P((SMFICTX *)); + + /* body block */ + sfsistat (*xxfi_body) SM__P((SMFICTX *, unsigned char *, size_t)); + + /* end of message */ + sfsistat (*xxfi_eom) SM__P((SMFICTX *)); + + /* message aborted */ + sfsistat (*xxfi_abort) SM__P((SMFICTX *)); + + /* connection cleanup */ + sfsistat (*xxfi_close) SM__P((SMFICTX *)); + + /* any unrecognized or unimplemented command filter */ + sfsistat (*xxfi_unknown) SM__P((SMFICTX *, const char *)); + + /* SMTP DATA command filter */ + sfsistat (*xxfi_data) SM__P((SMFICTX *)); + + /* negotiation callback */ + sfsistat (*xxfi_negotiate) SM__P((SMFICTX *, + unsigned long, unsigned long, + unsigned long, unsigned long, + unsigned long *, unsigned long *, + unsigned long *, unsigned long *)); + +#if 0 + /* signal handler callback, not yet implemented. */ + int (*xxfi_signal) SM__P((int)); +#endif + +}; + +LIBMILTER_API int smfi_opensocket __P((bool)); +LIBMILTER_API int smfi_register __P((struct smfiDesc)); +LIBMILTER_API int smfi_main __P((void)); +LIBMILTER_API int smfi_setbacklog __P((int)); +LIBMILTER_API int smfi_setdbg __P((int)); +LIBMILTER_API int smfi_settimeout __P((int)); +LIBMILTER_API int smfi_setconn __P((char *)); +LIBMILTER_API int smfi_stop __P((void)); +LIBMILTER_API size_t smfi_setmaxdatasize __P((size_t)); +LIBMILTER_API int smfi_version __P((unsigned int *, unsigned int *, unsigned int *)); + +/* +** 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 */ +#define SMFIF_QUARANTINE 0x00000020L /* filter may quarantine envelope */ + +/* filter may change "from" (envelope sender) */ +#define SMFIF_CHGFROM 0x00000040L +#define SMFIF_ADDRCPT_PAR 0x00000080L /* add recipients incl. args */ + +/* filter can send set of symbols (macros) that it wants */ +#define SMFIF_SETSYMLIST 0x00000100L + + +/* +** Macro "places"; +** Notes: +** - must be coordinated with libmilter/engine.c and sendmail/milter.c +** - the order MUST NOT be changed as it would break compatibility between +** different versions. It's ok to append new entries however +** (hence the list is not sorted by the SMT protocol steps). +*/ + +#define SMFIM_FIRST 0 /* Do NOT use, internal marker only */ +#define SMFIM_CONNECT 0 /* connect */ +#define SMFIM_HELO 1 /* HELO/EHLO */ +#define SMFIM_ENVFROM 2 /* MAIL From */ +#define SMFIM_ENVRCPT 3 /* RCPT To */ +#define SMFIM_DATA 4 /* DATA */ +#define SMFIM_EOM 5 /* end of message (final dot) */ +#define SMFIM_EOH 6 /* end of header */ +#define SMFIM_LAST 6 /* Do NOT use, internal marker only */ + +/* +** Continue processing message/connection. +*/ + +#define SMFIS_CONTINUE 0 + +/* +** Reject the message/connection. +** No further routines will be called for this message +** (or connection, if returned from a connection-oriented routine). +*/ + +#define SMFIS_REJECT 1 + +/* +** Accept the message, +** but silently discard the message. +** No further routines will be called for this message. +** This is only meaningful from message-oriented routines. +*/ + +#define SMFIS_DISCARD 2 + +/* +** Accept the message/connection. +** No further routines will be called for this message +** (or connection, if returned from a connection-oriented routine; +** in this case, it causes all messages on this connection +** to be accepted without filtering). +*/ + +#define SMFIS_ACCEPT 3 + +/* +** Return a temporary failure, i.e., +** the corresponding SMTP command will return a 4xx status code. +** In some cases this may prevent further routines from +** being called on this message or connection, +** although in other cases (e.g., when processing an envelope +** recipient) processing of the message will continue. +*/ + +#define SMFIS_TEMPFAIL 4 + +/* +** Do not send a reply to the MTA +*/ + +#define SMFIS_NOREPLY 7 + +/* +** Skip over rest of same callbacks, e.g., body. +*/ + +#define SMFIS_SKIP 8 + +/* xxfi_negotiate: use all existing protocol options/actions */ +#define SMFIS_ALL_OPTS 10 + +#if 0 +/* +** Filter Routine Details +*/ + +/* connection info filter */ +extern sfsistat xxfi_connect __P((SMFICTX *, char *, _SOCK_ADDR *)); + +/* +** xxfi_connect(ctx, hostname, hostaddr) Invoked on each connection +** +** char *hostname; Host domain name, as determined by a reverse lookup +** on the host address. +** _SOCK_ADDR *hostaddr; Host address, as determined by a getpeername +** call on the SMTP socket. +*/ + +/* SMTP HELO command filter */ +extern sfsistat xxfi_helo __P((SMFICTX *, char *)); + +/* +** xxfi_helo(ctx, helohost) Invoked on SMTP HELO/EHLO command +** +** char *helohost; Value passed to HELO/EHLO command, which should be +** the domain name of the sending host (but is, in practice, +** anything the sending host wants to send). +*/ + +/* envelope sender filter */ +extern sfsistat xxfi_envfrom __P((SMFICTX *, char **)); + +/* +** xxfi_envfrom(ctx, argv) Invoked on envelope from +** +** char **argv; Null-terminated SMTP command arguments; +** argv[0] is guaranteed to be the sender address. +** Later arguments are the ESMTP arguments. +*/ + +/* envelope recipient filter */ +extern sfsistat xxfi_envrcpt __P((SMFICTX *, char **)); + +/* +** xxfi_envrcpt(ctx, argv) Invoked on each envelope recipient +** +** char **argv; Null-terminated SMTP command arguments; +** argv[0] is guaranteed to be the recipient address. +** Later arguments are the ESMTP arguments. +*/ + +/* unknown command filter */ + +extern sfsistat *xxfi_unknown __P((SMFICTX *, const char *)); + +/* +** xxfi_unknown(ctx, arg) Invoked when SMTP command is not recognized or not +** implemented. +** const char *arg; Null-terminated SMTP command +*/ + +/* header filter */ +extern sfsistat xxfi_header __P((SMFICTX *, char *, char *)); + +/* +** xxfi_header(ctx, headerf, headerv) Invoked on each message header. The +** content of the header may have folded white space (that is, multiple +** lines with following white space) included. +** +** char *headerf; Header field name +** char *headerv; Header field value +*/ + +/* end of header */ +extern sfsistat xxfi_eoh __P((SMFICTX *)); + +/* +** xxfi_eoh(ctx) Invoked at end of header +*/ + +/* body block */ +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). +** +** unsigned char *bodyp; Pointer to body data +** size_t bodylen; Length of body data +*/ + +/* end of message */ +extern sfsistat xxfi_eom __P((SMFICTX *)); + +/* +** xxfi_eom(ctx) Invoked at end of message. This routine can perform +** special operations such as modifying the message header, body, or +** envelope. +*/ + +/* message aborted */ +extern sfsistat xxfi_abort __P((SMFICTX *)); + +/* +** xxfi_abort(ctx) Invoked if message is aborted outside of the control of +** the filter, for example, if the SMTP sender issues an RSET command. If +** xxfi_abort is called, xxfi_eom will not be called and vice versa. +*/ + +/* connection cleanup */ +extern sfsistat xxfi_close __P((SMFICTX *)); + +/* +** xxfi_close(ctx) Invoked at end of the connection. This is called on +** close even if the previous mail transaction was aborted. +*/ +#endif /* 0 */ + +/* +** Additional information is passed in to the vendor filter routines using +** symbols. Symbols correspond closely to sendmail macros. The symbols +** defined depend on the context. The value of a symbol is accessed using: +*/ + +/* Return the value of a symbol. */ +LIBMILTER_API char * smfi_getsymval __P((SMFICTX *, char *)); + +/* +** Return the value of a symbol. +** +** SMFICTX *ctx; Opaque context structure +** char *symname; The name of the symbol to access. +*/ + +/* +** Vendor filter routines that want to pass additional information back to +** the MTA for use in SMTP replies may call smfi_setreply before returning. +*/ + +LIBMILTER_API int smfi_setreply __P((SMFICTX *, char *, char *, char *)); + +/* +** 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 *, ...)); + +/* +** Set the specific reply code to be used in response to the active +** command. If not specified, a generic reply code is used. +** +** SMFICTX *ctx; Opaque context structure +** char *rcode; The three-digit (RFC 821) SMTP reply code to be +** returned, e.g., ``551''. +** char *xcode; The extended (RFC 2034) reply code, e.g., ``5.7.6''. +** char *message; The text part of the SMTP reply. +*/ + +/* +** The xxfi_eom routine is called at the end of a message (essentially, +** after the final DATA dot). This routine can call some special routines +** to modify the envelope, header, or body of the message before the +** message is enqueued. These routines must not be called from any vendor +** routine other than xxfi_eom. +*/ + +LIBMILTER_API int smfi_addheader __P((SMFICTX *, char *, char *)); + +/* +** Add a header to the message. It is not checked for standards +** compliance; the mail filter must ensure that no protocols are violated +** as a result of adding this header. +** +** SMFICTX *ctx; Opaque context structure +** char *headerf; Header field name +** char *headerv; Header field value +*/ + +LIBMILTER_API int smfi_chgheader __P((SMFICTX *, char *, int, char *)); + +/* +** Change/delete a header in the message. It is not checked for standards +** compliance; the mail filter must ensure that no protocols are violated +** as a result of adding this header. +** +** SMFICTX *ctx; Opaque context structure +** char *headerf; Header field name +** int index; The Nth occurence of header field name +** char *headerv; New header field value (empty for delete header) +*/ + +LIBMILTER_API int smfi_insheader __P((SMFICTX *, int, char *, char *)); + +/* +** Insert a header into the message. It is not checked for standards +** compliance; the mail filter must ensure that no protocols are violated +** as a result of adding this header. +** +** SMFICTX *ctx; Opaque context structure +** int idx; index into the header list where the insertion should happen +** char *headerh; Header field name +** char *headerv; Header field value +*/ + +LIBMILTER_API int smfi_chgfrom __P((SMFICTX *, char *, char *)); + +/* +** Modify envelope sender address +** +** SMFICTX *ctx; Opaque context structure +** char *mail; New envelope sender address +** char *args; ESMTP arguments +*/ + + +LIBMILTER_API int smfi_addrcpt __P((SMFICTX *, char *)); + +/* +** Add a recipient to the envelope +** +** SMFICTX *ctx; Opaque context structure +** char *rcpt; Recipient to be added +*/ + +LIBMILTER_API int smfi_addrcpt_par __P((SMFICTX *, char *, char *)); + +/* +** Add a recipient to the envelope +** +** SMFICTX *ctx; Opaque context structure +** char *rcpt; Recipient to be added +** char *args; ESMTP arguments +*/ + + +LIBMILTER_API int smfi_delrcpt __P((SMFICTX *, char *)); + +/* +** Send a "no-op" up to the MTA to tell it we're still alive, so long +** milter-side operations don't time out. +** +** SMFICTX *ctx; Opaque context structure +*/ + +LIBMILTER_API int smfi_progress __P((SMFICTX *)); + +/* +** Delete a recipient from the envelope +** +** SMFICTX *ctx; Opaque context structure +** char *rcpt; Envelope recipient to be deleted. This should be in +** exactly the form passed to xxfi_envrcpt or the address may +** not be deleted. +*/ + +LIBMILTER_API int smfi_replacebody __P((SMFICTX *, unsigned char *, int)); + +/* +** Replace the body of the message. This routine may be called multiple +** times if the body is longer than convenient to send in one call. End of +** line should be represented as Carriage-Return/Line Feed. +** +** char *bodyp; Pointer to block of body information to insert +** int bodylen; Length of data pointed at by bodyp +*/ + +/* +** If the message is aborted (for example, if the SMTP sender sends the +** envelope but then does a QUIT or RSET before the data is sent), +** xxfi_abort is called. This can be used to reset state. +*/ + +/* +** Quarantine an envelope +** +** SMFICTX *ctx; Opaque context structure +** char *reason: explanation +*/ + +LIBMILTER_API int smfi_quarantine __P((SMFICTX *ctx, char *reason)); + +/* +** Connection-private data (specific to an SMTP connection) can be +** allocated using the smfi_setpriv routine; routines can access private +** data using smfi_getpriv. +*/ + +LIBMILTER_API int smfi_setpriv __P((SMFICTX *, void *)); + +/* +** Set the private data pointer +** +** SMFICTX *ctx; Opaque context structure +** void *privatedata; Pointer to private data area +*/ + +LIBMILTER_API void *smfi_getpriv __P((SMFICTX *)); + +/* +** Get the private data pointer +** +** SMFICTX *ctx; Opaque context structure +** void *privatedata; Pointer to private data area +*/ + +LIBMILTER_API int smfi_setsymlist __P((SMFICTX *, int, char *)); + +/* +** Set list of symbols (macros) to receive +** +** SMFICTX *ctx; Opaque context structure +** int where; where in the SMTP dialogue should the macros be sent +** char *macros; list of macros (space separated) +*/ + +#if _FFR_THREAD_MONITOR +LIBMILTER_API int smfi_set_max_exec_time __P((unsigned int)); +#endif /* _FFR_THREAD_MONITOR */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ! _LIBMILTER_MFAPI_H */ diff --git a/contrib/sendmail/include/libmilter/mfdef.h b/contrib/sendmail/include/libmilter/mfdef.h new file mode 100644 index 0000000..f42ec02 --- /dev/null +++ b/contrib/sendmail/include/libmilter/mfdef.h @@ -0,0 +1,126 @@ +/* + * Copyright (c) 1999-2007 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.39 2009/11/06 00:57:08 ca Exp $ + */ + +/* +** mfdef.h -- Global definitions for mail filter and MTA. +*/ + +#ifndef _LIBMILTER_MFDEF_H +# define _LIBMILTER_MFDEF_H 1 + +#ifndef SMFI_PROT_VERSION +# define SMFI_PROT_VERSION 6 /* MTA - libmilter protocol version */ +#endif /* SMFI_PROT_VERSION */ + +/* 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 */ +#define MILTER_MAX_DATA_SIZE 65535 /* default milter command data limit */ + +#if _FFR_MDS_NEGOTIATE +# define MILTER_MDS_64K ((64 * 1024) - 1) +# define MILTER_MDS_256K ((256 * 1024) - 1) +# define MILTER_MDS_1M ((1024 * 1024) - 1) +#endif /* _FFR_MDS_NEGOTIATE */ + +/* These apply to SMFIF_* flags */ +#define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */ +#define SMFI_V2_ACTS 0x0000003FL /* The actions of V2 filter */ +#define SMFI_CURR_ACTS 0x000001FFL /* actions of 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_QUIT_NC 'K' /* QUIT but new connection follows */ +#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 */ +#define SMFIC_DATA 'T' /* DATA */ +#define SMFIC_UNKNOWN 'U' /* Any unknown command */ + +/* actions (replies) */ +#define SMFIR_ADDRCPT '+' /* add recipient */ +#define SMFIR_DELRCPT '-' /* remove recipient */ +#define SMFIR_ADDRCPT_PAR '2' /* add recipient (incl. ESMTP args) */ +#define SMFIR_SHUTDOWN '4' /* 421: shutdown (internal to MTA) */ +#define SMFIR_ACCEPT 'a' /* accept */ +#define SMFIR_REPLBODY 'b' /* replace body (chunk) */ +#define SMFIR_CONTINUE 'c' /* continue */ +#define SMFIR_DISCARD 'd' /* discard */ +#define SMFIR_CHGFROM 'e' /* change envelope sender (from) */ +#define SMFIR_CONN_FAIL 'f' /* cause a connection failure */ +#define SMFIR_ADDHEADER 'h' /* add header */ +#define SMFIR_INSHEADER 'i' /* insert header */ +#define SMFIR_SETSYMLIST 'l' /* set list of symbols (macros) */ +#define SMFIR_CHGHEADER 'm' /* change header */ +#define SMFIR_PROGRESS 'p' /* progress */ +#define SMFIR_QUARANTINE 'q' /* quarantine */ +#define SMFIR_REJECT 'r' /* reject */ +#define SMFIR_SKIP 's' /* skip */ +#define SMFIR_TEMPFAIL 't' /* tempfail */ +#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 SMFIP_NR_HDR 0x00000080L /* No reply for headers */ +#define SMFIP_NOHREPL SMFIP_NR_HDR /* No reply for headers */ +#define SMFIP_NOUNKNOWN 0x00000100L /* MTA should not send unknown commands */ +#define SMFIP_NODATA 0x00000200L /* MTA should not send DATA */ +#define SMFIP_SKIP 0x00000400L /* MTA understands SMFIS_SKIP */ +#define SMFIP_RCPT_REJ 0x00000800L /* MTA should also send rejected RCPTs */ +#define SMFIP_NR_CONN 0x00001000L /* No reply for connect */ +#define SMFIP_NR_HELO 0x00002000L /* No reply for HELO */ +#define SMFIP_NR_MAIL 0x00004000L /* No reply for MAIL */ +#define SMFIP_NR_RCPT 0x00008000L /* No reply for RCPT */ +#define SMFIP_NR_DATA 0x00010000L /* No reply for DATA */ +#define SMFIP_NR_UNKN 0x00020000L /* No reply for UNKN */ +#define SMFIP_NR_EOH 0x00040000L /* No reply for eoh */ +#define SMFIP_NR_BODY 0x00080000L /* No reply for body chunk */ +#define SMFIP_HDR_LEADSPC 0x00100000L /* header value leading space */ +#define SMFIP_MDS_256K 0x10000000L /* MILTER_MAX_DATA_SIZE=256K */ +#define SMFIP_MDS_1M 0x20000000L /* MILTER_MAX_DATA_SIZE=1M */ +/* #define SMFIP_ 0x40000000L reserved: see SMFI_INTERNAL*/ + +#define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */ +#define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */ + +/* all defined protocol bits */ +#define SMFI_CURR_PROT 0x001FFFFFL + +/* internal flags: only used between MTA and libmilter */ +#define SMFI_INTERNAL 0x70000000L + +#if _FFR_MILTER_CHECK +# define SMFIP_TEST 0x80000000L +#endif /* _FFR_MILTER_CHECK */ + +#endif /* !_LIBMILTER_MFDEF_H */ diff --git a/contrib/sendmail/include/libmilter/milter.h b/contrib/sendmail/include/libmilter/milter.h new file mode 100644 index 0000000..061a4db --- /dev/null +++ b/contrib/sendmail/include/libmilter/milter.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 1999-2003, 2006 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: milter.h,v 8.41 2006/05/22 23:23:55 ca Exp $ + */ + +/* +** MILTER.H -- Global definitions for mail filter. +*/ + +#ifndef _LIBMILTER_MILTER_H +# define _LIBMILTER_MILTER_H 1 + +#include "sendmail.h" +#include "libmilter/mfapi.h" + +/* socket and thread portability */ +# include <pthread.h> +typedef pthread_t sthread_t; +typedef int socket_t; + +#endif /* ! _LIBMILTER_MILTER_H */ diff --git a/contrib/sendmail/include/libsmdb/smdb.h b/contrib/sendmail/include/libsmdb/smdb.h new file mode 100644 index 0000000..6db0103 --- /dev/null +++ b/contrib/sendmail/include/libsmdb/smdb.h @@ -0,0 +1,360 @@ +/* + * Copyright (c) 1999-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: smdb.h,v 8.41 2002/09/24 19:53:28 ca Exp $ + * + */ + +#ifndef _SMDB_H_ +# define _SMDB_H_ + +# include <sys/types.h> +# include <sys/stat.h> +# include <sm/gen.h> +# include <sm/errstring.h> + +# ifdef NDBM +# include <ndbm.h> +# endif /* NDBM */ + +# ifdef NEWDB +# include "sm/bdb.h" +# endif /* NEWDB */ + +/* +** Some size constants +*/ + +#define SMDB_MAX_USER_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. +** +** 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 +** +** Parameters: +** db -- The database to close. +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_close_func) __P((SMDB_DATABASE *db)); + +/* +** DB_DEL_FUNC -- removes a key and data pair from the database +** +** Parameters: +** db -- The database to close. +** key -- The key to remove. +** flags -- delete options. There are currently no defined +** flags for delete. +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +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. +** +** Parameters: +** db -- The database to close. +** fd -- A pointer to store the returned fd in. +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_fd_func) __P((SMDB_DATABASE *db, int* fd)); + +/* +** DB_GET_FUNC -- Gets the data associated with a key. +** +** Parameters: +** db -- The database to close. +** key -- The key to access. +** data -- A place to store the returned data. +** flags -- get options. There are currently no defined +** flags for get. +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_get_func) __P((SMDB_DATABASE *db, + SMDB_DBENT *key, + SMDB_DBENT *data, unsigned int flags)); + +/* +** DB_PUT_FUNC -- Sets some data according to the key. +** +** Parameters: +** db -- The database to close. +** key -- The key to use. +** data -- The data to store. +** flags -- put options: +** SMDBF_NO_OVERWRITE - Return an error if key alread +** exists. +** SMDBF_ALLOW_DUP - Allow duplicates in btree maps. +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_put_func) __P((SMDB_DATABASE *db, + SMDB_DBENT *key, + SMDB_DBENT *data, unsigned int flags)); + +/* +** DB_SYNC_FUNC -- Flush any cached information to disk. +** +** Parameters: +** db -- The database to sync. +** flags -- sync options: +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +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. +** +** Parameters: +** db -- The database to set. +** uid -- The UID for the new owner (-1 for no change) +** gid -- The GID for the new owner (-1 for no change) +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_set_owner_func) __P((SMDB_DATABASE *db, uid_t uid, gid_t gid)); + +/* +** DB_CURSOR -- Obtain a cursor for sequential access +** +** Parameters: +** db -- The database to use. +** cursor -- The address of a cursor pointer. +** flags -- sync options: +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_cursor_func) __P((SMDB_DATABASE *db, + SMDB_CURSOR **cursor, unsigned int flags)); + +typedef int (*db_lockfd_func) __P((SMDB_DATABASE *db)); + +struct database_struct +{ + db_close_func smdb_close; + db_del_func smdb_del; + db_fd_func smdb_fd; + db_get_func smdb_get; + db_put_func smdb_put; + db_sync_func smdb_sync; + db_set_owner_func smdb_set_owner; + db_cursor_func smdb_cursor; + db_lockfd_func smdb_lockfd; + void *smdb_impl; +}; +/* +** DB_CURSOR_CLOSE -- Close a cursor +** +** Parameters: +** cursor -- The cursor to close. +** +** Returns: +** 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 +** +** Parameters: +** cursor -- The cursor. +** flags -- flags +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_cursor_del_func) __P((SMDB_CURSOR *cursor, + unsigned int flags)); + +/* +** DB_CURSOR_GET -- Get the key/value of this cursor. +** +** Parameters: +** cursor -- The cursor. +** key -- The current key. +** value -- The current value +** flags -- flags +** +** Returns: +** 0 - Success, otherwise errno. +** SMDBE_LAST_ENTRY - This is a success condition that +** gets returned when the end of the +** database is hit. +** +*/ + +typedef int (*db_cursor_get_func) __P((SMDB_CURSOR *cursor, + SMDB_DBENT *key, + SMDB_DBENT *data, + unsigned int flags)); + +/* +** 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. +** +** Parameters: +** cursor -- The cursor. +** key -- The current key. +** value -- The current value +** flags -- flags +** +** Returns: +** 0 - Success, otherwise errno. +** +*/ + +typedef int (*db_cursor_put_func) __P((SMDB_CURSOR *cursor, + SMDB_DBENT *key, + SMDB_DBENT *data, + unsigned int flags)); + + + +struct cursor_struct +{ + db_cursor_close_func smdbc_close; + db_cursor_del_func smdbc_del; + db_cursor_get_func smdbc_get; + db_cursor_put_func smdbc_put; + void *smdbc_impl; +}; + + +struct database_params_struct +{ + unsigned int smdbp_num_elements; + unsigned int smdbp_cache_size; + bool smdbp_allow_dup; +}; + +typedef struct database_params_struct SMDB_DBPARAMS; + +struct database_user_struct +{ + uid_t smdbu_id; + gid_t smdbu_group_id; + char smdbu_name[SMDB_MAX_USER_NAME_LEN]; +}; + +typedef struct database_user_struct SMDB_USER_INFO; + +struct entry_struct +{ + void *data; + size_t size; +}; + +typedef char *SMDB_DBTYPE; +typedef unsigned int SMDB_FLAG; + +/* +** These are types of databases. +*/ + +# define SMDB_TYPE_DEFAULT NULL +# define SMDB_TYPE_DEFAULT_LEN 0 +# define SMDB_TYPE_HASH "hash" +# define SMDB_TYPE_HASH_LEN 5 +# define SMDB_TYPE_BTREE "btree" +# define SMDB_TYPE_BTREE_LEN 6 +# define SMDB_TYPE_NDBM "dbm" +# define SMDB_TYPE_NDBM_LEN 4 + +/* +** These are flags +*/ + +/* Flags for put */ +# define SMDBF_NO_OVERWRITE 0x00000001 +# define SMDBF_ALLOW_DUP 0x00000002 + + +extern SMDB_DATABASE *smdb_malloc_database __P((void)); +extern void smdb_free_database __P((SMDB_DATABASE *)); +extern int smdb_open_database __P((SMDB_DATABASE **, char *, int, + int, long, SMDB_DBTYPE, + SMDB_USER_INFO *, + SMDB_DBPARAMS *)); +# ifdef NEWDB +extern int smdb_db_open __P((SMDB_DATABASE **, char *, int, int, + long, SMDB_DBTYPE, SMDB_USER_INFO *, + SMDB_DBPARAMS *)); +# endif /* NEWDB */ +# ifdef NDBM +extern int smdb_ndbm_open __P((SMDB_DATABASE **, char *, int, int, + long, SMDB_DBTYPE, + SMDB_USER_INFO *, + SMDB_DBPARAMS *)); +# endif /* NDBM */ +extern int smdb_add_extension __P((char *, int, char *, char *)); +extern int smdb_setup_file __P((char *, char *, int, long, + SMDB_USER_INFO *, struct stat *)); +extern int smdb_lock_file __P((int *, char *, int, long, char *)); +extern int smdb_unlock_file __P((int)); +extern int smdb_filechanged __P((char *, char *, int, + struct stat *)); +extern void smdb_print_available_types __P((void)); +extern char *smdb_db_definition __P((SMDB_DBTYPE)); +extern int smdb_lock_map __P((SMDB_DATABASE *, int)); +extern int smdb_unlock_map __P((SMDB_DATABASE *)); +#endif /* ! _SMDB_H_ */ diff --git a/contrib/sendmail/include/sendmail/mailstats.h b/contrib/sendmail/include/sendmail/mailstats.h new file mode 100644 index 0000000..faa83cb --- /dev/null +++ b/contrib/sendmail/include/sendmail/mailstats.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers. + * All rights reserved. + * Copyright (c) 1983 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: mailstats.h,v 8.19 2002/06/27 22:47:22 gshapiro Exp $ + */ + +#define STAT_VERSION 4 +#define STAT_MAGIC 0x1B1DE + +/* +** Statistics structure. +*/ + +struct statistics +{ + int stat_magic; /* magic number */ + int stat_version; /* stat file version */ + time_t stat_itime; /* file initialization time */ + short stat_size; /* size of this structure */ + long stat_cf; /* # from connections */ + long stat_ct; /* # to connections */ + long stat_cr; /* # rejected connections */ + long stat_nf[MAXMAILERS]; /* # msgs from each mailer */ + long stat_bf[MAXMAILERS]; /* kbytes from each mailer */ + long stat_nt[MAXMAILERS]; /* # msgs to each mailer */ + long stat_bt[MAXMAILERS]; /* kbytes to each mailer */ + long stat_nr[MAXMAILERS]; /* # rejects by each mailer */ + long stat_nd[MAXMAILERS]; /* # discards by each mailer */ + long stat_nq[MAXMAILERS]; /* # quarantines by each mailer */ +}; diff --git a/contrib/sendmail/include/sendmail/pathnames.h b/contrib/sendmail/include/sendmail/pathnames.h new file mode 100644 index 0000000..cbf5f4a --- /dev/null +++ b/contrib/sendmail/include/sendmail/pathnames.h @@ -0,0 +1,62 @@ +/*- + * 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. + * + * 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: pathnames.h,v 8.36 2002/04/09 22:40:26 gshapiro 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_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 new file mode 100644 index 0000000..b12a5a1 --- /dev/null +++ b/contrib/sendmail/include/sendmail/sendmail.h @@ -0,0 +1,135 @@ +/* + * 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: sendmail.h,v 8.68 2002/07/01 22:18:53 gshapiro Exp $ + */ + +/* +** SENDMAIL.H -- Global definitions for sendmail. +*/ + +#include <stdio.h> +#include <sm/bitops.h> +#include <sm/io.h> +#include <sm/string.h> +#include "conf.h" + +/********************************************************************** +** Table sizes, etc.... +** There shouldn't be much need to change these.... +**********************************************************************/ +#ifndef MAXMAILERS +# define MAXMAILERS 25 /* maximum mailers known to system */ +#endif /* ! MAXMAILERS */ + +/* +** Flags passed to safefile/safedirpath. +*/ + +#define SFF_ANYFILE 0L /* no special restrictions */ +#define SFF_MUSTOWN 0x00000001L /* user must own this file */ +#define SFF_NOSLINK 0x00000002L /* file cannot be a symbolic link */ +#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 /* 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 */ +#define SFF_NOHLINK 0x00000200L /* file cannot have hard links */ +#define SFF_NOWLINK 0x00000400L /* links only in non-writable dirs */ +#define SFF_NOGWFILES 0x00000800L /* disallow world writable files */ +#define SFF_NOWWFILES 0x00001000L /* disallow group writable files */ +#define SFF_OPENASROOT 0x00002000L /* open as root instead of real user */ +#define SFF_NOLOCK 0x00004000L /* don't lock the file */ +#define SFF_NOGRFILES 0x00008000L /* disallow g readable files */ +#define SFF_NOWRFILES 0x00010000L /* disallow o readable files */ +#define SFF_NOTEXCL 0x00020000L /* creates don't need to be exclusive */ +#define SFF_EXECOK 0x00040000L /* executable files are ok (E_SM_ISEXEC) */ +#define SFF_NBLOCK 0x00080000L /* use a non-blocking lock */ +#define SFF_NORFILES (SFF_NOGRFILES|SFF_NOWRFILES) + +/* pseudo-flags */ +#define SFF_NOLINK (SFF_NOHLINK|SFF_NOSLINK) + +/* functions */ +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 *)); + +/* +** DontBlameSendmail options +** +** Hopefully nobody uses these. +*/ + +#define DBS_SAFE 0 +#define DBS_ASSUMESAFECHOWN 1 +#define DBS_GROUPWRITABLEDIRPATHSAFE 2 +#define DBS_GROUPWRITABLEFORWARDFILESAFE 3 +#define DBS_GROUPWRITABLEINCLUDEFILESAFE 4 +#define DBS_GROUPWRITABLEALIASFILE 5 +#define DBS_WORLDWRITABLEALIASFILE 6 +#define DBS_FORWARDFILEINUNSAFEDIRPATH 7 +#define DBS_MAPINUNSAFEDIRPATH 8 +#define DBS_LINKEDALIASFILEINWRITABLEDIR 9 +#define DBS_LINKEDCLASSFILEINWRITABLEDIR 10 +#define DBS_LINKEDFORWARDFILEINWRITABLEDIR 11 +#define DBS_LINKEDINCLUDEFILEINWRITABLEDIR 12 +#define DBS_LINKEDMAPINWRITABLEDIR 13 +#define DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR 14 +#define DBS_FILEDELIVERYTOHARDLINK 15 +#define DBS_FILEDELIVERYTOSYMLINK 16 +#define DBS_WRITEMAPTOHARDLINK 17 +#define DBS_WRITEMAPTOSYMLINK 18 +#define DBS_WRITESTATSTOHARDLINK 19 +#define DBS_WRITESTATSTOSYMLINK 20 +#define DBS_FORWARDFILEINGROUPWRITABLEDIRPATH 21 +#define DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH 22 +#define DBS_CLASSFILEINUNSAFEDIRPATH 23 +#define DBS_ERRORHEADERINUNSAFEDIRPATH 24 +#define DBS_HELPFILEINUNSAFEDIRPATH 25 +#define DBS_FORWARDFILEINUNSAFEDIRPATHSAFE 26 +#define DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE 27 +#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 +#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 */ + unsigned char dbs_flag; /* numeric level */ +}; + +/* 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/bdb.h b/contrib/sendmail/include/sm/bdb.h new file mode 100644 index 0000000..babe1ff --- /dev/null +++ b/contrib/sendmail/include/sm/bdb.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002, 2003 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: bdb.h,v 1.4 2003/03/06 16:30:05 ca Exp $ + */ + +#ifndef SM_BDB_H +#define SM_BDB_H + +#if NEWDB +# include <db.h> +# ifndef DB_VERSION_MAJOR +# define DB_VERSION_MAJOR 1 +# endif /* ! DB_VERSION_MAJOR */ + +# if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1 + +# define DBTXN NULL , + +/* +** Always turn on DB_FCNTL_LOCKING for DB 4.1.x since its +** "workaround" for accepting an empty (locked) file depends on +** this flag. Notice: this requires 4.1.24 + patch (which should be +** part of 4.1.25). +*/ + +# define SM_DB_FLAG_ADD(flag) (flag) |= DB_FCNTL_LOCKING + +# else /* DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1 */ + +# define DBTXN +# if !HASFLOCK && defined(DB_FCNTL_LOCKING) +# define SM_DB_FLAG_ADD(flag) (flag) |= DB_FCNTL_LOCKING +# else /* !HASFLOCK && defined(DB_FCNTL_LOCKING) */ +# define SM_DB_FLAG_ADD(flag) ((void) 0) +# endif /* !HASFLOCK && defined(DB_FCNTL_LOCKING) */ + +# endif /* DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1 */ +#endif /* NEWDB */ + +#endif /* ! SM_BDB_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..046ea04 --- /dev/null +++ b/contrib/sendmail/include/sm/cdefs.h @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2000-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: cdefs.h,v 1.16 2003/12/05 22:45:25 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) +# ifndef __P +# define __P(protos) protos +# endif /* __P */ +# 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 +# define SM_DEAD_D volatile +# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ +# define SM_DEAD(proto) proto __attribute__((__noreturn__)) +# define SM_DEAD_D +# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ +# else /* __GNUC__ >= 2 */ +# define SM_DEAD(proto) proto +# define SM_DEAD_D +# 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..ba7fd68 --- /dev/null +++ b/contrib/sendmail/include/sm/clock.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 1998-2001, 2004 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.12 2004/08/03 19:57:21 ca 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_seteventm __P((int, void(*)__P((int)), int)); +extern SM_EVENT *sm_sigsafe_seteventm __P((int, void(*)__P((int)), 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..5b18754 --- /dev/null +++ b/contrib/sendmail/include/sm/conf.h @@ -0,0 +1,3034 @@ +/* + * Copyright (c) 1998-2009 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.139 2009/06/16 23:41:32 ca Exp $ + */ + +/* +** CONF.H -- All user-configurable parameters for sendmail +** +** Send updates to Sendmail.ORG so they will be +** included in the next release; see +** http://www.sendmail.org/email-addresses.html +** for current e-mail address. +*/ + +#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" +# ifndef SMRSH_CMDDIR +# define SMRSH_CMDDIR "/var/adm/sm.bin" +# endif /* ! SMRSH_CMDDIR */ +# endif /* HPUX10 */ +# ifdef HPUX11 +# define HASSETREUID 1 /* setreuid(2) works on HP-UX 11.x */ +# 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 */ +# ifndef SMRSH_CMDDIR +# define SMRSH_CMDDIR "/var/adm/sm.bin" +# endif /* ! SMRSH_CMDDIR */ +# 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 +# include <sys/signal.h> +# include <sys/wait.h> +# define _AIX4 40300 +# define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */ +# define SOCKOPT_LEN_T socklen_t /* arg#5 to getsockopt */ +# if _AIX5 >= 50200 +# define HASUNSETENV 1 /* has unsetenv(3) call */ +# endif /* _AIX5 >= 50200 */ +# 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 */ +# ifndef SOCKOPT_LEN_T +# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */ +# endif /* SOCKOPT_LEN_T */ +# if _AIX4 >= 40200 +# define HASSETREUID 1 /* setreuid(2) works as of AIX 4.2 */ +# ifndef SOCKADDR_LEN_T +# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */ +# endif /* SOCKADDR_LEN_T */ +# 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 */ +# ifndef LA_TYPE +# define LA_TYPE LA_INT +# endif /* LA_TYPE */ +# 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 +# if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) + /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */ +# define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN +# endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */ +# 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 >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) +# define HASSNPRINTF 1 /* has snprintf(3c) starting in 2.6 */ +# endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */ +# 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" +# ifndef SMRSH_CMDDIR +# define SMRSH_CMDDIR "/var/adm/sm.bin" +# endif /* ! SMRSH_CMDDIR */ +# define SL_FUDGE 34 /* fudge offset for SyslogPrefixLen */ +# define HASLDAPGETALIASBYNAME 1 /* added in S8 */ +# endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */ +# if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) +# define HASURANDOMDEV 1 /* /dev/[u]random added in S9 */ +# define HASCLOSEFROM 1 /* closefrom(3c) added in S9 */ +# define HASFDWALK 1 /* fdwalk(3c) added in S9 */ +# endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */ +# if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) +# define HASUNSETENV 1 /* unsetenv() added in S10 */ +# endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */ +# if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) +# define GETLDAPALIASBYNAME_VERSION 2 /* changed in S11 */ +# define HAVE_NANOSLEEP 1 /* moved from librt to libc in S11 */ +# endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */ +# 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 +# include <standards.h> +# if _XOPEN_SOURCE+0 >= 400 +# define HASFLOCK 0 /* 5.0 and later has bad flock(2) call */ +# else /* _XOPEN_SOURCE+0 >= 400 */ +# define HASFLOCK 1 /* has flock(2) call */ +# endif /* _XOPEN_SOURCE+0 >= 400 */ +# 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 */ +# if _FFR_DIGUNIX_SAFECHOWN +/* +** Testing on a Digital UNIX 4.0a system showed this to be the correct +** setting but given the security consequences, more testing and +** verification is needed. Unfortunately, the man page offers no +** assistance. +*/ +# define IS_SAFE_CHOWN >= 0 +# endif /* _FFR_DIGUNIX_SAFECHOWN */ +# 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 Darwin +** Contributed by Wilfredo Sanchez <wsanchez@mit.edu> +*/ + +# if defined(DARWIN) +# define HASFCHMOD 1 /* has fchmod(2) */ +# define HASFCHOWN 1 /* has fchown(2) */ +# define HASFLOCK 1 /* has flock(2) */ +# define HASUNAME 1 /* has uname(2) */ +# define HASUNSETENV 1 /* has unsetenv(3) */ +# define HASSETSID 1 /* has POSIX setsid(2) call */ +# define HASINITGROUPS 1 /* has initgroups(3) */ +# define HASSETVBUF 1 /* has setvbuf (3) */ +# define HASSETREUID 0 /* setreuid(2) unusable */ +# define HASSETEUID 1 /* has seteuid(2) */ +# define USESETEUID 1 /* has seteuid(2) */ +# define HASSETEGID 1 /* has setegid(2) */ +# define HASSETREGID 1 /* has setregid(2) */ +# define HASSETRESGID 0 /* no setresgid(2) */ +# define HASLSTAT 1 /* has lstat(2) */ +# define HASSETRLIMIT 1 /* has setrlimit(2) */ +# define HASWAITPID 1 /* has waitpid(2) */ +# define HASGETDTABLESIZE 1 /* has getdtablesize(2) */ +# define HAS_ST_GEN 1 /* has st_gen field in struct stat */ +# define HASURANDOMDEV 1 /* has urandom(4) */ +# define HASSTRERROR 1 /* has strerror(3) */ +# define HASGETUSERSHELL 1 /* had getusershell(3) */ +# define GIDSET_T gid_t /* getgroups(2) takes gid_t */ +# define LA_TYPE LA_SUBR /* use getloadavg(3) */ +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ +# if DARWIN >= 70000 +# define SOCKADDR_LEN_T socklen_t +# endif +# if DARWIN >= 80000 +# define SPT_TYPE SPT_REUSEARGV +# define SPT_PADCHAR '\0' +# define SOCKOPT_LEN_T socklen_t +# else +# define SPT_TYPE SPT_PSSTRINGS /* use magic PS_STRINGS pointer for setproctitle */ +# endif +# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ +# define BSD4_4_SOCKADDR /* struct sockaddr has sa_len */ +# define SAFENFSPATHCONF 0 /* unverified: pathconf(2) doesn't work on NFS */ +# define HAS_IN_H 1 +# define NETLINK 1 /* supports AF_LINK */ +# ifndef NOT_SENDMAIL +# define sleep sleepX +extern unsigned int sleepX __P((unsigned int seconds)); +# endif /* ! NOT_SENDMAIL */ +# endif /* defined(DARWIN) */ + + +/* +** 4.4 BSD +** +** See also BSD defines. +*/ + +# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN) +# 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__) && !defined(DARWIN)*/ + + +/* +** 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 POSIX setsid(2) call */ +# 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__ */ + + +# if defined(__QNX__) +# if defined(__QNXNTO__) +/* QNX 6 */ +# include <unix.h> +# define HASUNSETENV 1 /* has unsetenv(3) call */ +# define HASINITGROUPS 1 /* has initgroups(3) call */ +# define HASSETSID 1 /* has POSIX setsid(2) call */ +# define USESETEUID 1 /* has usable seteuid(2) call */ +# define HASFCHMOD 1 /* has fchmod(2) syscall */ +# define HASFCHOWN 1 /* has fchown(2) syscall */ +# define HASUNAME 1 /* has uname(2) syscall */ +# define HASSTRERROR 1 /* has strerror(3) */ +# define BSD4_4_SOCKADDR /* has sa_len */ +# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ +# define NETLINK 1 /* supports AF_LINK */ +# define GIDSET_T gid_t +# define QUAD_T uint64_t +# define HASSNPRINTF 1 /* has snprintf(3) (all versions?) */ +# define HASGETUSERSHELL 0 + +/* +** We have a strrev() that doesn't allocate anything. +** Make sure the one here is used. +*/ + +# define strrev strrev_sendmail + +# else /* defined(__QNXNTO__) */ + +/* +** QNX 4.2x +** Contributed by Glen McCready <glen@qnx.com>. +** +** Should work with all versions of QNX 4. +*/ + +# include <unix.h> +# include <sys/select.h> +# undef NGROUPS_MAX +# define HASSETSID 1 /* has POSIX setsid(2) call */ +# 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 _FILE_H_INCLUDED +# endif /* defined(__QNXNTO__) */ +# endif /* defined(__QNX__) */ + + +/* +** DragonFly BSD/ 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(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +# include <paths.h> +# define HASUNSETENV 1 /* has unsetenv(3) call */ +# define HASSETSID 1 /* has POSIX setsid(2) call */ +# define USESETEUID 1 /* has usable seteuid(2) call */ +# define HASFCHMOD 1 /* has fchmod(2) syscall */ +# define HASFCHOWN 1 /* has fchown(2) syscall */ +# 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 +# define HASSNPRINTF 1 /* has snprintf(3) (all versions?) */ +# ifndef LA_TYPE +# define LA_TYPE LA_SUBR +# endif /* ! LA_TYPE */ +# if defined(__NetBSD__) && defined(__NetBSD_Version__) && \ + ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \ + (__NetBSD_Version__ >= 299000900)) +# undef SFS_TYPE +# define SFS_TYPE SFS_STATVFS +# else +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ +# endif +# 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(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000 +# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */ +# endif +# if defined(__NetBSD__) && defined(__NetBSD_Version__) && \ + ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \ + (__NetBSD_Version__ >= 299000900)) +# define HASCLOSEFROM 1 /* closefrom(3) added in 2.0F */ +# endif +# if defined(__NetBSD__) +# define USESYSCTL 1 /* use sysctl(3) for getting ncpus */ +# include <sys/param.h> +# include <sys/sysctl.h> +# endif +# if defined(__DragonFly__) +# define HASSETLOGIN 1 /* has setlogin(2) */ +# define HASSRANDOMDEV 1 /* has srandomdev(3) */ +# define HASURANDOMDEV 1 /* has /dev/urandom(4) */ +# undef SPT_TYPE +# include <libutil.h> +# define SPT_TYPE SPT_BUILTIN +# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */ +# ifndef SMRSH_CMDDIR +# define SMRSH_CMDDIR "/usr/libexec/sm.bin" +# endif /* ! SMRSH_CMDDIR */ +# ifndef SMRSH_PATH +# define SMRSH_PATH "/bin:/usr/bin" +# endif /* ! SMRSH_PATH */ +# define USESYSCTL 1 /* use sysctl(3) for getting ncpus */ +# include <sys/sysctl.h> +# endif /* defined(__DragonFly__) */ +# 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 */ +# ifndef SMRSH_CMDDIR +# define SMRSH_CMDDIR "/usr/libexec/sm.bin" +# endif /* ! SMRSH_CMDDIR */ +# ifndef SMRSH_PATH +# define SMRSH_PATH "/bin:/usr/bin" +# endif /* ! SMRSH_PATH */ +# endif /* __FreeBSD_version >= 330000 */ +# if __FreeBSD_version >= 430000 /* 4.3.0-release and later */ +# define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */ +# define SOCKOPT_LEN_T socklen_t /* arg#5 to getsockopt */ +# endif /* __FreeBSD_version >= 430000 */ +# 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) */ +# if OpenBSD < 200305 +# define HASSETREUID 0 /* setreuid(2) broken in OpenBSD < 3.3 */ +# endif /* OpenBSD < 200305 */ +# 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 */ +# if OpenBSD >= 200405 +# define HASCLOSEFROM 1 /* closefrom(3) added in 3.5 */ +# endif /* OpenBSD >= 200405 */ +# if OpenBSD >= 200505 +# undef NETISO /* iso.h removed in 3.7 */ +# endif /* OpenBSD >= 200505 */ +# endif /* defined(__OpenBSD__) */ +# endif /* defined(__DragonFly__) || 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> +** +** 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 */ +# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) +# define HASFLOCK 1 /* flock(2) fixed after 1.3.95 */ +# else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */ +# define HASFLOCK 0 /* flock(2) is broken (again) after 2.4.0 */ +# endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */ +# 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)) */ +# if defined(__GLIBC__) && defined(__GLIBC_MINOR__) +# define HASSTRERROR 1 /* has strerror(3) */ +# endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */ +# ifndef TZ_TYPE +# define TZ_TYPE TZ_NONE /* no standard for Linux */ +# endif /* ! TZ_TYPE */ +# if (__GLIBC__ >= 2) +# include <paths.h> +# endif /* (__GLIBC__ >= 2) */ +# 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 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, UNICOS/mk, and UNICOS/mp +** +** UNICOS: +** Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov> +** Update Brian Ginsbach <ginsbach@cray.com> +** UNICOS/mk (Cray T3E): +** Contributed by Manu Mahonen <mailadm@csc.fi> +** of Center for Scientific Computing. +** Update Brian Ginsbach <ginsbach@cray.com> +** UNICOS/mp: +** From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com> +*/ + +# if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP) +# define SYSTEM5 1 /* include all the System V defines */ +# define HASFCHMOD 1 /* has fchmod(2) syscall */ +# define HASFCHOWN 1 /* has fchown(2) */ +# define HASUNSETENV 1 /* has unsetenv(3) call */ +# define HASINITGROUPS 1 /* has initgroups(3) call */ +# define HASSETREUID 1 /* has setreuid(2) call */ +# define USESETEUID 1 /* has usable seteuid(2) call */ +# define HASGETDTABLESIZE 1 /* has getdtablesize(2) syscall */ +# define HASSTRERROR 1 /* has strerror(3) */ +# define GIDSET_T gid_t +# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ +# define SFS_BAVAIL f_bfree /* alternate field name */ +# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */ +# ifdef UNICOS +# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */ +# define LA_TYPE LA_ZERO +# define _PATH_MAILDIR "/usr/spool/mail" +# define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst) +# ifndef MAXPATHLEN +# define MAXPATHLEN PATHSIZE +# endif /* ! MAXPATHLEN */ +# ifndef _PATH_UNIX +# ifdef UNICOSMK +# define _PATH_UNIX "/unicosmk.ar" +# else +# define _PATH_UNIX "/unicos" +# endif /* UNICOSMK */ +# endif /* ! _PATH_UNIX */ +# ifndef _PATH_VENDOR_CF +# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf" +# endif /* ! _PATH_VENDOR_CF */ +# endif /* UNICOS */ +# ifdef _UNICOSMP +# if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) + /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */ +# define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN +# endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */ +# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ +# define HASSETRLIMIT 1 /* has setrlimit(2) syscall */ +# define LA_TYPE LA_IRIX6 /* figure out at run time */ +# include <sys/cdefs.h> +# include <paths.h> +# define ARGV_T char *const * +# endif /* _UNICOSMP */ +# endif /* _CRAY */ + +/* +** 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 /* has POSIX setsid(2) call */ +# 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 /* has POSIX setsid(2) call */ +# 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 */ + + +/* +** 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 /* has POSIX setsid(2) call */ +# 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 */ + +/* +** Interix +** Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com> +** +** Used for Interix support. +*/ + +# if defined(__INTERIX) +# define HASURANDOMDEV 1 +# define HASGETUSERSHELL 0 +# define HASSTRERROR 1 +# define HASUNSETENV 1 +# define HASFCHOWN 1 +# undef HAVE_SYS_ERRLIST +# define sys_errlist __sys_errlist +# define sys_nerr __sys_nerr +# include <sys/mkdev.h> +# ifndef major +# define major(dev) ((int)(((dev) >> 8) & 0xff)) +# endif /* ! major */ +# ifndef minor +# define minor(dev) ((int)((dev) & 0xff)) +# endif /* ! minor */ +# endif /* defined(__INTERIX) */ + + +/********************************************************************** +** 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 _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255 + /* + ** override Linux wierdness: a FQHN can be 255 chars long + ** SUSv3 requires HOST_NAME_MAX ("Maximum length of a host + ** name (not including the terminating null) as returned from the + ** gethostname() function.") to be at least 255. c.f.: + ** http://www.opengroup.org/onlinepubs/009695399 + ** but Linux defines that to 64 too. + */ +# undef MAXHOSTNAMELEN +# define MAXHOSTNAMELEN 256 +# endif /* _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255 */ + +# 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 */ + +/* for FD_SET() */ +#ifndef FD_SETSIZE +# define FD_SETSIZE 256 +#endif /* ! FD_SETSIZE */ + +/* +** 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) __P((void)); + } 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..5ebe548 --- /dev/null +++ b/contrib/sendmail/include/sm/config.h @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2000-2003 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.47 2004/10/26 21:41:07 gshapiro 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 */ + +/* LDAP Checks */ +# if LDAPMAP +# include <lber.h> +# include <ldap.h> + +/* Does the LDAP library have ldap_memfree()? */ +# ifndef SM_CONF_LDAP_MEMFREE + +/* +** The new LDAP C API (draft-ietf-ldapext-ldap-c-api-04.txt) includes +** ldap_memfree() in the API. That draft states to use LDAP_API_VERSION +** of 2004 to identify the API. +*/ + +# if USING_NETSCAPE_LDAP || LDAP_API_VERSION >= 2004 +# define SM_CONF_LDAP_MEMFREE 1 +# else /* USING_NETSCAPE_LDAP || LDAP_API_VERSION >= 2004 */ +# define SM_CONF_LDAP_MEMFREE 0 +# endif /* USING_NETSCAPE_LDAP || LDAP_API_VERSION >= 2004 */ +# endif /* ! SM_CONF_LDAP_MEMFREE */ + +/* Does the LDAP library have ldap_initialize()? */ +# ifndef SM_CONF_LDAP_INITIALIZE + +/* +** Check for ldap_initialize() support for support for LDAP URI's with +** non-ldap:// schemes. +*/ + +/* OpenLDAP does it with LDAP_OPT_URI */ +# ifdef LDAP_OPT_URI +# define SM_CONF_LDAP_INITIALIZE 1 +# endif /* LDAP_OPT_URI */ +# endif /* !SM_CONF_LDAP_INITIALIZE */ +# endif /* LDAPMAP */ + +/* don't use strcpy() */ +# ifndef DO_NOT_USE_STRCPY +# define DO_NOT_USE_STRCPY 1 +# endif /* ! DO_NOT_USE_STRCPY */ + +#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..e3142b2 --- /dev/null +++ b/contrib/sendmail/include/sm/debug.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2000, 2001, 2003 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.16 2003/01/10 00:26:06 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)); + +extern void +sm_debug_close __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..1d41526 --- /dev/null +++ b/contrib/sendmail/include/sm/errstring.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1998-2001, 2003 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.10 2007/03/21 23:56:19 ca Exp $ + */ + +/* +** Error codes. +*/ + +#ifndef SM_ERRSTRING_H +# define SM_ERRSTRING_H + +#if defined(__QNX__) +# define E_PSEUDOBASE 512 +#endif /* defined(__QNX__) */ + +#include <errno.h> +#if NEEDINTERRNO +extern int errno; +#endif /* NEEDINTERRNO */ + +/* +** 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 */ +#define E_LDAPURLBASE (E_PSEUDOBASE + 200) /* base for LDAP URL 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) +#define SMDBE_VERSION_MISMATCH (E_SMDBBASE + 24) + +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..bb42185 --- /dev/null +++ b/contrib/sendmail/include/sm/fdset.h @@ -0,0 +1,25 @@ +/* + * 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: fdset.h,v 1.5 2002/12/10 19:48:19 ca Exp $ + */ + +#ifndef SM_FDSET_H +# define SM_FDSET_H + +/* +** Note: SM_FD_OK_SELECT(fd) requires that ValidSocket(fd) has been checked +** before. +*/ + +# 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 +# define SM_FD_OK_SELECT(fd) (FD_SETSIZE <= 0 || (fd) < 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..6fec06c --- /dev/null +++ b/contrib/sendmail/include/sm/gen.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2000-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: gen.h,v 1.23 2003/11/04 18:51:54 ca 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 /* ! NULL */ +# 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 +# define __bool_true_false_are_defined 1 +# endif /* ! __cplusplus */ +# 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..cd346b3 --- /dev/null +++ b/contrib/sendmail/include/sm/heap.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2000-2001, 2006 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.23 2006/08/15 00:53:46 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) + +#define SM_FREE(ptr) \ + do \ + { \ + if ((ptr) != NULL) \ + { \ + sm_free(ptr); \ + (ptr) = NULL; \ + } \ + } while (0) + +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..d3f21d0 --- /dev/null +++ b/contrib/sendmail/include/sm/io.h @@ -0,0 +1,389 @@ +/* + * Copyright (c) 2000-2002, 2004 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.24 2004/03/03 19:14:49 ca 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 */ + +# define SM_IO_BINARY 0x0 /* binary mode: not used in Unix */ +#define SM_IS_BINARY(mode) (((mode) & SM_IO_BINARY) != 0) +#define SM_IO_MODE(mode) ((mode) & 0x0f) + +#define SM_IO_RDWR_B (SM_IO_RDWR|SM_IO_BINARY) +#define SM_IO_RDONLY_B (SM_IO_RDONLY|SM_IO_BINARY) +#define SM_IO_WRONLY_B (SM_IO_WRONLY|SM_IO_BINARY) +#define SM_IO_APPEND_B (SM_IO_APPEND|SM_IO_BINARY) +#define SM_IO_APPENDRW_B (SM_IO_APPENDRW|SM_IO_BINARY) +#define SM_IO_RDWRTR_B (SM_IO_RDWRTR|SM_IO_BINARY) + +/* 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 +#define SM_IO_WHAT_SIZE 8 + +/* 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 */ + 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 */ + + /* 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 SMMODEMASK 0x0070 /* read/write mode */ + +/* 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..b0a9cc0 --- /dev/null +++ b/contrib/sendmail/include/sm/ldap.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2001-2003, 2005-2007 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.34 2008/11/17 21:02:54 ca Exp $ + */ + +#ifndef SM_LDAP_H +# define SM_LDAP_H + +# include <sm/conf.h> +# include <sm/rpool.h> + +/* +** NOTE: These should be changed from LDAPMAP_* to SM_LDAP_* +** in the next major release (8.x+1) of sendmail. +*/ + +# 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 + +/* maximum number of arguments in a map lookup, see sendmail.h: MAX_MAP_ARGS */ +# define SM_LDAP_ARGS 10 + +/* error codes from sm_ldap_search*() */ +# define SM_LDAP_ERR (-1) /* generic error: ldap_search(3) */ +# define SM_LDAP_ERR_ARG_MISS (-2) /* an argument is missing */ + +/* Attribute types */ +# define SM_LDAP_ATTR_NONE (-1) +# define SM_LDAP_ATTR_OBJCLASS 0 +# define SM_LDAP_ATTR_NORMAL 1 +# define SM_LDAP_ATTR_DN 2 +# define SM_LDAP_ATTR_FILTER 3 +# define SM_LDAP_ATTR_URL 4 + +/* sm_ldap_results() flags */ +# define SM_LDAP_SINGLEMATCH 0x0001 +# define SM_LDAP_MATCHONLY 0x0002 +# define SM_LDAP_USE_ALLATTR 0x0004 +# define SM_LDAP_SINGLEDN 0x0008 + +struct sm_ldap_struct +{ + /* needed for ldap_open or ldap_init */ + char *ldap_uri; + char *ldap_host; + int ldap_port; + int ldap_version; + 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]; + int ldap_attr_type[LDAPMAP_MAX_ATTR + 1]; + char *ldap_attr_needobjclass[LDAPMAP_MAX_ATTR + 1]; + bool ldap_attrsonly; + bool ldap_multi_args; + + /* args for ldap_result */ + struct timeval ldap_timeout; + LDAPMessage *ldap_res; + + /* ldapmap_lookup options */ + char ldap_attrsep; + +# if _FFR_LDAP_NETWORK_TIMEOUT + int ldap_networktmo; +# endif /* _FFR_LDAP_NETWORK_TIMEOUT */ + + /* Linked list of maps sharing the same LDAP binding */ + void *ldap_next; +}; + +typedef struct sm_ldap_struct SM_LDAP_STRUCT; + +struct sm_ldap_recurse_entry +{ + char *lr_search; + int lr_type; + LDAPURLDesc *lr_ludp; + char **lr_attrs; + bool lr_done; +}; + +struct sm_ldap_recurse_list +{ + int lrl_size; + int lrl_cnt; + struct sm_ldap_recurse_entry **lrl_data; +}; + +typedef struct sm_ldap_recurse_entry SM_LDAP_RECURSE_ENTRY; +typedef struct sm_ldap_recurse_list SM_LDAP_RECURSE_LIST; + +/* 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 *)); +extern int sm_ldap_search_m __P((SM_LDAP_STRUCT *, char **)); +extern int sm_ldap_results __P((SM_LDAP_STRUCT *, int, int, int, + SM_RPOOL_T *, char **, int *, int *, + SM_LDAP_RECURSE_LIST *)); +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 *)); + +/* Portability defines */ +# if !SM_CONF_LDAP_MEMFREE +# define ldap_memfree(x) ((void) 0) +# endif /* !SM_CONF_LDAP_MEMFREE */ + +# 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..010e50c --- /dev/null +++ b/contrib/sendmail/include/sm/mbdb.h @@ -0,0 +1,43 @@ +/* + * 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: mbdb.h,v 1.6 2002/05/24 20:50:14 gshapiro 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]; + char mbdb_shell[PATH_MAX]; +} 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/misc.h b/contrib/sendmail/include/sm/misc.h new file mode 100644 index 0000000..a9d6637 --- /dev/null +++ b/contrib/sendmail/include/sm/misc.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2006 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: misc.h,v 1.1 2006/06/28 23:57:59 ca Exp $ + */ + +#ifndef SM_MISC_H +# define SM_MISC_H 1 + +int sm_memstat_open __P((void)); +int sm_memstat_close __P((void)); +int sm_memstat_get __P((char *, long *)); + +#endif /* ! SM_MISC_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..4669a3c --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_aix.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2000-2001, 2003 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.11 2003/04/28 23:42:23 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 */ + +#if _AIX5 >= 50200 +# define SM_CONF_LONGLONG 1 +#endif /* _AIX5 >= 50200 */ diff --git a/contrib/sendmail/include/sm/os/sm_os_dragonfly.h b/contrib/sendmail/include/sm/os/sm_os_dragonfly.h new file mode 100644 index 0000000..4428cab --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_dragonfly.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2000-2001, 2004 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_dragonfly.h,v 1.1 2004/08/06 03:54:07 gshapiro Exp $ + */ + +/* +** Platform definitions for DragonFly BSD +*/ + +#define SM_OS_NAME "dragonfly" + +#define SM_CONF_SYS_CDEFS_H 1 + +#define MI_SOMAXCONN -1 /* listen() max backlog for milter */ + +#ifndef SM_CONF_STRL +# define SM_CONF_STRL 1 +#endif /* SM_CONF_STRL */ +#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_freebsd.h b/contrib/sendmail/include/sm/os/sm_os_freebsd.h new file mode 100644 index 0000000..3ba61fd --- /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.11 2002/04/15 17:17:05 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_qnx.h b/contrib/sendmail/include/sm/os/sm_os_qnx.h new file mode 100644 index 0000000..9769827 --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_qnx.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2007 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_qnx.h,v 1.1 2007/03/21 23:56:20 ca Exp $ + */ + +/* +** sm_os_qnx.h -- platform definitions for QNX +*/ + +#define SM_CONF_SYS_CDEFS_H 1 + +#ifndef SM_CONF_SETITIMER +# define SM_CONF_SETITIMER 0 +#endif /* SM_CONF_SETITIMER */ 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_unicos.h b/contrib/sendmail/include/sm/os/sm_os_unicos.h new file mode 100644 index 0000000..57d6b72 --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_unicos.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2003 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_unicos.h,v 1.1 2003/04/21 17:03:51 ca Exp $ + */ + +/* +** Cray UNICOS +*/ + +#define SM_OS_NAME "unicos" + +#define SM_CONF_LONGLONG 1 +#define SM_CONF_SETITIMER 0 diff --git a/contrib/sendmail/include/sm/os/sm_os_unicosmk.h b/contrib/sendmail/include/sm/os/sm_os_unicosmk.h new file mode 100644 index 0000000..ce87c04 --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_unicosmk.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2003 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_unicosmk.h,v 1.1 2003/04/21 17:03:51 ca Exp $ + */ + +/* +** Cray UNICOS/mk +*/ + +#define SM_OS_NAME "unicosmk" + +#define SM_CONF_LONGLONG 1 diff --git a/contrib/sendmail/include/sm/os/sm_os_unicosmp.h b/contrib/sendmail/include/sm/os/sm_os_unicosmp.h new file mode 100644 index 0000000..b11350b --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_unicosmp.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2003 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_unicosmp.h,v 1.1 2003/04/21 17:03:51 ca Exp $ + */ + +/* +** Cray UNICOS/mp +*/ + +#define SM_OS_NAME "unicosmp" + +#define SM_CONF_LONGLONG 1 +#define SM_CONF_SYS_CDEFS_H 1 +#define SM_CONF_MSG 1 +#define SM_CONF_SHM 1 +#define SM_CONF_SEM 1 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..6c7bfe6 --- /dev/null +++ b/contrib/sendmail/include/sm/os/sm_os_unixware.h @@ -0,0 +1,42 @@ +/* + * 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: sm_os_unixware.h,v 1.8 2002/10/24 18:04:54 ca Exp $ + */ + +#define SM_OS_NAME "unixware" + +#ifndef SM_CONF_LONGLONG +# if defined(__SCO_VERSION__) && __SCO_VERSION__ > 400000000L +# define SM_CONF_LONGLONG 1 +# define SM_CONF_TEST_LLONG 1 +# define SM_CONF_BROKEN_SIZE_T 0 +# endif /* defined(__SCO_VERSION__) && __SCO_VERSION__ > 400000000L */ +#endif /* !SM_CONF_LONGLONG */ + +/* 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 */ +#ifndef SM_CONF_BROKEN_SIZE_T +# define SM_CONF_BROKEN_SIZE_T 1 +#endif /* SM_CONF_BROKEN_SIZE_T */ + +/* 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..cdff4c7 --- /dev/null +++ b/contrib/sendmail/include/sm/rpool.h @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2000-2001, 2003 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.16 2003/09/05 23:07:49 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 */ + +#if DO_NOT_USE_STRCPY +extern char *sm_rpool_strdup_x __P((SM_RPOOL_T *rpool, const char *s)); +#else /* DO_NOT_USE_STRCPY */ +# define sm_rpool_strdup_x(rpool, str) \ + strcpy(sm_rpool_malloc_x(rpool, strlen(str) + 1), str) +#endif /* DO_NOT_USE_STRCPY */ + +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/sem.h b/contrib/sendmail/include/sm/sem.h new file mode 100644 index 0000000..3ac0bc6 --- /dev/null +++ b/contrib/sendmail/include/sm/sem.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2000-2001, 2005, 2008 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: sem.h,v 1.10 2008/05/30 16:26:39 ca Exp $ + */ + +#ifndef SM_SEM_H +# define SM_SEM_H 1 + +#include <sm/gen.h> + +/* key for semaphores */ +# define SM_SEM_KEY (41L) +# define SM_SEM_NO_ID (-1) +# define SM_NO_SEM(id) ((id) < 0) + +# if SM_CONF_SEM > 0 +# include <sys/types.h> +# include <sys/ipc.h> +# include <sys/sem.h> + +# if SM_CONF_SEM == 2 +union semun +{ + int val; + struct semid_ds *buf; + ushort *array; +}; +# endif /* SM_CONF_SEM == 2 */ + +# ifndef SEM_A +# define SEM_A 0200 +# endif /* SEM_A */ +# ifndef SEM_R +# define SEM_R 0400 +# endif /* SEM_R */ + +# define SM_NSEM 1 + +extern int sm_sem_start __P((key_t, int, int, bool)); +extern int sm_sem_stop __P((int)); +extern int sm_sem_acq __P((int, int, int)); +extern int sm_sem_rel __P((int, int, int)); +extern int sm_sem_get __P((int, int)); +extern int sm_semsetowner __P((int, uid_t, gid_t, mode_t)); + +# else /* SM_CONF_SEM > 0 */ +# define sm_sem_start(key, nsem, semflg, owner) 0 +# define sm_sem_stop(semid) 0 +# define sm_sem_acq(semid, semnum, timeout) 0 +# define sm_sem_rel(semid, semnum, timeout) 0 +# define sm_sem_get(semid, semnum) 0 +# endif /* SM_CONF_SEM > 0 */ + +#endif /* ! SM_SEM_H */ diff --git a/contrib/sendmail/include/sm/sendmail.h b/contrib/sendmail/include/sm/sendmail.h new file mode 100644 index 0000000..3008934 --- /dev/null +++ b/contrib/sendmail/include/sm/sendmail.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2006 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. + */ + +/* +** SENDMAIL.H -- MTA-specific definitions for sendmail. +*/ + +#ifndef _SM_SENDMAIL_H +# define _SM_SENDMAIL_H 1 + +/* "out of band" indicator */ +#define METAQUOTE ((unsigned char)0377) /* quotes the next octet */ + +extern int dequote_internal_chars __P((char *, char *, int)); +extern char *quote_internal_chars __P((char *, char *, int *)); +extern char *str2prt __P((char *)); + +#endif /* ! _SM_SENDMAIL_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..61333a2 --- /dev/null +++ b/contrib/sendmail/include/sm/shm.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2000-2003, 2005 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.11 2005/01/13 22:57:04 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 (-2) + +extern void *sm_shmstart __P((key_t, int , int , int *, bool)); +extern int sm_shmstop __P((void *, int, bool)); +extern int sm_shmsetowner __P((int, uid_t, gid_t, mode_t)); + + +/* 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..7c96b8f --- /dev/null +++ b/contrib/sendmail/include/sm/string.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2000-2001, 2003 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.38 2003/10/10 17:56:57 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)); + +#if DO_NOT_USE_STRCPY +/* for "normal" data (free'd before end of process) */ +extern char * +sm_strdup_x __P((const char *_str)); + +/* for data that is supposed to be persistent. */ +extern char * +sm_pstrdup_x __P((const char *_str)); + +extern char * +sm_strdup_tagged_x __P((const char *str, char *file, int line, int group)); + +#else /* DO_NOT_USE_STRCPY */ + +/* 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) +#endif /* DO_NOT_USE_STRCPY */ + +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/tailq.h b/contrib/sendmail/include/sm/tailq.h new file mode 100644 index 0000000..c8eeec4 --- /dev/null +++ b/contrib/sendmail/include/sm/tailq.h @@ -0,0 +1,157 @@ +/* $OpenBSD: queue.h,v 1.30 2005/10/25 06:37:47 otto Exp $ */ +/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef SM_TAILQ_H_ +#define SM_TAILQ_H_ + +/* + * $Id: tailq.h,v 1.2 2007/06/29 23:09:57 ca Exp $ + * + * This file is a modified copy of queue.h from a BSD system: + * we only need tail queues here. + * We do not use queue.h directly because there is a conflict with + * some versions of that file on some OSs. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + */ + +/* + * Tail queue definitions. + */ +#define SM_TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define SM_TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define SM_TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +/* + * tail queue access methods + */ +#define SM_TAILQ_FIRST(head) ((head)->tqh_first) +#define SM_TAILQ_END(head) NULL +#define SM_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#define SM_TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +/* XXX */ +#define SM_TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) +#define SM_TAILQ_EMPTY(head) \ + (SM_TAILQ_FIRST(head) == SM_TAILQ_END(head)) + +#define SM_TAILQ_FOREACH(var, head, field) \ + for((var) = SM_TAILQ_FIRST(head); \ + (var) != SM_TAILQ_END(head); \ + (var) = SM_TAILQ_NEXT(var, field)) + +#define SM_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for((var) = SM_TAILQ_LAST(head, headname); \ + (var) != SM_TAILQ_END(head); \ + (var) = SM_TAILQ_PREV(var, headname, field)) + +/* + * Tail queue functions. + */ +#define SM_TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (0) + +#define SM_TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (0) + +#define SM_TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (0) + +#define SM_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (0) + +#define SM_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (0) + +#define SM_TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (0) + +#define SM_TAILQ_REPLACE(head, elm, elm2, field) do { \ + if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ + (elm2)->field.tqe_next->field.tqe_prev = \ + &(elm2)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm2)->field.tqe_next; \ + (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ + *(elm2)->field.tqe_prev = (elm2); \ +} while (0) + +#endif /* !SM_TAILQ_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/time.h b/contrib/sendmail/include/sm/time.h new file mode 100644 index 0000000..310847c --- /dev/null +++ b/contrib/sendmail/include/sm/time.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2005 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: time.h,v 1.1 2005/06/14 23:07:19 ca Exp $ + */ + +#ifndef SM_TIME_H +# define SM_TIME_H 1 + +# include <sm/config.h> + +# include <sys/time.h> + +/* should be defined in sys/time.h */ +#ifndef timersub +# define timersub(tvp, uvp, vvp) \ + do \ + { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) \ + { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) +#endif /* !timersub */ + +#ifndef timeradd +# define timeradd(tvp, uvp, vvp) \ + do \ + { \ + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ + if ((vvp)->tv_usec >= 1000000) \ + { \ + (vvp)->tv_sec++; \ + (vvp)->tv_usec -= 1000000; \ + } \ + } while (0) +#endif /* !timeradd */ + +#ifndef timercmp +# define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#endif /* !timercmp */ + + +#endif /* ! SM_TIME_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..7746e3a --- /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.8 2002/07/29 21:31:00 gshapiro 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) memcpy(&(dst), &(src), sizeof((dst))) +# 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 */ |