1295Seric /* 2*406Seric ** DLVRMAIL.H -- Global definitions for delivermail. 3295Seric ** 4295Seric ** Most of these are actually allocated in globals.c 5295Seric ** 6*406Seric ** @(#)sendmail.h 1.3 07/25/80 7295Seric */ 8295Seric 9295Seric 10295Seric 11295Seric 12295Seric /* 13295Seric ** Manifest constants. 14295Seric */ 15295Seric 16295Seric # define MAXLINE 256 /* maximum line length */ 17295Seric # define MAXNAME 128 /* maximum length of a name */ 18295Seric # define MAXPV 15 /* maximum # of parms to mailers */ 19295Seric # define MAXHOP 30 /* maximum value of HopCount */ 20295Seric 21295Seric 22295Seric 23295Seric 24295Seric 25295Seric /* 26295Seric ** Mailer definition structure. 27295Seric ** Every mailer known to the system is declared in this 28295Seric ** structure. It defines the pathname of the mailer, some 29295Seric ** flags associated with it, and the argument vector to 30295Seric ** pass to it. 31295Seric ** 32295Seric ** The flags are as follows: 33295Seric ** M_FOPT -- if set, the mailer has a picky "-f" 34295Seric ** option. In this mode, the mailer will only 35295Seric ** accept the "-f" option if the sender is 36295Seric ** actually "root", "network", and possibly 37295Seric ** (but not necessarily) if the -f argument 38295Seric ** matches the real sender. The effect is 39295Seric ** that if the "-f" option is given to 40295Seric ** delivermail then it will be passed through 41295Seric ** (as arguments 1 & 2) to the mailer. 42295Seric ** M_ROPT -- identical to M_FOPT, except uses -r instead. 43295Seric ** UGH! 44295Seric ** M_QUIET -- if set, don't print a message if the mailer 45295Seric ** returns bad status. 46295Seric ** M_RESTR -- if set, this mailer is restricted to use 47295Seric ** by "daemon"; otherwise, we do a 48295Seric ** setuid(getuid()) before calling the mailer. 49295Seric ** M_HDR -- if set, the mailer wants us to insert a 50295Seric ** UNIX "From" line before outputting. 51295Seric ** M_NOHOST -- if set, this mailer doesn't care about 52295Seric ** the host part (e.g., the local mailer). 53295Seric ** M_STRIPQ -- if set, strip quote (`"') characters 54295Seric ** out of parameters as you transliterate them 55295Seric ** into the argument vector. For example, the 56295Seric ** local mailer is called directly, so these 57295Seric ** should be stripped, but the program-mailer 58295Seric ** (i.e., csh) should leave them in. 59295Seric ** 60295Seric ** The argument vector is expanded before actual use. Every- 61295Seric ** thing is passed through except for things starting with "$". 62295Seric ** "$x" defines some interpolation, as defined by x: 63295Seric ** $f The "from" person. 64295Seric ** $h The host being sent to. 65295Seric ** $u The user being sent to. 66295Seric ** $c The current hop count. 67295Seric ** "$x" where x is unknown expands to "x", so use "$$" to get "$". 68295Seric */ 69295Seric 70295Seric struct mailer 71295Seric { 72295Seric char *m_mailer; /* pathname of the mailer to use */ 73295Seric short m_flags; /* status flags, see below */ 74295Seric short m_badstat; /* the status code to use on unknown error */ 75295Seric char **m_local; /* list of local names for this host */ 76295Seric char *m_argv[MAXPV]; /* template argument vector */ 77295Seric }; 78295Seric 79295Seric # define M_FOPT 0001 /* mailer takes picky -f flag */ 80295Seric # define M_ROPT 0002 /* mailer takes picky -r flag */ 81295Seric # define M_QUIET 0004 /* don't print error on bad status */ 82295Seric # define M_RESTR 0010 /* must be daemon to execute */ 83295Seric # define M_HDR 0020 /* insert From line */ 84295Seric # define M_NOHOST 0040 /* ignore host in comparisons */ 85295Seric # define M_STRIPQ 0100 /* strip quote characters from user/host */ 86295Seric 87295Seric extern struct mailer Mailer[]; 88295Seric 89295Seric 90295Seric /* 91295Seric ** Address structure. 92295Seric ** Addresses are stored internally in this structure. 93295Seric */ 94295Seric 95295Seric struct address 96295Seric { 97295Seric char *q_paddr; /* the printname for the address */ 98295Seric char *q_user; /* user name */ 99295Seric char *q_host; /* host name */ 100295Seric struct mailer *q_mailer; /* mailer to use */ 101295Seric struct address *q_next; /* chain */ 102295Seric struct address *q_prev; /* back pointer */ 103295Seric }; 104295Seric 105295Seric typedef struct address addrq; 106295Seric 107295Seric /* some other primitives */ 108295Seric # define nxtinq(q) ((q)->q_next) 109295Seric # define clearq(q) (q)->q_next = (q)->q_prev = NULL 110295Seric 111295Seric extern addrq SendQ; /* queue of people to send to */ 112295Seric extern addrq AliasQ; /* queue of people that are aliases */ 113295Seric 114295Seric 115295Seric /* 116295Seric ** Parse structure. 117295Seric ** This table drives the parser which determines the network 118295Seric ** to send the mail to. 119295Seric */ 120295Seric 121295Seric struct parsetab 122295Seric { 123295Seric char p_char; /* trigger character */ 124295Seric char p_mailer; /* the index of the mailer to call */ 125295Seric short p_flags; /* see below */ 126295Seric char *p_arg; /* extra info needed for some flags */ 127295Seric }; 128295Seric 129295Seric # define P_MAP 0001 /* map p_char -> p_arg[0] */ 130295Seric # define P_HLAST 0002 /* host is last, & right associative */ 131295Seric # define P_ONE 0004 /* can only be one p_char in addr */ 132295Seric # define P_MOVE 0010 /* send untouched to host p_arg */ 133295Seric # define P_USR_UPPER 0020 /* don't map UPPER->lower in user names */ 134295Seric # define P_HST_UPPER 0040 /* don't map UPPER->lower in host names */ 135295Seric 136295Seric 137295Seric 138295Seric 139295Seric /* 140295Seric ** Global variables. 141295Seric */ 142295Seric 143295Seric extern char ArpaFmt; /* if set, message is in arpanet fmt */ 144295Seric extern char FromFlag; /* if set, "From" person is explicit */ 145295Seric extern char Debug; /* if set, debugging info */ 146295Seric extern char MailBack; /* mail back response on error */ 147401Seric extern char BerkNet; /* called from BerkNet */ 148295Seric extern char WriteBack; /* write back response on error */ 149295Seric extern char NoAlias; /* if set, don't do any aliasing */ 150295Seric extern char ForceMail; /* if set, mail even if already got a copy */ 151295Seric extern char MeToo; /* send to the sender also */ 152295Seric extern char Error; /* set if errors */ 153295Seric extern int ExitStat; /* exit status code */ 154295Seric extern char InFileName[]; /* input file name */ 155295Seric extern char Transcript[]; /* the transcript file name */ 156295Seric extern addrq From; /* the person it is from */ 157295Seric extern char *To; /* the target person */ 158295Seric extern int HopCount; /* hop count */ 159295Seric 160295Seric 161295Seric # include <sysexits.h> 162295Seric 163295Seric # define flagset(bits, word) ((bits) & (word)) 164295Seric # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } 165295Seric 166295Seric # include "useful.h" 167295Seric 168295Seric # define BADMAIL YES /* mail doesn't know about new returncodes */ 169