diff options
Diffstat (limited to 'contrib/sendmail/include')
-rw-r--r-- | contrib/sendmail/include/libmilter/mfapi.h | 408 | ||||
-rw-r--r-- | contrib/sendmail/include/libmilter/milter.h | 107 | ||||
-rw-r--r-- | contrib/sendmail/include/libsmdb/smdb.h | 379 | ||||
-rw-r--r-- | contrib/sendmail/include/sendmail/cdefs.h | 103 | ||||
-rw-r--r-- | contrib/sendmail/include/sendmail/errstring.h | 73 | ||||
-rw-r--r-- | contrib/sendmail/include/sendmail/mailstats.h | 38 | ||||
-rw-r--r-- | contrib/sendmail/include/sendmail/pathnames.h | 36 | ||||
-rw-r--r-- | contrib/sendmail/include/sendmail/sendmail.h | 177 | ||||
-rw-r--r-- | contrib/sendmail/include/sendmail/useful.h | 63 |
9 files changed, 1384 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..5c04fe4 --- /dev/null +++ b/contrib/sendmail/include/libmilter/mfapi.h @@ -0,0 +1,408 @@ +/* + * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. + * All rights reserved. + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the sendmail distribution. + * + * + * $Id: mfapi.h,v 8.13.4.11 2000/07/11 21:45:56 geir Exp $ + */ + +/* +** MFAPI.H -- Global definitions for mail filter library and mail filters. +*/ + +#ifndef _LIBMILTER_MFAPI_H +# define _LIBMILTER_MFAPI_H 1 + +# define LIBMILTER_API extern + + +# include <sys/types.h> + +#ifndef _SOCK_ADDR +# include <sys/socket.h> +# define _SOCK_ADDR struct sockaddr +#endif /* ! _SOCK_ADDR */ + +/* +** libmilter functions return one of the following to indicate +** success/failure: +*/ + +#define MI_SUCCESS 0 +#define MI_FAILURE (-1) + +/* "forward" declarations */ +typedef struct smfi_str SMFICTX; +typedef struct smfi_str *SMFICTX_PTR; + +typedef struct smfiDesc smfiDesc_str; +typedef struct smfiDesc *smfiDesc_ptr; + +#define SMFI_VERSION 2 /* version number */ + +/* +** What the filter might do -- values to be ORed together for +** smfiDesc.xxfi_flags. +*/ + +#define SMFIF_ADDHDRS 0x00000001L /* filter may add headers */ +#define SMFIF_CHGBODY 0x00000002L /* filter may replace body */ +#define SMFIF_MODBODY SMFIF_CHGBODY /* backwards compatible */ +#define SMFIF_ADDRCPT 0x00000004L /* filter may add recipients */ +#define SMFIF_DELRCPT 0x00000008L /* filter may delete recipients */ +#define SMFIF_CHGHDRS 0x00000010L /* filter may change/delete headers */ + +#define SMFI_V1_ACTS 0x0000000FL /* The actions of V1 filter */ +#define SMFI_V2_ACTS 0x0000001FL /* The actions of V2 filter */ +#define SMFI_CURR_ACTS SMFI_V2_ACTS /* The current version */ + +/* +** Type which callbacks should return to indicate message status. +** This may take on one of the SMFIS_* values listed below. +*/ + +typedef int sfsistat; + +/* +** structure describing one milter +*/ + +#if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8 +# define SM__P(X) __PMT(X) +#else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */ +# 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 */ + +struct smfiDesc +{ + char *xxfi_name; /* filter name */ + int xxfi_version; /* version code -- do not change */ + u_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 *, u_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 *)); +}; + +LIBMILTER_API int smfi_register __P((struct smfiDesc)); +LIBMILTER_API int smfi_main __P((void)); +LIBMILTER_API int smfi_setdbg __P((int)); +LIBMILTER_API int smfi_settimeout __P((int)); +LIBMILTER_API int smfi_setconn __P((char *)); + +/* +** 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 + +#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. +*/ + +/* 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 *, u_char *, size_t)); + +/* +** xxfi_body(ctx, bodyp, bodylen) Invoked for each body chunk. There may +** be multiple body chunks passed to the filter. End-of-lines are +** represented as received from SMTP (normally Carriage-Return/Line-Feed). +** +** u_char *bodyp; Pointer to body data +** 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 *)); + +/* +** 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. This header is not passed to other +** filters. 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_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_delrcpt __P((SMFICTX *, char *)); + +/* +** 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 *, u_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. +*/ + + +/* +** 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 *)); + + +#endif /* !_LIBMILTER_MFAPI_H */ diff --git a/contrib/sendmail/include/libmilter/milter.h b/contrib/sendmail/include/libmilter/milter.h new file mode 100644 index 0000000..569a37c --- /dev/null +++ b/contrib/sendmail/include/libmilter/milter.h @@ -0,0 +1,107 @@ +/* + * Copyright (c) 1999 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.24.16.6 2000/06/08 22:13:39 gshapiro Exp $ + */ + +/* +** MILTER.H -- Global definitions for mail filter and MTA. +*/ + +#ifndef _LIBMILTER_MILTER_H +# define _LIBMILTER_MILTER_H 1 + +#include "libmilter/mfapi.h" +#include "sendmail.h" + +/* Shared protocol constants */ +# define MILTER_LEN_BYTES 4 /* length of 32 bit integer in bytes */ +# define MILTER_OPTLEN (MILTER_LEN_BYTES * 3) /* length of options */ +# define MILTER_CHUNK_SIZE 65535 /* body chunk size */ + +/* address families */ +# define SMFIA_UNKNOWN 'U' /* unknown */ +# define SMFIA_UNIX 'L' /* unix/local */ +# define SMFIA_INET '4' /* inet */ +# define SMFIA_INET6 '6' /* inet6 */ + +/* commands: don't use anything smaller than ' ' */ +# define SMFIC_ABORT 'A' /* Abort */ +# define SMFIC_BODY 'B' /* Body chunk */ +# define SMFIC_CONNECT 'C' /* Connection information */ +# define SMFIC_MACRO 'D' /* Define macro */ +# define SMFIC_BODYEOB 'E' /* final body chunk (End) */ +# define SMFIC_HELO 'H' /* HELO/EHLO */ +# define SMFIC_HEADER 'L' /* Header */ +# define SMFIC_MAIL 'M' /* MAIL from */ +# define SMFIC_EOH 'N' /* EOH */ +# define SMFIC_OPTNEG 'O' /* Option negotiation */ +# define SMFIC_QUIT 'Q' /* QUIT */ +# define SMFIC_RCPT 'R' /* RCPT to */ + +/* actions (replies) */ +# define SMFIR_ADDRCPT '+' /* add recipient */ +# define SMFIR_DELRCPT '-' /* remove recipient */ +# define SMFIR_ACCEPT 'a' /* accept */ +# define SMFIR_REPLBODY 'b' /* replace body (chunk) */ +# define SMFIR_CONTINUE 'c' /* continue */ +# define SMFIR_DISCARD 'd' /* discard */ +# define SMFIR_CHGHEADER 'm' /* change header */ +# define SMFIR_PROGRESS 'p' /* progress */ +# define SMFIR_REJECT 'r' /* reject */ +# define SMFIR_TEMPFAIL 't' /* tempfail */ +# define SMFIR_ADDHEADER 'h' /* add header */ +# define SMFIR_REPLYCODE 'y' /* reply code etc */ + +/* What the MTA can send/filter wants in protocol */ +# define SMFIP_NOCONNECT 0x00000001L /* MTA should not send connect info */ +# define SMFIP_NOHELO 0x00000002L /* MTA should not send HELO info */ +# define SMFIP_NOMAIL 0x00000004L /* MTA should not send MAIL info */ +# define SMFIP_NORCPT 0x00000008L /* MTA should not send RCPT info */ +# define SMFIP_NOBODY 0x00000010L /* MTA should not send body */ +# define SMFIP_NOHDRS 0x00000020L /* MTA should not send headers */ +# define SMFIP_NOEOH 0x00000040L /* MTA should not send EOH */ + +# define SMFI_V1_PROT 0x0000003FL /* The protocol of V1 filter */ +# define SMFI_V2_PROT 0x0000007FL /* The protocol of V2 filter */ +# define SMFI_CURR_PROT SMFI_V2_PROT /* The current version */ + +/* socket and thread portability */ +# include <pthread.h> +typedef pthread_t sthread_t; +typedef int socket_t; + +# define MAX_MACROS_ENTRIES 4 /* max size of macro pointer array */ + +/* +** context for milter +** implementation hint: +** macros are stored in mac_buf[] as sequence of: +** macro_name \0 macro_value +** (just as read from the MTA) +** mac_ptr is a list of pointers into mac_buf to the beginning of each +** entry, i.e., macro_name, macro_value, ... +*/ + +struct smfi_str +{ + sthread_t ctx_id; /* thread id */ + socket_t ctx_sd; /* socket descriptor */ + int ctx_dbg; /* debug level */ + time_t ctx_timeout; /* timeout */ + int ctx_state; /* state */ + smfiDesc_ptr ctx_smfi; /* filter description */ + u_long ctx_pflags; /* protocol flags */ + char **ctx_mac_ptr[MAX_MACROS_ENTRIES]; + char *ctx_mac_buf[MAX_MACROS_ENTRIES]; + char *ctx_reply; /* reply code */ + void *ctx_privdata; /* private data */ +}; + +#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..dfe07fd --- /dev/null +++ b/contrib/sendmail/include/libsmdb/smdb.h @@ -0,0 +1,379 @@ +/* +** Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. +** All rights reserved. +** +** By using this file, you agree to the terms and conditions set +** forth in the LICENSE file which can be found at the top level of +** the sendmail distribution. +** +** $Id: smdb.h,v 8.29.2.1 2000/04/08 20:40:42 ca Exp $ +*/ + +#ifndef _SMDB_H_ +# define _SMDB_H_ + +# include <sys/types.h> +# include <sys/stat.h> +# ifndef __P +# include "sendmail/cdefs.h" +# endif /* __P */ + +# ifndef NDBM +# ifndef NEWDB +ERROR NDBM or NEWDB must be defined. +# endif /* ! NEWDB */ +# endif /* ! NDBM */ + +# ifdef NDBM +# include <ndbm.h> +# endif /* NDBM */ + +# ifdef NEWDB +# include <db.h> +# ifndef DB_VERSION_MAJOR +# define DB_VERSION_MAJOR 1 +# endif /* ! DB_VERSION_MAJOR */ +# endif /* NEWDB */ + +/* +** Some size constants +*/ +#define SMDB_MAX_USER_NAME_LEN 1024 +#define SMDB_MAX_NAME_LEN 1024 + +/* +** This file defines the abstraction for database lookups. It is pretty +** much a copy of the db2 interface with the exception that every function +** returns 0 on success and non-zero on failure. The non-zero return code +** is meaningful. +** +** 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 union database_entity_union 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, u_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, u_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, u_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, u_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, u_int flags)); + + +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; + 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, u_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, + u_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, + u_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 +{ + u_int smdbp_num_elements; + u_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; + +union database_entity_union +{ +# ifdef NDBM + datum dbm; +# endif /* NDBM */ +# ifdef NEWDB + DBT db; +# endif /* NEWDB */ + struct + { + char *data; + size_t size; + } data; +}; + + +typedef char *SMDB_DBTYPE; +typedef u_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)); +#endif /* ! _SMDB_H_ */ 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 <errno.h> + +extern int errno; + +/* +** These are used in a few cases where we need some special +** error codes, but where the system doesn't provide something +** reasonable. They are printed in 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 <sfio/stdio.h> +#else /* SFIO */ +# include <stdio.h> +#endif /* SFIO */ +#include <string.h> +#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 <sys/types.h> + +/* 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 */ |