1 /*
2 **  SENDMAIL.H -- Global definitions for sendmail.
3 **
4 **	@(#)sendmail.h	3.12	03/28/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		40	/* 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 /*
30 **  Address structure.
31 **	Addresses are stored internally in this structure.
32 */
33 
34 struct address
35 {
36 	char		*q_paddr;	/* the printname for the address */
37 	char		*q_user;	/* user name */
38 	char		*q_host;	/* host name */
39 	short		q_mailer;	/* mailer to use */
40 	short		q_rmailer;	/* real mailer (before mapping) */
41 	short		q_flags;	/* status flags, see below */
42 	struct address	*q_next;	/* chain */
43 };
44 
45 typedef struct address ADDRESS;
46 
47 # define QDONTSEND	000001	/* don't send to this address */
48 
49 
50 
51 
52 
53 /*
54 **  Mailer definition structure.
55 **	Every mailer known to the system is declared in this
56 **	structure.  It defines the pathname of the mailer, some
57 **	flags associated with it, and the argument vector to
58 **	pass to it.  The flags are defined in conf.c
59 **
60 **	The host map is a list of lists of strings.  Within each
61 **	list, any host is mapped to the last host in the list.
62 **	This allows multiple names, as well as doing clever
63 **	mail grouping in point-to-point networks.  Note: this
64 **	is only used internally, so the apparent host is still
65 **	kept around.
66 **
67 **	The argument vector is expanded before actual use.  Every-
68 **	thing is passed through except for things starting with "$".
69 **	"$x" defines some interpolation, as described in conf.c
70 **	"$x" where x is unknown expands to "x", so use "$$" to get "$".
71 */
72 
73 struct mailer
74 {
75 	char	*m_name;	/* symbolic name of this mailer */
76 	char	*m_mailer;	/* pathname of the mailer to use */
77 	short	m_flags;	/* status flags, see below */
78 	short	m_badstat;	/* the status code to use on unknown error */
79 	char	*m_from;	/* pattern for From: header */
80 	char	**m_argv;	/* template argument vector */
81 	ADDRESS	*m_sendq;	/* list of addresses to send to */
82 };
83 
84 # define M_FOPT		000001	/* mailer takes picky -f flag */
85 # define M_ROPT		000002	/* mailer takes picky -r flag */
86 # define M_QUIET	000004	/* don't print error on bad status */
87 # define M_RESTR	000010	/* must be daemon to execute */
88 # define M_NHDR		000020	/* don't insert From line */
89 # define M_NOHOST	000040	/* ignore host in comparisons */
90 # define M_STRIPQ	000100	/* strip quote characters from user/host */
91 # define M_MUSER	000200	/* mailer can handle multiple users at once */
92 # define M_NEEDFROM	000400	/* need arpa-style From: line */
93 # define M_NEEDDATE	001000	/* need arpa-style Date: line */
94 # define M_MSGID	002000	/* need Message-Id: field */
95 # define M_USR_UPPER	010000	/* preserve user case distinction */
96 # define M_HST_UPPER	020000	/* preserve host case distinction */
97 # define M_FULLNAME	040000	/* want Full-Name field */
98 
99 # define M_ARPAFMT	(M_NEEDDATE|M_NEEDFROM|M_NEEDDATE)
100 
101 extern struct mailer *Mailer[];
102 
103 
104 
105 /*
106 **  Header structure.
107 **	This structure is used internally to store header items.
108 */
109 
110 struct header
111 {
112 	char		*h_field;	/* the name of the field */
113 	char		*h_value;	/* the value of that field */
114 	struct header	*h_link;	/* the next header */
115 	short		h_flags;	/* status bits, see below */
116 	short		h_mflags;	/* m_flags bits needed */
117 };
118 
119 typedef struct header	HDR;
120 
121 extern HDR	*Header;	/* head of header list */
122 
123 /*
124 **  Header information structure.
125 **	Defined in conf.c, this struct declares the header fields
126 **	that have some magic meaning.
127 */
128 
129 struct hdrinfo
130 {
131 	char	*hi_field;	/* the name of the field */
132 	short	hi_flags;	/* status bits, see below */
133 	short	hi_mflags;	/* m_flags needed for this field */
134 };
135 
136 extern struct hdrinfo	HdrInfo[];
137 
138 /* bits for h_flags and hi_flags */
139 # define H_EOH		00001	/* this field terminates header */
140 # define H_DELETE	00002	/* don't send this field */
141 # define H_DEFAULT	00004	/* if another value is found, drop this */
142 # define H_USED		00010	/* indicates that this has been output */
143 # define H_CHECK	00020	/* check h_mflags against m_flags */
144 # define H_ACHECK	00040	/* ditto, but always (not just default) */
145 
146 
147 /*
148 **  Rewrite rules.
149 */
150 
151 struct rewrite
152 {
153 	char	**r_lhs;	/* pattern match */
154 	char	**r_rhs;	/* substitution value */
155 	struct rewrite	*r_next;/* next in chain */
156 };
157 
158 struct rewrite	*RewriteRules;
159 
160 # define MATCHANY	'\020'	/* match exactly one token */
161 # define MATCHONE	'\021'	/* match one or more tokens */
162 
163 # define CANONNET	'\025'	/* canonical net, next token */
164 # define CANONHOST	'\026'	/* canonical host, next token */
165 # define CANONUSER	'\027'	/* canonical user, next N tokens */
166 
167 
168 
169 
170 /*
171 **  Global variables.
172 */
173 
174 extern bool	ArpaFmt;	/* if set, message is in arpanet fmt */
175 extern bool	FromFlag;	/* if set, "From" person is explicit */
176 extern bool	Debug;		/* if set, debugging info */
177 extern bool	MailBack;	/* mail back response on error */
178 extern bool	BerkNet;	/* called from BerkNet */
179 extern bool	WriteBack;	/* write back response on error */
180 extern bool	NoAlias;	/* if set, don't do any aliasing */
181 extern bool	ForceMail;	/* if set, mail even if already got a copy */
182 extern bool	MeToo;		/* send to the sender also */
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 ADDRESS	From;		/* the person it is from */
190 extern char	*To;		/* the target person */
191 extern int	HopCount;	/* hop count */
192 extern long	CurTime;	/* time of this message */
193 extern char	FromLine[];	/* a UNIX-style From line for this message */
194 
195 
196 # include	<sysexits.h>
197 
198 # define setstat(s)		{ if (ExitStat == EX_OK) ExitStat = s; }
199