xref: /csrg-svn/usr.sbin/sendmail/src/conf.h (revision 64718)
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  *	@(#)conf.h	8.38 (Berkeley) 10/15/93
9  */
10 
11 /*
12 **  CONF.H -- All user-configurable parameters for sendmail
13 */
14 
15 # include <sys/param.h>
16 # include <sys/types.h>
17 # include <sys/stat.h>
18 # include <sys/file.h>
19 # include <sys/wait.h>
20 # include <fcntl.h>
21 # include <signal.h>
22 
23 /**********************************************************************
24 **  Table sizes, etc....
25 **	There shouldn't be much need to change these....
26 **********************************************************************/
27 
28 # define MAXLINE	2048		/* max line length */
29 # define MAXNAME	256		/* max length of a name */
30 # define MAXPV		40		/* max # of parms to mailers */
31 # define MAXATOM	200		/* max atoms per address */
32 # define MAXMAILERS	25		/* maximum mailers known to system */
33 # define MAXRWSETS	100		/* max # of sets of rewriting rules */
34 # define MAXPRIORITIES	25		/* max values for Precedence: field */
35 # define MAXMXHOSTS	20		/* max # of MX records */
36 # define SMTPLINELIM	990		/* maximum SMTP line length */
37 # define MAXKEY		128		/* maximum size of a database key */
38 # define MEMCHUNKSIZE	1024		/* chunk size for memory allocation */
39 # define MAXUSERENVIRON	100		/* max envars saved, must be >= 3 */
40 # define MAXALIASDB	12		/* max # of alias databases */
41 # define PSBUFSIZE	(MAXLINE + MAXATOM)	/* size of prescan buffer */
42 
43 # ifndef QUEUESIZE
44 # define QUEUESIZE	1000		/* max # of jobs per queue run */
45 # endif
46 
47 /**********************************************************************
48 **  Compilation options.
49 **
50 **	#define these if they are available; comment them out otherwise.
51 **********************************************************************/
52 
53 # define LOG		1	/* enable logging */
54 # define UGLYUUCP	1	/* output ugly UUCP From lines */
55 # define NETINET	1	/* include internet support */
56 # define SETPROCTITLE	1	/* munge argv to display current status */
57 # define NAMED_BIND	1	/* use Berkeley Internet Domain Server */
58 # define MATCHGECOS	1	/* match user names from gecos field */
59 # define XDEBUG		1	/* enable extended debugging */
60 
61 # ifdef NEWDB
62 # define USERDB		1	/* look in user database (requires NEWDB) */
63 # endif
64 
65 /*
66 **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
67 **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
68 **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
69 **  are closed.  Some firewalls return this error if you try to connect
70 **  to the IDENT port (113), so you can't receive email from these hosts
71 **  on these systems.  The firewall really should use a more specific
72 **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _NET_PROHIB.  This
73 **  will get #undefed below as needed.
74 */
75 
76 # define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
77 
78 /**********************************************************************
79 **  Operating system configuration.
80 **
81 **	Unless you are porting to a new OS, you shouldn't have to
82 **	change these.
83 **********************************************************************/
84 
85 /*
86 **  Per-Operating System defines
87 */
88 
89 
90 /*
91 **  HP-UX -- tested for 8.07
92 */
93 
94 # ifdef __hpux
95 # define SYSTEM5	1	/* include all the System V defines */
96 # define HASINITGROUPS	1	/* has initgroups(3) call */
97 # define HASSTATFS	1	/* has the statfs(2) syscall */
98 # define HASSETREUID	1	/* has setreuid(2) call */
99 # define setreuid(r, e)		setresuid(r, e, -1)
100 # define LA_TYPE	LA_FLOAT
101 # define _PATH_UNIX	"/hp-ux"
102 # undef IDENTPROTO		/* TCP/IP implementation is broken */
103 # endif
104 
105 
106 /*
107 **  IBM AIX 3.x -- actually tested for 3.2.3
108 */
109 
110 # ifdef _AIX3
111 # define HASINITGROUPS	1	/* has initgroups(3) call */
112 # define FORK		fork	/* no vfork primitive available */
113 # undef  SETPROCTITLE		/* setproctitle confuses AIX */
114 # endif
115 
116 
117 /*
118 **  Silicon Graphics IRIX
119 **
120 **	Compiles on 4.0.1.
121 */
122 
123 # ifdef IRIX
124 # define HASSETREUID	1	/* has setreuid(2) call */
125 # define HASINITGROUPS	1	/* has initgroups(3) call */
126 # define HASSTATFS	1	/* has the statfs(2) syscall */
127 # define FORK		fork	/* no vfork primitive available */
128 # define WAITUNION	1	/* use "union wait" as wait argument type */
129 # define setpgid	BSDsetpgrp
130 # define GIDSET_T	gid_t
131 # endif
132 
133 
134 /*
135 **  SunOS
136 */
137 
138 #if defined(sun) && !defined(BSD)
139 
140 # define LA_TYPE	LA_INT
141 # define HASSETREUID	1	/* has setreuid(2) call */
142 # define HASINITGROUPS	1	/* has initgroups(3) call */
143 
144 # ifdef SOLARIS
145 			/* Solaris 2.x (a.k.a. SunOS 5.x) */
146 #  define SYSTEM5	1	/* use System V definitions */
147 #  define setreuid(r, e)	seteuid(e)
148 #  include <sys/time.h>
149 #  define gethostbyname	__switch_gethostbyname	/* get working version */
150 #  define gethostbyaddr	__switch_gethostbyaddr	/* get working version */
151 #  define _PATH_UNIX	"/kernel/unix"
152 #  ifndef _PATH_SENDMAILCF
153 #   define _PATH_SENDMAILCF	"/etc/mail/sendmail.cf"
154 #  endif
155 #  ifndef _PATH_SENDMAILPID
156 #   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
157 #  endif
158 
159 # else
160 			/* SunOS 4.1.x */
161 #  define HASSTATFS	1	/* has the statfs(2) syscall */
162 /* #  define HASFLOCK	1	/* has flock(2) call */
163 #  include <vfork.h>
164 
165 # endif
166 #endif
167 
168 /*
169 ** DG/UX 5.4.2
170 */
171 
172 #ifdef	DGUX
173 # define SYSTEM5	1
174 # define LA_TYPE	LA_SUBR
175 # define HASSTATFS	1	/* has the statfs(2) syscall */
176 # define HASSETREUID	1	/* has setreuid(2) call */
177 # define HASUNAME	1	/* use System V uname(2) system call */
178 # define HASSETSID	1	/* has Posix setsid(2) call */
179 # define HASINITGROUPS	1	/* has initgroups(3) call */
180 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
181 # undef IDENTPROTO		/* TCP/IP implementation is broken */
182 # undef SETPROCTITLE
183 # define inet_addr	dgux_inet_addr
184 extern long	dgux_inet_addr();
185 #endif
186 
187 
188 /*
189 **  Digital Ultrix 4.2A or 4.3
190 **
191 **	Apparently, fcntl locking is broken on 4.2A, in that locks are
192 **	not dropped when the process exits.  This causes major problems,
193 **	so flock is the only alternative.
194 */
195 
196 #ifdef ultrix
197 # define HASSTATFS	1	/* has the statfs(2) syscall */
198 # define HASSETREUID	1	/* has setreuid(2) call */
199 # define HASUNSETENV	1	/* has unsetenv(3) call */
200 # define HASINITGROUPS	1	/* has initgroups(3) call */
201 # define HASFLOCK	1	/* has flock(2) call */
202 # define LA_TYPE	LA_INT
203 # define LA_AVENRUN	"avenrun"
204 # undef IDENTPROTO		/* TCP/IP implementation is broken */
205 #endif
206 
207 
208 /*
209 **  OSF/1 (tested on Alpha)
210 */
211 
212 #ifdef __osf__
213 # define HASSTATFS	1	/* has the statfs(2) syscall */
214 # define HASUNSETENV	1	/* has unsetenv(3) call */
215 # define HASSETREUID	1	/* has setreuid(2) call */
216 # define HASINITGROUPS	1	/* has initgroups(3) call */
217 /* # define HASFLOCK	1	/* has flock(2) call */
218 # define LA_TYPE	LA_INT
219 #endif
220 
221 
222 /*
223 **  NeXTstep
224 */
225 
226 #ifdef NeXT
227 # define HASINITGROUPS	1	/* has initgroups(3) call */
228 # define HASFLOCK	1	/* has flock(2) call */
229 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
230 # define HASSTATFS	1	/* has the statfs(2) syscall */
231 # define WAITUNION	1	/* use "union wait" as wait argument type */
232 # define sleep		sleepX
233 # define setpgid	setpgrp
234 # ifndef LA_TYPE
235 #  define LA_TYPE	LA_MACH
236 # endif
237 # ifndef _POSIX_SOURCE
238 typedef int		pid_t;
239 #  undef WEXITSTATUS
240 #  undef WIFEXITED
241 # endif
242 # ifndef _PATH_SENDMAILCF
243 #  define _PATH_SENDMAILCF	"/etc/sendmail/sendmail.cf"
244 # endif
245 # ifndef _PATH_SENDMAILPID
246 #  define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
247 # endif
248 #endif
249 
250 
251 /*
252 **  4.4 BSD
253 */
254 
255 #ifdef BSD4_4
256 # define HASUNSETENV	1	/* has unsetenv(3) call */
257 # define HASSTATFS	1	/* has the statfs(2) syscall */
258 # include <sys/cdefs.h>
259 # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
260 # ifndef LA_TYPE
261 #  define LA_TYPE	LA_SUBR
262 # endif
263 #endif
264 
265 
266 /*
267 **  4.3 BSD -- this is for very old systems
268 **
269 **	You'll also have to install a new resolver library.
270 **	I don't guarantee that support for this environment is complete.
271 */
272 
273 #ifdef oldBSD43
274 # define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
275 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
276 # define ARBPTR_T	char *
277 # define setpgid	setpgrp
278 # ifndef LA_TYPE
279 #  define LA_TYPE	LA_FLOAT
280 # endif
281 # ifndef _PATH_SENDMAILCF
282 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
283 # endif
284 # undef IDENTPROTO		/* TCP/IP implementation is broken */
285 #endif
286 
287 
288 /*
289 **  SCO Unix
290 */
291 
292 #ifdef _SCO_unix_
293 # define SYSTEM5	1	/* include all the System V defines */
294 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
295 # define HASSTATFS	1	/* has the statfs(2) syscall */
296 # define FORK		fork
297 # define MAXPATHLEN	PATHSIZE
298 # define LA_TYPE	LA_SHORT
299 #endif
300 
301 
302 /*
303 **  ConvexOS 11.0 and later
304 */
305 
306 #ifdef _CONVEX_SOURCE
307 # define BSD		1	/* include all the BSD defines */
308 # define HASUNAME	1	/* use System V uname(2) system call */
309 # define HASSTATFS	1	/* has the statfs(2) syscall */
310 # define HASSETSID	1	/* has POSIX setsid(2) call */
311 # define NEEDGETOPT	1	/* need replacement for getopt(3) */
312 # define LA_TYPE	LA_FLOAT
313 # undef IDENTPROTO
314 #endif
315 
316 
317 /*
318 **  RISC/os 4.51
319 **
320 **	Untested...
321 */
322 
323 #ifdef RISCOS
324 # define HASUNSETENV	1	/* has unsetenv(3) call */
325 /* # define HASFLOCK	1	/* has flock(2) call */
326 # define LA_TYPE	LA_INT
327 # define LA_AVENRUN	"avenrun"
328 # define _PATH_UNIX	"/unix"
329 #endif
330 
331 
332 /*
333 **  Linux 0.99pl10 and above...
334 **	From Karl London <karl@borg.demon.co.uk>.
335 */
336 
337 #ifdef linux
338 # define BSD		1	/* pretend to be BSD based today */
339 # undef  NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
340 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
341 # define HASUNSETENV	1	/* has unsetenv(3) call */
342 # ifndef LA_TYPE
343 #  define LA_TYPE	LA_FLOAT
344 # endif
345 #endif
346 
347 
348 /*
349 **  DELL SVR4 Issue 2.2, and others
350 **	From Kimmo Suominen <kim@grendel.lut.fi>
351 **
352 **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
353 **	defined, and the definitions conflict.
354 */
355 
356 #ifdef DELL_SVR4
357 # define SYSTEM5	1
358 /* # define setreuid(r, e)	seteuid(e) */
359 /* # include <sys/time.h> */
360 # define _PATH_UNIX	"/unix"
361 # ifndef _PATH_SENDMAILCF
362 #  define _PATH_SENDMAILCF	"/usr/ucblib/sendmail.cf"
363 # endif
364 # ifndef _PATH_SENDMAILPID
365 #  define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
366 # endif
367 #endif
368 
369 
370 /*
371 **  Apple A/UX 3.0
372 */
373 
374 #ifdef _AUX_SOURCE
375 # define BSD			/* has BSD routines */
376 # define HASSTATFS	1	/* has the statfs(2) syscall */
377 # define HASUNAME	1	/* use System V uname(2) system call */
378 # define HASUSTAT	1	/* use System V ustat(2) syscall */
379 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
380 # define SIGFUNC_DEFINED	/* sigfunc_t already defined */
381 # undef IDENTPROTO		/* TCP/IP implementation is broken */
382 # define FORK		fork
383 # ifndef _PATH_SENDMAILCF
384 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
385 # endif
386 # ifndef LA_TYPE
387 #  define LA_TYPE	LA_ZERO
388 # endif
389 # undef WIFEXITED
390 # undef WEXITSTATUS
391 #endif
392 
393 
394 /*
395 **  Encore UMAX V
396 **
397 **	Not extensively tested.
398 */
399 
400 #ifdef UMAXV
401 # include <limits.h>
402 # define HASUNAME	1	/* use System V uname(2) system call */
403 # define HASSTATFS	1	/* has the statfs(2) syscall */
404 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
405 # define HASINITGROUPS	1	/* has initgroups(3) call */
406 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
407 # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
408 # define FORK		fork	/* no vfork(2) primitive available */
409 # define MAXPATHLEN	PATH_MAX
410 extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
411 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
412 # undef WIFEXITED
413 # undef WEXITSTATUS
414 #endif
415 
416 
417 
418 /**********************************************************************
419 **  End of Per-Operating System defines
420 **********************************************************************/
421 
422 /**********************************************************************
423 **  More general defines
424 **********************************************************************/
425 
426 /* general BSD defines */
427 #ifdef BSD
428 # define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
429 # define HASSETREUID	1	/* has setreuid(2) call */
430 # define HASINITGROUPS	1	/* has initgroups(2) call */
431 # define HASFLOCK	1	/* has flock(2) call */
432 #endif
433 
434 /* general System V defines */
435 # ifdef SYSTEM5
436 # define HASUNAME	1	/* use System V uname(2) system call */
437 # define HASUSTAT	1	/* use System V ustat(2) syscall */
438 # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
439 # ifndef LA_TYPE
440 #  define LA_TYPE	LA_INT
441 # endif
442 # define bcopy(s, d, l)		(memmove((d), (s), (l)))
443 # define bzero(d, l)		(memset((d), '\0', (l)))
444 # define bcmp(s, d, l)		(memcmp((s), (d), (l)))
445 # endif
446 
447 /* general "standard C" defines */
448 #if defined(__STDC__) || defined(SYSTEM5)
449 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
450 #endif
451 
452 /* general POSIX defines */
453 #ifdef _POSIX_VERSION
454 # define HASSETSID	1	/* has Posix setsid(2) call */
455 # define HASWAITPID	1	/* has Posix waitpid(2) call */
456 #endif
457 
458 /*
459 **  If no type for argument two of getgroups call is defined, assume
460 **  it's an integer -- unfortunately, there seem to be several choices
461 **  here.
462 */
463 
464 #ifndef GIDSET_T
465 # define GIDSET_T	int
466 #endif
467 
468 
469 /**********************************************************************
470 **  Remaining definitions should never have to be changed.  They are
471 **  primarily to provide back compatibility for older systems -- for
472 **  example, it includes some POSIX compatibility definitions
473 **********************************************************************/
474 
475 /* System 5 compatibility */
476 #ifndef S_ISREG
477 #define S_ISREG(foo)	((foo & S_IFREG) == S_IFREG)
478 #endif
479 #ifndef S_IWGRP
480 #define S_IWGRP		020
481 #endif
482 #ifndef S_IWOTH
483 #define S_IWOTH		002
484 #endif
485 
486 /*
487 **  Older systems don't have this error code -- it should be in
488 **  /usr/include/sysexits.h.
489 */
490 
491 # ifndef EX_CONFIG
492 # define EX_CONFIG	78	/* configuration error */
493 # endif
494 
495 /* pseudo-code used in server SMTP */
496 # define EX_QUIT	22	/* drop out of server immediately */
497 
498 
499 /*
500 **  These are used in a few cases where we need some special
501 **  error codes, but where the system doesn't provide something
502 **  reasonable.  They are printed in errstring.
503 */
504 
505 #ifndef E_PSEUDOBASE
506 # define E_PSEUDOBASE	256
507 #endif
508 
509 #define EOPENTIMEOUT	(E_PSEUDOBASE + 0)	/* timeout on open */
510 #define E_DNSBASE	(E_PSEUDOBASE + 20)	/* base for DNS h_errno */
511 
512 /* type of arbitrary pointer */
513 #ifndef ARBPTR_T
514 # define ARBPTR_T	void *
515 #endif
516 
517 #ifndef __P
518 # include "cdefs.h"
519 #endif
520 
521 /*
522 **  Do some required dependencies
523 */
524 
525 #if defined(NETINET) || defined(NETISO)
526 # define SMTP		1	/* enable user and server SMTP */
527 # define QUEUE		1	/* enable queueing */
528 # define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
529 #endif
530 
531 
532 /*
533 **  Arrange to use either varargs or stdargs
534 */
535 
536 # ifdef __STDC__
537 
538 # include <stdarg.h>
539 
540 # define VA_LOCAL_DECL	va_list ap;
541 # define VA_START(f)	va_start(ap, f)
542 # define VA_END		va_end(ap)
543 
544 # else
545 
546 # include <varargs.h>
547 
548 # define VA_LOCAL_DECL	va_list ap;
549 # define VA_START(f)	va_start(ap)
550 # define VA_END		va_end(ap)
551 
552 # endif
553 
554 #ifdef HASUNAME
555 # include <sys/utsname.h>
556 # ifdef newstr
557 #  undef newstr
558 # endif
559 #else /* ! HASUNAME */
560 # define NODE_LENGTH 32
561 struct utsname
562 {
563 	char nodename[NODE_LENGTH+1];
564 };
565 #endif /* HASUNAME */
566 
567 #if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_)
568 # define MAXHOSTNAMELEN	256
569 #endif
570 
571 #if !defined(SIGCHLD) && defined(SIGCLD)
572 # define SIGCHLD	SIGCLD
573 #endif
574 
575 #ifndef STDIN_FILENO
576 #define STDIN_FILENO	0
577 #endif
578 
579 #ifndef STDOUT_FILENO
580 #define STDOUT_FILENO	1
581 #endif
582 
583 #ifndef STDERR_FILENO
584 #define STDERR_FILENO	2
585 #endif
586 
587 #ifndef LOCK_SH
588 # define LOCK_SH	0x01	/* shared lock */
589 # define LOCK_EX	0x02	/* exclusive lock */
590 # define LOCK_NB	0x04	/* non-blocking lock */
591 # define LOCK_UN	0x08	/* unlock */
592 #endif
593 
594 #ifndef SIG_ERR
595 # define SIG_ERR	((void (*)()) -1)
596 #endif
597 
598 #ifndef WEXITSTATUS
599 # define WEXITSTATUS(st)	(((st) >> 8) & 0377)
600 #endif
601 #ifndef WIFEXITED
602 # define WIFEXITED(st)		(((st) & 0377) == 0)
603 #endif
604 
605 #ifndef SIGFUNC_DEFINED
606 typedef void		(*sigfunc_t) __P((int));
607 #endif
608 
609 /*
610 **  Size of tobuf (deliver.c)
611 **	Tweak this to match your syslog implementation.  It will have to
612 **	allow for the extra information printed.
613 */
614 
615 #ifndef TOBUFSIZE
616 # define TOBUFSIZE (1024 - 256)
617 #endif
618 
619 /* fork routine -- set above using #ifdef _osname_ or in Makefile */
620 # ifndef FORK
621 # define FORK		vfork		/* function to call to fork mailer */
622 # endif
623