📄 sendmail.h
字号:
/* * Copyright (c) 1983 Eric P. Allman * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted provided * that: (1) source distributions retain this entire copyright notice and * comment, and (2) distributions including binaries display the following * acknowledgement: ``This product includes software developed by the * University of California, Berkeley and its contributors'' in the * documentation or other materials provided with the distribution and in * all advertising materials mentioning features or use of this software. * Neither the name of the University nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * @(#)sendmail.h 1.1 92/07/30 SMI from 5.11 3/13/88 * * Sendmail * Copyright (c) 1983 Eric P. Allman * Berkeley, California * *//*** SENDMAIL.H -- Global definitions for sendmail.*/# ifdef _DEFINE# define EXTERN# else _DEFINE# define EXTERN extern# endif _DEFINE# include <stdio.h># include <ctype.h>#ifdef INTER# include <locale.h>#endif# include <setjmp.h># include "conf.h"# include "useful.h"# ifdef LOG# include <syslog.h># endif LOG# ifdef DAEMON# ifdef VMUNIX# include <sys/socket.h># include <netinet/in.h># endif VMUNIX# endif DAEMON# define PSBUFSIZE (MAXNAME + MAXATOM) /* size of prescan buffer *//*** Data structure for bit maps.**** Each bit in this map can be referenced by an ascii character.** This is 128 possible bits, or 12 8-bit bytes.*/#define BITMAPBYTES 16 /* number of bytes in a bit map */#define BYTEBITS 8 /* number of bits in a byte *//* internal macros */#define _BITWORD(bit) (bit / (BYTEBITS * sizeof (int)))#define _BITBIT(bit) (1 << (bit % (BYTEBITS * sizeof (int))))typedef int BITMAP[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) bzero((char *) map, BITMAPBYTES)/*** 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_short q_flags; /* status flags, see below */ short q_uid; /* user-id of receiver (if known) */ short 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 */ struct address *q_tchain; /* temporary use chain */ time_t q_timeout; /* timeout for this address */};typedef struct address ADDRESS;# define QDONTSEND 000001 /* don't send to this address */# define QBADADDR 000002 /* this address is verified bad */# define QGOODUID 000004 /* the q_uid q_gid fields are good */# define QPRIMARY 000010 /* set from argv or RCPT TO: command */# define QQUEUEUP 000020 /* queue for later transmission */# define QDOMAIN 000040 /* was result of a domain-wide alias */# define QWASLOCAL 000100 /* we've seen our host name, stop NISing *//*** 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 */ BITMAP m_flags; /* status flags, see below */ short m_mno; /* mailer number internally */ char **m_argv; /* template argument vector */ short m_s_rwset; /* rewriting set for sender addresses */ short m_r_rwset; /* rewriting set for recipient addresses */ char *m_eol; /* end of line string */ long m_maxsize; /* size limit on message to this mailer */ int m_argvsize; /* size limit on argv to this mailer */};typedef struct mailer MAILER;/* bits for m_flags */# define M_CANONICAL 'C' /* make addresses canonical "u@dom" */# 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 */# define M_HST_UPPER 'h' /* preserve host case distinction */# define M_INTERNAL 'I' /* SMTP to another sendmail site */# define M_LOCAL 'l' /* delivery is to this host */# define M_LIMITS 'L' /* must enforce SMTP line limits */# define M_MUSER 'm' /* can handle multiple users at once */# define M_NHDR 'n' /* don't insert From line */# define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */# 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_RESTR 'S' /* must be daemon to execute */# define M_USR_UPPER 'u' /* preserve user case distinction */# define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */# define M_XDOT 'X' /* use hidden-dot algorithm */EXTERN MAILER *Mailer[MAXMAILERS+1];EXTERN MAILER *LocalMailer; /* ptr to local mailer */EXTERN MAILER *ProgMailer; /* ptr to program mailer */EXTERN char AlreadyKnown; /* don't log unless this is zero *//*** 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_short h_flags; /* status bits, see below */ BITMAP 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_short hi_flags; /* status bits, see below */};extern struct hdrinfo HdrInfo[];/* bits for h_flags and hi_flags */# define H_EOH 00001 /* this field terminates header */# define H_RCPT 00002 /* contains recipient addresses */# define H_DEFAULT 00004 /* if another value is found, drop this */# define H_RESENT 00010 /* this address is a "Resent-..." address */# define H_CHECK 00020 /* check h_mflags against m_flags */# define H_ACHECK 00040 /* ditto, but always (not just default) */# define H_FORCE 00100 /* force this field, even if default */# define H_TRACE 00200 /* this field contains trace information */# define H_FROM 00400 /* this is a from-type field */# define H_VALID 01000 /* this field has a validated value */# define H_ERRSTO 02000 /* this is an errors-to: line *//*** 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 */ char *e_receiptto; /* return receipt address */ ADDRESS e_from; /* the person it is from */ char **e_fromdomain; /* the domain part of the sender */ ADDRESS *e_sendqueue; /* list of message recipients */ ADDRESS *e_errorqueue; /* the queue for error responses */ long e_msgsize; /* size of the message in bytes */ long e_bodysize; /* size of the message body in bytes */ int e_nrcpts; /* number of recipients */ short e_class; /* msg class (priority, junk, etc.) */ short e_flags; /* flags, see below */ short e_hopcount; /* number of times processed */ int (*e_puthdr)(); /* function to put header of message */ int (*e_putbody)(); /* function to put body of message */ struct envelope *e_parent; /* the message this one encloses */ struct envelope *e_sibling; /* the next envelope of interest */ char *e_df; /* location of temp file */ FILE *e_dfp; /* temporary file */ char *e_id; /* code for this entry in queue */ FILE *e_xfp; /* transcript file */ char *e_message; /* error message */ char *e_macro[128]; /* macro definitions */};typedef struct envelope ENVELOPE;/* values for e_flags */#define EF_OLDSTYLE 000001 /* use spaces (not commas) in hdrs */#define EF_INQUEUE 000002 /* this message is fully queued */#define EF_TIMEOUT 000004 /* this message is too old */#define EF_CLRQUEUE 000010 /* disk copy is no longer needed */#define EF_SENDRECEIPT 000020 /* send a return receipt */#define EF_FATALERRS 000040 /* fatal errors occured */#define EF_KEEPQUEUE 000100 /* keep queue files always */#define EF_RESPONSE 000200 /* this is an error or return receipt */#define EF_RESENT 000400 /* this message is being forwarded */#define EF_ERRSTOFROM 001000 /* DON'T add an errors-to: line */EXTERN ENVELOPE *CurEnv; /* envelope currently being processed *//*** 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** this message. Classes with negative representations will have** error messages thrown away if they are not local.*/struct priority{ char *pri_name; /* external name of priority */ int pri_val; /* internal value for same */};EXTERN struct priority Priorities[MAXPRIORITIES];EXTERN int NumPriorities; /* pointer into Priorities */# define WKRECIPFACT 50 /* bytes each recipient is worth */# define WKTIMEFACT (-1000) /* bytes each reprocessing is worth *//*** Rewrite rules.*/struct rewrite{ char **r_lhs; /* pattern match */ char **r_rhs; /* substitution value */ struct rewrite *r_next;/* next in chain */};EXTERN struct rewrite *RewriteRules[MAXRWSETS];/*** Special characters in rewriting rules.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -