1 /* 2 ** POSTBOX.H -- Global definitions for postbox. 3 ** 4 ** @(#)sendmail.h 3.6 03/09/81 5 */ 6 7 8 9 10 # include "useful.h" 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 MAXFIELD 2500 /* maximum total length of a header field */ 19 # define MAXPV 15 /* maximum # of parms to mailers */ 20 # define MAXHOP 30 /* maximum value of HopCount */ 21 # define MAXATOM 15 /* max atoms per address */ 22 # define ALIASFILE "/usr/lib/aliases" /* location of alias file */ 23 24 25 26 27 28 /* 29 ** Mailer definition structure. 30 ** Every mailer known to the system is declared in this 31 ** structure. It defines the pathname of the mailer, some 32 ** flags associated with it, and the argument vector to 33 ** pass to it. The flags are defined in conf.c 34 ** 35 ** The host map is a list of lists of strings. Within each 36 ** list, any host is mapped to the last host in the list. 37 ** This allows multiple names, as well as doing clever 38 ** mail grouping in point-to-point networks. Note: this 39 ** is only used internally, so the apparent host is still 40 ** kept around. 41 ** 42 ** The argument vector is expanded before actual use. Every- 43 ** thing is passed through except for things starting with "$". 44 ** "$x" defines some interpolation, as described in conf.c 45 ** "$x" where x is unknown expands to "x", so use "$$" to get "$". 46 */ 47 48 struct mailer 49 { 50 char *m_mailer; /* pathname of the mailer to use */ 51 char *m_name; /* symbolic name of this mailer */ 52 short m_flags; /* status flags, see below */ 53 short m_badstat; /* the status code to use on unknown error */ 54 char *m_from; /* pattern for From: header */ 55 char **m_argv; /* template argument vector */ 56 }; 57 58 # define M_FOPT 000001 /* mailer takes picky -f flag */ 59 # define M_ROPT 000002 /* mailer takes picky -r flag */ 60 # define M_QUIET 000004 /* don't print error on bad status */ 61 # define M_RESTR 000010 /* must be daemon to execute */ 62 # define M_HDR 000020 /* insert From line */ 63 # define M_NOHOST 000040 /* ignore host in comparisons */ 64 # define M_STRIPQ 000100 /* strip quote characters from user/host */ 65 # define M_FHDR 000200 /* force good From line */ 66 # define M_NEEDFROM 000400 /* need arpa-style From: line */ 67 # define M_NEEDDATE 001000 /* need arpa-style Date: line */ 68 # define M_MSGID 002000 /* need Message-Id: field */ 69 # define M_COMMAS 004000 /* need comma-seperated address lists */ 70 # define M_USR_UPPER 010000 /* preserve user case distinction */ 71 # define M_HST_UPPER 020000 /* preserve host case distinction */ 72 73 # define M_ARPAFMT (M_NEEDDATE|M_NEEDFROM|M_MSGID|M_COMMAS) 74 75 extern struct mailer *Mailer[]; 76 77 78 /* 79 ** Address structure. 80 ** Addresses are stored internally in this structure. 81 */ 82 83 struct address 84 { 85 char *q_paddr; /* the printname for the address */ 86 char *q_user; /* user name */ 87 char *q_host; /* host name */ 88 short q_mailer; /* mailer to use */ 89 short q_rmailer; /* real mailer (before mapping) */ 90 struct address *q_next; /* chain */ 91 struct address *q_prev; /* back pointer */ 92 }; 93 94 typedef struct address ADDRESS; 95 96 /* some other primitives */ 97 # define nxtinq(q) ((q)->q_next) 98 # define clearq(q) (q)->q_next = (q)->q_prev = NULL 99 100 extern ADDRESS SendQ; /* queue of people to send to */ 101 extern ADDRESS AliasQ; /* queue of people that are aliases */ 102 103 104 105 106 107 /* 108 ** Header structure. 109 ** This structure is used internally to store header items. 110 */ 111 112 struct header 113 { 114 char *h_field; /* the name of the field */ 115 char *h_value; /* the value of that field */ 116 struct header *h_link; /* the next header */ 117 short h_flags; /* status bits, see below */ 118 }; 119 120 typedef struct header HDR; 121 122 extern HDR *Header; /* head of header list */ 123 124 /* 125 ** Header information structure. 126 ** Defined in conf.c, this struct declares the header fields 127 ** that have some magic meaning. 128 */ 129 130 struct hdrinfo 131 { 132 char *hi_field; /* the name of the field */ 133 short hi_flags; /* status bits, see below */ 134 char **hi_pptr; /* &ptr to point to this value */ 135 }; 136 137 extern struct hdrinfo HdrInfo[]; 138 139 /* bits for h_flags and hi_flags */ 140 # define H_EOH 00001 /* this field terminates header */ 141 # define H_DELETE 00002 /* don't send this field */ 142 # define H_DEFAULT 00004 /* if another value is found, drop this */ 143 # define H_USED 00010 /* indicates that this has been output */ 144 145 146 /* 147 ** Rewrite rules. 148 */ 149 150 struct rewrite 151 { 152 char **r_lhs; /* pattern match */ 153 char **r_rhs; /* substitution value */ 154 struct rewrite *r_next;/* next in chain */ 155 }; 156 157 struct rewrite *RewriteRules; 158 159 # define MATCHANY '\020' /* match exactly one token */ 160 # define MATCHONE '\021' /* match one or more tokens */ 161 162 # define CANONNET '\025' /* canonical net, next token */ 163 # define CANONHOST '\026' /* canonical host, next token */ 164 # define CANONUSER '\027' /* canonical user, next N tokens */ 165 166 167 168 169 /* 170 ** Global variables. 171 */ 172 173 extern bool ArpaFmt; /* if set, message is in arpanet fmt */ 174 extern bool FromFlag; /* if set, "From" person is explicit */ 175 extern bool Debug; /* if set, debugging info */ 176 extern bool MailBack; /* mail back response on error */ 177 extern bool BerkNet; /* called from BerkNet */ 178 extern bool WriteBack; /* write back response on error */ 179 extern bool NoAlias; /* if set, don't do any aliasing */ 180 extern bool ForceMail; /* if set, mail even if already got a copy */ 181 extern bool MeToo; /* send to the sender also */ 182 extern bool UseMsgId; /* put msg-id's in all msgs [conf.c] */ 183 extern bool IgnrDot; /* don't let dot end messages */ 184 extern bool SaveFrom; /* save leading "From" lines */ 185 extern int Errors; /* set if errors */ 186 extern int ExitStat; /* exit status code */ 187 extern char InFileName[]; /* input file name */ 188 extern char Transcript[]; /* the transcript file name */ 189 extern char *MsgId; /* the message id for this message */ 190 extern char *Date; /* origination date (UNIX format) */ 191 extern ADDRESS From; /* the person it is from */ 192 extern char *To; /* the target person */ 193 extern int HopCount; /* hop count */ 194 195 196 # include <sysexits.h> 197 198 # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } 199