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