1295Seric /*
2*3313Seric **  SENDMAIL.H -- Global definitions for sendmail.
3295Seric **
4*3313Seric **	@(#)sendmail.h	3.9	03/20/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 */
423190Seric 	struct address	*q_next;	/* chain */
433190Seric };
443190Seric 
453190Seric typedef struct address ADDRESS;
463190Seric 
473190Seric # define QDONTSEND	000001	/* don't send to this address */
483190Seric 
493190Seric 
503190Seric 
513190Seric 
523190Seric 
533190Seric /*
54295Seric **  Mailer definition structure.
55295Seric **	Every mailer known to the system is declared in this
56295Seric **	structure.  It defines the pathname of the mailer, some
57295Seric **	flags associated with it, and the argument vector to
581390Seric **	pass to it.  The flags are defined in conf.c
59295Seric **
602899Seric **	The host map is a list of lists of strings.  Within each
612899Seric **	list, any host is mapped to the last host in the list.
622899Seric **	This allows multiple names, as well as doing clever
632899Seric **	mail grouping in point-to-point networks.  Note: this
642899Seric **	is only used internally, so the apparent host is still
652899Seric **	kept around.
662899Seric **
67295Seric **	The argument vector is expanded before actual use.  Every-
68295Seric **	thing is passed through except for things starting with "$".
691390Seric **	"$x" defines some interpolation, as described in conf.c
70295Seric **	"$x" where x is unknown expands to "x", so use "$$" to get "$".
71295Seric */
72295Seric 
73295Seric struct mailer
74295Seric {
753190Seric 	char	*m_name;	/* symbolic name of this mailer */
76295Seric 	char	*m_mailer;	/* pathname of the mailer to use */
77295Seric 	short	m_flags;	/* status flags, see below */
78295Seric 	short	m_badstat;	/* the status code to use on unknown error */
792899Seric 	char	*m_from;	/* pattern for From: header */
803049Seric 	char	**m_argv;	/* template argument vector */
813190Seric 	ADDRESS	*m_sendq;	/* list of addresses to send to */
82295Seric };
83295Seric 
842899Seric # define M_FOPT		000001	/* mailer takes picky -f flag */
852899Seric # define M_ROPT		000002	/* mailer takes picky -r flag */
862899Seric # define M_QUIET	000004	/* don't print error on bad status */
872899Seric # define M_RESTR	000010	/* must be daemon to execute */
883190Seric # define M_NHDR		000020	/* don't insert From line */
892899Seric # define M_NOHOST	000040	/* ignore host in comparisons */
902899Seric # define M_STRIPQ	000100	/* strip quote characters from user/host */
913190Seric # define M_MUSER	000200	/* mailer can handle multiple users at once */
922899Seric # define M_NEEDFROM	000400	/* need arpa-style From: line */
932899Seric # define M_NEEDDATE	001000	/* need arpa-style Date: line */
942899Seric # define M_MSGID	002000	/* need Message-Id: field */
953153Seric # define M_USR_UPPER	010000	/* preserve user case distinction */
963153Seric # define M_HST_UPPER	020000	/* preserve host case distinction */
97295Seric 
983190Seric # define M_ARPAFMT	(M_NEEDDATE|M_NEEDFROM|M_MSGID)
992899Seric 
1003049Seric extern struct mailer *Mailer[];
101295Seric 
102295Seric 
103295Seric 
1042899Seric /*
1052899Seric **  Header structure.
1062899Seric **	This structure is used internally to store header items.
1072899Seric */
108295Seric 
1092899Seric struct header
1102899Seric {
1112899Seric 	char		*h_field;	/* the name of the field */
1122899Seric 	char		*h_value;	/* the value of that field */
1132899Seric 	struct header	*h_link;	/* the next header */
1142899Seric 	short		h_flags;	/* status bits, see below */
1152899Seric };
116295Seric 
1172899Seric typedef struct header	HDR;
1182899Seric 
1192899Seric extern HDR	*Header;	/* head of header list */
1202899Seric 
121295Seric /*
1222899Seric **  Header information structure.
1232899Seric **	Defined in conf.c, this struct declares the header fields
1242899Seric **	that have some magic meaning.
1252899Seric */
1262899Seric 
1272899Seric struct hdrinfo
1282899Seric {
1292899Seric 	char	*hi_field;	/* the name of the field */
1302899Seric 	short	hi_flags;	/* status bits, see below */
1313060Seric 	char	**hi_pptr;	/* &ptr to point to this value */
1322899Seric };
1332899Seric 
1342899Seric extern struct hdrinfo	HdrInfo[];
1352899Seric 
1362899Seric /* bits for h_flags and hi_flags */
1373060Seric # define H_EOH		00001	/* this field terminates header */
1382899Seric # define H_DELETE	00002	/* don't send this field */
1392899Seric # define H_DEFAULT	00004	/* if another value is found, drop this */
1402899Seric # define H_USED		00010	/* indicates that this has been output */
1412899Seric 
1422899Seric 
1433153Seric /*
1443153Seric **  Rewrite rules.
1453153Seric */
1462899Seric 
1473153Seric struct rewrite
1483153Seric {
1493153Seric 	char	**r_lhs;	/* pattern match */
1503153Seric 	char	**r_rhs;	/* substitution value */
1513153Seric 	struct rewrite	*r_next;/* next in chain */
1523153Seric };
1532899Seric 
1543153Seric struct rewrite	*RewriteRules;
1553153Seric 
1563153Seric # define MATCHANY	'\020'	/* match exactly one token */
1573153Seric # define MATCHONE	'\021'	/* match one or more tokens */
1583153Seric 
1593153Seric # define CANONNET	'\025'	/* canonical net, next token */
1603153Seric # define CANONHOST	'\026'	/* canonical host, next token */
1613153Seric # define CANONUSER	'\027'	/* canonical user, next N tokens */
1623153Seric 
1633153Seric 
1643153Seric 
1653153Seric 
1662899Seric /*
167295Seric **  Global variables.
168295Seric */
169295Seric 
1701390Seric extern bool	ArpaFmt;	/* if set, message is in arpanet fmt */
1711390Seric extern bool	FromFlag;	/* if set, "From" person is explicit */
1721390Seric extern bool	Debug;		/* if set, debugging info */
1731390Seric extern bool	MailBack;	/* mail back response on error */
1741390Seric extern bool	BerkNet;	/* called from BerkNet */
1751390Seric extern bool	WriteBack;	/* write back response on error */
1761390Seric extern bool	NoAlias;	/* if set, don't do any aliasing */
1771390Seric extern bool	ForceMail;	/* if set, mail even if already got a copy */
1781390Seric extern bool	MeToo;		/* send to the sender also */
1791390Seric extern bool	UseMsgId;	/* put msg-id's in all msgs [conf.c] */
1801390Seric extern bool	IgnrDot;	/* don't let dot end messages */
1811390Seric extern bool	SaveFrom;	/* save leading "From" lines */
1821516Seric extern int	Errors;		/* set if errors */
183295Seric extern int	ExitStat;	/* exit status code */
184295Seric extern char	InFileName[];	/* input file name */
185295Seric extern char	Transcript[];	/* the transcript file name */
1862899Seric extern char	*MsgId;		/* the message id for this message */
1872899Seric extern char	*Date;		/* origination date (UNIX format) */
1882979Seric extern ADDRESS	From;		/* the person it is from */
189295Seric extern char	*To;		/* the target person */
190295Seric extern int	HopCount;	/* hop count */
1913190Seric extern long	CurTime;	/* time of this message */
1923190Seric extern char	FromLine[];	/* a UNIX-style From line for this message */
193295Seric 
194295Seric 
195295Seric # include	<sysexits.h>
196295Seric 
197295Seric # define setstat(s)		{ if (ExitStat == EX_OK) ExitStat = s; }
198