📄 sendmail.h
字号:
#define M_MUSER 'm' /* can handle multiple users at once */
/* 'M' CF: include Message-Id: */
#define M_NHDR 'n' /* don't insert From line */
#define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */
#define M_RUNASRCPT 'o' /* always run mailer as recipient */
#define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */
/* 'P' CF: include Return-Path: */
#define M_VRFY250 'q' /* VRFY command returns 250 instead of 252 */
#define M_ROPT 'r' /* mailer takes picky -r flag */
#define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */
#define M_STRIPQ 's' /* strip quote chars from user/host */
#define M_SPECIFIC_UID 'S' /* run as specific uid/gid */
#define M_USR_UPPER 'u' /* preserve user case distinction */
#define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */
#define M_CONTENT_LEN 'v' /* add Content-Length: header (SVr4) */
/* 'V' UIUC: !-relativize all addresses */
#define M_HASPWENT 'w' /* check for /etc/passwd entry */
/* 'x' CF: include Full-Name: */
#define M_XDOT 'X' /* use hidden-dot algorithm */
#define M_LMTP 'z' /* run Local Mail Transport Protocol */
#define M_NOMX '0' /* turn off MX lookups */
#define M_NONULLS '1' /* don't send null bytes */
#define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
#define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
#define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
#define M_7BITS '7' /* use 7-bit path */
#define M_8BITS '8' /* force "just send 8" behaviour */
#define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */
#define M_CHECKINCLUDE ':' /* check for :include: files */
#define M_CHECKPROG '|' /* check for |program addresses */
#define M_CHECKFILE '/' /* check for /file addresses */
#define M_CHECKUDB '@' /* user can be user database key */
#define M_CHECKHDIR '~' /* SGI: check for valid home directory */
#define M_HOLD '%' /* Hold delivery until ETRN/-qI/-qR/-qS */
#define M_PLUS '+' /* Reserved: Used in mc for adding new flags */
#define M_MINUS '-' /* Reserved: Used in mc for removing flags */
/* functions */
extern void initerrmailers __P((void));
extern void makemailer __P((char *));
/*
** Information about currently open connections to mailers, or to
** hosts that we have looked up recently.
*/
#define MCI struct mailer_con_info
MCI
{
u_long mci_flags; /* flag bits, see below */
short mci_errno; /* error number on last connection */
short mci_herrno; /* h_errno from last DNS lookup */
short mci_exitstat; /* exit status from last connection */
short mci_state; /* SMTP state */
int mci_deliveries; /* delivery attempts for connection */
long mci_maxsize; /* max size this server will accept */
#if SFIO
Sfio_t *mci_in; /* input side of connection */
Sfio_t *mci_out; /* output side of connection */
#else /* SFIO */
FILE *mci_in; /* input side of connection */
FILE *mci_out; /* output side of connection */
#endif /* SFIO */
pid_t mci_pid; /* process id of subordinate proc */
char *mci_phase; /* SMTP phase string */
struct mailer *mci_mailer; /* ptr to the mailer for this conn */
char *mci_host; /* host name */
char *mci_status; /* DSN status to be copied to addrs */
char *mci_rstatus; /* SMTP status to be copied to addrs */
time_t mci_lastuse; /* last usage time */
FILE *mci_statfile; /* long term status file */
char *mci_heloname; /* name to use as HELO arg */
#if SASL
bool mci_sasl_auth; /* authenticated? */
int mci_sasl_string_len;
char *mci_sasl_string; /* sasl reply string */
char *mci_saslcap; /* SASL list of mechanisms */
sasl_conn_t *mci_conn; /* SASL connection */
#endif /* SASL */
#if STARTTLS
SSL *mci_ssl; /* SSL connection */
#endif /* STARTTLS */
};
/* flag bits */
#define MCIF_VALID 0x00000001 /* this entry is valid */
#define MCIF_TEMP 0x00000002 /* don't cache this connection */
#define MCIF_CACHED 0x00000004 /* currently in open cache */
#define MCIF_ESMTP 0x00000008 /* this host speaks ESMTP */
#define MCIF_EXPN 0x00000010 /* EXPN command supported */
#define MCIF_SIZE 0x00000020 /* SIZE option supported */
#define MCIF_8BITMIME 0x00000040 /* BODY=8BITMIME supported */
#define MCIF_7BIT 0x00000080 /* strip this message to 7 bits */
#define MCIF_MULTSTAT 0x00000100 /* MAIL11V3: handles MULT status */
#define MCIF_INHEADER 0x00000200 /* currently outputing header */
#define MCIF_CVT8TO7 0x00000400 /* convert from 8 to 7 bits */
#define MCIF_DSN 0x00000800 /* DSN extension supported */
#define MCIF_8BITOK 0x00001000 /* OK to send 8 bit characters */
#define MCIF_CVT7TO8 0x00002000 /* convert from 7 to 8 bits */
#define MCIF_INMIME 0x00004000 /* currently reading MIME header */
#define MCIF_AUTH 0x00008000 /* AUTH= supported */
#define MCIF_AUTHACT 0x00010000 /* SASL (AUTH) active */
#define MCIF_ENHSTAT 0x00020000 /* ENHANCEDSTATUSCODES supported */
#if STARTTLS
#define MCIF_TLS 0x00100000 /* STARTTLS supported */
#define MCIF_TLSACT 0x00200000 /* STARTTLS active */
#define MCIF_EXTENS (MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT | MCIF_TLS)
#else /* STARTTLS */
#define MCIF_EXTENS (MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT)
#endif /* STARTTLS */
/* states */
#define MCIS_CLOSED 0 /* no traffic on this connection */
#define MCIS_OPENING 1 /* sending initial protocol */
#define MCIS_OPEN 2 /* open, initial protocol sent */
#define MCIS_ACTIVE 3 /* message being sent */
#define MCIS_QUITING 4 /* running quit protocol */
#define MCIS_SSD 5 /* service shutting down */
#define MCIS_ERROR 6 /* I/O error on connection */
/* functions */
extern void mci_cache __P((MCI *));
extern void mci_dump __P((MCI *, bool));
extern void mci_dump_all __P((bool));
extern void mci_flush __P((bool, MCI *));
extern MCI *mci_get __P((char *, MAILER *));
extern int mci_lock_host __P((MCI *));
extern bool mci_match __P((char *, MAILER *));
extern int mci_print_persistent __P((char *, char *));
extern int mci_purge_persistent __P((char *, char *));
extern MCI **mci_scan __P((MCI *));
extern void mci_setstat __P((MCI *, int, char *, char *));
extern void mci_store_persistent __P((MCI *));
extern int mci_traverse_persistent __P((int (*)(), char *));
extern void mci_unlock_host __P((MCI *));
/*
** Header structure.
** This structure is used internally to store header items.
*/
struct header
{
char *h_field; /* the name of the field */
char *h_value; /* the value of that field */
struct header *h_link; /* the next header */
u_char h_macro; /* include header if macro defined */
u_long h_flags; /* status bits, see below */
BITMAP256 h_mflags; /* m_flags bits needed */
};
typedef struct header HDR;
/*
** Header information structure.
** Defined in conf.c, this struct declares the header fields
** that have some magic meaning.
*/
struct hdrinfo
{
char *hi_field; /* the name of the field */
u_long hi_flags; /* status bits, see below */
char *hi_ruleset; /* validity check ruleset */
};
extern struct hdrinfo HdrInfo[];
/* bits for h_flags and hi_flags */
#define H_EOH 0x00000001 /* field terminates header */
#define H_RCPT 0x00000002 /* contains recipient addresses */
#define H_DEFAULT 0x00000004 /* if another value is found, drop this */
#define H_RESENT 0x00000008 /* this address is a "Resent-..." address */
#define H_CHECK 0x00000010 /* check h_mflags against m_flags */
#define H_ACHECK 0x00000020 /* ditto, but always (not just default) */
#define H_FORCE 0x00000040 /* force this field, even if default */
#define H_TRACE 0x00000080 /* this field contains trace information */
#define H_FROM 0x00000100 /* this is a from-type field */
#define H_VALID 0x00000200 /* this field has a validated value */
#define H_RECEIPTTO 0x00000400 /* field has return receipt info */
#define H_ERRORSTO 0x00000800 /* field has error address info */
#define H_CTE 0x00001000 /* field is a content-transfer-encoding */
#define H_CTYPE 0x00002000 /* this is a content-type field */
#define H_BCC 0x00004000 /* Bcc: header: strip value or delete */
#define H_ENCODABLE 0x00008000 /* field can be RFC 1522 encoded */
#define H_STRIPCOMM 0x00010000 /* header check: strip comments */
#define H_BINDLATE 0x00020000 /* only expand macros at deliver */
#define H_USER 0x00040000 /* header came from the user/SMTP */
/* bits for chompheader() */
#define CHHDR_DEF 0x0001 /* default header */
#define CHHDR_CHECK 0x0002 /* call ruleset for header */
#define CHHDR_USER 0x0004 /* header from user */
#define CHHDR_QUEUE 0x0008 /* header from qf file */
/* functions */
extern void addheader __P((char *, char *, int, HDR **));
extern u_long chompheader __P((char *, int, HDR **, ENVELOPE *));
extern void commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *));
extern HDR *copyheader __P((HDR *));
extern void eatheader __P((ENVELOPE *, bool));
extern char *hvalue __P((char *, HDR *));
extern bool isheader __P((char *));
extern void putfromline __P((MCI *, ENVELOPE *));
extern void setupheaders __P((void));
/*
** Performance monitoring
*/
#define TIMERS struct sm_timers
TIMERS
{
TIMER ti_overall; /* the whole process */
};
#define PUSHTIMER(l, t) { if (tTd(98, l)) pushtimer(&t); }
#define POPTIMER(l, t) { if (tTd(98, l)) poptimer(&t); }
/*
** Envelope structure.
** This structure defines the message itself. There is usually
** only one of these -- for the message that we originally read
** and which is our primary interest -- but other envelopes can
** be generated during processing. For example, error messages
** will have their own envelope.
*/
struct envelope
{
HDR *e_header; /* head of header list */
long e_msgpriority; /* adjusted priority of this message */
time_t e_ctime; /* time message appeared in the queue */
char *e_to; /* the target person */
ADDRESS e_from; /* the person it is from */
char *e_sender; /* e_from.q_paddr w comments stripped */
char **e_fromdomain; /* the domain part of the sender */
ADDRESS *e_sendqueue; /* list of message recipients */
ADDRESS *e_errorqueue; /* the queue for error responses */
/*
** Overflow detection is based on < 0, so don't change this
** to unsigned. We don't use unsigned and == ULONG_MAX because
** some libc's don't have strtoul(), see mail_esmtp_args().
*/
long e_msgsize; /* size of the message in bytes */
long e_flags; /* flags, see below */
int e_nrcpts; /* number of recipients */
short e_class; /* msg class (priority, junk, etc.) */
short e_hopcount; /* number of times processed */
short e_nsent; /* number of sends since checkpoint */
short e_sendmode; /* message send mode */
short e_errormode; /* error return mode */
short e_timeoutclass; /* message timeout class */
void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int));
/* function to put header of message */
void (*e_putbody)__P((MCI *, ENVELOPE *, char *));
/* function to put body of message */
ENVELOPE *e_parent; /* the message this one encloses */
ENVELOPE *e_sibling; /* the next envelope of interest */
char *e_bodytype; /* type of message body */
FILE *e_dfp; /* data file */
char *e_id; /* code for this entry in queue */
int e_queuedir; /* index into queue directories */
FILE *e_xfp; /* transcript file */
FILE *e_lockfp; /* the lock file for this message */
char *e_message; /* error message */
char *e_statmsg; /* stat msg (changes per delivery) */
char *e_msgboundary; /* MIME-style message part boundary */
char *e_origrcpt; /* original recipient (one only) */
char *e_envid; /* envelope id from MAIL FROM: line */
char *e_status; /* DSN status for this message */
time_t e_dtime; /* time of last delivery attempt */
int e_ntries; /* number of delivery attempts */
dev_t e_dfdev; /* df file's device, for crash recov */
ino_t e_dfino; /* df file's ino, for crash recovery */
char *e_macro[256]; /* macro definitions */
char *e_if_macros[2]; /* HACK: incoming interface info */
char *e_auth_param;
TIMERS e_timers; /* per job timers */
#if _FFR_QUEUEDELAY
int e_queuealg; /* algorithm for queue delay */
time_t e_queuedelay; /* current delay */
#endif /* _FFR_QUEUEDELAY */
};
/* values for e_flags */
#define EF_OLDSTYLE 0x0000001L /* use spaces (not commas) in hdrs */
#define EF_INQUEUE 0x0000002L /* this message is fully queued */
#define EF_NO_BODY_RETN 0x0000004L /* omit message body on error */
#define EF_CLRQUEUE 0x0000008L /* disk copy is no longer needed */
#define EF_SENDRECEIPT 0x0000010L /* send a return receipt */
#define EF_FATALERRS 0x0000020L /* fatal errors occurred */
#define EF_DELETE_BCC 0x0000040L /* delete Bcc: headers entirely */
#define EF_RESPONSE 0x0000080L /* this is an error or return receipt */
#define EF_RESENT 0x0000100L /* this message is being forwarded */
#define EF_VRFYONLY 0x0000200L /* verify only (don't expand aliases) */
#define EF_WARNING 0x0000400L /* warning message has been sent */
#define EF_QUEUERUN 0x0000800L /* this envelope is from queue */
#define EF_GLOBALERRS 0x0001000L /* treat errors as global */
#define EF_PM_NOTIFY 0x0002000L /* send return mail to postmaster */
#define EF_METOO 0x0004000L /* send to me too */
#define EF_LOGSENDER 0x0008000L /* need to log the sender */
#define EF_NORECEIPT 0x0010000L /* suppress all return-receipts */
#define EF_HAS8BIT 0x0020000L /* at least one 8-bit char in body */
#define EF_NL_NOT_EOL 0x0040000L /* don't accept raw NL as EOLine */
#define EF_CRLF_NOT_EOL 0x0080000L /* don't accept CR-LF as EOLine */
#define EF_RET_PARAM 0x0100000L /* RCPT command had RET argument */
#define EF_HAS_DF 0x0200000L /* set when df file is instantiated */
#define EF_IS_MIME 0x0400000L /* really is a MIME message */
#define EF_DONT_MIME 0x0800000L /* never MIME this message */
#define EF_DISCARD 0x1000000L /* discard the message */
#define EF_TOOBIG 0x2000000L /* message is too big */
/* values for e_if_macros */
#define EIF_ADDR 0 /* ${if_addr} */
/* functions */
extern void clearenvelope __P((ENVELOPE *, bool));
extern void dropenvelope __P((ENVELOPE *, bool));
extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *));
extern void printenvflags __P((ENVELOPE *));
extern void putbody __P((MCI *, ENVELOPE *, char *));
extern void putheader __P((MCI *, HDR *, ENVELOPE *, int));
/*
** Message priority classes.
**
** The message class is read directly from the Priority: header
** field in the message.
**
** CurEnv->e_msgpriority is the number of bytes in the message plus
** the creation time (so that jobs ``tend'' to be ordered correctly),
** adjusted by the message class, the number of recipients, and the
** amount of time the message has been sitting around. This number
** is used to order the queue. Higher values mean LOWER priority.
**
** Each priority class point is worth WkClassFact priority points;
** each recipient is worth WkRecipFact priority points. Each time
** we reprocess a message the priority is adjusted by WkTimeFact.
** WkTimeFact should normally decrease the priority so that jobs
** that have historically failed will be run later; thanks go to
** Jay Lepreau at Utah for pointing out the error in my thinking.
**
** The "class" is this number, unadjusted by the age or size of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -