xref: /csrg-svn/usr.sbin/sendmail/src/conf.h (revision 64705)
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.37 (Berkeley) 10/08/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 /*
170 **  Digital Ultrix 4.2A or 4.3
171 **
172 **	Apparently, fcntl locking is broken on 4.2A, in that locks are
173 **	not dropped when the process exits.  This causes major problems,
174 **	so flock is the only alternative.
175 */
176 
177 #ifdef ultrix
178 # define HASSTATFS	1	/* has the statfs(2) syscall */
179 # define HASSETREUID	1	/* has setreuid(2) call */
180 # define HASUNSETENV	1	/* has unsetenv(3) call */
181 # define HASINITGROUPS	1	/* has initgroups(3) call */
182 # define HASFLOCK	1	/* has flock(2) call */
183 # define LA_TYPE	LA_INT
184 # define LA_AVENRUN	"avenrun"
185 # undef IDENTPROTO		/* TCP/IP implementation is broken */
186 #endif
187 
188 
189 /*
190 **  OSF/1 (tested on Alpha)
191 */
192 
193 #ifdef __osf__
194 # define HASSTATFS	1	/* has the statfs(2) syscall */
195 # define HASUNSETENV	1	/* has unsetenv(3) call */
196 # define HASSETREUID	1	/* has setreuid(2) call */
197 # define HASINITGROUPS	1	/* has initgroups(3) call */
198 /* # define HASFLOCK	1	/* has flock(2) call */
199 # define LA_TYPE	LA_INT
200 #endif
201 
202 
203 /*
204 **  NeXTstep
205 */
206 
207 #ifdef NeXT
208 # define HASINITGROUPS	1	/* has initgroups(3) call */
209 # define HASFLOCK	1	/* has flock(2) call */
210 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
211 # define HASSTATFS	1	/* has the statfs(2) syscall */
212 # define WAITUNION	1	/* use "union wait" as wait argument type */
213 # define sleep		sleepX
214 # define setpgid	setpgrp
215 # ifndef LA_TYPE
216 #  define LA_TYPE	LA_MACH
217 # endif
218 # ifndef _POSIX_SOURCE
219 typedef int		pid_t;
220 #  undef WEXITSTATUS
221 #  undef WIFEXITED
222 # endif
223 # ifndef _PATH_SENDMAILCF
224 #  define _PATH_SENDMAILCF	"/etc/sendmail/sendmail.cf"
225 # endif
226 # ifndef _PATH_SENDMAILPID
227 #  define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
228 # endif
229 #endif
230 
231 
232 /*
233 **  4.4 BSD
234 */
235 
236 #ifdef BSD4_4
237 # define HASUNSETENV	1	/* has unsetenv(3) call */
238 # define HASSTATFS	1	/* has the statfs(2) syscall */
239 # include <sys/cdefs.h>
240 # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
241 # ifndef LA_TYPE
242 #  define LA_TYPE	LA_SUBR
243 # endif
244 #endif
245 
246 
247 /*
248 **  4.3 BSD -- this is for very old systems
249 **
250 **	You'll also have to install a new resolver library.
251 **	I don't guarantee that support for this environment is complete.
252 */
253 
254 #ifdef oldBSD43
255 # define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
256 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
257 # define ARBPTR_T	char *
258 # define setpgid	setpgrp
259 # ifndef LA_TYPE
260 #  define LA_TYPE	LA_FLOAT
261 # endif
262 # ifndef _PATH_SENDMAILCF
263 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
264 # endif
265 # undef IDENTPROTO		/* TCP/IP implementation is broken */
266 #endif
267 
268 
269 /*
270 **  SCO Unix
271 */
272 
273 #ifdef _SCO_unix_
274 # define SYSTEM5	1	/* include all the System V defines */
275 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
276 # define HASSTATFS	1	/* has the statfs(2) syscall */
277 # define FORK		fork
278 # define MAXPATHLEN	PATHSIZE
279 # define LA_TYPE	LA_ZERO
280 #endif
281 
282 
283 /*
284 **  ConvexOS 11.0 and later
285 */
286 
287 #ifdef _CONVEX_SOURCE
288 # define BSD		1	/* include all the BSD defines */
289 # define HASUNAME	1	/* use System V uname(2) system call */
290 # define HASSTATFS	1	/* has the statfs(2) syscall */
291 # define HASSETSID	1	/* has POSIX setsid(2) call */
292 # define NEEDGETOPT	1	/* need replacement for getopt(3) */
293 # define LA_TYPE	LA_FLOAT
294 # undef IDENTPROTO
295 #endif
296 
297 
298 /*
299 **  RISC/os 4.51
300 **
301 **	Untested...
302 */
303 
304 #ifdef RISCOS
305 # define HASUNSETENV	1	/* has unsetenv(3) call */
306 /* # define HASFLOCK	1	/* has flock(2) call */
307 # define LA_TYPE	LA_INT
308 # define LA_AVENRUN	"avenrun"
309 # define _PATH_UNIX	"/unix"
310 #endif
311 
312 
313 /*
314 **  Linux 0.99pl10 and above...
315 **	From Karl London <karl@borg.demon.co.uk>.
316 */
317 
318 #ifdef linux
319 # define BSD		1	/* pretend to be BSD based today */
320 # undef  NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
321 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
322 # define HASUNSETENV	1	/* has unsetenv(3) call */
323 # ifndef LA_TYPE
324 #  define LA_TYPE	LA_FLOAT
325 # endif
326 #endif
327 
328 
329 /*
330 **  DELL SVR4 Issue 2.2, and others
331 **	From Kimmo Suominen <kim@grendel.lut.fi>
332 **
333 **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
334 **	defined, and the definitions conflict.
335 */
336 
337 #ifdef DELL_SVR4
338 # define SYSTEM5	1
339 /* # define setreuid(r, e)	seteuid(e) */
340 /* # include <sys/time.h> */
341 # define _PATH_UNIX	"/unix"
342 # ifndef _PATH_SENDMAILCF
343 #  define _PATH_SENDMAILCF	"/usr/ucblib/sendmail.cf"
344 # endif
345 # ifndef _PATH_SENDMAILPID
346 #  define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
347 # endif
348 #endif
349 
350 
351 /*
352 **  Apple A/UX 3.0
353 */
354 
355 #ifdef _AUX_SOURCE
356 # define BSD			/* has BSD routines */
357 # define HASSTATFS	1	/* has the statfs(2) syscall */
358 # define HASUNAME	1	/* use System V uname(2) system call */
359 # define HASUSTAT	1	/* use System V ustat(2) syscall */
360 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
361 # define SIGFUNC_DEFINED	/* sigfunc_t already defined */
362 # define FORK		fork
363 # ifndef _PATH_SENDMAILCF
364 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
365 # endif
366 # ifndef LA_TYPE
367 #  define LA_TYPE	LA_ZERO
368 # endif
369 # undef WIFEXITED
370 # undef WEXITSTATUS
371 #endif
372 
373 
374 /*
375 **  Encore UMAX V
376 **
377 **	Not extensively tested.
378 */
379 
380 #ifdef UMAXV
381 # include <limits.h>
382 # define HASUNAME	1	/* use System V uname(2) system call */
383 # define HASSTATFS	1	/* has the statfs(2) syscall */
384 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
385 # define HASINITGROUPS	1	/* has initgroups(3) call */
386 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
387 # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
388 # define FORK		fork	/* no vfork(2) primitive available */
389 # define MAXPATHLEN	PATH_MAX
390 extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
391 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
392 # undef WIFEXITED
393 # undef WEXITSTATUS
394 #endif
395 
396 
397 
398 /**********************************************************************
399 **  End of Per-Operating System defines
400 **********************************************************************/
401 
402 /**********************************************************************
403 **  More general defines
404 **********************************************************************/
405 
406 /* general BSD defines */
407 #ifdef BSD
408 # define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
409 # define HASSETREUID	1	/* has setreuid(2) call */
410 # define HASINITGROUPS	1	/* has initgroups(2) call */
411 # define HASFLOCK	1	/* has flock(2) call */
412 #endif
413 
414 /* general System V defines */
415 # ifdef SYSTEM5
416 # define HASUNAME	1	/* use System V uname(2) system call */
417 # define HASUSTAT	1	/* use System V ustat(2) syscall */
418 # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
419 # ifndef LA_TYPE
420 #  define LA_TYPE	LA_INT
421 # endif
422 # define bcopy(s, d, l)		(memmove((d), (s), (l)))
423 # define bzero(d, l)		(memset((d), '\0', (l)))
424 # define bcmp(s, d, l)		(memcmp((s), (d), (l)))
425 # endif
426 
427 /* general "standard C" defines */
428 #if defined(__STDC__) || defined(SYSTEM5)
429 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
430 #endif
431 
432 /* general POSIX defines */
433 #ifdef _POSIX_VERSION
434 # define HASSETSID	1	/* has setsid(2) call */
435 # define HASWAITPID	1	/* has waitpid(2) call */
436 #endif
437 
438 /*
439 **  If no type for argument two of getgroups call is defined, assume
440 **  it's an integer -- unfortunately, there seem to be several choices
441 **  here.
442 */
443 
444 #ifndef GIDSET_T
445 # define GIDSET_T	int
446 #endif
447 
448 
449 /**********************************************************************
450 **  Remaining definitions should never have to be changed.  They are
451 **  primarily to provide back compatibility for older systems -- for
452 **  example, it includes some POSIX compatibility definitions
453 **********************************************************************/
454 
455 /* System 5 compatibility */
456 #ifndef S_ISREG
457 #define S_ISREG(foo)	((foo & S_IFREG) == S_IFREG)
458 #endif
459 #ifndef S_IWGRP
460 #define S_IWGRP		020
461 #endif
462 #ifndef S_IWOTH
463 #define S_IWOTH		002
464 #endif
465 
466 /*
467 **  Older systems don't have this error code -- it should be in
468 **  /usr/include/sysexits.h.
469 */
470 
471 # ifndef EX_CONFIG
472 # define EX_CONFIG	78	/* configuration error */
473 # endif
474 
475 /*
476 **  These are used in a few cases where we need some special
477 **  error codes, but where the system doesn't provide something
478 **  reasonable.  They are printed in errstring.
479 */
480 
481 #ifndef E_PSEUDOBASE
482 # define E_PSEUDOBASE	256
483 #endif
484 
485 #define EOPENTIMEOUT	(E_PSEUDOBASE + 0)	/* timeout on open */
486 #define E_DNSBASE	(E_PSEUDOBASE + 20)	/* base for DNS h_errno */
487 
488 /* type of arbitrary pointer */
489 #ifndef ARBPTR_T
490 # define ARBPTR_T	void *
491 #endif
492 
493 #ifndef __P
494 # include "cdefs.h"
495 #endif
496 
497 /*
498 **  Do some required dependencies
499 */
500 
501 #if defined(NETINET) || defined(NETISO)
502 # define SMTP		1	/* enable user and server SMTP */
503 # define QUEUE		1	/* enable queueing */
504 # define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
505 #endif
506 
507 
508 /*
509 **  Arrange to use either varargs or stdargs
510 */
511 
512 # ifdef __STDC__
513 
514 # include <stdarg.h>
515 
516 # define VA_LOCAL_DECL	va_list ap;
517 # define VA_START(f)	va_start(ap, f)
518 # define VA_END		va_end(ap)
519 
520 # else
521 
522 # include <varargs.h>
523 
524 # define VA_LOCAL_DECL	va_list ap;
525 # define VA_START(f)	va_start(ap)
526 # define VA_END		va_end(ap)
527 
528 # endif
529 
530 #ifdef HASUNAME
531 # include <sys/utsname.h>
532 # ifdef newstr
533 #  undef newstr
534 # endif
535 #else /* ! HASUNAME */
536 # define NODE_LENGTH 32
537 struct utsname
538 {
539 	char nodename[NODE_LENGTH+1];
540 };
541 #endif /* HASUNAME */
542 
543 #if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_)
544 # define MAXHOSTNAMELEN	256
545 #endif
546 
547 #if !defined(SIGCHLD) && defined(SIGCLD)
548 # define SIGCHLD	SIGCLD
549 #endif
550 
551 #ifndef STDIN_FILENO
552 #define STDIN_FILENO	0
553 #endif
554 
555 #ifndef STDOUT_FILENO
556 #define STDOUT_FILENO	1
557 #endif
558 
559 #ifndef STDERR_FILENO
560 #define STDERR_FILENO	2
561 #endif
562 
563 #ifndef LOCK_SH
564 # define LOCK_SH	0x01	/* shared lock */
565 # define LOCK_EX	0x02	/* exclusive lock */
566 # define LOCK_NB	0x04	/* non-blocking lock */
567 # define LOCK_UN	0x08	/* unlock */
568 #endif
569 
570 #ifndef SIG_ERR
571 # define SIG_ERR	((void (*)()) -1)
572 #endif
573 
574 #ifndef WEXITSTATUS
575 # define WEXITSTATUS(st)	(((st) >> 8) & 0377)
576 #endif
577 #ifndef WIFEXITED
578 # define WIFEXITED(st)		(((st) & 0377) == 0)
579 #endif
580 
581 #ifndef SIGFUNC_DEFINED
582 typedef void		(*sigfunc_t) __P((int));
583 #endif
584 
585 /*
586 **  Size of tobuf (deliver.c)
587 **	Tweak this to match your syslog implementation.  It will have to
588 **	allow for the extra information printed.
589 */
590 
591 #ifndef TOBUFSIZE
592 # define TOBUFSIZE (1024 - 256)
593 #endif
594 
595 /* fork routine -- set above using #ifdef _osname_ or in Makefile */
596 # ifndef FORK
597 # define FORK		vfork		/* function to call to fork mailer */
598 # endif
599