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