1 /* 2 ** DLVRMAIL.H -- Global definitions for delivermail. 3 ** 4 ** Most of these are actually allocated in globals.c 5 ** 6 ** @(#)sendmail.h 1.3 07/25/80 7 */ 8 9 10 11 12 /* 13 ** Manifest constants. 14 */ 15 16 # define MAXLINE 256 /* maximum line length */ 17 # define MAXNAME 128 /* maximum length of a name */ 18 # define MAXPV 15 /* maximum # of parms to mailers */ 19 # define MAXHOP 30 /* maximum value of HopCount */ 20 21 22 23 24 25 /* 26 ** Mailer definition structure. 27 ** Every mailer known to the system is declared in this 28 ** structure. It defines the pathname of the mailer, some 29 ** flags associated with it, and the argument vector to 30 ** pass to it. 31 ** 32 ** The flags are as follows: 33 ** M_FOPT -- if set, the mailer has a picky "-f" 34 ** option. In this mode, the mailer will only 35 ** accept the "-f" option if the sender is 36 ** actually "root", "network", and possibly 37 ** (but not necessarily) if the -f argument 38 ** matches the real sender. The effect is 39 ** that if the "-f" option is given to 40 ** delivermail then it will be passed through 41 ** (as arguments 1 & 2) to the mailer. 42 ** M_ROPT -- identical to M_FOPT, except uses -r instead. 43 ** UGH! 44 ** M_QUIET -- if set, don't print a message if the mailer 45 ** returns bad status. 46 ** M_RESTR -- if set, this mailer is restricted to use 47 ** by "daemon"; otherwise, we do a 48 ** setuid(getuid()) before calling the mailer. 49 ** M_HDR -- if set, the mailer wants us to insert a 50 ** UNIX "From" line before outputting. 51 ** M_NOHOST -- if set, this mailer doesn't care about 52 ** the host part (e.g., the local mailer). 53 ** M_STRIPQ -- if set, strip quote (`"') characters 54 ** out of parameters as you transliterate them 55 ** into the argument vector. For example, the 56 ** local mailer is called directly, so these 57 ** should be stripped, but the program-mailer 58 ** (i.e., csh) should leave them in. 59 ** 60 ** The argument vector is expanded before actual use. Every- 61 ** thing is passed through except for things starting with "$". 62 ** "$x" defines some interpolation, as defined by x: 63 ** $f The "from" person. 64 ** $h The host being sent to. 65 ** $u The user being sent to. 66 ** $c The current hop count. 67 ** "$x" where x is unknown expands to "x", so use "$$" to get "$". 68 */ 69 70 struct mailer 71 { 72 char *m_mailer; /* pathname of the mailer to use */ 73 short m_flags; /* status flags, see below */ 74 short m_badstat; /* the status code to use on unknown error */ 75 char **m_local; /* list of local names for this host */ 76 char *m_argv[MAXPV]; /* template argument vector */ 77 }; 78 79 # define M_FOPT 0001 /* mailer takes picky -f flag */ 80 # define M_ROPT 0002 /* mailer takes picky -r flag */ 81 # define M_QUIET 0004 /* don't print error on bad status */ 82 # define M_RESTR 0010 /* must be daemon to execute */ 83 # define M_HDR 0020 /* insert From line */ 84 # define M_NOHOST 0040 /* ignore host in comparisons */ 85 # define M_STRIPQ 0100 /* strip quote characters from user/host */ 86 87 extern struct mailer Mailer[]; 88 89 90 /* 91 ** Address structure. 92 ** Addresses are stored internally in this structure. 93 */ 94 95 struct address 96 { 97 char *q_paddr; /* the printname for the address */ 98 char *q_user; /* user name */ 99 char *q_host; /* host name */ 100 struct mailer *q_mailer; /* mailer to use */ 101 struct address *q_next; /* chain */ 102 struct address *q_prev; /* back pointer */ 103 }; 104 105 typedef struct address addrq; 106 107 /* some other primitives */ 108 # define nxtinq(q) ((q)->q_next) 109 # define clearq(q) (q)->q_next = (q)->q_prev = NULL 110 111 extern addrq SendQ; /* queue of people to send to */ 112 extern addrq AliasQ; /* queue of people that are aliases */ 113 114 115 /* 116 ** Parse structure. 117 ** This table drives the parser which determines the network 118 ** to send the mail to. 119 */ 120 121 struct parsetab 122 { 123 char p_char; /* trigger character */ 124 char p_mailer; /* the index of the mailer to call */ 125 short p_flags; /* see below */ 126 char *p_arg; /* extra info needed for some flags */ 127 }; 128 129 # define P_MAP 0001 /* map p_char -> p_arg[0] */ 130 # define P_HLAST 0002 /* host is last, & right associative */ 131 # define P_ONE 0004 /* can only be one p_char in addr */ 132 # define P_MOVE 0010 /* send untouched to host p_arg */ 133 # define P_USR_UPPER 0020 /* don't map UPPER->lower in user names */ 134 # define P_HST_UPPER 0040 /* don't map UPPER->lower in host names */ 135 136 137 138 139 /* 140 ** Global variables. 141 */ 142 143 extern char ArpaFmt; /* if set, message is in arpanet fmt */ 144 extern char FromFlag; /* if set, "From" person is explicit */ 145 extern char Debug; /* if set, debugging info */ 146 extern char MailBack; /* mail back response on error */ 147 extern char BerkNet; /* called from BerkNet */ 148 extern char WriteBack; /* write back response on error */ 149 extern char NoAlias; /* if set, don't do any aliasing */ 150 extern char ForceMail; /* if set, mail even if already got a copy */ 151 extern char MeToo; /* send to the sender also */ 152 extern char Error; /* set if errors */ 153 extern int ExitStat; /* exit status code */ 154 extern char InFileName[]; /* input file name */ 155 extern char Transcript[]; /* the transcript file name */ 156 extern addrq From; /* the person it is from */ 157 extern char *To; /* the target person */ 158 extern int HopCount; /* hop count */ 159 160 161 # include <sysexits.h> 162 163 # define flagset(bits, word) ((bits) & (word)) 164 # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } 165 166 # include "useful.h" 167 168 # define BADMAIL YES /* mail doesn't know about new returncodes */ 169