1295Seric /* 2406Seric ** DLVRMAIL.H -- Global definitions for delivermail. 3295Seric ** 4295Seric ** Most of these are actually allocated in globals.c 5295Seric ** 6*2899Seric ** @(#)sendmail.h 3.1 03/04/81 7295Seric */ 8295Seric 9295Seric 10295Seric 11295Seric 121390Seric # include "useful.h" 131390Seric 14295Seric /* 15295Seric ** Manifest constants. 16295Seric */ 17295Seric 18295Seric # define MAXLINE 256 /* maximum line length */ 19295Seric # define MAXNAME 128 /* maximum length of a name */ 201379Seric # define MAXFIELD 2500 /* maximum total length of a header field */ 21295Seric # define MAXPV 15 /* maximum # of parms to mailers */ 22295Seric # define MAXHOP 30 /* maximum value of HopCount */ 231516Seric # define ALIASFILE "/usr/lib/aliases" /* location of alias file */ 24295Seric 25295Seric 26295Seric 27295Seric 28295Seric 29295Seric /* 30295Seric ** Mailer definition structure. 31295Seric ** Every mailer known to the system is declared in this 32295Seric ** structure. It defines the pathname of the mailer, some 33295Seric ** flags associated with it, and the argument vector to 341390Seric ** pass to it. The flags are defined in conf.c 35295Seric ** 36*2899Seric ** The host map is a list of lists of strings. Within each 37*2899Seric ** list, any host is mapped to the last host in the list. 38*2899Seric ** This allows multiple names, as well as doing clever 39*2899Seric ** mail grouping in point-to-point networks. Note: this 40*2899Seric ** is only used internally, so the apparent host is still 41*2899Seric ** kept around. 42*2899Seric ** 43295Seric ** The argument vector is expanded before actual use. Every- 44295Seric ** thing is passed through except for things starting with "$". 451390Seric ** "$x" defines some interpolation, as described in conf.c 46295Seric ** "$x" where x is unknown expands to "x", so use "$$" to get "$". 47295Seric */ 48295Seric 49295Seric struct mailer 50295Seric { 51295Seric char *m_mailer; /* pathname of the mailer to use */ 52295Seric short m_flags; /* status flags, see below */ 53295Seric short m_badstat; /* the status code to use on unknown error */ 54295Seric char **m_local; /* list of local names for this host */ 55*2899Seric char *m_from; /* pattern for From: header */ 56*2899Seric char ***m_hmap; /* host map */ 57295Seric char *m_argv[MAXPV]; /* template argument vector */ 58295Seric }; 59295Seric 60*2899Seric # define M_FOPT 000001 /* mailer takes picky -f flag */ 61*2899Seric # define M_ROPT 000002 /* mailer takes picky -r flag */ 62*2899Seric # define M_QUIET 000004 /* don't print error on bad status */ 63*2899Seric # define M_RESTR 000010 /* must be daemon to execute */ 64*2899Seric # define M_HDR 000020 /* insert From line */ 65*2899Seric # define M_NOHOST 000040 /* ignore host in comparisons */ 66*2899Seric # define M_STRIPQ 000100 /* strip quote characters from user/host */ 67*2899Seric # define M_FHDR 000200 /* force good From line */ 68*2899Seric # define M_NEEDFROM 000400 /* need arpa-style From: line */ 69*2899Seric # define M_NEEDDATE 001000 /* need arpa-style Date: line */ 70*2899Seric # define M_MSGID 002000 /* need Message-Id: field */ 71*2899Seric # define M_COMMAS 004000 /* need comma-seperated address lists */ 72295Seric 73*2899Seric # define M_ARPAFMT (M_NEEDDATE|M_NEEDFROM|M_MSGID|M_COMMAS) 74*2899Seric 75295Seric extern struct mailer Mailer[]; 76295Seric 77295Seric 78295Seric /* 79295Seric ** Address structure. 80295Seric ** Addresses are stored internally in this structure. 81295Seric */ 82295Seric 83295Seric struct address 84295Seric { 85295Seric char *q_paddr; /* the printname for the address */ 86295Seric char *q_user; /* user name */ 87295Seric char *q_host; /* host name */ 88295Seric struct mailer *q_mailer; /* mailer to use */ 89295Seric struct address *q_next; /* chain */ 90295Seric struct address *q_prev; /* back pointer */ 91295Seric }; 92295Seric 93295Seric typedef struct address addrq; 94295Seric 95295Seric /* some other primitives */ 96295Seric # define nxtinq(q) ((q)->q_next) 97295Seric # define clearq(q) (q)->q_next = (q)->q_prev = NULL 98295Seric 99295Seric extern addrq SendQ; /* queue of people to send to */ 100295Seric extern addrq AliasQ; /* queue of people that are aliases */ 101295Seric 102295Seric 103295Seric /* 104295Seric ** Parse structure. 105295Seric ** This table drives the parser which determines the network 106295Seric ** to send the mail to. 107295Seric */ 108295Seric 109295Seric struct parsetab 110295Seric { 111295Seric char p_char; /* trigger character */ 112295Seric char p_mailer; /* the index of the mailer to call */ 113295Seric short p_flags; /* see below */ 114295Seric char *p_arg; /* extra info needed for some flags */ 115295Seric }; 116295Seric 117295Seric # define P_MAP 0001 /* map p_char -> p_arg[0] */ 118295Seric # define P_HLAST 0002 /* host is last, & right associative */ 119295Seric # define P_ONE 0004 /* can only be one p_char in addr */ 120295Seric # define P_MOVE 0010 /* send untouched to host p_arg */ 121295Seric # define P_USR_UPPER 0020 /* don't map UPPER->lower in user names */ 122295Seric # define P_HST_UPPER 0040 /* don't map UPPER->lower in host names */ 123295Seric 124295Seric 125*2899Seric /* 126*2899Seric ** Header structure. 127*2899Seric ** This structure is used internally to store header items. 128*2899Seric */ 129295Seric 130*2899Seric struct header 131*2899Seric { 132*2899Seric char *h_field; /* the name of the field */ 133*2899Seric char *h_value; /* the value of that field */ 134*2899Seric struct header *h_link; /* the next header */ 135*2899Seric short h_flags; /* status bits, see below */ 136*2899Seric }; 137295Seric 138*2899Seric typedef struct header HDR; 139*2899Seric 140*2899Seric extern HDR *Header; /* head of header list */ 141*2899Seric 142295Seric /* 143*2899Seric ** Header information structure. 144*2899Seric ** Defined in conf.c, this struct declares the header fields 145*2899Seric ** that have some magic meaning. 146*2899Seric */ 147*2899Seric 148*2899Seric struct hdrinfo 149*2899Seric { 150*2899Seric char *hi_field; /* the name of the field */ 151*2899Seric short hi_flags; /* status bits, see below */ 152*2899Seric }; 153*2899Seric 154*2899Seric extern struct hdrinfo HdrInfo[]; 155*2899Seric 156*2899Seric /* bits for h_flags and hi_flags */ 157*2899Seric # define H_CONCAT 00001 /* comma-concat multiple fields */ 158*2899Seric # define H_DELETE 00002 /* don't send this field */ 159*2899Seric # define H_DEFAULT 00004 /* if another value is found, drop this */ 160*2899Seric # define H_USED 00010 /* indicates that this has been output */ 161*2899Seric 162*2899Seric 163*2899Seric 164*2899Seric 165*2899Seric /* 166295Seric ** Global variables. 167295Seric */ 168295Seric 1691390Seric extern bool ArpaFmt; /* if set, message is in arpanet fmt */ 1701390Seric extern bool FromFlag; /* if set, "From" person is explicit */ 1711390Seric extern bool Debug; /* if set, debugging info */ 1721390Seric extern bool MailBack; /* mail back response on error */ 1731390Seric extern bool BerkNet; /* called from BerkNet */ 1741390Seric extern bool WriteBack; /* write back response on error */ 1751390Seric extern bool NoAlias; /* if set, don't do any aliasing */ 1761390Seric extern bool ForceMail; /* if set, mail even if already got a copy */ 1771390Seric extern bool MeToo; /* send to the sender also */ 1781390Seric extern bool UseMsgId; /* put msg-id's in all msgs [conf.c] */ 1791390Seric extern bool IgnrDot; /* don't let dot end messages */ 1801390Seric extern bool SaveFrom; /* save leading "From" lines */ 1811516Seric extern int Errors; /* set if errors */ 182295Seric extern int ExitStat; /* exit status code */ 183295Seric extern char InFileName[]; /* input file name */ 184295Seric extern char Transcript[]; /* the transcript file name */ 185*2899Seric extern char *MsgId; /* the message id for this message */ 186*2899Seric extern char *Date; /* origination date (UNIX format) */ 187295Seric extern addrq From; /* the person it is from */ 188295Seric extern char *To; /* the target person */ 189295Seric extern int HopCount; /* hop count */ 190295Seric 191295Seric 192295Seric # include <sysexits.h> 193295Seric 194295Seric # define flagset(bits, word) ((bits) & (word)) 195295Seric # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } 196