📄 sendmail.h
字号:
/*
* 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.
*/
/*
** SENDMAIL.H -- MTA-specific definitions for sendmail.
*/
#ifndef _SENDMAIL_H
#define _SENDMAIL_H 1
#ifdef _DEFINE
# define EXTERN
# ifndef lint
static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.37 2000/09/25 07:53:29 gshapiro Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
#endif /* _DEFINE */
#include <unistd.h>
#if SFIO
# include <sfio/stdio.h>
# if defined(SFIO_VERSION) && SFIO_VERSION > 20000000L
ERROR README: SFIO 2000 does not work with sendmail, use SFIO 1999 instead.
# endif /* defined(SFIO_VERSION) && SFIO_VERSION > 20000000L */
#endif /* SFIO */
#include <stddef.h>
#include <stdlib.h>
#if !SFIO
# include <stdio.h>
#endif /* !SFIO */
#include <ctype.h>
#include <setjmp.h>
#include <string.h>
#include <time.h>
# ifdef EX_OK
# undef EX_OK /* for SVr4.2 SMP */
# endif /* EX_OK */
#include <sysexits.h>
#include "sendmail/sendmail.h"
#include "bf.h"
#include "timers.h"
#ifdef LOG
# include <syslog.h>
#endif /* LOG */
# if NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25
# include <sys/socket.h>
# endif /* NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25 */
# if NETUNIX
# include <sys/un.h>
# endif /* NETUNIX */
# if NETINET || NETINET6
# include <netinet/in.h>
# endif /* NETINET || NETINET6 */
# if NETINET6
/*
** There is no standard yet for IPv6 includes.
** Specify OS specific implementation in conf.h
*/
# endif /* NETINET6 */
# if NETISO
# include <netiso/iso.h>
# endif /* NETISO */
# if NETNS
# include <netns/ns.h>
# endif /* NETNS */
# if NETX25
# include <netccitt/x25.h>
# endif /* NETX25 */
# if NAMED_BIND
# include <arpa/nameser.h>
# ifdef NOERROR
# undef NOERROR /* avoid <sys/streams.h> conflict */
# endif /* NOERROR */
# include <resolv.h>
# endif /* NAMED_BIND */
# ifdef HESIOD
# include <hesiod.h>
# if !defined(HES_ER_OK) || defined(HESIOD_INTERFACES)
# define HESIOD_INIT /* support for the new interface */
# endif /* !defined(HES_ER_OK) || defined(HESIOD_INTERFACES) */
# endif /* HESIOD */
#if STARTTLS
# if !SFIO && !_FFR_TLS_TOREK
ERROR README: STARTTLS requires SFIO
# endif /* !SFIO && !_FFR_TLS_TOREK */
# if SFIO && _FFR_TLS_TOREK
ERROR README: Can not do both SFIO and _FFR_TLS_TOREK
# endif /* SFIO && _FFR_TLS_TOREK */
# include <openssl/ssl.h>
#endif /* STARTTLS */
#if SASL /* include the sasl include files if we have them */
# include <sasl.h>
# if defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP)
# define SASL_VERSION (SASL_VERSION_MAJOR * 10000) + (SASL_VERSION_MINOR * 100) + SASL_VERSION_STEP
# if SASL == 1
# undef SASL
# define SASL SASL_VERSION
# else /* SASL == 1 */
# if SASL != SASL_VERSION
ERROR README: -DSASL (SASL) does not agree with the version of the CYRUS_SASL library (SASL_VERSION)
ERROR README: see README!
# endif /* SASL != SASL_VERSION */
# endif /* SASL == 1 */
# else /* defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP) */
# if SASL == 1
ERROR README: please set -DSASL to the version of the CYRUS_SASL library
ERROR README: see README!
# endif /* SASL == 1 */
# endif /* defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP) */
#endif /* SASL */
/*
** Following are "sort of" configuration constants, but they should
** be pretty solid on most architectures today. They have to be
** defined after <arpa/nameser.h> because some versions of that
** file also define them. In all cases, we can't use sizeof because
** some systems (e.g., Crays) always treat everything as being at
** least 64 bits.
*/
#ifndef INADDRSZ
# define INADDRSZ 4 /* size of an IPv4 address in bytes */
#endif /* ! INADDRSZ */
#ifndef IN6ADDRSZ
# define IN6ADDRSZ 16 /* size of an IPv6 address in bytes */
#endif /* ! IN6ADDRSZ */
#ifndef INT16SZ
# define INT16SZ 2 /* size of a 16 bit integer in bytes */
#endif /* ! INT16SZ */
#ifndef INT32SZ
# define INT32SZ 4 /* size of a 32 bit integer in bytes */
#endif /* ! INT32SZ */
/*
** Error return from inet_addr(3), in case not defined in /usr/include.
*/
#ifndef INADDR_NONE
# define INADDR_NONE 0xffffffff
#endif /* ! INADDR_NONE */
/* forward references for prototypes */
typedef struct envelope ENVELOPE;
typedef struct mailer MAILER;
/*
** Address structure.
** Addresses are stored internally in this structure.
*/
struct address
{
char *q_paddr; /* the printname for the address */
char *q_user; /* user name */
char *q_ruser; /* real user name, or NULL if q_user */
char *q_host; /* host name */
struct mailer *q_mailer; /* mailer to use */
u_long q_flags; /* status flags, see below */
uid_t q_uid; /* user-id of receiver (if known) */
gid_t q_gid; /* group-id of receiver (if known) */
char *q_home; /* home dir (local mailer only) */
char *q_fullname; /* full name if known */
struct address *q_next; /* chain */
struct address *q_alias; /* address this results from */
char *q_owner; /* owner of q_alias */
struct address *q_tchain; /* temporary use chain */
char *q_orcpt; /* ORCPT parameter from RCPT TO: line */
char *q_status; /* status code for DSNs */
char *q_rstatus; /* remote status message for DSNs */
time_t q_statdate; /* date of status messages */
char *q_statmta; /* MTA generating q_rstatus */
short q_state; /* address state, see below */
short q_specificity; /* how "specific" this address is */
};
typedef struct address ADDRESS;
/* bit values for q_flags */
#define QGOODUID 0x00000001 /* the q_uid q_gid fields are good */
#define QPRIMARY 0x00000002 /* set from RCPT or argv */
#define QNOTREMOTE 0x00000004 /* address not for remote forwarding */
#define QSELFREF 0x00000008 /* this address references itself */
#define QBOGUSSHELL 0x00000010 /* user has no valid shell listed */
#define QUNSAFEADDR 0x00000020 /* address acquired via unsafe path */
#define QPINGONSUCCESS 0x00000040 /* give return on successful delivery */
#define QPINGONFAILURE 0x00000080 /* give return on failure */
#define QPINGONDELAY 0x00000100 /* give return on message delay */
#define QHASNOTIFY 0x00000200 /* propogate notify parameter */
#define QRELAYED 0x00000400 /* DSN: relayed to non-DSN aware sys */
#define QEXPANDED 0x00000800 /* DSN: undergone list expansion */
#define QDELIVERED 0x00001000 /* DSN: successful final delivery */
#define QDELAYED 0x00002000 /* DSN: message delayed */
#define QALIAS 0x00004000 /* expanded alias */
#define QTHISPASS 0x40000000 /* temp: address set this pass */
#define QRCPTOK 0x80000000 /* recipient() processed address */
#define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
/* values for q_state */
#define QS_OK 0 /* address ok (for now)/not yet tried */
#define QS_SENT 1 /* good address, delivery complete */
#define QS_BADADDR 2 /* illegal address */
#define QS_QUEUEUP 3 /* save address in queue */
#define QS_VERIFIED 4 /* verified, but not expanded */
#define QS_DONTSEND 5 /* don't send to this address */
#define QS_EXPANDED 6 /* expanded */
#define QS_SENDER 7 /* message sender (MeToo) */
#define QS_CLONED 8 /* addr cloned to a split envelope */
#define QS_DISCARDED 9 /* recipient discarded (EF_DISCARD) */
#define QS_REPLACED 10 /* maplocaluser()/UserDB replaced */
#define QS_REMOVED 11 /* removed (removefromlist()) */
#define QS_DUPLICATE 12 /* duplicate suppressed */
#define QS_INCLUDED 13 /* :include: delivery */
/* address state testing primitives */
#define QS_IS_OK(s) ((s) == QS_OK)
#define QS_IS_SENT(s) ((s) == QS_SENT)
#define QS_IS_BADADDR(s) ((s) == QS_BADADDR)
#define QS_IS_QUEUEUP(s) ((s) == QS_QUEUEUP)
#define QS_IS_VERIFIED(s) ((s) == QS_VERIFIED)
#define QS_IS_EXPANDED(s) ((s) == QS_EXPANDED)
#define QS_IS_REMOVED(s) ((s) == QS_REMOVED)
#define QS_IS_UNDELIVERED(s) ((s) == QS_OK || \
(s) == QS_QUEUEUP || \
(s) == QS_VERIFIED)
#define QS_IS_SENDABLE(s) ((s) == QS_OK || \
(s) == QS_QUEUEUP)
#define QS_IS_ATTEMPTED(s) ((s) == QS_QUEUEUP || \
(s) == QS_SENT)
#define QS_IS_DEAD(s) ((s) == QS_DONTSEND || \
(s) == QS_CLONED || \
(s) == QS_SENDER || \
(s) == QS_DISCARDED || \
(s) == QS_REPLACED || \
(s) == QS_REMOVED || \
(s) == QS_DUPLICATE || \
(s) == QS_INCLUDED || \
(s) == QS_EXPANDED)
#define NULLADDR ((ADDRESS *) NULL)
extern ADDRESS NullAddress; /* a null (template) address [main.c] */
/* functions */
extern void cataddr __P((char **, char **, char *, int, int));
extern char *crackaddr __P((char *));
extern bool emptyaddr __P((ADDRESS *));
extern ADDRESS *getctladdr __P((ADDRESS *));
extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern bool invalidaddr __P((char *, char *));
extern ADDRESS *parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *));
extern char **prescan __P((char *, int, char[], int, char **, u_char *));
extern void printaddr __P((ADDRESS *, bool));
extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *));
extern int rewrite __P((char **, int, int, ENVELOPE *));
extern bool sameaddr __P((ADDRESS *, ADDRESS *));
extern int sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern int removefromlist __P((char *, ADDRESS **, ENVELOPE *));
extern void setsender __P((char *, ENVELOPE *, char **, int, bool));
/*
** Mailer definition structure.
** Every mailer known to the system is declared in this
** structure. It defines the pathname of the mailer, some
** flags associated with it, and the argument vector to
** pass to it. The flags are defined in conf.c
**
** The argument vector is expanded before actual use. All
** words except the first are passed through the macro
** processor.
*/
struct mailer
{
char *m_name; /* symbolic name of this mailer */
char *m_mailer; /* pathname of the mailer to use */
char *m_mtatype; /* type of this MTA */
char *m_addrtype; /* type for addresses */
char *m_diagtype; /* type for diagnostics */
BITMAP256 m_flags; /* status flags, see below */
short m_mno; /* mailer number internally */
short m_nice; /* niceness to run at (mostly for prog) */
char **m_argv; /* template argument vector */
short m_sh_rwset; /* rewrite set: sender header addresses */
short m_se_rwset; /* rewrite set: sender envelope addresses */
short m_rh_rwset; /* rewrite set: recipient header addresses */
short m_re_rwset; /* rewrite set: recipient envelope addresses */
char *m_eol; /* end of line string */
long m_maxsize; /* size limit on message to this mailer */
int m_linelimit; /* max # characters per line */
int m_maxdeliveries; /* max deliveries per mailer connection */
char *m_execdir; /* directory to chdir to before execv */
char *m_rootdir; /* directory to chroot to before execv */
uid_t m_uid; /* UID to run as */
gid_t m_gid; /* GID to run as */
char *m_defcharset; /* default character set */
time_t m_wait; /* timeout to wait for end */
#if _FFR_DYNAMIC_TOBUF
int m_maxrcpt; /* max recipients per envelope client-side */
#endif /* _FFR_DYNAMIC_TOBUF */
};
/* bits for m_flags */
#define M_ESMTP 'a' /* run Extended SMTP protocol */
#define M_ALIASABLE 'A' /* user can be LHS of an alias */
#define M_BLANKEND 'b' /* ensure blank line at end of message */
#define M_NOCOMMENT 'c' /* don't include comment part of address */
#define M_CANONICAL 'C' /* make addresses canonical "u@dom" */
#define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */
/* 'D' CF: include Date: */
#define M_EXPENSIVE 'e' /* it costs to use this mailer.... */
#define M_ESCFROM 'E' /* escape From lines to >From */
#define M_FOPT 'f' /* mailer takes picky -f flag */
/* 'F' CF: include From: or Resent-From: */
#define M_NO_NULL_FROM 'g' /* sender of errors should be $g */
#define M_HST_UPPER 'h' /* preserve host case distinction */
#define M_PREHEAD 'H' /* MAIL11V3: preview headers */
#define M_UDBENVELOPE 'i' /* do udbsender rewriting on envelope */
#define M_INTERNAL 'I' /* SMTP to another sendmail site */
#define M_UDBRECIPIENT 'j' /* do udbsender rewriting on recipient lines */
#define M_NOLOOPCHECK 'k' /* don't check for loops in HELO command */
#define M_CHUNKING 'K' /* CHUNKING: reserved for future use */
#define M_LOCALMAILER 'l' /* delivery is to this host */
#define M_LIMITS 'L' /* must enforce SMTP line limits */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -