📄 sendmail.h
字号:
**** The send mode tells how to send mail. It can be set in the** configuration file. It's setting determines how quickly the** mail will be delivered versus the load on your system. If the** -v (verbose) flag is given, it will be forced to SM_DELIVER** mode.**** The error mode tells how to return errors.*/EXTERN char OpMode; /* operation mode, see below */#define MD_DELIVER 'm' /* be a mail sender */#define MD_SMTP 's' /* run SMTP on standard input */#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */#define MD_DAEMON 'd' /* run as a daemon */#define MD_VERIFY 'v' /* verify: don't collect or deliver */#define MD_TEST 't' /* test mode: resolve addrs only */#define MD_INITALIAS 'i' /* initialize alias database */#define MD_PRINT 'p' /* print the queue */#define MD_FREEZE 'z' /* freeze the configuration file *//* values for e_sendmode -- send modes */#define SM_DELIVER 'i' /* interactive delivery */#define SM_QUICKD 'j' /* deliver w/o queueing */#define SM_FORK 'b' /* deliver in background */#define SM_QUEUE 'q' /* queue, don't deliver */#define SM_VERIFY 'v' /* verify only (used internally) *//* used only as a parameter to sendall */#define SM_DEFAULT '\0' /* unspecified, use SendMode *//* values for e_errormode -- error handling modes */#define EM_PRINT 'p' /* print errors */#define EM_MAIL 'm' /* mail back errors */#define EM_WRITE 'w' /* write back errors */#define EM_BERKNET 'e' /* special berknet processing */#define EM_QUIET 'q' /* don't print messages (stat only) *//*** Additional definitions*//*** Privacy flags** These are bit values for the PrivacyFlags word.*/#define PRIV_PUBLIC 0 /* what have I got to hide? */#define PRIV_NEEDMAILHELO 00001 /* insist on HELO for MAIL, at least */#define PRIV_NEEDEXPNHELO 00002 /* insist on HELO for EXPN */#define PRIV_NEEDVRFYHELO 00004 /* insist on HELO for VRFY */#define PRIV_NOEXPN 00010 /* disallow EXPN command entirely */#define PRIV_NOVRFY 00020 /* disallow VRFY command entirely */#define PRIV_AUTHWARNINGS 00040 /* flag possible authorization probs */#define PRIV_NORECEIPTS 00100 /* disallow return receipts */#define PRIV_RESTRICTMAILQ 01000 /* restrict mailq command */#define PRIV_RESTRICTQRUN 02000 /* restrict queue run */#define PRIV_GOAWAY 00777 /* don't give no info, anyway, anyhow *//* struct defining such things */struct prival{ char *pv_name; /* name of privacy flag */ int pv_flag; /* numeric level */};/*** Flags passed to remotename, parseaddr, allocaddr, and buildaddr.*/#define RF_SENDERADDR 0001 /* this is a sender address */#define RF_HEADERADDR 0002 /* this is a header address */#define RF_CANONICAL 0004 /* strip comment information */#define RF_ADDDOMAIN 0010 /* OK to do domain extension */#define RF_COPYPARSE 0020 /* copy parsed user & host */#define RF_COPYPADDR 0040 /* copy print address */#define RF_COPYALL (RF_COPYPARSE|RF_COPYPADDR)#define RF_COPYNONE 0/*** Flags passed to safefile.*/#define SFF_ANYFILE 0 /* no special restrictions */#define SFF_MUSTOWN 0x0001 /* user must own this file */#define SFF_NOSLINK 0x0002 /* file cannot be a symbolic link */#define SFF_ROOTOK 0x0004 /* ok for root to own this file *//*** Regular UNIX sockaddrs are too small to handle ISO addresses, so** we are forced to declare a supertype here.*/union bigsockaddr{ struct sockaddr sa; /* general version */#ifdef NETUNIX struct sockaddr_un sunix; /* UNIX family */#endif#ifdef NETINET struct sockaddr_in sin; /* INET family */#endif#ifdef NETISO struct sockaddr_iso siso; /* ISO family */#endif#ifdef NETNS struct sockaddr_ns sns; /* XNS family */#endif#ifdef NETX25 struct sockaddr_x25 sx25; /* X.25 family */#endif};#define SOCKADDR union bigsockaddr/*** Global variables.*/EXTERN bool FromFlag; /* if set, "From" person is explicit */EXTERN bool MeToo; /* send to the sender also */EXTERN bool IgnrDot; /* don't let dot end messages */EXTERN bool SaveFrom; /* save leading "From" lines */EXTERN bool Verbose; /* set if blow-by-blow desired */EXTERN bool GrabTo; /* if set, get recipients from msg */EXTERN bool NoReturn; /* don't return letter to sender */EXTERN bool SuprErrs; /* set if we are suppressing errors */EXTERN bool HoldErrs; /* only output errors to transcript */EXTERN bool NoConnect; /* don't connect to non-local mailers */EXTERN bool SuperSafe; /* be extra careful, even if expensive */EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */EXTERN bool CheckAliases; /* parse addresses during newaliases */EXTERN bool NoAlias; /* suppress aliasing */EXTERN bool UseNameServer; /* use internet domain name server */EXTERN bool SevenBit; /* force 7-bit data */EXTERN time_t SafeAlias; /* interval to wait until @:@ in alias file */EXTERN FILE *InChannel; /* input connection */EXTERN FILE *OutChannel; /* output connection */EXTERN uid_t RealUid; /* when Daemon, real uid of caller */EXTERN gid_t RealGid; /* when Daemon, real gid of caller */EXTERN uid_t DefUid; /* default uid to run as */EXTERN gid_t DefGid; /* default gid to run as */EXTERN char *DefUser; /* default user to run as (from DefUid) */EXTERN int OldUmask; /* umask when sendmail starts up */EXTERN int Errors; /* set if errors (local to single pass) */EXTERN int ExitStat; /* exit status code */EXTERN int AliasLevel; /* depth of aliasing */EXTERN int LineNumber; /* line number in current input */EXTERN int LogLevel; /* level of logging to perform */EXTERN int FileMode; /* mode on files */EXTERN int QueueLA; /* load average starting forced queueing */EXTERN int RefuseLA; /* load average refusing connections are */EXTERN int CurrentLA; /* current load average */EXTERN long QueueFactor; /* slope of queue function */EXTERN time_t QueueIntvl; /* intervals between running the queue */EXTERN char *HelpFile; /* location of SMTP help file */EXTERN char *ErrMsgFile; /* file to prepend to all error messages */EXTERN char *StatFile; /* location of statistics summary */EXTERN char *QueueDir; /* location of queue directory */EXTERN char *FileName; /* name to print on error messages */EXTERN char *SmtpPhase; /* current phase in SMTP processing */EXTERN char *MyHostName; /* name of this host for SMTP messages */EXTERN char *RealHostName; /* name of host we are talking to */EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */EXTERN char *CurHostName; /* current host we are dealing with */EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */EXTERN bool QuickAbort; /* .... but only if we want a quick abort */EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */EXTERN bool SendMIMEErrors; /* send error messages in MIME format */EXTERN bool MatchGecos; /* look for user names in gecos field */EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */extern bool CheckLoopBack; /* check for loopback on HELO packet */EXTERN bool InChild; /* true if running in an SMTP subprocess */EXTERN bool DisConnected; /* running with OutChannel redirected to xf */EXTERN char SpaceSub; /* substitution for <lwsp> */EXTERN int PrivacyFlags; /* privacy flags */EXTERN char *ConfFile; /* location of configuration file [conf.c] */extern char *PidFile; /* location of proc id file [conf.c] */extern ADDRESS NullAddress; /* a null (template) address [main.c] */EXTERN long WkClassFact; /* multiplier for message class -> priority */EXTERN long WkRecipFact; /* multiplier for # of recipients -> priority */EXTERN long WkTimeFact; /* priority offset each time this job is run */EXTERN char *UdbSpec; /* user database source spec */EXTERN int MaxHopCount; /* max # of hops until bounce */EXTERN int ConfigLevel; /* config file level */EXTERN char *TimeZoneSpec; /* override time zone specification */EXTERN char *ForwardPath; /* path to search for .forward files */EXTERN long MinBlocksFree; /* min # of blocks free on queue fs */EXTERN char *FallBackMX; /* fall back MX host */EXTERN long MaxMessageSize; /* advertised max size we will accept */EXTERN char *PostMasterCopy; /* address to get errs cc's */EXTERN int CheckpointInterval; /* queue file checkpoint interval */EXTERN bool DontPruneRoutes; /* don't prune source routes */extern bool BrokenSmtpPeers; /* peers can't handle 2-line greeting */EXTERN int MaxMciCache; /* maximum entries in MCI cache */EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */EXTERN char *QueueLimitRecipient; /* limit queue runs to this recipient */EXTERN char *QueueLimitSender; /* limit queue runs to this sender */EXTERN char *QueueLimitId; /* limit queue runs to this id */EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */extern int errno;/*** Timeouts**** Indicated values are the MINIMUM per RFC 1123 section 5.3.2.*/EXTERN struct{ /* RFC 1123-specified timeouts [minimum value] */ time_t to_initial; /* initial greeting timeout [5m] */ time_t to_mail; /* MAIL command [5m] */ time_t to_rcpt; /* RCPT command [5m] */ time_t to_datainit; /* DATA initiation [2m] */ time_t to_datablock; /* DATA block [3m] */ time_t to_datafinal; /* DATA completion [10m] */ time_t to_nextcommand; /* next command [5m] */ /* following timeouts are not mentioned in RFC 1123 */ time_t to_rset; /* RSET command */ time_t to_helo; /* HELO command */ time_t to_quit; /* QUIT command */ time_t to_miscshort; /* misc short commands (NOOP, VERB, etc) */ time_t to_ident; /* IDENT protocol requests */ /* following are per message */ time_t to_q_return; /* queue return timeout */ time_t to_q_warning; /* queue warning timeout */} TimeOuts;/*** Trace information*//* trace vector and macros for debugging flags */EXTERN u_char tTdvect[100];# define tTd(flag, level) (tTdvect[flag] >= level)# define tTdlevel(flag) (tTdvect[flag])/*** Miscellaneous information.*//*** Some in-line functions*//* set exit status */#define setstat(s) { \ if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \ ExitStat = s; \ }/* make a copy of a string */#define newstr(s) strcpy(xalloc(strlen(s) + 1), s)#define STRUCTCOPY(s, d) d = s/*** Declarations of useful functions*/extern ADDRESS *parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *));extern char *xalloc __P((int));extern bool sameaddr __P((ADDRESS *, ADDRESS *));extern FILE *dfopen __P((char *, int, int));extern EVENT *setevent __P((time_t, int(*)(), int));extern char *sfgets __P((char *, int, FILE *, time_t, char *));extern char *queuename __P((ENVELOPE *, int));extern time_t curtime __P(());extern bool transienterror __P((int));extern const char *errstring __P((int));extern void expand __P((char *, char *, char *, ENVELOPE *));extern void define __P((int, char *, ENVELOPE *));extern char *macvalue __P((int, ENVELOPE *));extern char **prescan __P((char *, int, char[], int, char **));extern int rewrite __P((char **, int, int, ENVELOPE *));extern char *fgetfolded __P((char *, int, FILE *));extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, ENVELOPE *));extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *));extern void dropenvelope __P((ENVELOPE *));extern void clearenvelope __P((ENVELOPE *, int));extern char *username __P(());extern MCI *mci_get __P((char *, MAILER *));extern char *pintvl __P((time_t, int));extern char *map_rewrite __P((MAP *, char *, int, char **));extern ADDRESS *getctladdr __P((ADDRESS *));extern char *anynet_ntoa __P((SOCKADDR *));extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *));extern bool shouldqueue __P((long, time_t));extern bool lockfile __P((int, char *, char *, int));extern char *hostsignature __P((MAILER *, char *, ENVELOPE *));extern void openxscript __P((ENVELOPE *));extern void closexscript __P((ENVELOPE *));extern sigfunc_t setsignal __P((int, sigfunc_t));extern char *shortenstring __P((char *, int));extern bool usershellok __P((char *));extern void commaize __P((HDR *, char *, int, MCI *, ENVELOPE *));/* ellipsis is a different case though */#ifdef __STDC__extern void auth_warning(ENVELOPE *, const char *, ...);extern void syserr(const char *, ...);extern void usrerr(const char *, ...);extern void message(const char *, ...);extern void nmessage(const char *, ...);#elseextern void auth_warning();extern void syserr();extern void usrerr();extern void message();extern void nmessage();#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -