From 4332139a9a11f773ffe5109bed871561e3c290a1 Mon Sep 17 00:00:00 2001 From: gshapiro Date: Sat, 12 Aug 2000 21:55:49 +0000 Subject: Import of sendmail version 8.11.0 into vendor branch SENDMAIL with release tag v8_11_0. Obtained from: ftp://ftp.sendmail.org/pub/sendmail/ --- contrib/sendmail/include/sendmail/cdefs.h | 103 +++++++++++++++ contrib/sendmail/include/sendmail/errstring.h | 73 +++++++++++ contrib/sendmail/include/sendmail/mailstats.h | 38 ++++++ contrib/sendmail/include/sendmail/pathnames.h | 36 ++++++ contrib/sendmail/include/sendmail/sendmail.h | 177 ++++++++++++++++++++++++++ contrib/sendmail/include/sendmail/useful.h | 63 +++++++++ 6 files changed, 490 insertions(+) create mode 100644 contrib/sendmail/include/sendmail/cdefs.h create mode 100644 contrib/sendmail/include/sendmail/errstring.h create mode 100644 contrib/sendmail/include/sendmail/mailstats.h create mode 100644 contrib/sendmail/include/sendmail/pathnames.h create mode 100644 contrib/sendmail/include/sendmail/sendmail.h create mode 100644 contrib/sendmail/include/sendmail/useful.h (limited to 'contrib/sendmail/include/sendmail') diff --git a/contrib/sendmail/include/sendmail/cdefs.h b/contrib/sendmail/include/sendmail/cdefs.h new file mode 100644 index 0000000..bd7285bc --- /dev/null +++ b/contrib/sendmail/include/sendmail/cdefs.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1991, 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: cdefs.h,v 8.5 1999/06/02 22:32:17 gshapiro Exp $ + * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + */ + +#ifndef _CDEFS_H_ +# define _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) */ + +/* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + */ +# if defined(__STDC__) || defined(__cplusplus) +# define __P(protos) protos /* full-blown ANSI C */ +# ifndef __CONCAT +# define __CONCAT(x,y) x ## y +# endif /* ! __CONCAT */ +# define __STRING(x) #x + +# ifndef __const +# define __const const /* define reserved names to standard */ +# endif /* ! __const */ +# define __signed signed +# define __volatile volatile +# if defined(__cplusplus) +# define __inline inline /* convert to C++ keyword */ +# else /* defined(__cplusplus) */ +# ifndef __GNUC__ +# define __inline /* delete GCC keyword */ +# endif /* ! __GNUC__ */ +# endif /* defined(__cplusplus) */ + +# else /* defined(__STDC__) || defined(__cplusplus) */ +# define __P(protos) () /* traditional C preprocessor */ +# ifndef __CONCAT +# define __CONCAT(x,y) x/**/y +# endif /* ! __CONCAT */ +# define __STRING(x) "x" + +# ifndef __GNUC__ +# define __const /* delete pseudo-ANSI C keywords */ +# define __inline +# define __signed +# define __volatile +/* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ +# ifndef NO_ANSI_KEYWORDS +# define const /* delete ANSI C keywords */ +# define inline +# define signed +# define volatile +# endif /* ! NO_ANSI_KEYWORDS */ +# endif /* ! __GNUC__ */ +# endif /* defined(__STDC__) || defined(__cplusplus) */ + +/* + * GCC1 and some versions of GCC2 declare dead (non-returning) and + * pure (no side effects) functions using "volatile" and "const"; + * unfortunately, these then cause warnings under "-ansi -pedantic". + * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of + * these work for GNU C++ (modulo a slight glitch in the C++ grammar + * in the distribution version of 2.5.5). + */ +# if !defined(__GNUC__) || __GNUC__ < 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +# define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ +# if defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define __dead __volatile +# define __pure __const +# endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) */ +# endif /* !defined(__GNUC__) || __GNUC__ < 2 || \ */ + +/* Delete pseudo-keywords wherever they are not available or needed. */ +# ifndef __dead +# define __dead +# define __pure +# endif /* ! __dead */ + +#endif /* ! _CDEFS_H_ */ diff --git a/contrib/sendmail/include/sendmail/errstring.h b/contrib/sendmail/include/sendmail/errstring.h new file mode 100644 index 0000000..b3b2480 --- /dev/null +++ b/contrib/sendmail/include/sendmail/errstring.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 1998-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: errstring.h,v 8.6.4.1 2000/05/26 18:24:13 geir Exp $ + */ + +/* +** ERRSTRING.H -- Error codes. +*/ + +#include + +extern int errno; + +/* +** These are used in a few cases where we need some special +** error codes, but where the system doesn't provide something +** reasonable. They are printed in errstring. +*/ + +#ifndef E_PSEUDOBASE +# define E_PSEUDOBASE 256 +#endif /* ! E_PSEUDOBASE */ + +#define E_SM_OPENTIMEOUT (E_PSEUDOBASE + 0) /* Timeout on file open */ +#define E_SM_NOSLINK (E_PSEUDOBASE + 1) /* Symbolic links not allowed */ +#define E_SM_NOHLINK (E_PSEUDOBASE + 2) /* Hard links not allowed */ +#define E_SM_REGONLY (E_PSEUDOBASE + 3) /* Regular files only */ +#define E_SM_ISEXEC (E_PSEUDOBASE + 4) /* Executable files not allowed */ +#define E_SM_WWDIR (E_PSEUDOBASE + 5) /* World writable directory */ +#define E_SM_GWDIR (E_PSEUDOBASE + 6) /* Group writable directory */ +#define E_SM_FILECHANGE (E_PSEUDOBASE + 7) /* File changed after open */ +#define E_SM_WWFILE (E_PSEUDOBASE + 8) /* World writable file */ +#define E_SM_GWFILE (E_PSEUDOBASE + 9) /* Group writable file */ +#define E_SM_GRFILE (E_PSEUDOBASE + 10) /* g readable file */ +#define E_SM_WRFILE (E_PSEUDOBASE + 11) /* o readable file */ +#define E_DNSBASE (E_PSEUDOBASE + 20) /* base for DNS h_errno */ +#define E_SMDBBASE (E_PSEUDOBASE + 40) /* base for libsmdb errors */ +#define E_LDAPBASE (E_PSEUDOBASE + 70) /* base for LDAP errors */ + +/* libsmdb */ +#define SMDBE_OK 0 +#define SMDBE_MALLOC (E_SMDBBASE + 1) +#define SMDBE_GDBM_IS_BAD (E_SMDBBASE + 2) +#define SMDBE_UNSUPPORTED (E_SMDBBASE + 3) +#define SMDBE_DUPLICATE (E_SMDBBASE + 4) +#define SMDBE_BAD_OPEN (E_SMDBBASE + 5) +#define SMDBE_NOT_FOUND (E_SMDBBASE + 6) +#define SMDBE_UNKNOWN_DB_TYPE (E_SMDBBASE + 7) +#define SMDBE_UNSUPPORTED_DB_TYPE (E_SMDBBASE + 8) +#define SMDBE_INCOMPLETE (E_SMDBBASE + 9) +#define SMDBE_KEY_EMPTY (E_SMDBBASE + 10) +#define SMDBE_KEY_EXIST (E_SMDBBASE + 11) +#define SMDBE_LOCK_DEADLOCK (E_SMDBBASE + 12) +#define SMDBE_LOCK_NOT_GRANTED (E_SMDBBASE + 13) +#define SMDBE_LOCK_NOT_HELD (E_SMDBBASE + 14) +#define SMDBE_RUN_RECOVERY (E_SMDBBASE + 15) +#define SMDBE_IO_ERROR (E_SMDBBASE + 16) +#define SMDBE_READ_ONLY (E_SMDBBASE + 17) +#define SMDBE_DB_NAME_TOO_LONG (E_SMDBBASE + 18) +#define SMDBE_INVALID_PARAMETER (E_SMDBBASE + 19) +#define SMDBE_ONLY_SUPPORTS_ONE_CURSOR (E_SMDBBASE + 20) +#define SMDBE_NOT_A_VALID_CURSOR (E_SMDBBASE + 21) +#define SMDBE_LAST_ENTRY (E_SMDBBASE + 22) +#define SMDBE_OLD_VERSION (E_SMDBBASE + 23) + +extern const char *errstring __P((int)); diff --git a/contrib/sendmail/include/sendmail/mailstats.h b/contrib/sendmail/include/sendmail/mailstats.h new file mode 100644 index 0000000..830061d --- /dev/null +++ b/contrib/sendmail/include/sendmail/mailstats.h @@ -0,0 +1,38 @@ +/* + * 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.13 1999/05/22 02:29:10 ca Exp $ + */ + +#define STAT_VERSION 3 +#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 */ +}; diff --git a/contrib/sendmail/include/sendmail/pathnames.h b/contrib/sendmail/include/sendmail/pathnames.h new file mode 100644 index 0000000..20b0f19 --- /dev/null +++ b/contrib/sendmail/include/sendmail/pathnames.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 1998-2000 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.16.8.5 2000/06/09 18:16:13 geir Exp $ + */ + + +# 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_HOSTS +# define _PATH_HOSTS "/etc/hosts" +# endif /* ! _PATH_HOSTS */ + + diff --git a/contrib/sendmail/include/sendmail/sendmail.h b/contrib/sendmail/include/sendmail/sendmail.h new file mode 100644 index 0000000..bbc62d7 --- /dev/null +++ b/contrib/sendmail/include/sendmail/sendmail.h @@ -0,0 +1,177 @@ +/* + * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * All rights reserved. + * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * 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.34.4.4 2000/07/15 17:35:17 gshapiro Exp $ + */ + +/* +** SENDMAIL.H -- Global definitions for sendmail. +*/ + +#if SFIO +# include +#else /* SFIO */ +# include +#endif /* SFIO */ +#include +#include "conf.h" +#include "sendmail/errstring.h" +#include "sendmail/useful.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 */ + +/* +** Data structure for bit maps. +** +** Each bit in this map can be referenced by an ascii character. +** This is 256 possible bits, or 32 8-bit bytes. +*/ + +#define BITMAPBITS 256 /* number of bits in a bit map */ +#define BYTEBITS 8 /* number of bits in a byte */ +#define BITMAPBYTES (BITMAPBITS / BYTEBITS) /* number of bytes in bit map */ + +/* internal macros */ +#define _BITWORD(bit) ((bit) / (BYTEBITS * sizeof (int))) +#define _BITBIT(bit) ((unsigned int)1 << ((bit) % (BYTEBITS * sizeof (int)))) + +typedef unsigned int BITMAP256[BITMAPBYTES / sizeof (int)]; + +/* test bit number N */ +#define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit)) + +/* set bit number N */ +#define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit) + +/* clear bit number N */ +#define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit) + +/* clear an entire bit map */ +#define clrbitmap(map) memset((char *) map, '\0', BITMAPBYTES) + + +/* +** Utility macros +*/ + +/* return number of bytes left in a buffer */ +#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf)) +/* +** Flags passed to safefile/safedirpath. +*/ + +#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 /* setuid 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_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 FILE *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 /* Not used yet */ +#define DBS_RUNWRITABLEPROGRAM 29 +#define DBS_INCLUDEFILEINUNSAFEDIRPATH 30 +#define DBS_NONROOTSAFEADDR 31 +#define DBS_TRUSTSTICKYBIT 32 +#define DBS_DONTWARNFORWARDFILEINUNSAFEDIRPATH 33 +#define DBS_INSUFFICIENTENTROPY 34 +#if _FFR_UNSAFE_SASL +#define DBS_GROUPREADABLESASLFILE 35 +#endif /* _FFR_UNSAFE_SASL */ + +/* struct defining such things */ +struct dbsval +{ + char *dbs_name; /* name of DontBlameSendmail flag */ + u_char dbs_flag; /* numeric level */ +}; + +#if _FFR_DPRINTF +extern void dprintf __P((const char *, ...)); +extern int dflush __P((void)); +#else /* _FFR_DPRINTF */ +#define dprintf printf +#define dflush() fflush(stdout) +#endif /* _FFR_DPRINTF */ + +extern int sm_snprintf __P((char *, size_t, const char *, ...)); +extern int sm_vsnprintf __P((char *, size_t, const char *, va_list)); +extern char *quad_to_string __P((QUAD_T)); + +extern size_t strlcpy __P((char *, const char *, size_t)); +extern size_t strlcat __P((char *, const char *, size_t)); + diff --git a/contrib/sendmail/include/sendmail/useful.h b/contrib/sendmail/include/sendmail/useful.h new file mode 100644 index 0000000..55ba407 --- /dev/null +++ b/contrib/sendmail/include/sendmail/useful.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers. + * All rights reserved. + * Copyright (c) 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: useful.h,v 8.18 1999/07/13 15:05:57 ca Exp $ + */ + +#ifndef _USEFUL_H +# define _USEFUL_H + +# include + +/* support for bool type */ +typedef int bool; +# ifndef TRUE +# define TRUE 1 +# define FALSE 0 +# endif /* ! TRUE */ + +# ifndef NULL +# define NULL 0 +# endif /* ! NULL */ + +/* bit hacking */ +# define bitset(bit, word) (((word) & (bit)) != 0) + +/* some simple functions */ +# ifndef max +# define max(a, b) ((a) > (b) ? (a) : (b)) +# define min(a, b) ((a) < (b) ? (a) : (b)) +# endif /* ! max */ + +/* assertions */ +# ifndef NASSERT +# define ASSERT(expr, msg, parm)\ + if (!(expr))\ + {\ + fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ + fprintf(stderr, msg, parm);\ + } +# else /* ! NASSERT */ +# define ASSERT(expr, msg, parm) +# endif /* ! NASSERT */ + +/* sccs id's */ +# ifndef lint +# ifdef __STDC__ +# define SCCSID(arg) static char SccsId[] = #arg; +# else /* __STDC__ */ +# define SCCSID(arg) static char SccsId[] = "arg"; +# endif /* __STDC__ */ +# else /* ! lint */ +# define SCCSID(arg) +# endif /* ! lint */ +#endif /* ! _USEFUL_H */ -- cgit v1.1