1295Seric /* 23313Seric ** SENDMAIL.H -- Global definitions for sendmail. 3295Seric ** 4*4090Seric ** @(#)sendmail.h 3.21 08/09/81 5295Seric */ 6295Seric 7295Seric 8295Seric 9295Seric 101390Seric # include "useful.h" 111390Seric 12295Seric /* 13295Seric ** Manifest constants. 14295Seric */ 15295Seric 16295Seric # define MAXLINE 256 /* maximum line length */ 17295Seric # define MAXNAME 128 /* maximum length of a name */ 181379Seric # define MAXFIELD 2500 /* maximum total length of a header field */ 193234Seric # define MAXPV 40 /* maximum # of parms to mailers */ 20295Seric # define MAXHOP 30 /* maximum value of HopCount */ 213153Seric # define MAXATOM 15 /* max atoms per address */ 221516Seric # define ALIASFILE "/usr/lib/aliases" /* location of alias file */ 23295Seric 24295Seric 25295Seric 26295Seric 27295Seric 283190Seric 29295Seric /* 303190Seric ** Address structure. 313190Seric ** Addresses are stored internally in this structure. 323190Seric */ 333190Seric 343190Seric struct address 353190Seric { 363190Seric char *q_paddr; /* the printname for the address */ 373190Seric char *q_user; /* user name */ 383190Seric char *q_host; /* host name */ 393190Seric short q_mailer; /* mailer to use */ 403190Seric short q_rmailer; /* real mailer (before mapping) */ 413190Seric short q_flags; /* status flags, see below */ 424079Seric char *q_home; /* home dir (local mailer only) */ 433190Seric struct address *q_next; /* chain */ 443190Seric }; 453190Seric 463190Seric typedef struct address ADDRESS; 473190Seric 483190Seric # define QDONTSEND 000001 /* don't send to this address */ 494068Seric # define QBADADDR 000002 /* this address is verified bad */ 503190Seric 513190Seric 523190Seric 533190Seric 543190Seric 553190Seric /* 56295Seric ** Mailer definition structure. 57295Seric ** Every mailer known to the system is declared in this 58295Seric ** structure. It defines the pathname of the mailer, some 59295Seric ** flags associated with it, and the argument vector to 601390Seric ** pass to it. The flags are defined in conf.c 61295Seric ** 622899Seric ** The host map is a list of lists of strings. Within each 632899Seric ** list, any host is mapped to the last host in the list. 642899Seric ** This allows multiple names, as well as doing clever 652899Seric ** mail grouping in point-to-point networks. Note: this 662899Seric ** is only used internally, so the apparent host is still 672899Seric ** kept around. 682899Seric ** 69295Seric ** The argument vector is expanded before actual use. Every- 70295Seric ** thing is passed through except for things starting with "$". 711390Seric ** "$x" defines some interpolation, as described in conf.c 72295Seric ** "$x" where x is unknown expands to "x", so use "$$" to get "$". 73295Seric */ 74295Seric 75295Seric struct mailer 76295Seric { 773190Seric char *m_name; /* symbolic name of this mailer */ 78295Seric char *m_mailer; /* pathname of the mailer to use */ 79295Seric short m_flags; /* status flags, see below */ 80295Seric short m_badstat; /* the status code to use on unknown error */ 812899Seric char *m_from; /* pattern for From: header */ 823049Seric char **m_argv; /* template argument vector */ 833190Seric ADDRESS *m_sendq; /* list of addresses to send to */ 84295Seric }; 85295Seric 862899Seric # define M_FOPT 000001 /* mailer takes picky -f flag */ 872899Seric # define M_ROPT 000002 /* mailer takes picky -r flag */ 882899Seric # define M_QUIET 000004 /* don't print error on bad status */ 892899Seric # define M_RESTR 000010 /* must be daemon to execute */ 903190Seric # define M_NHDR 000020 /* don't insert From line */ 912899Seric # define M_NOHOST 000040 /* ignore host in comparisons */ 922899Seric # define M_STRIPQ 000100 /* strip quote characters from user/host */ 933190Seric # define M_MUSER 000200 /* mailer can handle multiple users at once */ 942899Seric # define M_NEEDFROM 000400 /* need arpa-style From: line */ 952899Seric # define M_NEEDDATE 001000 /* need arpa-style Date: line */ 962899Seric # define M_MSGID 002000 /* need Message-Id: field */ 973153Seric # define M_USR_UPPER 010000 /* preserve user case distinction */ 983153Seric # define M_HST_UPPER 020000 /* preserve host case distinction */ 993390Seric # define M_FULLNAME 040000 /* want Full-Name field */ 100295Seric 1013390Seric # define M_ARPAFMT (M_NEEDDATE|M_NEEDFROM|M_NEEDDATE) 1022899Seric 1033049Seric extern struct mailer *Mailer[]; 104295Seric 1054079Seric /* special mailer numbers */ 1064079Seric # define M_LOCAL 0 /* local mailer */ 1074079Seric # define M_PROG 1 /* program mailer */ 1084079Seric # define M_PRIVATE 2 /* user's private mailer */ 1094079Seric /* mailers from 3 on are arbitrary */ 110295Seric 111295Seric 1124079Seric 1132899Seric /* 1142899Seric ** Header structure. 1152899Seric ** This structure is used internally to store header items. 1162899Seric */ 117295Seric 1182899Seric struct header 1192899Seric { 1202899Seric char *h_field; /* the name of the field */ 1212899Seric char *h_value; /* the value of that field */ 1222899Seric struct header *h_link; /* the next header */ 1232899Seric short h_flags; /* status bits, see below */ 1243386Seric short h_mflags; /* m_flags bits needed */ 1252899Seric }; 126295Seric 1272899Seric typedef struct header HDR; 1282899Seric 1292899Seric extern HDR *Header; /* head of header list */ 1302899Seric 131295Seric /* 1322899Seric ** Header information structure. 1332899Seric ** Defined in conf.c, this struct declares the header fields 1342899Seric ** that have some magic meaning. 1352899Seric */ 1362899Seric 1372899Seric struct hdrinfo 1382899Seric { 1392899Seric char *hi_field; /* the name of the field */ 1402899Seric short hi_flags; /* status bits, see below */ 1413386Seric short hi_mflags; /* m_flags needed for this field */ 1422899Seric }; 1432899Seric 1442899Seric extern struct hdrinfo HdrInfo[]; 1452899Seric 1462899Seric /* bits for h_flags and hi_flags */ 1473060Seric # define H_EOH 00001 /* this field terminates header */ 1482899Seric # define H_DELETE 00002 /* don't send this field */ 1492899Seric # define H_DEFAULT 00004 /* if another value is found, drop this */ 1502899Seric # define H_USED 00010 /* indicates that this has been output */ 1513386Seric # define H_CHECK 00020 /* check h_mflags against m_flags */ 1523390Seric # define H_ACHECK 00040 /* ditto, but always (not just default) */ 1532899Seric 1542899Seric 1553153Seric /* 1563153Seric ** Rewrite rules. 1573153Seric */ 1582899Seric 1593153Seric struct rewrite 1603153Seric { 1613153Seric char **r_lhs; /* pattern match */ 1623153Seric char **r_rhs; /* substitution value */ 1633153Seric struct rewrite *r_next;/* next in chain */ 1643153Seric }; 1652899Seric 166*4090Seric extern struct rewrite *RewriteRules[]; 1673153Seric 1684060Seric # define MATCHANY '\020' /* match one or more tokens */ 1694060Seric # define MATCHONE '\021' /* match exactly one token */ 1704060Seric # define MATCHCLASS '\022' /* match one token in a class */ 1713153Seric 1723153Seric # define CANONNET '\025' /* canonical net, next token */ 1733153Seric # define CANONHOST '\026' /* canonical host, next token */ 1743153Seric # define CANONUSER '\027' /* canonical user, next N tokens */ 1753153Seric 1763153Seric 1773153Seric 1784056Seric /* 1794056Seric ** Symbol table definitions 1804056Seric */ 1813153Seric 1824056Seric struct symtab 1834056Seric { 1844056Seric char *s_name; /* name to be entered */ 1854056Seric char s_type; /* general type (unused) */ 1864056Seric long s_class; /* bit-map of word classes */ 1874056Seric struct symtab *s_next; /* pointer to next in chain */ 1884056Seric }; 1894056Seric 1904056Seric typedef struct symtab STAB; 1914056Seric 1924056Seric extern STAB *stab(); 1934056Seric 1944056Seric /* opcodes to stab */ 1954056Seric # define ST_FIND 0 /* find entry */ 1964056Seric # define ST_ENTER 1 /* enter if not there */ 1974056Seric 1984056Seric 1994056Seric 2004056Seric 2012899Seric /* 202295Seric ** Global variables. 203295Seric */ 204295Seric 2051390Seric extern bool ArpaFmt; /* if set, message is in arpanet fmt */ 2061390Seric extern bool FromFlag; /* if set, "From" person is explicit */ 2071390Seric extern bool MailBack; /* mail back response on error */ 2081390Seric extern bool BerkNet; /* called from BerkNet */ 2091390Seric extern bool WriteBack; /* write back response on error */ 2101390Seric extern bool NoAlias; /* if set, don't do any aliasing */ 2111390Seric extern bool ForceMail; /* if set, mail even if already got a copy */ 2121390Seric extern bool MeToo; /* send to the sender also */ 2131390Seric extern bool IgnrDot; /* don't let dot end messages */ 2141390Seric extern bool SaveFrom; /* save leading "From" lines */ 2154064Seric extern bool Verbose; /* set if blow-by-blow desired */ 2164073Seric extern int Debug; /* debugging level */ 2171516Seric extern int Errors; /* set if errors */ 218295Seric extern int ExitStat; /* exit status code */ 219295Seric extern char InFileName[]; /* input file name */ 220295Seric extern char Transcript[]; /* the transcript file name */ 2212979Seric extern ADDRESS From; /* the person it is from */ 222295Seric extern char *To; /* the target person */ 223295Seric extern int HopCount; /* hop count */ 2243190Seric extern long CurTime; /* time of this message */ 2253190Seric extern char FromLine[]; /* a UNIX-style From line for this message */ 226295Seric 227295Seric 228295Seric # include <sysexits.h> 229295Seric 230295Seric # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } 2314085Seric 2324085Seric 2334085Seric /* useful functions */ 2344085Seric 2354085Seric extern char *newstr(); 2364085Seric extern ADDRESS *parse(); 2374085Seric extern char *xalloc(); 2384085Seric extern char *expand(); 2394085Seric extern bool sameaddr(); 240