1 /*
2  * Copyright (c) 1983 Eric P. Allman
3  * Copyright (c) 1988, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * %sccs.include.redist.c%
7  *
8  *	@(#)sendmail.h	8.86 (Berkeley) 02/11/95
9  */
10 
11 /*
12 **  SENDMAIL.H -- Global definitions for sendmail.
13 */
14 
15 # ifdef _DEFINE
16 # define EXTERN
17 # ifndef lint
18 static char SmailSccsId[] =	"@(#)sendmail.h	8.86		02/11/95";
19 # endif
20 # else /*  _DEFINE */
21 # define EXTERN extern
22 # endif /* _DEFINE */
23 
24 # include <unistd.h>
25 # include <stddef.h>
26 # include <stdlib.h>
27 # include <stdio.h>
28 # include <ctype.h>
29 # include <setjmp.h>
30 # include <sysexits.h>
31 # include <string.h>
32 # include <time.h>
33 # include <errno.h>
34 
35 # include "conf.h"
36 # include "useful.h"
37 
38 # ifdef LOG
39 # include <syslog.h>
40 # endif /* LOG */
41 
42 # ifdef DAEMON
43 # include <sys/socket.h>
44 # endif
45 # ifdef NETUNIX
46 # include <sys/un.h>
47 # endif
48 # ifdef NETINET
49 # include <netinet/in.h>
50 # endif
51 # ifdef NETISO
52 # include <netiso/iso.h>
53 # endif
54 # ifdef NETNS
55 # include <netns/ns.h>
56 # endif
57 # ifdef NETX25
58 # include <netccitt/x25.h>
59 # endif
60 
61 
62 
63 
64 /*
65 **  Data structure for bit maps.
66 **
67 **	Each bit in this map can be referenced by an ascii character.
68 **	This is 256 possible bits, or 32 8-bit bytes.
69 */
70 
71 #define BITMAPBYTES	32	/* number of bytes in a bit map */
72 #define BYTEBITS	8	/* number of bits in a byte */
73 
74 /* internal macros */
75 #define _BITWORD(bit)	(bit / (BYTEBITS * sizeof (int)))
76 #define _BITBIT(bit)	(1 << (bit % (BYTEBITS * sizeof (int))))
77 
78 typedef int	BITMAP[BITMAPBYTES / sizeof (int)];
79 
80 /* test bit number N */
81 #define bitnset(bit, map)	((map)[_BITWORD(bit)] & _BITBIT(bit))
82 
83 /* set bit number N */
84 #define setbitn(bit, map)	(map)[_BITWORD(bit)] |= _BITBIT(bit)
85 
86 /* clear bit number N */
87 #define clrbitn(bit, map)	(map)[_BITWORD(bit)] &= ~_BITBIT(bit)
88 
89 /* clear an entire bit map */
90 #define clrbitmap(map)		bzero((char *) map, BITMAPBYTES)
91 /*
92 **  Address structure.
93 **	Addresses are stored internally in this structure.
94 */
95 
96 struct address
97 {
98 	char		*q_paddr;	/* the printname for the address */
99 	char		*q_user;	/* user name */
100 	char		*q_ruser;	/* real user name, or NULL if q_user */
101 	char		*q_host;	/* host name */
102 	struct mailer	*q_mailer;	/* mailer to use */
103 	u_long		q_flags;	/* status flags, see below */
104 	uid_t		q_uid;		/* user-id of receiver (if known) */
105 	gid_t		q_gid;		/* group-id of receiver (if known) */
106 	char		*q_home;	/* home dir (local mailer only) */
107 	char		*q_fullname;	/* full name if known */
108 	struct address	*q_next;	/* chain */
109 	struct address	*q_alias;	/* address this results from */
110 	char		*q_owner;	/* owner of q_alias */
111 	struct address	*q_tchain;	/* temporary use chain */
112 	char		*q_orcpt;	/* ORCPT parameter from RCPT TO: line */
113 	char		*q_status;	/* status code for DSNs */
114 	char		*q_fstatus;	/* final status code for DSNs */
115 	char		*q_rstatus;	/* remote status message for DSNs */
116 	time_t		q_statdate;	/* date of status messages */
117 	char		*q_statmta;	/* MTA generating q_rstatus */
118 };
119 
120 typedef struct address ADDRESS;
121 
122 # define QDONTSEND	0x00000001	/* don't send to this address */
123 # define QBADADDR	0x00000002	/* this address is verified bad */
124 # define QGOODUID	0x00000004	/* the q_uid q_gid fields are good */
125 # define QPRIMARY	0x00000008	/* set from argv */
126 # define QQUEUEUP	0x00000010	/* queue for later transmission */
127 # define QSENT		0x00000020	/* has been successfully delivered */
128 # define QNOTREMOTE	0x00000040	/* address not for remote forwarding */
129 # define QSELFREF	0x00000080	/* this address references itself */
130 # define QVERIFIED	0x00000100	/* verified, but not expanded */
131 # define QREPORT	0x00000200	/* report this addr in return message */
132 # define QBOGUSSHELL	0x00000400	/* user has no valid shell listed */
133 # define QUNSAFEADDR	0x00000800	/* address aquired via unsafe path */
134 # define QPINGONSUCCESS	0x00001000	/* give return on successful delivery */
135 # define QPINGONFAILURE	0x00002000	/* give return on failure */
136 # define QPINGONDELAY	0x00004000	/* give return on message delay */
137 # define QHAS_RET_PARAM	0x00008000	/* RCPT command had RET argument */
138 # define QRET_HDRS	0x00010000	/* don't return message body */
139 # define QRELAYED	0x00020000	/* relayed to non-DSN aware mailer */
140 
141 # define NULLADDR	((ADDRESS *) NULL)
142 /*
143 **  Mailer definition structure.
144 **	Every mailer known to the system is declared in this
145 **	structure.  It defines the pathname of the mailer, some
146 **	flags associated with it, and the argument vector to
147 **	pass to it.  The flags are defined in conf.c
148 **
149 **	The argument vector is expanded before actual use.  All
150 **	words except the first are passed through the macro
151 **	processor.
152 */
153 
154 struct mailer
155 {
156 	char	*m_name;	/* symbolic name of this mailer */
157 	char	*m_mailer;	/* pathname of the mailer to use */
158 	char	*m_mtatype;	/* type of this MTA */
159 	char	*m_addrtype;	/* type for addresses */
160 	char	*m_diagtype;	/* type for diagnostics */
161 	BITMAP	m_flags;	/* status flags, see below */
162 	short	m_mno;		/* mailer number internally */
163 	char	**m_argv;	/* template argument vector */
164 	short	m_sh_rwset;	/* rewrite set: sender header addresses */
165 	short	m_se_rwset;	/* rewrite set: sender envelope addresses */
166 	short	m_rh_rwset;	/* rewrite set: recipient header addresses */
167 	short	m_re_rwset;	/* rewrite set: recipient envelope addresses */
168 	char	*m_eol;		/* end of line string */
169 	long	m_maxsize;	/* size limit on message to this mailer */
170 	int	m_linelimit;	/* max # characters per line */
171 	char	*m_execdir;	/* directory to chdir to before execv */
172 	uid_t	m_uid;		/* UID to run as */
173 	gid_t	m_gid;		/* GID to run as */
174 	char	*m_defcharset;	/* default character set */
175 };
176 
177 typedef struct mailer	MAILER;
178 
179 /* bits for m_flags */
180 # define M_ESMTP	'a'	/* run Extended SMTP protocol */
181 # define M_ALIASABLE	'A'	/* user can be LHS of an alias */
182 # define M_BLANKEND	'b'	/* ensure blank line at end of message */
183 # define M_NOCOMMENT	'c'	/* don't include comment part of address */
184 # define M_CANONICAL	'C'	/* make addresses canonical "u@dom" */
185 # define M_NOBRACKET	'd'	/* never angle bracket envelope route-addrs */
186 		/*	'D'	/* CF: include Date: */
187 # define M_EXPENSIVE	'e'	/* it costs to use this mailer.... */
188 # define M_ESCFROM	'E'	/* escape From lines to >From */
189 # define M_FOPT		'f'	/* mailer takes picky -f flag */
190 		/*	'F'	/* CF: include From: or Resent-From: */
191 # define M_NO_NULL_FROM	'g'	/* sender of errors should be $g */
192 # define M_HST_UPPER	'h'	/* preserve host case distinction */
193 # define M_PREHEAD	'H'	/* MAIL11V3: preview headers */
194 # define M_UDBENVELOPE	'i'	/* do udbsender rewriting on envelope */
195 # define M_INTERNAL	'I'	/* SMTP to another sendmail site */
196 # define M_NOLOOPCHECK	'k'	/* don't check for loops in HELO command */
197 # define M_LOCALMAILER	'l'	/* delivery is to this host */
198 # define M_LIMITS	'L'	/* must enforce SMTP line limits */
199 # define M_MUSER	'm'	/* can handle multiple users at once */
200 		/*	'M'	/* CF: include Message-Id: */
201 # define M_NHDR		'n'	/* don't insert From line */
202 # define M_MANYSTATUS	'N'	/* MAIL11V3: DATA returns multi-status */
203 # define M_RUNASRCPT	'o'	/* always run mailer as recipient */
204 # define M_FROMPATH	'p'	/* use reverse-path in MAIL FROM: */
205 		/*	'P'	/* CF: include Return-Path: */
206 # define M_ROPT		'r'	/* mailer takes picky -r flag */
207 # define M_SECURE_PORT	'R'	/* try to send on a reserved TCP port */
208 # define M_STRIPQ	's'	/* strip quote chars from user/host */
209 # define M_SPECIFIC_UID	'S'	/* run as specific uid/gid */
210 # define M_USR_UPPER	'u'	/* preserve user case distinction */
211 # define M_UGLYUUCP	'U'	/* this wants an ugly UUCP from line */
212 		/*	'V'	/* UIUC: !-relativize all addresses */
213 # define M_HASPWENT	'w'	/* check for /etc/passwd entry */
214 		/*	'x'	/* CF: include Full-Name: */
215 # define M_XDOT		'X'	/* use hidden-dot algorithm */
216 # define M_TRYRULESET5	'5'	/* use ruleset 5 after local aliasing */
217 # define M_7BITS	'7'	/* use 7-bit path */
218 # define M_8BITS	'8'	/* force "just send 8" behaviour */
219 # define M_CHECKINCLUDE	':'	/* check for :include: files */
220 # define M_CHECKPROG	'|'	/* check for |program addresses */
221 # define M_CHECKFILE	'/'	/* check for /file addresses */
222 # define M_CHECKUDB	'@'	/* user can be user database key */
223 
224 EXTERN MAILER	*Mailer[MAXMAILERS+1];
225 
226 EXTERN MAILER	*LocalMailer;		/* ptr to local mailer */
227 EXTERN MAILER	*ProgMailer;		/* ptr to program mailer */
228 EXTERN MAILER	*FileMailer;		/* ptr to *file* mailer */
229 EXTERN MAILER	*InclMailer;		/* ptr to *include* mailer */
230 /*
231 **  Header structure.
232 **	This structure is used internally to store header items.
233 */
234 
235 struct header
236 {
237 	char		*h_field;	/* the name of the field */
238 	char		*h_value;	/* the value of that field */
239 	struct header	*h_link;	/* the next header */
240 	u_short		h_flags;	/* status bits, see below */
241 	BITMAP		h_mflags;	/* m_flags bits needed */
242 };
243 
244 typedef struct header	HDR;
245 
246 /*
247 **  Header information structure.
248 **	Defined in conf.c, this struct declares the header fields
249 **	that have some magic meaning.
250 */
251 
252 struct hdrinfo
253 {
254 	char	*hi_field;	/* the name of the field */
255 	u_short	hi_flags;	/* status bits, see below */
256 };
257 
258 extern struct hdrinfo	HdrInfo[];
259 
260 /* bits for h_flags and hi_flags */
261 # define H_EOH		0x0001	/* this field terminates header */
262 # define H_RCPT		0x0002	/* contains recipient addresses */
263 # define H_DEFAULT	0x0004	/* if another value is found, drop this */
264 # define H_RESENT	0x0008	/* this address is a "Resent-..." address */
265 # define H_CHECK	0x0010	/* check h_mflags against m_flags */
266 # define H_ACHECK	0x0020	/* ditto, but always (not just default) */
267 # define H_FORCE	0x0040	/* force this field, even if default */
268 # define H_TRACE	0x0080	/* this field contains trace information */
269 # define H_FROM		0x0100	/* this is a from-type field */
270 # define H_VALID	0x0200	/* this field has a validated value */
271 # define H_RECEIPTTO	0x0400	/* this field has return receipt info */
272 # define H_ERRORSTO	0x0800	/* this field has error address info */
273 # define H_CTE		0x1000	/* this field is a content-transfer-encoding */
274 # define H_CTYPE	0x2000	/* this is a content-type field */
275 /*
276 **  Information about currently open connections to mailers, or to
277 **  hosts that we have looked up recently.
278 */
279 
280 # define MCI		struct mailer_con_info
281 
282 MCI
283 {
284 	short		mci_flags;	/* flag bits, see below */
285 	short		mci_errno;	/* error number on last connection */
286 	short		mci_herrno;	/* h_errno from last DNS lookup */
287 	short		mci_exitstat;	/* exit status from last connection */
288 	short		mci_state;	/* SMTP state */
289 	long		mci_maxsize;	/* max size this server will accept */
290 	FILE		*mci_in;	/* input side of connection */
291 	FILE		*mci_out;	/* output side of connection */
292 	int		mci_pid;	/* process id of subordinate proc */
293 	char		*mci_phase;	/* SMTP phase string */
294 	struct mailer	*mci_mailer;	/* ptr to the mailer for this conn */
295 	char		*mci_host;	/* host name */
296 	char		*mci_status;	/* DSN status to be copied to addrs */
297 	time_t		mci_lastuse;	/* last usage time */
298 };
299 
300 
301 /* flag bits */
302 #define MCIF_VALID	0x0001		/* this entry is valid */
303 #define MCIF_TEMP	0x0002		/* don't cache this connection */
304 #define MCIF_CACHED	0x0004		/* currently in open cache */
305 #define MCIF_ESMTP	0x0008		/* this host speaks ESMTP */
306 #define MCIF_EXPN	0x0010		/* EXPN command supported */
307 #define MCIF_SIZE	0x0020		/* SIZE option supported */
308 #define MCIF_8BITMIME	0x0040		/* BODY=8BITMIME supported */
309 #define MCIF_7BIT	0x0080		/* strip this message to 7 bits */
310 #define MCIF_MULTSTAT	0x0100		/* MAIL11V3: handles MULT status */
311 #define MCIF_INHEADER	0x0200		/* currently outputing header */
312 #define MCIF_CVT8TO7	0x0400		/* convert from 8 to 7 bits */
313 #define MCIF_DSN	0x0800		/* DSN extension supported */
314 
315 /* states */
316 #define MCIS_CLOSED	0		/* no traffic on this connection */
317 #define MCIS_OPENING	1		/* sending initial protocol */
318 #define MCIS_OPEN	2		/* open, initial protocol sent */
319 #define MCIS_ACTIVE	3		/* message being sent */
320 #define MCIS_QUITING	4		/* running quit protocol */
321 #define MCIS_SSD	5		/* service shutting down */
322 #define MCIS_ERROR	6		/* I/O error on connection */
323 /*
324 **  Envelope structure.
325 **	This structure defines the message itself.  There is usually
326 **	only one of these -- for the message that we originally read
327 **	and which is our primary interest -- but other envelopes can
328 **	be generated during processing.  For example, error messages
329 **	will have their own envelope.
330 */
331 
332 # define ENVELOPE	struct envelope
333 
334 ENVELOPE
335 {
336 	HDR		*e_header;	/* head of header list */
337 	long		e_msgpriority;	/* adjusted priority of this message */
338 	time_t		e_ctime;	/* time message appeared in the queue */
339 	char		*e_to;		/* the target person */
340 	char		*e_receiptto;	/* return receipt address */
341 	ADDRESS		e_from;		/* the person it is from */
342 	char		*e_sender;	/* e_from.q_paddr w comments stripped */
343 	char		**e_fromdomain;	/* the domain part of the sender */
344 	ADDRESS		*e_sendqueue;	/* list of message recipients */
345 	ADDRESS		*e_errorqueue;	/* the queue for error responses */
346 	long		e_msgsize;	/* size of the message in bytes */
347 	long		e_flags;	/* flags, see below */
348 	int		e_nrcpts;	/* number of recipients */
349 	short		e_class;	/* msg class (priority, junk, etc.) */
350 	short		e_hopcount;	/* number of times processed */
351 	short		e_nsent;	/* number of sends since checkpoint */
352 	short		e_sendmode;	/* message send mode */
353 	short		e_errormode;	/* error return mode */
354 	short		e_timeoutclass;	/* message timeout class */
355 	int		(*e_puthdr)__P((MCI *, HDR *, ENVELOPE *));
356 					/* function to put header of message */
357 	int		(*e_putbody)__P((MCI *, ENVELOPE *, char *));
358 					/* function to put body of message */
359 	struct envelope	*e_parent;	/* the message this one encloses */
360 	struct envelope *e_sibling;	/* the next envelope of interest */
361 	char		*e_bodytype;	/* type of message body */
362 	char		*e_df;		/* location of temp file */
363 	FILE		*e_dfp;		/* temporary file */
364 	char		*e_id;		/* code for this entry in queue */
365 	FILE		*e_xfp;		/* transcript file */
366 	FILE		*e_lockfp;	/* the lock file for this message */
367 	char		*e_message;	/* error message */
368 	char		*e_statmsg;	/* stat msg (changes per delivery) */
369 	char		*e_msgboundary;	/* MIME-style message part boundary */
370 	char		*e_origrcpt;	/* original recipient (one only) */
371 	char		*e_envid;	/* envelope id from MAIL FROM: line */
372 	time_t		e_dtime;	/* time of last delivery attempt */
373 	int		e_ntries;	/* number of delivery attempts */
374 	dev_t		e_dfdev;	/* df file's device, for crash recov */
375 	ino_t		e_dfino;	/* df file's ino, for crash recovery */
376 	char		*e_macro[256];	/* macro definitions */
377 };
378 
379 /* values for e_flags */
380 #define EF_OLDSTYLE	0x0000001	/* use spaces (not commas) in hdrs */
381 #define EF_INQUEUE	0x0000002	/* this message is fully queued */
382 #define EF_NORETURN	0x0000004	/* don't return the message on error */
383 #define EF_CLRQUEUE	0x0000008	/* disk copy is no longer needed */
384 #define EF_SENDRECEIPT	0x0000010	/* send a return receipt */
385 #define EF_FATALERRS	0x0000020	/* fatal errors occured */
386 #define EF_KEEPQUEUE	0x0000040	/* keep queue files always */
387 #define EF_RESPONSE	0x0000080	/* this is an error or return receipt */
388 #define EF_RESENT	0x0000100	/* this message is being forwarded */
389 #define EF_VRFYONLY	0x0000200	/* verify only (don't expand aliases) */
390 #define EF_WARNING	0x0000400	/* warning message has been sent */
391 #define EF_QUEUERUN	0x0000800	/* this envelope is from queue */
392 #define EF_GLOBALERRS	0x0001000	/* treat errors as global */
393 #define EF_PM_NOTIFY	0x0002000	/* send return mail to postmaster */
394 #define EF_METOO	0x0004000	/* send to me too */
395 #define EF_LOGSENDER	0x0008000	/* need to log the sender */
396 #define EF_NORECEIPT	0x0010000	/* suppress all return-receipts */
397 #define EF_HAS8BIT	0x0020000	/* at least one 8-bit char in body */
398 #define EF_NL_NOT_EOL	0x0040000	/* don't accept raw NL as EOLine */
399 #define EF_CRLF_NOT_EOL	0x0080000	/* don't accept CR-LF as EOLine */
400 
401 EXTERN ENVELOPE	*CurEnv;	/* envelope currently being processed */
402 /*
403 **  Message priority classes.
404 **
405 **	The message class is read directly from the Priority: header
406 **	field in the message.
407 **
408 **	CurEnv->e_msgpriority is the number of bytes in the message plus
409 **	the creation time (so that jobs ``tend'' to be ordered correctly),
410 **	adjusted by the message class, the number of recipients, and the
411 **	amount of time the message has been sitting around.  This number
412 **	is used to order the queue.  Higher values mean LOWER priority.
413 **
414 **	Each priority class point is worth WkClassFact priority points;
415 **	each recipient is worth WkRecipFact priority points.  Each time
416 **	we reprocess a message the priority is adjusted by WkTimeFact.
417 **	WkTimeFact should normally decrease the priority so that jobs
418 **	that have historically failed will be run later; thanks go to
419 **	Jay Lepreau at Utah for pointing out the error in my thinking.
420 **
421 **	The "class" is this number, unadjusted by the age or size of
422 **	this message.  Classes with negative representations will have
423 **	error messages thrown away if they are not local.
424 */
425 
426 struct priority
427 {
428 	char	*pri_name;	/* external name of priority */
429 	int	pri_val;	/* internal value for same */
430 };
431 
432 EXTERN struct priority	Priorities[MAXPRIORITIES];
433 EXTERN int		NumPriorities;	/* pointer into Priorities */
434 /*
435 **  Rewrite rules.
436 */
437 
438 struct rewrite
439 {
440 	char	**r_lhs;	/* pattern match */
441 	char	**r_rhs;	/* substitution value */
442 	struct rewrite	*r_next;/* next in chain */
443 };
444 
445 EXTERN struct rewrite	*RewriteRules[MAXRWSETS];
446 
447 /*
448 **  Special characters in rewriting rules.
449 **	These are used internally only.
450 **	The COND* rules are actually used in macros rather than in
451 **		rewriting rules, but are given here because they
452 **		cannot conflict.
453 */
454 
455 /* left hand side items */
456 # define MATCHZANY	0220	/* match zero or more tokens */
457 # define MATCHANY	0221	/* match one or more tokens */
458 # define MATCHONE	0222	/* match exactly one token */
459 # define MATCHCLASS	0223	/* match one token in a class */
460 # define MATCHNCLASS	0224	/* match anything not in class */
461 # define MATCHREPL	0225	/* replacement on RHS for above */
462 
463 /* right hand side items */
464 # define CANONNET	0226	/* canonical net, next token */
465 # define CANONHOST	0227	/* canonical host, next token */
466 # define CANONUSER	0230	/* canonical user, next N tokens */
467 # define CALLSUBR	0231	/* call another rewriting set */
468 
469 /* conditionals in macros */
470 # define CONDIF		0232	/* conditional if-then */
471 # define CONDELSE	0233	/* conditional else */
472 # define CONDFI		0234	/* conditional fi */
473 
474 /* bracket characters for host name lookup */
475 # define HOSTBEGIN	0235	/* hostname lookup begin */
476 # define HOSTEND	0236	/* hostname lookup end */
477 
478 /* bracket characters for generalized lookup */
479 # define LOOKUPBEGIN	0205	/* generalized lookup begin */
480 # define LOOKUPEND	0206	/* generalized lookup end */
481 
482 /* macro substitution character */
483 # define MACROEXPAND	0201	/* macro expansion */
484 # define MACRODEXPAND	0202	/* deferred macro expansion */
485 
486 /* to make the code clearer */
487 # define MATCHZERO	CANONHOST
488 
489 /* external <==> internal mapping table */
490 struct metamac
491 {
492 	char	metaname;	/* external code (after $) */
493 	u_char	metaval;	/* internal code (as above) */
494 };
495 /*
496 **  Name canonification short circuit.
497 **
498 **	If the name server for a host is down, the process of trying to
499 **	canonify the name can hang.  This is similar to (but alas, not
500 **	identical to) looking up the name for delivery.  This stab type
501 **	caches the result of the name server lookup so we don't hang
502 **	multiple times.
503 */
504 
505 #define NAMECANON	struct _namecanon
506 
507 NAMECANON
508 {
509 	short		nc_errno;	/* cached errno */
510 	short		nc_herrno;	/* cached h_errno */
511 	short		nc_stat;	/* cached exit status code */
512 	short		nc_flags;	/* flag bits */
513 	char		*nc_cname;	/* the canonical name */
514 };
515 
516 /* values for nc_flags */
517 #define NCF_VALID	0x0001	/* entry valid */
518 /*
519 **  Mapping functions
520 **
521 **	These allow arbitrary mappings in the config file.  The idea
522 **	(albeit not the implementation) comes from IDA sendmail.
523 */
524 
525 # define MAPCLASS	struct _mapclass
526 # define MAP		struct _map
527 # define MAXMAPACTIONS	3		/* size of map_actions array */
528 
529 
530 /*
531 **  An actual map.
532 */
533 
534 MAP
535 {
536 	MAPCLASS	*map_class;	/* the class of this map */
537 	char		*map_mname;	/* name of this map */
538 	int		map_mflags;	/* flags, see below */
539 	char		*map_file;	/* the (nominal) filename */
540 	ARBPTR_T	map_db1;	/* the open database ptr */
541 	ARBPTR_T	map_db2;	/* an "extra" database pointer */
542 	char		*map_keycolnm;	/* key column name */
543 	char		*map_valcolnm;	/* value column name */
544 	u_char		map_keycolno;	/* key column number */
545 	u_char		map_valcolno;	/* value column number */
546 	char		map_coldelim;	/* column delimiter */
547 	char		*map_app;	/* to append to successful matches */
548 	char		*map_domain;	/* the (nominal) NIS domain */
549 	char		*map_rebuild;	/* program to run to do auto-rebuild */
550 	time_t		map_mtime;	/* last database modification time */
551 	MAP		*map_stack[MAXMAPSTACK];   /* list for stacked maps */
552 	short		map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */
553 };
554 
555 /* bit values for map_flags */
556 # define MF_VALID	0x0001		/* this entry is valid */
557 # define MF_INCLNULL	0x0002		/* include null byte in key */
558 # define MF_OPTIONAL	0x0004		/* don't complain if map not found */
559 # define MF_NOFOLDCASE	0x0008		/* don't fold case in keys */
560 # define MF_MATCHONLY	0x0010		/* don't use the map value */
561 # define MF_OPEN	0x0020		/* this entry is open */
562 # define MF_WRITABLE	0x0040		/* open for writing */
563 # define MF_ALIAS	0x0080		/* this is an alias file */
564 # define MF_TRY0NULL	0x0100		/* try with no null byte */
565 # define MF_TRY1NULL	0x0200		/* try with the null byte */
566 # define MF_LOCKED	0x0400		/* this map is currently locked */
567 # define MF_ALIASWAIT	0x0800		/* alias map in aliaswait state */
568 # define MF_IMPL_HASH	0x1000		/* implicit: underlying hash database */
569 # define MF_IMPL_NDBM	0x2000		/* implicit: underlying NDBM database */
570 # define MF_UNSAFEDB	0x4000		/* this map is world writable */
571 
572 /* indices for map_actions */
573 # define MA_NOTFOUND	0		/* member map returned "not found" */
574 # define MA_UNAVAIL	1		/* member map is not available */
575 # define MA_TRYAGAIN	2		/* member map returns temp failure */
576 
577 /*
578 **  The class of a map -- essentially the functions to call
579 */
580 
581 MAPCLASS
582 {
583 	char	*map_cname;		/* name of this map class */
584 	char	*map_ext;		/* extension for database file */
585 	short	map_cflags;		/* flag bits, see below */
586 	bool	(*map_parse)__P((MAP *, char *));
587 					/* argument parsing function */
588 	char	*(*map_lookup)__P((MAP *, char *, char **, int *));
589 					/* lookup function */
590 	void	(*map_store)__P((MAP *, char *, char *));
591 					/* store function */
592 	bool	(*map_open)__P((MAP *, int));
593 					/* open function */
594 	void	(*map_close)__P((MAP *));
595 					/* close function */
596 };
597 
598 /* bit values for map_cflags */
599 #define MCF_ALIASOK	0x0001		/* can be used for aliases */
600 #define MCF_ALIASONLY	0x0002		/* usable only for aliases */
601 #define MCF_REBUILDABLE	0x0004		/* can rebuild alias files */
602 #define MCF_OPTFILE	0x0008		/* file name is optional */
603 /*
604 **  Symbol table definitions
605 */
606 
607 struct symtab
608 {
609 	char		*s_name;	/* name to be entered */
610 	char		s_type;		/* general type (see below) */
611 	struct symtab	*s_next;	/* pointer to next in chain */
612 	union
613 	{
614 		BITMAP		sv_class;	/* bit-map of word classes */
615 		ADDRESS		*sv_addr;	/* pointer to address header */
616 		MAILER		*sv_mailer;	/* pointer to mailer */
617 		char		*sv_alias;	/* alias */
618 		MAPCLASS	sv_mapclass;	/* mapping function class */
619 		MAP		sv_map;		/* mapping function */
620 		char		*sv_hostsig;	/* host signature */
621 		MCI		sv_mci;		/* mailer connection info */
622 		NAMECANON	sv_namecanon;	/* canonical name cache */
623 		int		sv_macro;	/* macro name => id mapping */
624 	}	s_value;
625 };
626 
627 typedef struct symtab	STAB;
628 
629 /* symbol types */
630 # define ST_UNDEF	0	/* undefined type */
631 # define ST_CLASS	1	/* class map */
632 # define ST_ADDRESS	2	/* an address in parsed format */
633 # define ST_MAILER	3	/* a mailer header */
634 # define ST_ALIAS	4	/* an alias */
635 # define ST_MAPCLASS	5	/* mapping function class */
636 # define ST_MAP		6	/* mapping function */
637 # define ST_HOSTSIG	7	/* host signature */
638 # define ST_NAMECANON	8	/* cached canonical name */
639 # define ST_MACRO	9	/* macro name to id mapping */
640 # define ST_TRUSTED	10	/* trusted user */
641 # define ST_MCI		16	/* mailer connection info (offset) */
642 
643 # define s_class	s_value.sv_class
644 # define s_address	s_value.sv_addr
645 # define s_mailer	s_value.sv_mailer
646 # define s_alias	s_value.sv_alias
647 # define s_mci		s_value.sv_mci
648 # define s_mapclass	s_value.sv_mapclass
649 # define s_hostsig	s_value.sv_hostsig
650 # define s_map		s_value.sv_map
651 # define s_namecanon	s_value.sv_namecanon
652 # define s_macro	s_value.sv_macro
653 
654 extern STAB		*stab __P((char *, int, int));
655 extern void		stabapply __P((void (*)(STAB *, int), int));
656 
657 /* opcodes to stab */
658 # define ST_FIND	0	/* find entry */
659 # define ST_ENTER	1	/* enter if not there */
660 /*
661 **  STRUCT EVENT -- event queue.
662 **
663 **	Maintained in sorted order.
664 **
665 **	We store the pid of the process that set this event to insure
666 **	that when we fork we will not take events intended for the parent.
667 */
668 
669 struct event
670 {
671 	time_t		ev_time;	/* time of the function call */
672 	int		(*ev_func)__P((int));
673 					/* function to call */
674 	int		ev_arg;		/* argument to ev_func */
675 	int		ev_pid;		/* pid that set this event */
676 	struct event	*ev_link;	/* link to next item */
677 };
678 
679 typedef struct event	EVENT;
680 
681 EXTERN EVENT	*EventQueue;		/* head of event queue */
682 /*
683 **  Operation, send, error, and MIME modes
684 **
685 **	The operation mode describes the basic operation of sendmail.
686 **	This can be set from the command line, and is "send mail" by
687 **	default.
688 **
689 **	The send mode tells how to send mail.  It can be set in the
690 **	configuration file.  It's setting determines how quickly the
691 **	mail will be delivered versus the load on your system.  If the
692 **	-v (verbose) flag is given, it will be forced to SM_DELIVER
693 **	mode.
694 **
695 **	The error mode tells how to return errors.
696 */
697 
698 EXTERN char	OpMode;		/* operation mode, see below */
699 
700 #define MD_DELIVER	'm'		/* be a mail sender */
701 #define MD_SMTP		's'		/* run SMTP on standard input */
702 #define MD_ARPAFTP	'a'		/* obsolete ARPANET mode (Grey Book) */
703 #define MD_DAEMON	'd'		/* run as a daemon */
704 #define MD_VERIFY	'v'		/* verify: don't collect or deliver */
705 #define MD_TEST		't'		/* test mode: resolve addrs only */
706 #define MD_INITALIAS	'i'		/* initialize alias database */
707 #define MD_PRINT	'p'		/* print the queue */
708 #define MD_FREEZE	'z'		/* freeze the configuration file */
709 
710 
711 /* values for e_sendmode -- send modes */
712 #define SM_DELIVER	'i'		/* interactive delivery */
713 #define SM_QUICKD	'j'		/* deliver w/o queueing */
714 #define SM_FORK		'b'		/* deliver in background */
715 #define SM_QUEUE	'q'		/* queue, don't deliver */
716 #define SM_VERIFY	'v'		/* verify only (used internally) */
717 
718 /* used only as a parameter to sendall */
719 #define SM_DEFAULT	'\0'		/* unspecified, use SendMode */
720 
721 
722 /* values for e_errormode -- error handling modes */
723 #define EM_PRINT	'p'		/* print errors */
724 #define EM_MAIL		'm'		/* mail back errors */
725 #define EM_WRITE	'w'		/* write back errors */
726 #define EM_BERKNET	'e'		/* special berknet processing */
727 #define EM_QUIET	'q'		/* don't print messages (stat only) */
728 
729 
730 /* MIME processing mode */
731 EXTERN int	MimeMode;
732 
733 /* bit values for MimeMode */
734 #define MM_CVTMIME	0x0001		/* convert 8 to 7 bit MIME */
735 #define MM_PASS8BIT	0x0002		/* just send 8 bit data blind */
736 #define MM_MIME8BIT	0x0004		/* convert 8-bit data to MIME */
737 
738 /* queue sorting order algorithm */
739 EXTERN int	QueueSortOrder;
740 
741 #define QS_BYPRIORITY	0		/* sort by message priority */
742 #define QS_BYHOST	1		/* sort by first host name */
743 /*
744 **  Additional definitions
745 */
746 
747 
748 /*
749 **  Privacy flags
750 **	These are bit values for the PrivacyFlags word.
751 */
752 
753 #define PRIV_PUBLIC		0	/* what have I got to hide? */
754 #define PRIV_NEEDMAILHELO	0x0001	/* insist on HELO for MAIL, at least */
755 #define PRIV_NEEDEXPNHELO	0x0002	/* insist on HELO for EXPN */
756 #define PRIV_NEEDVRFYHELO	0x0004	/* insist on HELO for VRFY */
757 #define PRIV_NOEXPN		0x0008	/* disallow EXPN command entirely */
758 #define PRIV_NOVRFY		0x0010	/* disallow VRFY command entirely */
759 #define PRIV_AUTHWARNINGS	0x0020	/* flag possible authorization probs */
760 #define PRIV_NORECEIPTS		0x0040	/* disallow return receipts */
761 #define PRIV_RESTRICTMAILQ	0x1000	/* restrict mailq command */
762 #define PRIV_RESTRICTQRUN	0x2000	/* restrict queue run */
763 #define PRIV_GOAWAY		0x0fff	/* don't give no info, anyway, anyhow */
764 
765 /* struct defining such things */
766 struct prival
767 {
768 	char	*pv_name;	/* name of privacy flag */
769 	int	pv_flag;	/* numeric level */
770 };
771 
772 
773 /*
774 **  Flags passed to remotename, parseaddr, allocaddr, and buildaddr.
775 */
776 
777 #define RF_SENDERADDR		0x001	/* this is a sender address */
778 #define RF_HEADERADDR		0x002	/* this is a header address */
779 #define RF_CANONICAL		0x004	/* strip comment information */
780 #define RF_ADDDOMAIN		0x008	/* OK to do domain extension */
781 #define RF_COPYPARSE		0x010	/* copy parsed user & host */
782 #define RF_COPYPADDR		0x020	/* copy print address */
783 #define RF_COPYALL		(RF_COPYPARSE|RF_COPYPADDR)
784 #define RF_COPYNONE		0
785 
786 
787 /*
788 **  Flags passed to safefile.
789 */
790 
791 #define SFF_ANYFILE		0	/* no special restrictions */
792 #define SFF_MUSTOWN		0x0001	/* user must own this file */
793 #define SFF_NOSLINK		0x0002	/* file cannot be a symbolic link */
794 #define SFF_ROOTOK		0x0004	/* ok for root to own this file */
795 #define SFF_NOPATHCHECK		0x0010	/* don't bother checking dir path */
796 
797 
798 /*
799 **  Regular UNIX sockaddrs are too small to handle ISO addresses, so
800 **  we are forced to declare a supertype here.
801 */
802 
803 union bigsockaddr
804 {
805 	struct sockaddr		sa;	/* general version */
806 #ifdef NETUNIX
807 	struct sockaddr_un	sunix;	/* UNIX family */
808 #endif
809 #ifdef NETINET
810 	struct sockaddr_in	sin;	/* INET family */
811 #endif
812 #ifdef NETISO
813 	struct sockaddr_iso	siso;	/* ISO family */
814 #endif
815 #ifdef NETNS
816 	struct sockaddr_ns	sns;	/* XNS family */
817 #endif
818 #ifdef NETX25
819 	struct sockaddr_x25	sx25;	/* X.25 family */
820 #endif
821 };
822 
823 #define SOCKADDR	union bigsockaddr
824 
825 
826 /*
827 **  Vendor codes
828 **
829 **	Vendors can customize sendmail to add special behaviour,
830 **	generally for back compatibility.  Ideally, this should
831 **	be set up in the .cf file using the "V" command.  However,
832 **	it's quite reasonable for some vendors to want the default
833 **	be their old version; this can be set using
834 **		-DVENDOR_DEFAULT=VENDOR_xxx
835 **	in the Makefile.
836 **
837 **	Vendors should apply to sendmail@CS.Berkeley.EDU for
838 **	unique vendor codes.
839 */
840 
841 #define VENDOR_BERKELEY	1	/* Berkeley-native configuration file */
842 #define VENDOR_SUN	2	/* Sun-native configuration file */
843 
844 EXTERN int	VendorCode;	/* vendor-specific operation enhancements */
845 /*
846 **  Global variables.
847 */
848 
849 EXTERN bool	FromFlag;	/* if set, "From" person is explicit */
850 EXTERN bool	MeToo;		/* send to the sender also */
851 EXTERN bool	IgnrDot;	/* don't let dot end messages */
852 EXTERN bool	SaveFrom;	/* save leading "From" lines */
853 EXTERN bool	Verbose;	/* set if blow-by-blow desired */
854 EXTERN bool	GrabTo;		/* if set, get recipients from msg */
855 EXTERN bool	SuprErrs;	/* set if we are suppressing errors */
856 EXTERN bool	HoldErrs;	/* only output errors to transcript */
857 EXTERN bool	NoConnect;	/* don't connect to non-local mailers */
858 EXTERN bool	SuperSafe;	/* be extra careful, even if expensive */
859 EXTERN bool	ForkQueueRuns;	/* fork for each job when running the queue */
860 EXTERN bool	AutoRebuild;	/* auto-rebuild the alias database as needed */
861 EXTERN bool	CheckAliases;	/* parse addresses during newaliases */
862 EXTERN bool	NoAlias;	/* suppress aliasing */
863 EXTERN bool	UseNameServer;	/* using DNS -- interpret h_errno & MX RRs */
864 EXTERN bool	UseHesiod;	/* using Hesiod -- interpret Hesiod errors */
865 EXTERN bool	SevenBitInput;	/* force 7-bit data on input */
866 EXTERN bool	HasEightBits;	/* has at least one eight bit input byte */
867 EXTERN time_t	SafeAlias;	/* interval to wait until @:@ in alias file */
868 EXTERN FILE	*InChannel;	/* input connection */
869 EXTERN FILE	*OutChannel;	/* output connection */
870 EXTERN uid_t	RealUid;	/* when Daemon, real uid of caller */
871 EXTERN gid_t	RealGid;	/* when Daemon, real gid of caller */
872 EXTERN uid_t	DefUid;		/* default uid to run as */
873 EXTERN gid_t	DefGid;		/* default gid to run as */
874 EXTERN char	*DefUser;	/* default user to run as (from DefUid) */
875 EXTERN int	OldUmask;	/* umask when sendmail starts up */
876 EXTERN int	Errors;		/* set if errors (local to single pass) */
877 EXTERN int	ExitStat;	/* exit status code */
878 EXTERN int	LineNumber;	/* line number in current input */
879 EXTERN int	LogLevel;	/* level of logging to perform */
880 EXTERN int	FileMode;	/* mode on files */
881 EXTERN int	QueueLA;	/* load average starting forced queueing */
882 EXTERN int	RefuseLA;	/* load average refusing connections are */
883 EXTERN int	CurrentLA;	/* current load average */
884 EXTERN long	QueueFactor;	/* slope of queue function */
885 EXTERN time_t	QueueIntvl;	/* intervals between running the queue */
886 EXTERN char	*HelpFile;	/* location of SMTP help file */
887 EXTERN char	*ErrMsgFile;	/* file to prepend to all error messages */
888 EXTERN char	*StatFile;	/* location of statistics summary */
889 EXTERN char	*QueueDir;	/* location of queue directory */
890 EXTERN char	*FileName;	/* name to print on error messages */
891 EXTERN char	*SmtpPhase;	/* current phase in SMTP processing */
892 EXTERN char	*MyHostName;	/* name of this host for SMTP messages */
893 EXTERN char	*RealHostName;	/* name of host we are talking to */
894 EXTERN SOCKADDR RealHostAddr;	/* address of host we are talking to */
895 EXTERN char	*CurHostName;	/* current host we are dealing with */
896 EXTERN jmp_buf	TopFrame;	/* branch-to-top-of-loop-on-error frame */
897 EXTERN bool	QuickAbort;	/*  .... but only if we want a quick abort */
898 EXTERN bool	LogUsrErrs;	/* syslog user errors (e.g., SMTP RCPT cmd) */
899 EXTERN bool	SendMIMEErrors;	/* send error messages in MIME format */
900 EXTERN bool	MatchGecos;	/* look for user names in gecos field */
901 EXTERN bool	UseErrorsTo;	/* use Errors-To: header (back compat) */
902 EXTERN bool	TryNullMXList;	/* if we are the best MX, try host directly */
903 EXTERN bool	InChild;	/* true if running in an SMTP subprocess */
904 EXTERN bool	DisConnected;	/* running with OutChannel redirected to xf */
905 EXTERN char	SpaceSub;	/* substitution for <lwsp> */
906 EXTERN int	PrivacyFlags;	/* privacy flags */
907 EXTERN char	*ConfFile;	/* location of configuration file [conf.c] */
908 extern char	*PidFile;	/* location of proc id file [conf.c] */
909 extern ADDRESS	NullAddress;	/* a null (template) address [main.c] */
910 EXTERN long	WkClassFact;	/* multiplier for message class -> priority */
911 EXTERN long	WkRecipFact;	/* multiplier for # of recipients -> priority */
912 EXTERN long	WkTimeFact;	/* priority offset each time this job is run */
913 EXTERN char	*UdbSpec;	/* user database source spec */
914 EXTERN int	MaxHopCount;	/* max # of hops until bounce */
915 EXTERN int	ConfigLevel;	/* config file level */
916 EXTERN char	*TimeZoneSpec;	/* override time zone specification */
917 EXTERN char	*ForwardPath;	/* path to search for .forward files */
918 EXTERN long	MinBlocksFree;	/* min # of blocks free on queue fs */
919 EXTERN char	*FallBackMX;	/* fall back MX host */
920 EXTERN long	MaxMessageSize;	/* advertised max size we will accept */
921 EXTERN time_t	MaxHostStatAge;	/* max age of cached host status info */
922 EXTERN time_t	MinQueueAge;	/* min delivery interval */
923 EXTERN time_t	DialDelay;	/* delay between dial-on-demand tries */
924 EXTERN char	*ServiceSwitchFile;	/* backup service switch */
925 EXTERN char	*DefaultCharSet;	/* default character set for MIME */
926 EXTERN int	DeliveryNiceness;	/* how nice to be during delivery */
927 EXTERN char	*PostMasterCopy;	/* address to get errs cc's */
928 EXTERN int	CheckpointInterval;	/* queue file checkpoint interval */
929 EXTERN bool	DontPruneRoutes;	/* don't prune source routes */
930 EXTERN bool	BrokenSmtpPeers;	/* peers can't handle 2-line greeting */
931 EXTERN int	MaxMciCache;		/* maximum entries in MCI cache */
932 EXTERN time_t	MciCacheTimeout;	/* maximum idle time on connections */
933 EXTERN char	*QueueLimitRecipient;	/* limit queue runs to this recipient */
934 EXTERN char	*QueueLimitSender;	/* limit queue runs to this sender */
935 EXTERN char	*QueueLimitId;		/* limit queue runs to this id */
936 EXTERN FILE	*TrafficLogFile;	/* file in which to log all traffic */
937 extern int	errno;
938 
939 
940 /*
941 **  Timeouts
942 **
943 **	Indicated values are the MINIMUM per RFC 1123 section 5.3.2.
944 */
945 
946 EXTERN struct
947 {
948 			/* RFC 1123-specified timeouts [minimum value] */
949 	time_t	to_initial;	/* initial greeting timeout [5m] */
950 	time_t	to_mail;	/* MAIL command [5m] */
951 	time_t	to_rcpt;	/* RCPT command [5m] */
952 	time_t	to_datainit;	/* DATA initiation [2m] */
953 	time_t	to_datablock;	/* DATA block [3m] */
954 	time_t	to_datafinal;	/* DATA completion [10m] */
955 	time_t	to_nextcommand;	/* next command [5m] */
956 			/* following timeouts are not mentioned in RFC 1123 */
957 	time_t	to_rset;	/* RSET command */
958 	time_t	to_helo;	/* HELO command */
959 	time_t	to_quit;	/* QUIT command */
960 	time_t	to_miscshort;	/* misc short commands (NOOP, VERB, etc) */
961 	time_t	to_ident;	/* IDENT protocol requests */
962 	time_t	to_fileopen;	/* opening :include: and .forward files */
963 			/* following are per message */
964 	time_t	to_q_return[MAXTOCLASS];	/* queue return timeouts */
965 	time_t	to_q_warning[MAXTOCLASS];	/* queue warning timeouts */
966 } TimeOuts;
967 
968 /* timeout classes for return and warning timeouts */
969 # define TOC_NORMAL	0	/* normal delivery */
970 # define TOC_URGENT	1	/* urgent delivery */
971 # define TOC_NONURGENT	2	/* non-urgent delivery */
972 
973 
974 /*
975 **  Trace information
976 */
977 
978 /* trace vector and macros for debugging flags */
979 EXTERN u_char	tTdvect[100];
980 # define tTd(flag, level)	(tTdvect[flag] >= level)
981 # define tTdlevel(flag)		(tTdvect[flag])
982 /*
983 **  Miscellaneous information.
984 */
985 
986 
987 
988 /*
989 **  Some in-line functions
990 */
991 
992 /* set exit status */
993 #define setstat(s)	{ \
994 				if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \
995 					ExitStat = s; \
996 			}
997 
998 /* make a copy of a string */
999 #define newstr(s)	strcpy(xalloc(strlen(s) + 1), s)
1000 
1001 #define STRUCTCOPY(s, d)	d = s
1002 
1003 
1004 /*
1005 **  Declarations of useful functions
1006 */
1007 
1008 extern ADDRESS		*parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *));
1009 extern char		*xalloc __P((int));
1010 extern bool		sameaddr __P((ADDRESS *, ADDRESS *));
1011 extern FILE		*dfopen __P((char *, int, int));
1012 extern EVENT		*setevent __P((time_t, int(*)(), int));
1013 extern char		*sfgets __P((char *, int, FILE *, time_t, char *));
1014 extern char		*queuename __P((ENVELOPE *, int));
1015 extern time_t		curtime __P(());
1016 extern bool		transienterror __P((int));
1017 extern const char	*errstring __P((int));
1018 extern void		expand __P((char *, char *, char *, ENVELOPE *));
1019 extern void		define __P((int, char *, ENVELOPE *));
1020 extern char		*macvalue __P((int, ENVELOPE *));
1021 extern char		*macname __P((int));
1022 extern int		macid __P((char *, char **));
1023 extern char		**prescan __P((char *, int, char[], int, char **));
1024 extern int		rewrite __P((char **, int, int, ENVELOPE *));
1025 extern char		*fgetfolded __P((char *, int, FILE *));
1026 extern ADDRESS		*recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
1027 extern ENVELOPE		*newenvelope __P((ENVELOPE *, ENVELOPE *));
1028 extern void		dropenvelope __P((ENVELOPE *));
1029 extern void		clearenvelope __P((ENVELOPE *, int));
1030 extern char		*username __P(());
1031 extern MCI		*mci_get __P((char *, MAILER *));
1032 extern char		*pintvl __P((time_t, int));
1033 extern char		*map_rewrite __P((MAP *, char *, int, char **));
1034 extern ADDRESS		*getctladdr __P((ADDRESS *));
1035 extern char		*anynet_ntoa __P((SOCKADDR *));
1036 extern char		*remotename __P((char *, MAILER *, int, int *, ENVELOPE *));
1037 extern bool		shouldqueue __P((long, time_t));
1038 extern bool		lockfile __P((int, char *, char *, int));
1039 extern char		*hostsignature __P((MAILER *, char *, ENVELOPE *));
1040 extern void		openxscript __P((ENVELOPE *));
1041 extern void		closexscript __P((ENVELOPE *));
1042 extern sigfunc_t	setsignal __P((int, sigfunc_t));
1043 extern char		*shortenstring __P((char *, int));
1044 extern bool		usershellok __P((char *));
1045 extern void		commaize __P((HDR *, char *, int, MCI *, ENVELOPE *));
1046 extern char		*hvalue __P((char *, HDR *));
1047 extern char		*defcharset __P((ENVELOPE *));
1048 extern bool		emptyaddr __P((ADDRESS *));
1049 extern int		sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *));
1050 extern bool		wordinclass __P((char *, char));
1051 extern char		*denlstring __P((char *));
1052 
1053 /* ellipsis is a different case though */
1054 #ifdef __STDC__
1055 extern void		auth_warning(ENVELOPE *, const char *, ...);
1056 extern void		syserr(const char *, ...);
1057 extern void		usrerr(const char *, ...);
1058 extern void		message(const char *, ...);
1059 extern void		nmessage(const char *, ...);
1060 #else
1061 extern void		auth_warning();
1062 extern void		syserr();
1063 extern void		usrerr();
1064 extern void		message();
1065 extern void		nmessage();
1066 #endif
1067