Initial import from FreeBSD RELENG_4:
[games.git] / contrib / sendmail / include / sm / conf.h
1 /*
2  * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
3  *      All rights reserved.
4  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
5  * Copyright (c) 1988, 1993
6  *      The Regents of the University of California.  All rights reserved.
7  *
8  * By using this file, you agree to the terms and conditions set
9  * forth in the LICENSE file which can be found at the top level of
10  * the sendmail distribution.
11  *
12  *
13  *      $Id: conf.h,v 1.90.2.14 2003/03/06 18:38:06 ca Exp $
14  */
15
16 /*
17 **  CONF.H -- All user-configurable parameters for sendmail
18 **
19 **      Send updates to sendmail@Sendmail.ORG so they will be
20 **      included in the next release.
21 */
22
23 #ifndef SM_CONF_H
24 # define SM_CONF_H 1
25
26
27 # include <sm/config.h>
28 # include <sm/varargs.h>
29
30 /*
31 **  General "standard C" defines.
32 **
33 **      These may be undone later, to cope with systems that claim to
34 **      be Standard C but aren't.  Gcc is the biggest offender -- it
35 **      doesn't realize that the library is part of the language.
36 **
37 **      Life would be much easier if we could get rid of this sort
38 **      of bozo problems.
39 */
40
41 # ifdef __STDC__
42 #  define HASSETVBUF    1       /* we have setvbuf(3) in libc */
43 # endif /* __STDC__ */
44
45 /*
46 **  Assume you have standard calls; can be #undefed below if necessary.
47 */
48
49 # ifndef HASLSTAT
50 #  define HASLSTAT      1       /* has lstat(2) call */
51 # endif /* ! HASLSTAT */
52
53 # ifndef HASNICE
54 #  define HASNICE       1       /* has nice(2) call */
55 # endif /* ! HASNICE */
56
57 # ifndef HASRRESVPORT
58 #  define HASRRESVPORT  1       /* has rrsevport(3) call */
59 # endif /* ! HASRRESVPORT */
60
61 /**********************************************************************
62 **  "Hard" compilation options.
63 **      #define these if they are available; comment them out otherwise.
64 **  These cannot be overridden from the Makefile, and should really not
65 **  be turned off unless absolutely necessary.
66 **********************************************************************/
67
68 #define LOG             1       /* enable logging -- don't turn off */
69
70 /**********************************************************************
71 **  Operating system configuration.
72 **
73 **      Unless you are porting to a new OS, you shouldn't have to
74 **      change these.
75 **********************************************************************/
76
77 /*
78 **  HP-UX -- tested for 8.07, 9.00, and 9.01.
79 **
80 **      If V4FS is defined, compile for HP-UX 10.0.
81 **      11.x support from Richard Allen <ra@hp.is>.
82 */
83
84 # ifdef __hpux
85                 /* common definitions for HP-UX 9.x and 10.x */
86 #  undef m_flags                /* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
87 #  define SYSTEM5       1       /* include all the System V defines */
88 #  define HASINITGROUPS 1       /* has initgroups(3) call */
89 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
90 #  define USESETEUID    1       /* has usable seteuid(2) call */
91 #  define HASSETRESGID  1       /* use setresgid(2) to set saved gid */
92 #  define BOGUS_O_EXCL  1       /* exclusive open follows symlinks */
93 #  define seteuid(e)    setresuid(-1, e, -1)
94 #  define IP_SRCROUTE   1       /* can check IP source routing */
95 #  define LA_TYPE       LA_HPUX
96 #  define SPT_TYPE      SPT_PSTAT
97 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
98 #  define GIDSET_T      gid_t
99 #  define LDA_USE_LOCKF 1
100 #  ifndef HASGETUSERSHELL
101 #   define HASGETUSERSHELL 0    /* getusershell(3) causes core dumps */
102 #  endif /* ! HASGETUSERSHELL */
103 #  ifdef HPUX10
104 #   define _PATH_SENDMAIL       "/usr/sbin/sendmail"
105 #   define SMRSH_CMDDIR         "/var/adm/sm.bin"
106 #  endif /* HPUX10 */
107 #  ifdef HPUX11
108 #   define HASSETREUID  1       /* setreuid(2) works on HP-UX 11.x */
109 #   define HASFCHOWN    1       /* has fchown(2) */
110 #   ifndef BROKEN_RES_SEARCH
111 #    define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
112 #   endif /* ! BROKEN_RES_SEARCH */
113 #   define SMRSH_CMDDIR         "/var/adm/sm.bin"
114 #   define _PATH_SENDMAIL       "/usr/sbin/sendmail"
115 #  else /* HPUX11 */
116 #   ifndef NOT_SENDMAIL
117 #    define syslog      hard_syslog
118 #   endif /* ! NOT_SENDMAIL */
119 #  endif /* HPUX11 */
120 #  define SAFENFSPATHCONF 1     /* pathconf(2) pessimizes on NFS filesystems */
121
122 #  ifdef V4FS
123                 /* HP-UX 10.x */
124 #   define _PATH_UNIX           "/stand/vmunix"
125 #   ifndef _PATH_VENDOR_CF
126 #    define _PATH_VENDOR_CF     "/etc/mail/sendmail.cf"
127 #   endif /* ! _PATH_VENDOR_CF */
128 #   ifndef _PATH_SENDMAILPID
129 #    define _PATH_SENDMAILPID   "/etc/mail/sendmail.pid"
130 #   endif /* ! _PATH_SENDMAILPID */
131 #   ifndef IDENTPROTO
132 #    define IDENTPROTO  1       /* TCP/IP implementation fixed in 10.0 */
133 #   endif /* ! IDENTPROTO */
134 #   include <sys/mpctl.h>       /* for mpctl() in get_num_procs_online() */
135 #  else /* V4FS */
136                 /* HP-UX 9.x */
137 #   define _PATH_UNIX           "/hp-ux"
138 #   ifndef _PATH_VENDOR_CF
139 #    define _PATH_VENDOR_CF     "/usr/lib/sendmail.cf"
140 #   endif /* ! _PATH_VENDOR_CF */
141 #   ifndef IDENTPROTO
142 #    define IDENTPROTO  0       /* TCP/IP implementation is broken */
143 #   endif /* ! IDENTPROTO */
144 #   ifdef __STDC__
145 extern void     hard_syslog(int, char *, ...);
146 #   else /* __STDC__ */
147 extern void     hard_syslog();
148 #   endif /* __STDC__ */
149 #   define FDSET_CAST   (int *) /* cast for fd_set parameters to select */
150 #  endif /* V4FS */
151
152 # endif /* __hpux */
153
154 /*
155 **  IBM AIX 5.x
156 */
157
158 # ifdef _AIX5
159 #  define _AIX4         40300
160 # endif /* _AIX5 */
161
162 /*
163 **  IBM AIX 4.x
164 */
165
166 # ifdef _AIX4
167 #  define _AIX3         1       /* pull in AIX3 stuff */
168 #  define BSD4_4_SOCKADDR       /* has sa_len */
169 #  define USESETEUID    1       /* seteuid(2) works */
170 #  define TZ_TYPE       TZ_NAME /* use tzname[] vector */
171 #  define SOCKOPT_LEN_T size_t  /* arg#5 to getsockopt */
172 #  if _AIX4 >= 40200
173 #   define HASSETREUID  1       /* setreuid(2) works as of AIX 4.2 */
174 #   define SOCKADDR_LEN_T       size_t  /* e.g., arg#3 to accept, getsockname */
175 #  endif /* _AIX4 >= 40200 */
176 #  if defined(_ILS_MACROS)      /* IBM versions aren't side-effect clean */
177 #   undef isascii
178 #   define isascii(c)           !(c & ~0177)
179 #   undef isdigit
180 #   define isdigit(__a)         (_IS(__a,_ISDIGIT))
181 #   undef isspace
182 #   define isspace(__a)         (_IS(__a,_ISSPACE))
183 #  endif /* defined(_ILS_MACROS) */
184 # endif /* _AIX4 */
185
186
187 /*
188 **  IBM AIX 3.x -- actually tested for 3.2.3
189 */
190
191 # ifdef _AIX3
192 #  include <paths.h>
193 #  include <sys/machine.h>      /* to get byte order */
194 #  include <sys/select.h>
195 #  define HASFCHOWN     1       /* has fchown(2) */
196 #  define HASINITGROUPS 1       /* has initgroups(3) call */
197 #  define HASUNAME      1       /* use System V uname(2) system call */
198 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
199 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
200 #  define IP_SRCROUTE   0       /* Something is broken with getsockopt() */
201 #  define GIDSET_T      gid_t
202 #  define SFS_TYPE      SFS_STATFS      /* use <sys/statfs.h> statfs() impl */
203 #  define SPT_PADCHAR   '\0'    /* pad process title with nulls */
204 #  define LA_TYPE       LA_INT
205 #  define FSHIFT        16
206 #  define LA_AVENRUN    "avenrun"
207 #  if !defined(_AIX4) || _AIX4 < 40300
208 #   ifndef __BIT_TYPES_DEFINED__
209 #    define SM_INT32    int
210 #   endif /* __BIT_TYPES_DEFINED__ */
211 #  endif /* !defined(_AIX4) || _AIX4 < 40300 */
212 #  if !defined(_AIX4) || _AIX4 < 40200
213 #   define SM_CONF_SYSLOG       0
214 #  endif /* !defined(_AIX4) || _AIX4 < 40200 */
215 # endif /* _AIX3 */
216
217
218 /*
219 **  IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
220 **
221 **      From Mark Whetzel <markw@wg.waii.com>.
222 */
223
224 # ifdef AIX                     /* AIX/RT compiler pre-defines this */
225 #  include <paths.h>
226 #  include <sys/time.h>         /* AIX/RT resource.h does NOT include this */
227 #  define HASINITGROUPS 1       /* has initgroups(3) call */
228 #  define HASUNAME      1       /* use System V uname(2) system call */
229 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
230 #  define HASFCHMOD     0       /* does not have fchmod(2) syscall */
231 #  define HASSETREUID   1       /* use setreuid(2) -lbsd system call */
232 #  define HASSETVBUF    1       /* use setvbuf(2) system call */
233 #  define HASSETRLIMIT  0       /* does not have setrlimit call */
234 #  define HASFLOCK      0       /* does not have flock call - use fcntl */
235 #  define HASULIMIT     1       /* use ulimit instead of setrlimit call */
236 #  define SM_CONF_GETOPT        0       /* Do we need theirs or ours */
237 #  define SYS5SETPGRP   1       /* don't have setpgid on AIX/RT */
238 #  define IP_SRCROUTE   0       /* Something is broken with getsockopt() */
239 #  define BSD4_3                1       /* NOT bsd 4.4 or posix signals */
240 #  define GIDSET_T      int
241 #  define SFS_TYPE      SFS_STATFS      /* use <sys/statfs.h> statfs() impl */
242 #  define SPT_PADCHAR   '\0'            /* pad process title with nulls */
243 #  define LA_TYPE       LA_SUBR         /* use our ported loadavgd daemon */
244 #  define TZ_TYPE       TZ_TZNAME       /* use tzname[] vector */
245 #  define ARBPTR_T      int *
246 #  define void          int
247 typedef int             pid_t;
248 /* RTisms for BSD compatibility, specified in the Makefile
249   define BSD            1
250   define BSD_INCLUDES           1
251   define BSD_REMAP_SIGNAL_TO_SIGVEC
252     RTisms needed above */
253 /* make this sendmail in a completely different place */
254 #  ifndef _PATH_VENDOR_CF
255 #   define _PATH_VENDOR_CF      "/usr/local/newmail/sendmail.cf"
256 #  endif /* ! _PATH_VENDOR_CF */
257 #  ifndef _PATH_SENDMAILPID
258 #   define _PATH_SENDMAILPID    "/usr/local/newmail/sendmail.pid"
259 #  endif /* ! _PATH_SENDMAILPID */
260 # endif /* AIX */
261
262 # if defined(_AIX)
263 #  define LDA_USE_LOCKF         1
264 #  define LDA_USE_SETEUID       1
265 # endif /* defined(_AIX) */
266
267 /*
268 **  Silicon Graphics IRIX
269 **
270 **      Compiles on 4.0.1.
271 **
272 **      Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
273 **      Use IRIX5 instead of IRIX for IRIX 5.x.
274 **
275 **      IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
276 **      IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
277 */
278
279 # ifdef IRIX
280 #  define SYSTEM5       1       /* this is a System-V derived system */
281 #  define HASSETREUID   1       /* has setreuid(2) call */
282 #  define HASINITGROUPS 1       /* has initgroups(3) call */
283 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
284 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
285 #  define IP_SRCROUTE   1       /* can check IP source routing */
286 #  define setpgid       BSDsetpgrp
287 #  define GIDSET_T      gid_t
288 #  define SFS_TYPE      SFS_4ARGS       /* four argument statfs() call */
289 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
290 #  define SYSLOG_BUFSIZE 512
291 #  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
292     /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
293 #   define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
294 #  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
295 #  ifdef IRIX6
296 #   define STAT64       1
297 #   define QUAD_T       unsigned long long
298 #   define LA_TYPE      LA_IRIX6        /* figure out at run time */
299 #   define SAFENFSPATHCONF 0    /* pathconf(2) lies on NFS filesystems */
300 #  else /* IRIX6 */
301 #   define LA_TYPE      LA_INT
302
303 #   ifdef IRIX64
304 #    define STAT64      1
305 #    define QUAD_T      unsigned long long
306 #    define NAMELISTMASK        0x7fffffffffffffff      /* mask for nlist() values */
307 #   else /* IRIX64 */
308 #    define STAT64      0
309 #    define NAMELISTMASK        0x7fffffff              /* mask for nlist() values */
310 #   endif /* IRIX64 */
311 #  endif /* IRIX6 */
312 #  if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
313 #   include <sys/cdefs.h>
314 #   include <paths.h>
315 #   define ARGV_T       char *const *
316 #   define HASFCHOWN    1       /* has fchown(2) */
317 #   define HASSETRLIMIT 1       /* has setrlimit(2) syscall */
318 #   define HASGETDTABLESIZE 1   /* has getdtablesize(2) syscall */
319 #   define HASSTRERROR  1       /* has strerror(3) */
320 #  else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
321 #   define ARGV_T       const char **
322 #   define WAITUNION    1       /* use "union wait" as wait argument type */
323 #  endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
324 # endif /* IRIX */
325
326
327 /*
328 **  SunOS and Solaris
329 **
330 **      Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
331 **      Solaris 2.4 (a.k.a. SunOS 5.4).
332 */
333
334 # if defined(sun) && !defined(BSD)
335
336 #  include <sys/time.h>
337 #  define HASINITGROUPS 1       /* has initgroups(3) call */
338 #  define HASUNAME      1       /* use System V uname(2) system call */
339 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
340 #  define IP_SRCROUTE   1       /* can check IP source routing */
341 #  define SAFENFSPATHCONF 1     /* pathconf(2) pessimizes on NFS filesystems */
342 #  ifndef HASFCHOWN
343 #   define HASFCHOWN    1       /* fchown(2) */
344 #  endif /* ! HASFCHOWN */
345
346 #  ifdef __svr4__
347 #   define LDA_USE_LOCKF                1
348 #   define LDA_USE_SETEUID      1
349 #   define _PATH_MAILDIR                "/var/mail"
350 #  endif /* __svr4__ */
351
352 #  ifdef SOLARIS_2_3
353 #   define SOLARIS      20300   /* for back compat only -- use -DSOLARIS=20300 */
354 #  endif /* SOLARIS_2_3 */
355
356 #  if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
357 #   define SOLARIS      1       /* unknown Solaris version */
358 #  endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
359
360 #  ifdef SOLARIS
361                         /* Solaris 2.x (a.k.a. SunOS 5.x) */
362 #   ifndef __svr4__
363 #    define __svr4__            /* use all System V Release 4 defines below */
364 #   endif /* ! __svr4__ */
365 #   define GIDSET_T     gid_t
366 #   define USE_SA_SIGACTION     1       /* use sa_sigaction field */
367 #   define BROKEN_PTHREAD_SLEEP 1       /* sleep after pthread_create() fails */
368 #   define HASSTRERROR  1       /* has strerror(3) */
369 #   ifndef _PATH_UNIX
370 #    define _PATH_UNIX          "/dev/ksyms"
371 #   endif /* ! _PATH_UNIX */
372 #   ifndef _PATH_VENDOR_CF
373 #    define _PATH_VENDOR_CF     "/etc/mail/sendmail.cf"
374 #   endif /* ! _PATH_VENDOR_CF */
375 #   ifndef _PATH_SENDMAILPID
376 #    define _PATH_SENDMAILPID   "/etc/mail/sendmail.pid"
377 #   endif /* ! _PATH_SENDMAILPID */
378 #   ifndef _PATH_HOSTS
379 #    define _PATH_HOSTS         "/etc/inet/hosts"
380 #   endif /* ! _PATH_HOSTS */
381 #   ifndef SYSLOG_BUFSIZE
382 #    define SYSLOG_BUFSIZE      1024    /* allow full size syslog buffer */
383 #   endif /* ! SYSLOG_BUFSIZE */
384 #   ifndef TZ_TYPE
385 #    define TZ_TYPE     TZ_TZNAME
386 #   endif /* ! TZ_TYPE */
387 #   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
388 #    define USESETEUID          1       /* seteuid works as of 2.3 */
389 #    define LDA_CONTENTLENGTH   1       /* Needs the Content-Length header */
390 #   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
391 #   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
392 #    define HASSETREUID 1               /* setreuid works as of 2.5 */
393 #    define HASSETREGID 1       /* use setregid(2) to set saved gid */
394 #    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
395 #     ifndef LA_TYPE
396 #      define LA_TYPE   LA_KSTAT        /* use kstat(3k) -- may work in < 2.5 */
397 #     endif /* ! LA_TYPE */
398 #     ifndef RANDOMSHIFT                /* random() doesn't work well (sometimes) */
399 #      define RANDOMSHIFT       8
400 #     endif /* ! RANDOMSHIFT */
401 #    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
402 #   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
403 #    ifndef HASRANDOM
404 #     define HASRANDOM  0               /* doesn't have random(3) */
405 #    endif /* ! HASRANDOM */
406 #   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
407 #   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
408 #    define SM_INT32    int     /* 32bit integer */
409 #   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
410 #   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
411 #    ifndef LA_TYPE
412 #     include <sys/loadavg.h>
413 #     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
414 #      include <sys/pset.h>
415 #      define LA_TYPE   LA_PSET /* pset_getloadavg(3c) appears in 2.9 */
416 #     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
417 #      define LA_TYPE   LA_SUBR /* getloadavg(3c) appears in 2.7 */
418 #     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
419 #    endif /* ! LA_TYPE */
420 #    define HASGETUSERSHELL 1   /* getusershell(3c) bug fixed in 2.7 */
421 #   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
422 #   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
423 #    undef _PATH_SENDMAILPID    /* tmpfs /var/run added in 2.8 */
424 #    define _PATH_SENDMAILPID   "/var/run/sendmail.pid"
425 #    define SMRSH_CMDDIR                "/var/adm/sm.bin"
426 #    define SL_FUDGE    34      /* fudge offset for SyslogPrefixLen */
427 #   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
428 #   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
429 #    define HASURANDOMDEV       1       /* /dev/[u]random added in S9 */
430 #   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
431 #   ifndef HASGETUSERSHELL
432 #    define HASGETUSERSHELL 0   /* getusershell(3) causes core dumps pre-2.7 */
433 #   endif /* ! HASGETUSERSHELL */
434
435 #  else /* SOLARIS */
436                         /* SunOS 4.0.3 or 4.1.x */
437 #   define HASGETUSERSHELL 1    /* DOES have getusershell(3) call in libc */
438 #   define HASSETREUID  1       /* has setreuid(2) call */
439 #   ifndef HASFLOCK
440 #    define HASFLOCK    1       /* has flock(2) call */
441 #   endif /* ! HASFLOCK */
442 #   define SFS_TYPE     SFS_VFS /* use <sys/vfs.h> statfs() implementation */
443 #   define TZ_TYPE      TZ_TM_ZONE      /* use tm->tm_zone */
444 #   include <memory.h>
445 #   include <vfork.h>
446 #   ifdef __GNUC__
447 #    define strtoul     strtol  /* gcc library bogosity */
448 #   endif /* __GNUC__ */
449 #   define memmove(d, s, l)     (bcopy((s), (d), (l)))
450 #   define atexit(f)    on_exit((f), 0) /* ugly hack for SunOS */
451 #   define SM_INT32     int     /* 32bit integer */
452 #   define SM_ALIGN_SIZE (sizeof(long))
453 #   define GIDSET_T     int
454 #   define SM_CONF_SYSLOG       0
455
456 #   ifdef SUNOS403
457                         /* special tweaking for SunOS 4.0.3 */
458 #    include <malloc.h>
459 #    define BSD4_3      1       /* 4.3 BSD-based */
460 #    define NEEDSTRSTR  1       /* need emulation of strstr(3) routine */
461 #    define WAITUNION   1       /* use "union wait" as wait argument type */
462 #    undef WIFEXITED
463 #    undef WEXITSTATUS
464 #    undef HASUNAME
465 #    define setpgid     setpgrp
466 #    define MODE_T      int
467 typedef int             pid_t;
468 extern char             *getenv();
469
470 #   else /* SUNOS403 */
471                         /* 4.1.x specifics */
472 #    define HASSETSID   1       /* has Posix setsid(2) call */
473 #    define HASSETVBUF  1       /* we have setvbuf(3) in libc */
474
475 #   endif /* SUNOS403 */
476 #  endif /* SOLARIS */
477
478 #  ifndef LA_TYPE
479 #   define LA_TYPE      LA_INT
480 #  endif /* ! LA_TYPE */
481
482 # endif /* defined(sun) && !defined(BSD) */
483
484 /*
485 **  DG/UX
486 **
487 **      Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
488 **      older support.
489 **      5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
490 */
491
492 # ifdef DGUX_5_4_2
493 #  define DGUX          1
494 # endif /* DGUX_5_4_2 */
495
496 # ifdef DGUX
497 #  define SYSTEM5       1
498 #  define LA_TYPE       LA_DGUX
499 #  define HASSETREUID   1       /* has setreuid(2) call */
500 #  define HASUNAME      1       /* use System V uname(2) system call */
501 #  define HASSETSID     1       /* has Posix setsid(2) call */
502 #  define HASINITGROUPS 1       /* has initgroups(3) call */
503 #  define IP_SRCROUTE   0       /* does not have <netinet/ip_var.h> */
504 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) */
505 #  ifndef IDENTPROTO
506 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
507 #  endif /* ! IDENTPROTO */
508 #  define SPT_TYPE      SPT_NONE        /* don't use setproctitle */
509 #  define SFS_TYPE      SFS_4ARGS       /* four argument statfs() call */
510 #  define LDA_USE_LOCKF         1
511
512 /* these include files must be included early on DG/UX */
513 #  include <netinet/in.h>
514 #  include <arpa/inet.h>
515
516 /* compiler doesn't understand const? */
517 #  define const
518
519 #  ifdef DGUX_5_4_2
520 #   define inet_addr    dgux_inet_addr
521 extern long     dgux_inet_addr();
522 #  endif /* DGUX_5_4_2 */
523 # endif /* DGUX */
524
525
526 /*
527 **  Digital Ultrix 4.2 - 4.5
528 **
529 **      Apparently, fcntl locking is broken on 4.2A, in that locks are
530 **      not dropped when the process exits.  This causes major problems,
531 **      so flock is the only alternative.
532 */
533
534 # ifdef ultrix
535 #  define HASSETREUID   1       /* has setreuid(2) call */
536 #  define HASUNSETENV   1       /* has unsetenv(3) call */
537 #  define HASINITGROUPS 1       /* has initgroups(3) call */
538 #  define HASUNAME      1       /* use System V uname(2) system call */
539 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
540 #  define HASFCHOWN     1       /* has fchown(2) syscall */
541 #  ifndef HASFLOCK
542 #   define HASFLOCK     1       /* has flock(2) call */
543 #  endif /* ! HASFLOCK */
544 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
545 #  ifndef BROKEN_RES_SEARCH
546 #   define BROKEN_RES_SEARCH 1  /* res_search(unknown) returns h_errno=0 */
547 #  endif /* ! BROKEN_RES_SEARCH */
548 #  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
549 #   define NEEDLOCAL_HOSTNAME_LENGTH    1       /* see sendmail/README */
550 #  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
551 #  ifdef vax
552 #   define LA_TYPE      LA_FLOAT
553 #  else /* vax */
554 #   define LA_TYPE      LA_INT
555 #   define LA_AVENRUN   "avenrun"
556 #  endif /* vax */
557 #  define SFS_TYPE      SFS_MOUNT       /* use <sys/mount.h> statfs() impl */
558 #  ifndef IDENTPROTO
559 #   define IDENTPROTO   0       /* pre-4.4 TCP/IP implementation is broken */
560 #  endif /* ! IDENTPROTO */
561 #  define SYSLOG_BUFSIZE        256
562 #  define SM_CONF_SYSLOG        0
563 # endif /* ultrix */
564
565
566 /*
567 **  OSF/1 for KSR.
568 **
569 **      Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
570 */
571
572 # ifdef __ksr__
573 #  define __osf__       1       /* get OSF/1 defines below */
574 #  ifndef TZ_TYPE
575 #   define TZ_TYPE      TZ_TZNAME       /* use tzname[] vector */
576 #  endif /* ! TZ_TYPE */
577 # endif /* __ksr__ */
578
579
580 /*
581 **  OSF/1 for Intel Paragon.
582 **
583 **      Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
584 **      of Intel Scalable Systems Divison.
585 */
586
587 # ifdef __PARAGON__
588 #  define __osf__       1       /* get OSF/1 defines below */
589 #  ifndef TZ_TYPE
590 #   define TZ_TYPE      TZ_TZNAME       /* use tzname[] vector */
591 #  endif /* ! TZ_TYPE */
592 #  define GIDSET_T      gid_t
593 #  define MAXNAMLEN     NAME_MAX
594 # endif /* __PARAGON__ */
595
596
597 /*
598 **  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
599 **
600 **      Tested for 3.2 and 4.0.
601 */
602
603 # ifdef __osf__
604 #  define HASUNAME      1       /* has uname(2) call */
605 #  define HASUNSETENV   1       /* has unsetenv(3) call */
606 #  define USESETEUID    1       /* has usable seteuid(2) call */
607 #  define HASINITGROUPS 1       /* has initgroups(3) call */
608 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
609 #  define HASFCHOWN     1       /* has fchown(2) syscall */
610 #  define HASSETLOGIN   1       /* has setlogin(2) */
611 #  define IP_SRCROUTE   1       /* can check IP source routing */
612 #  define HAS_ST_GEN    1       /* has st_gen field in stat struct */
613 #  define GIDSET_T      gid_t
614 #  define SM_INT32      int     /* 32bit integer */
615 #  ifndef HASFLOCK
616 #   include <standards.h>
617 #   if _XOPEN_SOURCE+0 >= 400
618 #    define HASFLOCK    0       /* 5.0 and later has bad flock(2) call */
619 #   else /* _XOPEN_SOURCE+0 >= 400 */
620 #    define HASFLOCK    1       /* has flock(2) call */
621 #   endif /* _XOPEN_SOURCE+0 >= 400 */
622 #  endif /* ! HASFLOCK */
623 #  define LA_TYPE       LA_ALPHAOSF
624 #  define SFS_TYPE      SFS_STATVFS     /* use <sys/statvfs.h> statfs() impl */
625 #  ifndef _PATH_VENDOR_CF
626 #   define _PATH_VENDOR_CF      "/var/adm/sendmail/sendmail.cf"
627 #  endif /* ! _PATH_VENDOR_CF */
628 #  ifndef _PATH_SENDMAILPID
629 #   define _PATH_SENDMAILPID    "/var/run/sendmail.pid"
630 #  endif /* ! _PATH_SENDMAILPID */
631 #  if _FFR_DIGUNIX_SAFECHOWN
632 /*
633 **  Testing on a Digital UNIX 4.0a system showed this to be the correct
634 **  setting but given the security consequences, more testing and
635 **  verification is needed.  Unfortunately, the man page offers no
636 **  assistance.
637 */
638 #   define IS_SAFE_CHOWN >= 0
639 #  endif /* _FFR_DIGUNIX_SAFECHOWN */
640 # endif /* __osf__ */
641
642
643 /*
644 **  NeXTstep
645 */
646
647 # ifdef NeXT
648 #  define HASINITGROUPS 1       /* has initgroups(3) call */
649 #  define NEEDPUTENV    2       /* need putenv(3) call; no setenv(3) call */
650 #  ifndef HASFLOCK
651 #   define HASFLOCK     1       /* has flock(2) call */
652 #  endif /* ! HASFLOCK */
653 #  define UID_T         int     /* compiler gripes on uid_t */
654 #  define GID_T         int     /* ditto for gid_t */
655 #  define MODE_T        int     /* and mode_t */
656 #  define setpgid       setpgrp
657 #  ifndef NOT_SENDMAIL
658 #   define sleep                sleepX
659 #  endif /* ! NOT_SENDMAIL */
660 #  ifndef LA_TYPE
661 #   define LA_TYPE      LA_MACH
662 #  endif /* ! LA_TYPE */
663 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
664 #  ifdef _POSIX_SOURCE
665 extern struct passwd    *getpwent();
666 #  else /* _POSIX_SOURCE */
667 #   define SM_CONF_GETOPT       0       /* need a replacement for getopt(3) */
668 #   define WAITUNION    1       /* use "union wait" as wait argument type */
669 typedef int             pid_t;
670 #   undef WEXITSTATUS
671 #   undef WIFEXITED
672 #   undef WIFSTOPPED
673 #   undef WTERMSIG
674 #  endif /* _POSIX_SOURCE */
675 #  ifndef _PATH_VENDOR_CF
676 #   define _PATH_VENDOR_CF      "/etc/sendmail/sendmail.cf"
677 #  endif /* ! _PATH_VENDOR_CF */
678 #  ifndef _PATH_SENDMAILPID
679 #   define _PATH_SENDMAILPID    "/etc/sendmail/sendmail.pid"
680 #  endif /* ! _PATH_SENDMAILPID */
681 #  define SM_INT32      int     /* 32bit integer */
682
683 #  ifdef TCPWRAPPERS
684 #   ifndef HASUNSETENV
685 #    define HASUNSETENV 1
686 #   endif /* ! HASUNSETENV */
687 #   undef NEEDPUTENV
688 #  endif /* TCPWRAPPERS */
689 #  ifndef __APPLE__
690 #   include <libc.h>
691 #   ifndef S_IRUSR
692 #    define S_IRUSR     S_IREAD
693 #   endif /* ! S_IRUSR */
694 #   ifndef S_IWUSR
695 #    define S_IWUSR     S_IWRITE
696 #   endif /* ! S_IWUSR */
697 #   define _PATH_MAILDIR        "/usr/spool/mail"
698 #  endif /* ! __APPLE__ */
699 #  ifndef isascii
700 #   define isascii(c)   ((unsigned)(c) <= 0177)
701 #  endif /* ! isascii */
702 # endif /* NeXT */
703
704 /*
705 **  Apple Darwin (aka Rhapsody)
706 **
707 **      Contributed by Wilfredo Sanchez <wsanchez@mit.edu>
708 */
709
710 # if defined(DARWIN)
711 #  define HASFCHMOD             1       /* has fchmod(2) */
712 #  define HASFCHOWN             1       /* has fchown(2) */
713 #  define HASFLOCK              1       /* has flock(2) */
714 #  define HASUNAME              1       /* has uname(2) */
715 #  define HASUNSETENV           1       /* has unsetenv(3) */
716 #  define HASSETSID             1       /* has the setsid(2) */
717 #  define HASINITGROUPS 1       /* has initgroups(3) */
718 #  define HASSETVBUF            1       /* has setvbuf (3) */
719 #  define HASSETREUID           0       /* setreuid(2) unusable */
720 #  define HASSETEUID            1       /* has seteuid(2) */
721 #  define USESETEUID            1       /* has seteuid(2) */
722 #  define HASSETEGID            1       /* has setegid(2) */
723 #  define HASSETREGID           1       /* has setregid(2) */
724 #  define HASSETRESGID          0       /* no setresgid(2) */
725 #  define HASLSTAT              1       /* has lstat(2) */
726 #  define HASSETRLIMIT          1       /* has setrlimit(2) */
727 #  define HASWAITPID            1       /* has waitpid(2) */
728 #  define HASGETDTABLESIZE      1       /* has getdtablesize(2) */
729 #  define HAS_ST_GEN            1       /* has st_gen field in struct stat */
730 #  define HASURANDOMDEV 1       /* has urandom(4) */
731 #  define HASSTRERROR           1       /* has strerror(3) */
732 #  define HASGETUSERSHELL       1       /* had getusershell(3) */
733 #  define GIDSET_T              gid_t   /* getgroups(2) takes gid_t */
734 #  define LA_TYPE               LA_SUBR /* use getloadavg(3) */
735 #  define SFS_TYPE              SFS_MOUNT       /* use <sys/mount.h> statfs() impl */
736 #  define SPT_TYPE              SPT_PSSTRINGS   /* use magic PS_STRINGS pointer for setproctitle */
737 #  define ERRLIST_PREDEFINED            /* don't declare sys_errlist */
738 #  define BSD4_4_SOCKADDR               /* struct sockaddr has sa_len */
739 #  define SAFENFSPATHCONF       0       /* unverified: pathconf(2) doesn't work on NFS */
740 #  define HAS_IN_H              1
741 #  define NETLINK               1       /* supports AF_LINK */
742 #  ifndef NOT_SENDMAIL
743 #   define sleep sleepX
744 extern unsigned int sleepX __P((unsigned int seconds));
745 #  endif /* ! NOT_SENDMAIL */
746 # endif /* defined(DARWIN) */
747
748
749 /*
750 **  4.4 BSD
751 **
752 **      See also BSD defines.
753 */
754
755 # if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__)
756 #  include <paths.h>
757 #  define HASUNSETENV   1       /* has unsetenv(3) call */
758 #  define USESETEUID    1       /* has usable seteuid(2) call */
759 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
760 #  define HASFCHOWN     1       /* has fchown(2) syscall */
761 #  define HASSTRERROR   1       /* has strerror(3) */
762 #  define HAS_ST_GEN    1       /* has st_gen field in stat struct */
763 #  include <sys/cdefs.h>
764 #  define ERRLIST_PREDEFINED    /* don't declare sys_errlist */
765 #  define BSD4_4_SOCKADDR       /* has sa_len */
766 #  define NEED_PRINTF_PERCENTQ  1       /* doesn't have %lld */
767 #  define NETLINK       1       /* supports AF_LINK */
768 #  ifndef LA_TYPE
769 #   define LA_TYPE      LA_SUBR
770 #  endif /* ! LA_TYPE */
771 #  define SFS_TYPE      SFS_MOUNT       /* use <sys/mount.h> statfs() impl */
772 #  define SPT_TYPE      SPT_PSSTRINGS   /* use PS_STRINGS pointer */
773 # endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) */
774
775
776 /*
777 **  BSD/OS (was BSD/386) (all versions)
778 **      From Tony Sanders, BSDI
779 */
780
781 # ifdef __bsdi__
782 #  include <paths.h>
783 #  define HASUNSETENV   1       /* has the unsetenv(3) call */
784 #  define HASSETREUID   0       /* BSD-OS has broken setreuid(2) emulation */
785 #  define HASSETSID     1       /* has the setsid(2) POSIX syscall */
786 #  define USESETEUID    1       /* has usable seteuid(2) call */
787 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
788 #  define HASSETLOGIN   1       /* has setlogin(2) */
789 #  define HASUNAME      1       /* has uname(2) syscall */
790 #  define HASSTRERROR   1       /* has strerror(3) */
791 #  define HAS_ST_GEN    1       /* has st_gen field in stat struct */
792 #  include <sys/cdefs.h>
793 #  define ERRLIST_PREDEFINED    /* don't declare sys_errlist */
794 #  define BSD4_4_SOCKADDR       /* has sa_len */
795 #  define NETLINK       1       /* supports AF_LINK */
796 #  define SFS_TYPE      SFS_MOUNT       /* use <sys/mount.h> statfs() impl */
797 #  ifndef LA_TYPE
798 #   define LA_TYPE      LA_SUBR
799 #  endif /* ! LA_TYPE */
800 #  define GIDSET_T      gid_t
801 #  define QUAD_T                quad_t
802 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
803                         /* version 1.1 or later */
804 #   undef SPT_TYPE
805 #   define SPT_TYPE     SPT_BUILTIN     /* setproctitle is in libc */
806 #  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
807                         /* version 1.0 or earlier */
808 #   define SPT_PADCHAR  '\0'    /* pad process title with nulls */
809 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
810 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 /* on 3.x */
811 #   define HASSETUSERCONTEXT 1  /* has setusercontext */
812 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
813 #  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 /* 3.1 and earlier */
814 #   define MODE_T       int     /* va_arg() can't handle less than int */
815 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
816 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 /* on 4.x */
817 #   define HASURANDOMDEV        1       /* has /dev/urandom(4) */
818 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
819 # endif /* __bsdi__ */
820
821
822 /*
823 **  QNX 4.2x
824 **      Contributed by Glen McCready <glen@qnx.com>.
825 **
826 **      Should work with all versions of QNX.
827 */
828
829 # if defined(__QNX__)
830 #  include <unix.h>
831 #  include <sys/select.h>
832 #  undef NGROUPS_MAX
833 #  define HASSETSID     1       /* has the setsid(2) POSIX syscall */
834 #  define USESETEUID    1       /* has usable seteuid(2) call */
835 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
836 #  define HASGETDTABLESIZE 1    /* has getdtablesize(2) call */
837 #  define HASSETREUID   1       /* has setreuid(2) call */
838 #  define HASSTRERROR   1       /* has strerror(3) */
839 #  define HASFLOCK      0
840 #  undef HASINITGROUPS          /* has initgroups(3) call */
841 #  define SM_CONF_GETOPT        0       /* need a replacement for getopt(3) */
842 #  define IP_SRCROUTE   1       /* can check IP source routing */
843 #  define TZ_TYPE       TZ_TMNAME       /* use tmname variable */
844 #  define GIDSET_T      gid_t
845 #  define LA_TYPE       LA_ZERO
846 #  define SFS_TYPE      SFS_NONE
847 #  define SPT_TYPE      SPT_REUSEARGV
848 #  define SPT_PADCHAR   '\0'    /* pad process title with nulls */
849 #  define HASGETUSERSHELL 0
850 #  define E_PSEUDOBASE  512
851 #  define _FILE_H_INCLUDED
852 # endif /* defined(__QNX__) */
853
854
855 /*
856 **  FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
857 **
858 **  4.3BSD clone, closer to 4.4BSD      for FreeBSD 1.x and NetBSD 0.9x
859 **  4.4BSD-Lite based                   for FreeBSD 2.x and NetBSD 1.x
860 **
861 **      See also BSD defines.
862 */
863
864 # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
865 #  include <paths.h>
866 #  define HASUNSETENV   1       /* has unsetenv(3) call */
867 #  define HASSETSID     1       /* has the setsid(2) POSIX syscall */
868 #  define USESETEUID    1       /* has usable seteuid(2) call */
869 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
870 #  define HASFCHOWN     1       /* fchown(2) */
871 #  define HASUNAME      1       /* has uname(2) syscall */
872 #  define HASSTRERROR   1       /* has strerror(3) */
873 #  define HAS_ST_GEN    1       /* has st_gen field in stat struct */
874 #  define NEED_PRINTF_PERCENTQ  1       /* doesn't have %lld */
875 #  include <sys/cdefs.h>
876 #  define ERRLIST_PREDEFINED    /* don't declare sys_errlist */
877 #  define BSD4_4_SOCKADDR       /* has sa_len */
878 #  define NETLINK       1       /* supports AF_LINK */
879 #  define SAFENFSPATHCONF 1     /* pathconf(2) pessimizes on NFS filesystems */
880 #  define GIDSET_T      gid_t
881 #  define QUAD_T                unsigned long long
882 #  ifndef LA_TYPE
883 #   define LA_TYPE      LA_SUBR
884 #  endif /* ! LA_TYPE */
885 #  define SFS_TYPE      SFS_MOUNT       /* use <sys/mount.h> statfs() impl */
886 #  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
887 #   undef SPT_TYPE
888 #   define SPT_TYPE     SPT_BUILTIN     /* setproctitle is in libc */
889 #  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
890 #  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
891 #   define HASURANDOMDEV        1       /* has /dev/urandom(4) */
892 #  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
893 #  if defined(__FreeBSD__)
894 #   define HASSETLOGIN  1       /* has setlogin(2) */
895 #   if __FreeBSD_version >= 227001
896 #    define HASSRANDOMDEV       1       /* has srandomdev(3) */
897 #    define HASURANDOMDEV       1       /* has /dev/urandom(4) */
898 #   endif /* __FreeBSD_version >= 227001 */
899 #   undef SPT_TYPE
900 #   if __FreeBSD__ >= 2
901 #    include <osreldate.h>
902 #    if __FreeBSD_version >= 199512     /* 2.2-current when it appeared */
903 #     include <libutil.h>
904 #     define SPT_TYPE   SPT_BUILTIN
905 #    endif /* __FreeBSD_version >= 199512 */
906 #    if __FreeBSD_version >= 222000     /* 2.2.2-release and later */
907 #     define HASSETUSERCONTEXT  1       /* BSDI-style login classes */
908 #    endif /* __FreeBSD_version >= 222000 */
909 #    if __FreeBSD_version >= 330000     /* 3.3.0-release and later */
910 #     define SMRSH_CMDDIR       "/usr/libexec/sm.bin"
911 #     define SMRSH_PATH         "/bin:/usr/bin"
912 #    endif /* __FreeBSD_version >= 330000 */
913 #    define USESYSCTL           1       /* use sysctl(3) for getting ncpus */
914 #    include <sys/sysctl.h>
915 #   endif /* __FreeBSD__ >= 2 */
916 #   ifndef SPT_TYPE
917 #    define SPT_TYPE    SPT_REUSEARGV
918 #    define SPT_PADCHAR '\0'            /* pad process title with nulls */
919 #   endif /* ! SPT_TYPE */
920 #  endif /* defined(__FreeBSD__) */
921 #  if defined(__OpenBSD__)
922 #   undef SPT_TYPE
923 #   define SPT_TYPE     SPT_BUILTIN     /* setproctitle is in libc */
924 #   define HASSETLOGIN  1       /* has setlogin(2) */
925 #   define HASSETREUID  0       /* OpenBSD has broken setreuid(2) emulation */
926 #   define HASSETEGID   1       /* use setegid(2) to set saved gid */
927 #   define HASURANDOMDEV        1       /* has /dev/urandom(4) */
928 #   if OpenBSD >= 200006
929 #    define HASSRANDOMDEV       1       /* has srandomdev(3) */
930 #   endif /* OpenBSD >= 200006 */
931 #   if OpenBSD >= 200012
932 #    define HASSETUSERCONTEXT   1       /* BSDI-style login classes */
933 #   endif /* OpenBSD >= 200012 */
934 #  endif /* defined(__OpenBSD__) */
935 # endif /* defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
936
937
938 /*
939 **  Mach386
940 **
941 **      For mt Xinu's Mach386 system.
942 */
943
944 # if defined(MACH) && defined(i386) && !defined(__GNU__)
945 #  define MACH386       1
946 #  define HASUNSETENV   1       /* has unsetenv(3) call */
947 #  define HASINITGROUPS 1       /* has initgroups(3) call */
948 #  ifndef HASFLOCK
949 #   define HASFLOCK     1       /* has flock(2) call */
950 #  endif /* ! HASFLOCK */
951 #  define SM_CONF_GETOPT        0       /* need a replacement for getopt(3) */
952 #  define NEEDSTRTOL    1       /* need the strtol() function */
953 #  define setpgid       setpgrp
954 #  ifndef LA_TYPE
955 #   define LA_TYPE      LA_FLOAT
956 #  endif /* ! LA_TYPE */
957 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
958 #  undef HASSETVBUF             /* don't actually have setvbuf(3) */
959 #  undef WEXITSTATUS
960 #  undef WIFEXITED
961 #  ifndef _PATH_VENDOR_CF
962 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
963 #  endif /* ! _PATH_VENDOR_CF */
964 #  ifndef _PATH_SENDMAILPID
965 #   define _PATH_SENDMAILPID    "/etc/sendmail.pid"
966 #  endif /* ! _PATH_SENDMAILPID */
967 # endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
968
969
970
971 /*
972 **  GNU OS (hurd)
973 **      Largely BSD & posix compatible.
974 **      Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
975 **      Updated by Mark Kettenis <kettenis@wins.uva.nl>.
976 */
977
978 # if defined(__GNU__) && !defined(NeXT)
979 #  include <paths.h>
980 #  define HASFCHMOD     1       /* has fchmod(2) call */
981 #  define HASFCHOWN     1       /* has fchown(2) call */
982 #  define HASUNAME      1       /* has uname(2) call */
983 #  define HASUNSETENV   1       /* has unsetenv(3) call */
984 #  define HAS_ST_GEN    1       /* has st_gen field in stat struct */
985 #  define HASSTRERROR   1       /* has strerror(3) */
986 #  define GIDSET_T      gid_t
987 #  define SOCKADDR_LEN_T        socklen_t
988 #  define SOCKOPT_LEN_T socklen_t
989 #  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
990 #   define LA_TYPE      LA_SUBR
991 #  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
992 #   define LA_TYPE      LA_MACH
993    /* GNU uses mach[34], which renames some rpcs from mach2.x. */
994 #   define host_self    mach_host_self
995 #  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
996 #  define SFS_TYPE      SFS_STATFS
997 #  define SPT_TYPE      SPT_CHANGEARGV
998 #  define ERRLIST_PREDEFINED    1       /* don't declare sys_errlist */
999 #  define BSD4_4_SOCKADDR       1       /* has sa_len */
1000 #  define SIOCGIFCONF_IS_BROKEN  1      /* SIOCGFCONF doesn't work */
1001 #  define HAS_IN_H      1       /* GNU has netinet/in.h. */
1002 /* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
1003 #  define MAXPATHLEN    2048
1004 # endif /* defined(__GNU__) && !defined(NeXT) */
1005
1006 /*
1007 **  4.3 BSD -- this is for very old systems
1008 **
1009 **      Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
1010 **
1011 **      You'll also have to install a new resolver library.
1012 **      I don't guarantee that support for this environment is complete.
1013 */
1014
1015 # if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
1016 #  define NEEDVPRINTF   1       /* need a replacement for vprintf(3) */
1017 #  define SM_CONF_GETOPT        0       /* need a replacement for getopt(3) */
1018 #  define ARBPTR_T      char *
1019 #  define setpgid       setpgrp
1020 #  ifndef LA_TYPE
1021 #   define LA_TYPE      LA_FLOAT
1022 #  endif /* ! LA_TYPE */
1023 #  ifndef _PATH_VENDOR_CF
1024 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1025 #  endif /* ! _PATH_VENDOR_CF */
1026 #  ifndef IDENTPROTO
1027 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
1028 #  endif /* ! IDENTPROTO */
1029 #  undef WEXITSTATUS
1030 #  undef WIFEXITED
1031 typedef short           pid_t;
1032 # endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
1033
1034
1035 /*
1036 **  SCO Unix
1037 **
1038 **      This includes three parts:
1039 **
1040 **      The first is for SCO OpenServer 5.
1041 **      (Contributed by Keith Reynolds <keithr@sco.COM>).
1042 **
1043 **              SCO OpenServer 5 has a compiler version number macro,
1044 **              which we can use to figure out what version we're on.
1045 **              This may have to change in future releases.
1046 **
1047 **      The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
1048 **      (Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
1049 **
1050 **      The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
1051 */
1052
1053 /* SCO OpenServer 5 */
1054 # if _SCO_DS >= 1
1055 #  include <paths.h>
1056 #  define SIOCGIFNUM_IS_BROKEN 1        /* SIOCGIFNUM returns bogus value */
1057 #  define HASFCHMOD     1       /* has fchmod(2) call */
1058 #  define HASFCHOWN     1       /* has fchown(2) call */
1059 #  define HASSETRLIMIT  1       /* has setrlimit(2) call */
1060 #  define USESETEUID    1       /* has seteuid(2) call */
1061 #  define HASINITGROUPS 1       /* has initgroups(3) call */
1062 #  define HASGETDTABLESIZE 1    /* has getdtablesize(2) call */
1063 #  define RLIMIT_NEEDS_SYS_TIME_H       1
1064 #  define LDA_USE_LOCKF 1
1065 #  ifndef LA_TYPE
1066 #   define LA_TYPE      LA_DEVSHORT
1067 #  endif /* ! LA_TYPE */
1068 #  define _PATH_AVENRUN "/dev/table/avenrun"
1069 #  ifndef _SCO_unix_4_2
1070 #   define _SCO_unix_4_2
1071 #  else /* ! _SCO_unix_4_2 */
1072 #   define SOCKADDR_LEN_T       size_t  /* e.g., arg#3 to accept, getsockname */
1073 #   define SOCKOPT_LEN_T                size_t  /* arg#5 to getsockopt */
1074 #  endif /* ! _SCO_unix_4_2 */
1075 # endif /* _SCO_DS >= 1 */
1076
1077 /* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
1078 # ifdef _SCO_unix_4_2
1079 #  define _SCO_unix_
1080 #  define HASSETREUID   1       /* has setreuid(2) call */
1081 # endif /* _SCO_unix_4_2 */
1082
1083 /* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
1084 # ifdef _SCO_unix_
1085 #  include <sys/stream.h>       /* needed for IP_SRCROUTE */
1086 #  define SYSTEM5       1       /* include all the System V defines */
1087 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
1088 #  define NOFTRUNCATE   0       /* has (simulated) ftruncate call */
1089 #  ifndef USE_SIGLONGJMP
1090 #   define USE_SIGLONGJMP       1 /* sigsetjmp needed for signal handling */
1091 #  endif /* ! USE_SIGLONGJMP */
1092 #  define MAXPATHLEN    PATHSIZE
1093 #  define SFS_TYPE      SFS_4ARGS       /* use <sys/statfs.h> 4-arg impl */
1094 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1095 #  define SPT_TYPE      SPT_SCO         /* write kernel u. area */
1096 #  define TZ_TYPE       TZ_TM_NAME      /* use tm->tm_name */
1097 #  define UID_T         uid_t
1098 #  define GID_T         gid_t
1099 #  define GIDSET_T      gid_t
1100 #  define _PATH_UNIX            "/unix"
1101 #  ifndef _PATH_VENDOR_CF
1102 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1103 #  endif /* ! _PATH_VENDOR_CF */
1104 #  ifndef _PATH_SENDMAILPID
1105 #   define _PATH_SENDMAILPID    "/etc/sendmail.pid"
1106 #  endif /* ! _PATH_SENDMAILPID */
1107
1108 /* stuff fixed in later releases */
1109 #  ifndef _SCO_unix_4_2
1110 #   define SYS5SIGNALS  1       /* SysV signal semantics -- reset on each sig */
1111 #  endif /* ! _SCO_unix_4_2 */
1112
1113 #  ifndef _SCO_DS
1114 #   define ftruncate    chsize  /* use chsize(2) to emulate ftruncate */
1115 #   define NEEDFSYNC    1       /* needs the fsync(2) call stub */
1116 #   define NETUNIX      0       /* no unix domain socket support */
1117 #   define LA_TYPE      LA_SHORT
1118 #  endif /* ! _SCO_DS */
1119
1120 # endif /* _SCO_unix_ */
1121
1122 /*
1123 **  ISC (SunSoft) Unix.
1124 **
1125 **      Contributed by J.J. Bailey <jjb@jagware.bcc.com>
1126 */
1127
1128 # ifdef ISC_UNIX
1129 #  include <net/errno.h>
1130 #  include <sys/stream.h>       /* needed for IP_SRCROUTE */
1131 #  include <sys/bsdtypes.h>
1132 #  define SYSTEM5       1       /* include all the System V defines */
1133 #  define SYS5SIGNALS   1       /* SysV signal semantics -- reset on each sig */
1134 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
1135 #  define HASSETREUID   1       /* has setreuid(2) call */
1136 #  define NEEDFSYNC     1       /* needs the fsync(2) call stub */
1137 #  define NETUNIX       0       /* no unix domain socket support */
1138 #  define MAXPATHLEN    1024
1139 #  define LA_TYPE       LA_SHORT
1140 #  define SFS_TYPE      SFS_STATFS      /* use <sys/statfs.h> statfs() impl */
1141 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1142 #  define _PATH_UNIX            "/unix"
1143 #  ifndef _PATH_VENDOR_CF
1144 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1145 #  endif /* ! _PATH_VENDOR_CF */
1146 #  ifndef _PATH_SENDMAILPID
1147 #   define _PATH_SENDMAILPID    "/etc/sendmail.pid"
1148 #  endif /* ! _PATH_SENDMAILPID */
1149 # endif /* ISC_UNIX */
1150
1151
1152 /*
1153 **  Altos System V (5.3.1)
1154 **      Contributed by Tim Rice <tim@trr.metro.net>.
1155 */
1156
1157 # ifdef ALTOS_SYSTEM_V
1158 #  include <sys/stream.h>
1159 #  include <limits.h>
1160 #  define SYSTEM5       1       /* include all the System V defines */
1161 #  define SYS5SIGNALS   1       /* SysV signal semantics -- reset on each sig */
1162 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
1163 #  define WAITUNION     1       /* use "union wait" as wait argument type */
1164 #  define NEEDFSYNC     1       /* no fsync(2) in system library */
1165 #  define NEEDSTRSTR    1       /* need emulation of the strstr(3) call */
1166 #  define NOFTRUNCATE   1       /* do not have ftruncate(2) */
1167 #  define MAXPATHLEN    PATH_MAX
1168 #  define LA_TYPE       LA_SHORT
1169 #  define SFS_TYPE      SFS_STATFS      /* use <sys/statfs.h> statfs() impl */
1170 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1171 #  define TZ_TYPE       TZ_TZNAME       /* use tzname[] vector */
1172 #  define NETUNIX       0       /* no unix domain socket support */
1173 #  undef WIFEXITED
1174 #  undef WEXITSTATUS
1175 #  define strtoul       strtol  /* gcc library bogosity */
1176
1177 typedef unsigned short  uid_t;
1178 typedef unsigned short  gid_t;
1179 typedef short           pid_t;
1180 typedef unsigned long   mode_t;
1181
1182 /* some stuff that should have been in the include files */
1183 extern char             *malloc();
1184 extern struct passwd    *getpwent();
1185 extern struct passwd    *getpwnam();
1186 extern struct passwd    *getpwuid();
1187 extern char             *getenv();
1188 extern struct group     *getgrgid();
1189 extern struct group     *getgrnam();
1190
1191 # endif /* ALTOS_SYSTEM_V */
1192
1193
1194 /*
1195 **  ConvexOS 11.0 and later
1196 **
1197 **      "Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
1198 **      works on 9.1 as well.
1199 **
1200 **  ConvexOS 11.5 and later, should work on 11.0 as defined.
1201 **  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
1202 **
1203 **      Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
1204 **              (now the CONVEX Technologies Center of Hewlett Packard)
1205 */
1206
1207 # ifdef _CONVEX_SOURCE
1208 #  define HASGETDTABLESIZE      1       /* has getdtablesize(2) */
1209 #  define HASINITGROUPS 1       /* has initgroups(3) */
1210 #  define HASUNAME      1       /* use System V uname(2) system call */
1211 #  define HASSETSID     1       /* has POSIX setsid(2) call */
1212 #  define HASUNSETENV   1       /* has unsetenv(3) */
1213 #  define HASFLOCK      1       /* has flock(2) */
1214 #  define HASSETRLIMIT  1       /* has setrlimit(2) */
1215 #  define HASSETREUID   1       /* has setreuid(2) */
1216 #  define BROKEN_RES_SEARCH     1       /* res_search(unknown) returns h_error=0 */
1217 #  define NEEDPUTENV    1       /* needs putenv (written in terms of setenv) */
1218 #  define SM_CONF_GETOPT        1       /* need a replacement for getopt(3) */
1219 #  define IP_SRCROUTE   0       /* Something is broken with getsockopt() */
1220 #  define LA_TYPE       LA_FLOAT
1221 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
1222 #  ifndef _PATH_VENDOR_CF
1223 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1224 #  endif /* ! _PATH_VENDOR_CF */
1225 #  ifndef S_IREAD
1226 #   define S_IREAD      _S_IREAD
1227 #   define S_IWRITE     _S_IWRITE
1228 #   define S_IEXEC      _S_IEXEC
1229 #   define S_IFMT       _S_IFMT
1230 #   define S_IFCHR      _S_IFCHR
1231 #   define S_IFBLK      _S_IFBLK
1232 #  endif /* ! S_IREAD */
1233 #  ifndef TZ_TYPE
1234 #   define TZ_TYPE      TZ_TIMEZONE
1235 #  endif /* ! TZ_TYPE */
1236 #  ifndef IDENTPROTO
1237 #   define IDENTPROTO   1
1238 #  endif /* ! IDENTPROTO */
1239 #  ifndef SHARE_V1
1240 #   define SHARE_V1     1       /* version 1 of the fair share scheduler */
1241 #  endif /* ! SHARE_V1 */
1242 #  if !defined(__GNUC__ )
1243 #   define UID_T        int             /* GNUC gets it right, ConvexC botches */
1244 #   define GID_T        int             /* GNUC gets it right, ConvexC botches */
1245 #  endif /* !defined(__GNUC__ ) */
1246 #  if SECUREWARE
1247 #   define FORK fork            /* SecureWare wants the real fork! */
1248 #  else /* SECUREWARE */
1249 #   define FORK vfork           /* the rest of the OS versions don't care */
1250 #  endif /* SECUREWARE */
1251 # endif /* _CONVEX_SOURCE */
1252
1253
1254 /*
1255 **  RISC/os 4.52
1256 **
1257 **      Gives a ton of warning messages, but otherwise compiles.
1258 */
1259
1260 # ifdef RISCOS
1261
1262 #  define HASUNSETENV   1       /* has unsetenv(3) call */
1263 #  ifndef HASFLOCK
1264 #   define HASFLOCK     1       /* has flock(2) call */
1265 #  endif /* ! HASFLOCK */
1266 #  define WAITUNION     1       /* use "union wait" as wait argument type */
1267 #  define SM_CONF_GETOPT        0       /* need a replacement for getopt(3) */
1268 #  define NEEDPUTENV    1       /* need putenv(3) call */
1269 #  define NEEDSTRSTR    1       /* need emulation of the strstr(3) call */
1270 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
1271 #  define LA_TYPE       LA_INT
1272 #  define LA_AVENRUN    "avenrun"
1273 #  define _PATH_UNIX    "/unix"
1274 #  undef WIFEXITED
1275
1276 #  define setpgid       setpgrp
1277
1278 typedef int             pid_t;
1279 #  define SIGFUNC_DEFINED
1280 #  define SIGFUNC_RETURN        (0)
1281 #  define SIGFUNC_DECL  int
1282 typedef int             (*sigfunc_t)();
1283 extern char             *getenv();
1284 extern void             *malloc();
1285
1286 /* added for RISC/os 4.01...which is dumber than 4.50 */
1287 #  ifdef RISCOS_4_0
1288 #   ifndef ARBPTR_T
1289 #    define ARBPTR_T    char *
1290 #   endif /* ! ARBPTR_T */
1291 #   undef HASFLOCK
1292 #   define HASFLOCK     0
1293 #  endif /* RISCOS_4_0 */
1294
1295 #  include <sys/time.h>
1296
1297 # endif /* RISCOS */
1298
1299
1300 /*
1301 **  Linux 0.99pl10 and above...
1302 **
1303 **  Thanks to, in reverse order of contact:
1304 **
1305 **      John Kennedy <warlock@csuchico.edu>
1306 **      Andrew Pam <avatar@aus.xanadu.com>
1307 **      Florian La Roche <rzsfl@rz.uni-sb.de>
1308 **      Karl London <karl@borg.demon.co.uk>
1309 **
1310 **  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
1311 **      file locking is no longer allowed.  In particular, make sure
1312 **      your DBM library and sendmail are both using either flock(2)
1313 **      *or* fcntl(2) file locking, but not both.
1314 */
1315
1316 # ifdef __linux__
1317 #  include <linux/version.h>
1318 #  if !defined(KERNEL_VERSION)  /* not defined in 2.0.x kernel series */
1319 #   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
1320 #  endif /* !defined(KERNEL_VERSION) */
1321 #  define BSD           1       /* include BSD defines */
1322 #  define HASSETREGID   1       /* use setregid(2) to set saved gid */
1323 #  ifndef REQUIRES_DIR_FSYNC
1324 #   define REQUIRES_DIR_FSYNC   1       /* requires fsync() on directory */
1325 #  endif /* REQUIRES_DIR_FSYNC */
1326 #  ifndef USESETEUID
1327 #   define USESETEUID   0       /* has it due to POSIX, but doesn't work */
1328 #  endif /* USESETEUID */
1329 #  define SM_CONF_GETOPT        0       /* need a replacement for getopt(3) */
1330 #  define HASUNAME      1       /* use System V uname(2) system call */
1331 #  define HASUNSETENV   1       /* has unsetenv(3) call */
1332 #  define ERRLIST_PREDEFINED    /* don't declare sys_errlist */
1333 #  define GIDSET_T      gid_t   /* from <linux/types.h> */
1334 #  ifndef HASGETUSERSHELL
1335 #   define HASGETUSERSHELL 0    /* getusershell(3) broken in Slackware 2.0 */
1336 #  endif /* HASGETUSERSHELL */
1337 #  ifndef IP_SRCROUTE
1338 #   define IP_SRCROUTE  0       /* linux <= 1.2.8 doesn't support IP_OPTIONS */
1339 #  endif /* ! IP_SRCROUTE */
1340 #  ifndef HAS_IN_H
1341 #   define HAS_IN_H     1       /* use netinet/in.h */
1342 #  endif /* ! HAS_IN_H */
1343 #  ifndef USE_SIGLONGJMP
1344 #   define USE_SIGLONGJMP       1 /* sigsetjmp needed for signal handling */
1345 #  endif /* ! USE_SIGLONGJMP */
1346 #  ifndef HASFLOCK
1347 #   if LINUX_VERSION_CODE < 66399
1348 #    define HASFLOCK    0       /* flock(2) is broken after 0.99.13 */
1349 #   else /* LINUX_VERSION_CODE < 66399 */
1350 #    define HASFLOCK    1       /* flock(2) fixed after 1.3.95 */
1351 #   endif /* LINUX_VERSION_CODE < 66399 */
1352 #  endif /* ! HASFLOCK */
1353 #  ifndef LA_TYPE
1354 #   define LA_TYPE      LA_PROCSTR
1355 #  endif /* ! LA_TYPE */
1356 #  define SFS_TYPE      SFS_VFS         /* use <sys/vfs.h> statfs() impl */
1357 #  define SPT_PADCHAR   '\0'            /* pad process title with nulls */
1358 #  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
1359 #   ifndef HASURANDOMDEV
1360 #    define HASURANDOMDEV 1     /* 2.0 (at least) has linux/drivers/char/random.c */
1361 #   endif /* ! HASURANDOMDEV */
1362 #  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
1363 #  ifndef TZ_TYPE
1364 #   define TZ_TYPE      TZ_NONE         /* no standard for Linux */
1365 #  endif /* ! TZ_TYPE */
1366 #  if (__GLIBC__ >= 2)
1367 #   include <paths.h>
1368 #  endif /* (__GLIBC__ >= 2) */
1369 #  ifndef _PATH_SENDMAILPID
1370 #   define _PATH_SENDMAILPID    "/var/run/sendmail.pid"
1371 #  endif /* ! _PATH_SENDMAILPID */
1372 #  include <sys/sysmacros.h>
1373 #  undef atol                   /* wounded in <stdlib.h> */
1374 #  if NETINET6
1375    /*
1376    **  Linux doesn't have a good way to tell userland what interfaces are
1377    **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
1378    **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
1379    **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
1380    */
1381 #   define ADDRCONFIG_IS_BROKEN 1
1382
1383    /*
1384    **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
1385    **  in 2.1 and later, but the APIs appear before the functions.
1386    */
1387 #   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1388 #    define HASSTRERROR 1       /* has strerror(3) */
1389 #    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
1390 #    if (GLIBC_VERSION >= 0x201)
1391 #     undef IPPROTO_ICMPV6      /* linux #defines, glibc enums */
1392 #    else /* (GLIBC_VERSION >= 0x201) */
1393 #     include <linux/in6.h>     /* IPv6 support */
1394 #    endif /* (GLIBC_VERSION >= 0x201) */
1395 #    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
1396      /* Have APIs in <netdb.h>, but no support in glibc */
1397 #     define NEEDSGETIPNODE     1
1398 #    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
1399 #    undef GLIBC_VERSION
1400 #   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
1401 #  endif /* NETINET6 */
1402 #  ifndef HASFCHOWN
1403 #   define HASFCHOWN    1       /* fchown(2) */
1404 #  endif /* ! HASFCHOWN */
1405 #  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
1406 #    define HASFCHMOD   1       /* fchmod(2) */
1407 #  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
1408 # endif /* __linux__ */
1409
1410
1411 /*
1412 **  DELL SVR4 Issue 2.2, and others
1413 **      From Kimmo Suominen <kim@grendel.lut.fi>
1414 **
1415 **      It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
1416 **      defined, and the definitions conflict.
1417 **
1418 **      Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
1419 **      trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
1420 **      (SVR4.0/386 version 3.0).
1421 */
1422
1423 # ifdef DELL_SVR4
1424                                 /* no changes necessary */
1425                                 /* see general __svr4__ defines below */
1426 # endif /* DELL_SVR4 */
1427
1428
1429 /*
1430 **  Apple A/UX 3.0
1431 */
1432
1433 # ifdef _AUX_SOURCE
1434 #  include <sys/sysmacros.h>
1435 #  define BSD                   /* has BSD routines */
1436 #  define HASSETRLIMIT  0       /* ... but not setrlimit(2) */
1437 #  define BROKEN_RES_SEARCH 1   /* res_search(unknown) returns h_errno=0 */
1438 #  define BOGUS_O_EXCL  1       /* exclusive open follows symlinks */
1439 #  define HASUNAME      1       /* use System V uname(2) system call */
1440 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
1441 #  define HASINITGROUPS 1       /* has initgroups(3) call */
1442 #  define HASSETVBUF    1       /* has setvbuf(3) in libc */
1443 #  define HASSTRERROR   1       /* has strerror(3) */
1444 #  define SIGFUNC_DEFINED       /* sigfunc_t already defined */
1445 #  define SIGFUNC_RETURN                /* POSIX-mode */
1446 #  define SIGFUNC_DECL  void    /* POSIX-mode */
1447 #  define ERRLIST_PREDEFINED    1
1448 #  ifndef IDENTPROTO
1449 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
1450 #  endif /* ! IDENTPROTO */
1451 #  ifndef LA_TYPE
1452 #   define LA_TYPE      LA_INT
1453 #   define FSHIFT       16
1454 #  endif /* ! LA_TYPE */
1455 #  define LA_AVENRUN    "avenrun"
1456 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
1457 #  define TZ_TYPE       TZ_TZNAME
1458 #  ifndef _PATH_UNIX
1459 #   define _PATH_UNIX           "/unix"         /* should be in <paths.h> */
1460 #  endif /* ! _PATH_UNIX */
1461 #  ifndef _PATH_VENDOR_CF
1462 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1463 #  endif /* ! _PATH_VENDOR_CF */
1464 #  undef WIFEXITED
1465 #  undef WEXITSTATUS
1466 # endif /* _AUX_SOURCE */
1467
1468
1469 /*
1470 **  Encore UMAX V
1471 **
1472 **      Not extensively tested.
1473 */
1474
1475 # ifdef UMAXV
1476 #  define HASUNAME      1       /* use System V uname(2) system call */
1477 #  define HASSETVBUF    1       /* we have setvbuf(3) in libc */
1478 #  define HASINITGROUPS 1       /* has initgroups(3) call */
1479 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
1480 #  define SYS5SIGNALS   1       /* SysV signal semantics -- reset on each sig */
1481 #  define SYS5SETPGRP   1       /* use System V setpgrp(2) syscall */
1482 #  define SFS_TYPE      SFS_4ARGS       /* four argument statfs() call */
1483 #  define MAXPATHLEN    PATH_MAX
1484 extern struct passwd    *getpwent(), *getpwnam(), *getpwuid();
1485 extern struct group     *getgrent(), *getgrnam(), *getgrgid();
1486 #  undef WIFEXITED
1487 #  undef WEXITSTATUS
1488 # endif /* UMAXV */
1489
1490
1491 /*
1492 **  Stardent Titan 3000 running TitanOS 4.2.
1493 **
1494 **      Must be compiled in "cc -43" mode.
1495 **
1496 **      From Kate Hedstrom <kate@ahab.rutgers.edu>.
1497 **
1498 **      Note the tweaking below after the BSD defines are set.
1499 */
1500
1501 # ifdef titan
1502 #  define setpgid       setpgrp
1503 typedef int             pid_t;
1504 #  undef WIFEXITED
1505 #  undef WEXITSTATUS
1506 # endif /* titan */
1507
1508
1509 /*
1510 **  Sequent DYNIX 3.2.0
1511 **
1512 **      From Jim Davis <jdavis@cs.arizona.edu>.
1513 */
1514
1515 # ifdef sequent
1516
1517 #  define BSD           1
1518 #  define HASUNSETENV   1
1519 #  define BSD4_3                1       /* to get signal() in conf.c */
1520 #  define WAITUNION     1
1521 #  define LA_TYPE       LA_FLOAT
1522 #  ifdef _POSIX_VERSION
1523 #   undef _POSIX_VERSION                /* set in <unistd.h> */
1524 #  endif /* _POSIX_VERSION */
1525 #  undef HASSETVBUF             /* don't actually have setvbuf(3) */
1526 #  define setpgid       setpgrp
1527
1528 /* Have to redefine WIFEXITED to take an int, to work with waitfor() */
1529 #  undef        WIFEXITED
1530 #  define WIFEXITED(s)  (((union wait*)&(s))->w_stopval != WSTOPPED && \
1531                          ((union wait*)&(s))->w_termsig == 0)
1532 #  define WEXITSTATUS(s)        (((union wait*)&(s))->w_retcode)
1533 typedef int             pid_t;
1534 #  define isgraph(c)    (isprint(c) && (c != ' '))
1535
1536 #  ifndef IDENTPROTO
1537 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
1538 #  endif /* ! IDENTPROTO */
1539
1540 #  ifndef _PATH_UNIX
1541 #   define _PATH_UNIX           "/dynix"
1542 #  endif /* ! _PATH_UNIX */
1543 #  ifndef _PATH_VENDOR_CF
1544 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1545 #  endif /* ! _PATH_VENDOR_CF */
1546 # endif /* sequent */
1547
1548
1549 /*
1550 **  Sequent DYNIX/ptx v2.0 (and higher)
1551 **
1552 **      For DYNIX/ptx v1.x, undefine HASSETREUID.
1553 **
1554 **      From Tim Wright <timw@sequent.com>.
1555 **      Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
1556 **              for DYNIX/ptx 4.0.2.
1557 */
1558
1559 # ifdef _SEQUENT_
1560 #  include <sys/stream.h>
1561 #  define SYSTEM5       1       /* include all the System V defines */
1562 #  define HASSETSID     1       /* has POSIX setsid(2) call */
1563 #  define HASINITGROUPS 1       /* has initgroups(3) call */
1564 #  define HASSETREUID   1       /* has setreuid(2) call */
1565 #  define HASGETUSERSHELL 0     /* does not have getusershell(3) call */
1566 #  define GIDSET_T      gid_t
1567 #  define LA_TYPE       LA_INT
1568 #  define SFS_TYPE      SFS_STATFS      /* use <sys/statfs.h> statfs() impl */
1569 #  define SPT_TYPE      SPT_NONE        /* don't use setproctitle */
1570 #  ifndef IDENTPROTO
1571 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
1572 #  endif /* ! IDENTPROTO */
1573 #  ifndef _PATH_VENDOR_CF
1574 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1575 #  endif /* ! _PATH_VENDOR_CF */
1576 #  ifndef _PATH_SENDMAILPID
1577 #   define _PATH_SENDMAILPID    "/etc/sendmail.pid"
1578 #  endif /* ! _PATH_SENDMAILPID */
1579 # endif /* _SEQUENT_ */
1580
1581
1582 /*
1583 **  Cray Unicos
1584 **
1585 **      Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
1586 */
1587
1588 # ifdef UNICOS
1589 #  define SYSTEM5       1       /* include all the System V defines */
1590 #  define SYS5SIGNALS   1       /* SysV signal semantics -- reset on each sig */
1591 #  define MAXPATHLEN    PATHSIZE
1592 #  define LA_TYPE       LA_ZERO
1593 #  define SFS_TYPE      SFS_4ARGS       /* four argument statfs() call */
1594 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1595 # endif /* UNICOS */
1596
1597
1598 /*
1599 **  Apollo DomainOS
1600 **
1601 **  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
1602 **
1603 **  15 Jan 1994; updated 2 Aug 1995
1604 **
1605 */
1606
1607 # ifdef apollo
1608 #  define HASSETREUID   1       /* has setreuid(2) call */
1609 #  define HASINITGROUPS 1       /* has initgroups(2) call */
1610 #  define IP_SRCROUTE   0       /* does not have <netinet/ip_var.h> */
1611 #  define SPT_TYPE      SPT_NONE        /* don't use setproctitle */
1612 #  define LA_TYPE       LA_SUBR         /* use getloadavg.c */
1613 #  define SFS_TYPE      SFS_4ARGS       /* four argument statfs() call */
1614 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1615 #  define TZ_TYPE       TZ_TZNAME
1616 #  ifndef _PATH_VENDOR_CF
1617 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1618 #  endif /* ! _PATH_VENDOR_CF */
1619 #  ifndef _PATH_SENDMAILPID
1620 #   define _PATH_SENDMAILPID    "/etc/sendmail.pid"
1621 #  endif /* ! _PATH_SENDMAILPID */
1622 #  undef         S_IFSOCK               /* S_IFSOCK and S_IFIFO are the same */
1623 #  undef         S_IFIFO
1624 #  define S_IFIFO       0010000
1625 #  ifndef IDENTPROTO
1626 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
1627 #  endif /* ! IDENTPROTO */
1628 #  define RLIMIT_NEEDS_SYS_TIME_H       1
1629 #  if defined(NGROUPS_MAX) && !NGROUPS_MAX
1630 #   undef NGROUPS_MAX
1631 #  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
1632 # endif /* apollo */
1633
1634 /*
1635 **  MPE-iX
1636 **
1637 **      Requires MPE 6.0 or greater.  See sendmail/README for more info.
1638 **
1639 **      From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
1640 */
1641
1642 # ifdef MPE
1643
1644 #  include <sys/sysmacros.h>
1645 #  include <fcntl.h>
1646
1647 /* Sendmail stuff */
1648 #  define HASFCHOWN             0       /* lacks fchown() */
1649 #  define HASGETUSERSHELL       0       /* lacks getusershell() */
1650 #  ifdef HASNICE
1651 #   undef  HASNICE
1652 #  endif /* HASNICE */
1653 #  define HASNICE               0       /* lacks nice() */
1654 #  define HASRANDOM             0       /* lacks random() */
1655 #  ifdef HASRRESVPORT
1656 #   undef HASRRESVPORT
1657 #  endif /* HASRRESVPORT */
1658 #  define HASRRESVPORT          0       /* lacks rresvport() */
1659 #  define IP_SRCROUTE           0       /* lacks IP source routing fields */
1660 #  ifdef MATCHGECOS
1661 #   undef MATCHGECOS
1662 #  endif /* MATCHGECOS */
1663 #  define MATCHGECOS            0       /* lacks an initialized GECOS field */
1664 #  define NEEDFSYNC             1       /* use sendmail's fsync() */
1665 #  define NEEDLINK              1       /* use sendmail's link() */
1666 #  define NOFTRUNCATE           1       /* lacks ftruncate() */
1667 #  define SFS_TYPE              SFS_NONE /* can't determine disk space */
1668 #  define SM_CONF_SYSLOG        0       /* use sendmail decl of syslog() */
1669 #  define USE_DOUBLE_FORK       0       /* don't fork an intermediate zombie */
1670 #  define USE_ENVIRON           1       /* use environ instead of envp */
1671
1672 /* Missing header stuff */
1673 #  define AF_UNSPEC             0
1674 #  define AF_MAX                AF_INET
1675 #  define IFF_LOOPBACK          0x8
1676 #  define IN_LOOPBACKNET        127
1677 #  define MAXNAMLEN             NAME_MAX
1678 #  define S_IEXEC               S_IXUSR
1679 #  define S_IREAD               S_IRUSR
1680 #  define S_IWRITE              S_IWUSR
1681
1682 /* Present header stuff that needs to be missing */
1683 #  undef NGROUPS_MAX
1684
1685 /* Shadow functions */
1686 #  define bind          sendmail_mpe_bind
1687 #  define _exit         sendmail_mpe__exit
1688 #  define exit          sendmail_mpe_exit
1689 #  define fcntl         sendmail_mpe_fcntl
1690 #  define getegid       sendmail_mpe_getegid
1691 #  define geteuid       sendmail_mpe_geteuid
1692 #  define getpwnam      sendmail_mpe_getpwnam
1693 #  define getpwuid      sendmail_mpe_getpwuid
1694 #  define setgid        sendmail_mpe_setgid
1695 #  define setuid        sendmail_mpe_setuid
1696 extern int              sendmail_mpe_fcntl __P((int, int, ...));
1697 extern struct passwd *  sendmail_mpe_getpwnam __P((const char *));
1698 extern struct passwd *  sendmail_mpe_getpwuid __P((uid_t));
1699 # endif /* MPE */
1700
1701 /*
1702 **  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
1703 **
1704 **      Contributed by Paul Gampe <paulg@apnic.net>
1705 */
1706
1707 # ifdef __svr5__
1708 #  include <sys/mkdev.h>
1709 #  define __svr4__
1710 #  define SYS5SIGNALS           1
1711 #  define HASFCHOWN             1       /* has fchown(2) call */
1712 #  define HASSETSID             1
1713 #  define HASSETREUID           1
1714 #  define HASWAITPID            1
1715 #  define HASGETDTABLESIZE      1
1716 #  define GIDSET_T              gid_t
1717 #  define SOCKADDR_LEN_T                size_t
1718 #  define SOCKOPT_LEN_T         size_t
1719 #  ifndef _PATH_UNIX
1720 #   define _PATH_UNIX           "/stand/unix"
1721 #  endif /* ! _PATH_UNIX */
1722 #  define SPT_PADCHAR           '\0'    /* pad process title with nulls */
1723 #  ifndef SYSLOG_BUFSIZE
1724 #   define SYSLOG_BUFSIZE       1024    /* unsure */
1725 #  endif /* ! SYSLOG_BUFSIZE */
1726 #  ifndef _PATH_VENDOR_CF
1727 #   define _PATH_VENDOR_CF      "/etc/sendmail.cf"
1728 #  endif /* ! _PATH_VENDOR_CF */
1729 #  ifndef _PATH_SENDMAILPID
1730 #   define _PATH_SENDMAILPID    "/etc/sendmail.pid"
1731 #  endif /* ! _PATH_SENDMAILPID */
1732 #  undef offsetof               /* avoid stddefs.h, sys/sysmacros.h conflict */
1733 #if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
1734 # define SM_SET_H_ERRNO(err)    set_h_errno((err))
1735 #endif /* ! SM_SET_H_ERRNO && _REENTRANT */
1736 # endif /* __svr5__ */
1737
1738 /* ###################################################################### */
1739
1740 /*
1741 **  UnixWare 2.x
1742 */
1743
1744 # ifdef UNIXWARE2
1745 #  define UNIXWARE      1
1746 #  undef offsetof               /* avoid stddefs.h, sys/sysmacros.h conflict */
1747 # endif /* UNIXWARE2 */
1748
1749
1750 /*
1751 **  UnixWare 1.1.2.
1752 **
1753 **      Updated by Petr Lampa <lampa@fee.vutbr.cz>.
1754 **      From Evan Champion <evanc@spatial.synapse.org>.
1755 */
1756
1757 # ifdef UNIXWARE
1758 #  include <sys/mkdev.h>
1759 #  define SYSTEM5               1
1760 #  define HASGETUSERSHELL       0       /* does not have getusershell(3) call */
1761 #  define HASSETREUID           1
1762 #  define HASSETSID             1
1763 #  define HASINITGROUPS         1
1764 #  define GIDSET_T              gid_t
1765 #  define SLEEP_T               unsigned
1766 #  define SFS_TYPE              SFS_STATVFS
1767 #  define LA_TYPE               LA_ZERO
1768 #  undef WIFEXITED
1769 #  undef WEXITSTATUS
1770 #  ifndef _PATH_UNIX
1771 #   define _PATH_UNIX           "/unix"
1772 #  endif /* ! _PATH_UNIX */
1773 #  ifndef _PATH_VENDOR_CF
1774 #   define _PATH_VENDOR_CF      "/usr/ucblib/sendmail.cf"
1775 #  endif /* ! _PATH_VENDOR_CF */
1776 #  ifndef _PATH_SENDMAILPID
1777 #   define _PATH_SENDMAILPID    "/usr/ucblib/sendmail.pid"
1778 #  endif /* ! _PATH_SENDMAILPID */
1779 #  define SYSLOG_BUFSIZE        128
1780 # endif /* UNIXWARE */
1781
1782
1783 /*
1784 **  Intergraph CLIX 3.1
1785 **
1786 **      From Paul Southworth <pauls@locust.cic.net>
1787 */
1788
1789 # ifdef CLIX
1790 #  define SYSTEM5       1       /* looks like System V */
1791 #  ifndef HASGETUSERSHELL
1792 #   define HASGETUSERSHELL 0    /* does not have getusershell(3) call */
1793 #  endif /* ! HASGETUSERSHELL */
1794 #  define DEV_BSIZE     512     /* device block size not defined */
1795 #  define GIDSET_T      gid_t
1796 #  undef LOG                    /* syslog not available */
1797 #  define NEEDFSYNC     1       /* no fsync in system library */
1798 #  define GETSHORT      _getshort
1799 # endif /* CLIX */
1800
1801
1802 /*
1803 **  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
1804 **
1805 **      From Kevin Darcy <kevin@tech.mis.cfc.com>.
1806 */
1807
1808 # ifdef NCR_MP_RAS2
1809 #  include <sys/sockio.h>
1810 #  define __svr4__
1811 #  define IP_SRCROUTE   0       /* Something is broken with getsockopt() */
1812 #  define SYSLOG_BUFSIZE        1024
1813 #  define SPT_TYPE  SPT_NONE
1814 # endif /* NCR_MP_RAS2 */
1815
1816
1817 /*
1818 **  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
1819 **
1820 **      From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
1821 */
1822
1823 # ifdef NCR_MP_RAS3
1824 #  define __svr4__
1825 #  define HASFCHOWN             1       /* has fchown(2) call */
1826 #  define LDA_USE_LOCKF         1
1827 #  define SIOCGIFNUM_IS_BROKEN  1       /* SIOCGIFNUM has non-std interface */
1828 #  define SO_REUSEADDR_IS_BROKEN        1       /* doesn't work if accept() fails */
1829 #  define SYSLOG_BUFSIZE        1024
1830 #  define SPT_TYPE      SPT_NONE
1831 #  define _PATH_MAILDIR "/var/mail"
1832 #  ifndef _XOPEN_SOURCE
1833 #   define _XOPEN_SOURCE
1834 #   define _XOPEN_SOURCE_EXTENDED 1
1835 #   include <sys/resource.h>
1836 #   undef _XOPEN_SOURCE
1837 #   undef _XOPEN_SOURCE_EXTENDED
1838 #  endif /* ! _XOPEN_SOURCE */
1839 # endif /* NCR_MP_RAS3 */
1840
1841
1842 /*
1843 **  Tandem NonStop-UX SVR4
1844 **
1845 **      From Rick McCarty <mccarty@mpd.tandem.com>.
1846 */
1847
1848 # ifdef NonStop_UX_BXX
1849 #  define __svr4__
1850 # endif /* NonStop_UX_BXX */
1851
1852
1853 /*
1854 **  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
1855 **
1856 **      Tested for 1.04, 1.03
1857 **      From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
1858 **
1859 **      Tested for 4.02, 6.10 and 7.10
1860 **      From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
1861 */
1862
1863 # if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
1864 #  define SYSTEM5       1       /* include all the System V defines */
1865 #  define HASINITGROUPS 1       /* has initgroups(3) call */
1866 #  define HASFCHMOD     1       /* has fchmod(2) syscall */
1867 #  define setreuid(r, e)        setresuid(r, e, -1)
1868 #  define LA_TYPE       LA_FLOAT
1869 #  define SPT_TYPE      SPT_PSTAT
1870 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
1871 #  ifndef HASSETVBUF
1872 #   define HASSETVBUF   /* HI-UX has no setlinebuf */
1873 #  endif /* ! HASSETVBUF */
1874 #  ifndef GIDSET_T
1875 #   define GIDSET_T     gid_t
1876 #  endif /* ! GIDSET_T */
1877 #  ifndef _PATH_UNIX
1878 #   define _PATH_UNIX           "/HI-UX"
1879 #  endif /* ! _PATH_UNIX */
1880 #  ifndef _PATH_VENDOR_CF
1881 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1882 #  endif /* ! _PATH_VENDOR_CF */
1883 #  ifndef IDENTPROTO
1884 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
1885 #  endif /* ! IDENTPROTO */
1886 #  ifndef HASGETUSERSHELL
1887 #   define HASGETUSERSHELL 0    /* getusershell(3) causes core dumps */
1888 #  endif /* ! HASGETUSERSHELL */
1889 #  define FDSET_CAST    (int *) /* cast for fd_set parameters to select */
1890
1891 /*
1892 **  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
1893 **  on HIUX 3050
1894 */
1895 #  undef m_flags
1896
1897 #  define SM_CONF_SYSLOG        0
1898
1899 # endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
1900
1901
1902 /*
1903 **  Amdahl UTS System V 2.1.5 (SVr3-based)
1904 **
1905 **    From: Janet Jackson <janet@dialix.oz.au>.
1906 */
1907
1908 # ifdef _UTS
1909 #  include <sys/sysmacros.h>
1910 #  undef HASLSTAT               /* has symlinks, but they cause problems */
1911 #  define NEEDFSYNC     1       /* system fsync(2) fails on non-EFS filesys */
1912 #  define SYS5SIGNALS   1       /* System V signal semantics */
1913 #  define SYS5SETPGRP   1       /* use System V setpgrp(2) syscall */
1914 #  define HASUNAME      1       /* use System V uname(2) system call */
1915 #  define HASINITGROUPS 1       /* has initgroups(3) function */
1916 #  define HASSETVBUF    1       /* has setvbuf(3) function */
1917 #  ifndef HASGETUSERSHELL
1918 #   define HASGETUSERSHELL 0    /* does not have getusershell(3) function */
1919 #  endif /* ! HASGETUSERSHELL */
1920 #  define GIDSET_T      gid_t   /* type of 2nd arg to getgroups(2) isn't int */
1921 #  define LA_TYPE       LA_ZERO         /* doesn't have load average */
1922 #  define SFS_TYPE      SFS_4ARGS       /* use 4-arg statfs() */
1923 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1924 #  define _PATH_UNIX            "/unix"
1925 #  ifndef _PATH_VENDOR_CF
1926 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
1927 #  endif /* ! _PATH_VENDOR_CF */
1928 # endif /* _UTS */
1929
1930 /*
1931 **  Cray Computer Corporation's CSOS
1932 **
1933 **      From Scott Bolte <scott@craycos.com>.
1934 */
1935
1936 # ifdef _CRAYCOM
1937 #  define SYSTEM5       1       /* include all the System V defines */
1938 #  define SYS5SIGNALS   1       /* SysV signal semantics -- reset on each sig */
1939 #  define NEEDFSYNC     1       /* no fsync in system library */
1940 #  define MAXPATHLEN    PATHSIZE
1941 #  define LA_TYPE       LA_ZERO
1942 #  define SFS_TYPE      SFS_4ARGS       /* four argument statfs() call */
1943 #  define SFS_BAVAIL    f_bfree         /* alternate field name */
1944 #  define _POSIX_CHOWN_RESTRICTED       -1
1945 extern struct group     *getgrent(), *getgrnam(), *getgrgid();
1946 # endif /* _CRAYCOM */
1947
1948
1949 /*
1950 **  Sony NEWS-OS 4.2.1R and 6.0.3
1951 **
1952 **      From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
1953 */
1954
1955 # ifdef sony_news
1956 #  ifndef __svr4
1957                         /* NEWS-OS 4.2.1R */
1958 #   ifndef BSD
1959 #    define BSD                 /* has BSD routines */
1960 #   endif /* ! BSD */
1961 #   define HASUNSETENV  1       /* has unsetenv(2) call */
1962 #   undef HASSETVBUF            /* don't actually have setvbuf(3) */
1963 #   define WAITUNION    1       /* use "union wait" as wait argument type */
1964 #   define LA_TYPE      LA_INT
1965 #   define SFS_TYPE     SFS_VFS /* use <sys/vfs.h> statfs() implementation */
1966 #   ifndef HASFLOCK
1967 #    define HASFLOCK    1       /* has flock(2) call */
1968 #   endif /* ! HASFLOCK */
1969 #   define setpgid      setpgrp
1970 #   undef WIFEXITED
1971 #   undef WEXITSTATUS
1972 #   define MODE_T       int     /* system include files have no mode_t */
1973 typedef int             pid_t;
1974 typedef int             (*sigfunc_t)();
1975 #   define SIGFUNC_DEFINED
1976 #   define SIGFUNC_RETURN       (0)
1977 #   define SIGFUNC_DECL         int
1978
1979 #  else /* ! __svr4 */
1980                         /* NEWS-OS 6.0.3 with /bin/cc */
1981 #   ifndef __svr4__
1982 #    define __svr4__            /* use all System V Release 4 defines below */
1983 #   endif /* ! __svr4__ */
1984 #   define HASSETSID    1       /* has Posix setsid(2) call */
1985 #   define HASGETUSERSHELL 1    /* DOES have getusershell(3) call in libc */
1986 #   define LA_TYPE      LA_READKSYM     /* use MIOC_READKSYM ioctl */
1987 #   ifndef SPT_TYPE
1988 #    define SPT_TYPE    SPT_SYSMIPS     /* use sysmips() (OS 6.0.2 or later) */
1989 #   endif /* ! SPT_TYPE */
1990 #   define GIDSET_T     gid_t
1991 #   undef WIFEXITED
1992 #   undef WEXITSTATUS
1993 #   ifndef SYSLOG_BUFSIZE
1994 #    define SYSLOG_BUFSIZE      256
1995 #   endif /* ! SYSLOG_BUFSIZE */
1996 #   define _PATH_UNIX           "/stand/unix"
1997 #   ifndef _PATH_VENDOR_CF
1998 #    define _PATH_VENDOR_CF     "/etc/mail/sendmail.cf"
1999 #   endif /* ! _PATH_VENDOR_CF */
2000 #   ifndef _PATH_SENDMAILPID
2001 #    define _PATH_SENDMAILPID   "/etc/mail/sendmail.pid"
2002 #   endif /* ! _PATH_SENDMAILPID */
2003
2004 #  endif /* ! __svr4 */
2005 # endif /* sony_news */
2006
2007
2008 /*
2009 **  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
2010 **
2011 **      From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2012 */
2013
2014 # ifdef luna
2015 #  ifndef IDENTPROTO
2016 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
2017 #  endif /* ! IDENTPROTO */
2018 #  define HASUNSETENV   1       /* has unsetenv(2) call */
2019 #  define NEEDPUTENV    1       /* need putenv(3) call */
2020 #  define SM_CONF_GETOPT        0       /* need a replacement for getopt(3) */
2021 #  define NEEDSTRSTR    1       /* need emulation of the strstr(3) call */
2022 #  define WAITUNION     1       /* use "union wait" as wait argument type */
2023 #  ifdef uniosb
2024 #   include <sys/time.h>
2025 #   define NEEDVPRINTF  1       /* need a replacement for vprintf(3) */
2026 #   define LA_TYPE      LA_INT
2027 #   define TZ_TYPE      TZ_TM_ZONE      /* use tm->tm_zone */
2028 #  endif /* uniosb */
2029 #  ifdef luna2
2030 #   define LA_TYPE      LA_SUBR
2031 #   define TZ_TYPE      TZ_TM_ZONE      /* use tm->tm_zone */
2032 #  endif /* luna2 */
2033 #  ifdef luna88k
2034 #   define LA_TYPE      LA_INT
2035 #  endif /* luna88k */
2036 #  define SFS_TYPE      SFS_VFS /* use <sys/vfs.h> statfs() implementation */
2037 #  define setpgid       setpgrp
2038 #  undef WIFEXITED
2039 #  undef WEXITSTATUS
2040 typedef int             pid_t;
2041 typedef int             (*sigfunc_t)();
2042 #  define SIGFUNC_DEFINED
2043 #  define SIGFUNC_RETURN        (0)
2044 #  define SIGFUNC_DECL  int
2045 extern char     *getenv();
2046 #  ifndef _PATH_VENDOR_CF
2047 #   define _PATH_VENDOR_CF      "/usr/lib/sendmail.cf"
2048 #  endif /* ! _PATH_VENDOR_CF */
2049 # endif /* luna */
2050
2051
2052 /*
2053 **  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
2054 **
2055 **      From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2056 */
2057
2058 # if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
2059 #  ifndef __svr4__
2060 #   define __svr4__             /* use all System V Release 4 defines below */
2061 #  endif /* ! __svr4__ */
2062 #  define SYS5SIGNALS   1       /* SysV signal semantics -- reset on each sig */
2063 #  define HASSETSID     1       /* has Posix setsid(2) call */
2064 #  define LA_TYPE       LA_READKSYM     /* use MIOC_READSYM ioctl */
2065 #  define SFS_TYPE      SFS_USTAT       /* use System V ustat(2) syscall */
2066 #  define GIDSET_T      gid_t
2067 #  undef WIFEXITED
2068 #  undef WEXITSTATUS
2069 #  define NAMELISTMASK  0x7fffffff      /* mask for nlist() values */
2070 #  ifndef _PATH_VENDOR_CF
2071 #   define _PATH_VENDOR_CF      "/usr/ucblib/sendmail.cf"
2072 #  endif /* ! _PATH_VENDOR_CF */
2073 #  ifndef _PATH_SENDMAILPID
2074 #   define _PATH_SENDMAILPID    "/usr/ucblib/sendmail.pid"
2075 #  endif /* ! _PATH_SENDMAILPID */
2076 #  ifndef SYSLOG_BUFSIZE
2077 #   define SYSLOG_BUFSIZE       1024    /* allow full size syslog buffer */
2078 #  endif /* ! SYSLOG_BUFSIZE */
2079 # endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
2080
2081
2082 /*
2083 **  Fujitsu/ICL UXP/DS (For the DS/90 Series)
2084 **
2085 **      From Diego R. Lopez <drlopez@cica.es>.
2086 **      Additional changes from Fumio Moriya and Toshiaki Nomura of the
2087 **              Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
2088 */
2089
2090 # ifdef __uxp__
2091 #  include <arpa/nameser.h>
2092 #  include <sys/sysmacros.h>
2093 #  include <sys/mkdev.h>
2094 #  define __svr4__
2095 #  define HASGETUSERSHELL       0
2096 #  define HASFLOCK              0
2097 #  define _PATH_UNIX            "/stand/unix"
2098 #  ifndef _PATH_VENDOR_CF
2099 #   define _PATH_VENDOR_CF      "/usr/ucblib/sendmail.cf"
2100 #  endif /* ! _PATH_VENDOR_CF */
2101 #  ifndef _PATH_SENDMAILPID
2102 #   define _PATH_SENDMAILPID    "/usr/ucblib/sendmail.pid"
2103 #  endif /* ! _PATH_SENDMAILPID */
2104 # endif /* __uxp__ */
2105
2106 /*
2107 **  Pyramid DC/OSx
2108 **
2109 **      From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
2110 */
2111
2112 # ifdef DCOSx
2113 #  define GIDSET_T      gid_t
2114 #  ifndef IDENTPROTO
2115 #   define IDENTPROTO   0       /* TCP/IP implementation is broken */
2116 #  endif /* ! IDENTPROTO */
2117 # endif /* DCOSx */
2118
2119 /*
2120 **  Concurrent Computer Corporation Maxion
2121 **
2122 **      From Donald R. Laster Jr. <laster@access.digex.net>.
2123 */
2124
2125 # ifdef __MAXION__
2126
2127 #  include <sys/stream.h>
2128 #  define __svr4__              1       /* SVR4.2MP */
2129 #  define HASSETREUID           1       /* have setreuid(2) */
2130 #  define HASLSTAT              1       /* have lstat(2) */
2131 #  define HASSETRLIMIT          1       /* have setrlimit(2) */
2132 #  define HASGETDTABLESIZE      1       /* have getdtablesize(2) */
2133 #  define HASGETUSERSHELL       1       /* have getusershell(3) */
2134 #  define NOFTRUNCATE           1       /* do not have ftruncate(2) */
2135 #  define SLEEP_T               unsigned
2136 #  define SFS_TYPE              SFS_STATVFS
2137 #  define SFS_BAVAIL            f_bavail
2138 #  ifndef SYSLOG_BUFSIZE
2139 #   define SYSLOG_BUFSIZE       256     /* Use 256 bytes */
2140 #  endif /* ! SYSLOG_BUFSIZE */
2141
2142 #  undef WUNTRACED
2143 #  undef WIFEXITED
2144 #  undef WIFSIGNALED
2145 #  undef WIFSTOPPED
2146 #  undef WEXITSTATUS
2147 #  undef WTERMSIG
2148 #  undef WSTOPSIG
2149
2150 # endif /* __MAXION__ */
2151
2152 /*
2153 **  Harris Nighthawk PowerUX (nh6000 box)
2154 **
2155 **  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
2156 */
2157
2158 # ifdef _PowerUX
2159 #  ifndef __svr4__
2160 #   define __svr4__
2161 #  endif /* ! __svr4__ */
2162 #  ifndef _PATH_VENDOR_CF
2163 #   define _PATH_VENDOR_CF      "/etc/mail/sendmail.cf"
2164 #  endif /* ! _PATH_VENDOR_CF */
2165 #  ifndef _PATH_SENDMAILPID
2166 #   define _PATH_SENDMAILPID    "/etc/mail/sendmail.pid"
2167 #  endif /* ! _PATH_SENDMAILPID */
2168 #  define SYSLOG_BUFSIZE                1024
2169 #  define LA_TYPE               LA_ZERO
2170 typedef struct msgb             mblk_t;
2171 #  undef offsetof       /* avoid stddefs.h and sys/sysmacros.h conflict */
2172 # endif /* _PowerUX */
2173
2174 /*
2175 **  Siemens Nixdorf Informationssysteme AG SINIX
2176 **
2177 **      Contributed by Gerald Rinske of Siemens Business Services VAS.
2178 */
2179 # ifdef sinix
2180 #  define HASRANDOM             0       /* has random(3) */
2181 #  define SYSLOG_BUFSIZE        1024
2182 #  define SM_INT32              int     /* 32bit integer */
2183 # endif /* sinix */
2184
2185 /*
2186 **  CRAY T3E
2187 **
2188 **      Contributed by Manu Mahonen <mailadm@csc.fi>
2189 **      of Center for Scientific Computing.
2190 */
2191 # ifdef _CRAY
2192 #  define GET_IPOPT_DST(dst)    *(struct in_addr *)&(dst)
2193 #  define _PATH_MAILDIR "/usr/spool/mail"
2194 #  if !defined(MAXPATHLEN)
2195 #   define MAXPATHLEN PATHSIZE
2196 #  endif /* !defined(MAXPATHLEN) */
2197 # endif /* _CRAY */
2198
2199 /*
2200 **  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
2201 **
2202 **      Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
2203 */
2204
2205 # ifdef MOTO
2206 #  define HASFCHMOD             1
2207 #  define HASSETRLIMIT          0
2208 #  define HASSETSID             1
2209 #  define HASSETREUID           1
2210 #  define HASULIMIT             1
2211 #  define HASWAITPID            1
2212 #  define HASGETDTABLESIZE      1
2213 #  define HASGETUSERSHELL       1
2214 #  define IP_SRCROUTE           0
2215 #  define IDENTPROTO            0
2216 #  define RES_DNSRCH_VARIABLE   _res_dnsrch
2217 #  define _PATH_UNIX            "/unix"
2218 #  define _PATH_VENDOR_CF       "/etc/sendmail.cf"
2219 #  define _PATH_SENDMAILPID     "/var/run/sendmail.pid"
2220 # endif /* MOTO */
2221
2222 /*
2223 **  Interix
2224 **      Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
2225 **
2226 **      Used for Interix support.
2227 */
2228
2229 # if defined(__INTERIX)
2230 #  define HASURANDOMDEV         1
2231 #  define HASGETUSERSHELL       0
2232 #  define HASSTRERROR           1
2233 #  define HASUNSETENV           1
2234 #  define HASFCHOWN             1
2235 #  undef HAVE_SYS_ERRLIST
2236 #  define sys_errlist           __sys_errlist
2237 #  define sys_nerr              __sys_nerr
2238 #  define major(dev)            ((int)(((dev) >> 8) & 0xff)
2239 #  define minor(dev)            ((int)((dev) & 0xff)
2240 # endif /* defined(__INTERIX) */
2241
2242
2243 /**********************************************************************
2244 **  End of Per-Operating System defines
2245 **********************************************************************/
2246 /**********************************************************************
2247 **  More general defines
2248 **********************************************************************/
2249
2250 /* general BSD defines */
2251 # ifdef BSD
2252 #  define HASGETDTABLESIZE 1    /* has getdtablesize(2) call */
2253 #  ifndef HASSETREUID
2254 #   define HASSETREUID  1       /* has setreuid(2) call */
2255 #  endif /* ! HASSETREUID */
2256 #  define HASINITGROUPS 1       /* has initgroups(3) call */
2257 #  ifndef IP_SRCROUTE
2258 #   define IP_SRCROUTE  1       /* can check IP source routing */
2259 #  endif /* ! IP_SRCROUTE */
2260 #  ifndef HASSETRLIMIT
2261 #   define HASSETRLIMIT 1       /* has setrlimit(2) call */
2262 #  endif /* ! HASSETRLIMIT */
2263 #  ifndef HASFLOCK
2264 #   define HASFLOCK     1       /* has flock(2) call */
2265 #  endif /* ! HASFLOCK */
2266 #  ifndef TZ_TYPE
2267 #   define TZ_TYPE      TZ_TM_ZONE      /* use tm->tm_zone variable */
2268 #  endif /* ! TZ_TYPE */
2269 # endif /* BSD */
2270
2271 /* general System V Release 4 defines */
2272 # ifdef __svr4__
2273 #  define SYSTEM5       1
2274 #  define USESETEUID    1       /* has usable seteuid(2) call */
2275 #  define HASINITGROUPS 1       /* has initgroups(3) call */
2276 #  define BSD_COMP      1       /* get BSD ioctl calls */
2277 #  ifndef HASSETRLIMIT
2278 #   define HASSETRLIMIT 1       /* has setrlimit(2) call */
2279 #  endif /* ! HASSETRLIMIT */
2280 #  ifndef HASGETUSERSHELL
2281 #   define HASGETUSERSHELL 0    /* does not have getusershell(3) call */
2282 #  endif /* ! HASGETUSERSHELL */
2283 #  ifndef HASFCHMOD
2284 #   define HASFCHMOD    1       /* most (all?) SVr4s seem to have fchmod(2) */
2285 #  endif /* ! HASFCHMOD */
2286
2287 #  ifndef _PATH_UNIX
2288 #   define _PATH_UNIX           "/unix"
2289 #  endif /* ! _PATH_UNIX */
2290 #  ifndef _PATH_VENDOR_CF
2291 #   define _PATH_VENDOR_CF      "/usr/ucblib/sendmail.cf"
2292 #  endif /* ! _PATH_VENDOR_CF */
2293 #  ifndef _PATH_SENDMAILPID
2294 #   define _PATH_SENDMAILPID    "/usr/ucblib/sendmail.pid"
2295 #  endif /* ! _PATH_SENDMAILPID */
2296 #  ifndef SYSLOG_BUFSIZE
2297 #   define SYSLOG_BUFSIZE       128
2298 #  endif /* ! SYSLOG_BUFSIZE */
2299 #  ifndef SFS_TYPE
2300 #   define SFS_TYPE             SFS_STATVFS
2301 #  endif /* ! SFS_TYPE */
2302
2303 #  ifndef USE_SIGLONGJMP
2304 #   define USE_SIGLONGJMP       1 /* sigsetjmp needed for signal handling */
2305 #  endif /* ! USE_SIGLONGJMP */
2306 # endif /* __svr4__ */
2307
2308 # ifdef __SVR4
2309 #  define LDA_USE_LOCKF         1
2310 #  define LDA_USE_SETEUID       1
2311 #  define _PATH_MAILDIR         "/var/mail"
2312 # endif /* __SVR4 */
2313
2314 /* general System V defines */
2315 # ifdef SYSTEM5
2316 #  include <sys/sysmacros.h>
2317 #  define HASUNAME      1       /* use System V uname(2) system call */
2318 #  define SYS5SETPGRP   1       /* use System V setpgrp(2) syscall */
2319 #  define HASSETVBUF    1       /* we have setvbuf(3) in libc */
2320 #  ifndef HASULIMIT
2321 #   define HASULIMIT    1       /* has the ulimit(2) syscall */
2322 #  endif /* ! HASULIMIT */
2323 #  ifndef LA_TYPE
2324 #   ifdef MIOC_READKSYM
2325 #    define LA_TYPE     LA_READKSYM     /* use MIOC_READKSYM ioctl */
2326 #   else /* MIOC_READKSYM */
2327 #    define LA_TYPE     LA_INT          /* assume integer load average */
2328 #   endif /* MIOC_READKSYM */
2329 #  endif /* ! LA_TYPE */
2330 #  ifndef SFS_TYPE
2331 #   define SFS_TYPE     SFS_USTAT       /* use System V ustat(2) syscall */
2332 #  endif /* ! SFS_TYPE */
2333 #  ifndef TZ_TYPE
2334 #   define TZ_TYPE      TZ_TZNAME       /* use tzname[] vector */
2335 #  endif /* ! TZ_TYPE */
2336 # endif /* SYSTEM5 */
2337
2338 /* general POSIX defines */
2339 # ifdef _POSIX_VERSION
2340 #  define HASSETSID     1       /* has Posix setsid(2) call */
2341 #  define HASWAITPID    1       /* has Posix waitpid(2) call */
2342 #  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
2343 #   define USESETEUID   1       /* has usable seteuid(2) call */
2344 #  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
2345 # endif /* _POSIX_VERSION */
2346 /*
2347 **  Tweaking for systems that (for example) claim to be BSD or POSIX
2348 **  but don't have all the standard BSD or POSIX routines (boo hiss).
2349 */
2350
2351 # ifdef titan
2352 #  undef HASINITGROUPS          /* doesn't have initgroups(3) call */
2353 # endif /* titan */
2354
2355 # ifdef _CRAYCOM
2356 #  undef HASSETSID              /* despite POSIX claim, doesn't have setsid */
2357 # endif /* _CRAYCOM */
2358
2359 # ifdef MOTO
2360 #  undef USESETEUID
2361 # endif /* MOTO */
2362
2363 /*
2364 **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
2365 **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
2366 **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
2367 **  are closed.  Some firewalls return this error if you try to connect
2368 **  to the IDENT port (113), so you can't receive email from these hosts
2369 **  on these systems.  The firewall really should use a more specific
2370 **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
2371 **  not explicitly set to zero above, default it on.
2372 */
2373
2374 # ifndef IDENTPROTO
2375 #  define IDENTPROTO    1       /* use IDENT proto (RFC 1413) */
2376 # endif /* ! IDENTPROTO */
2377
2378 # ifndef IP_SRCROUTE
2379 #  define IP_SRCROUTE   1       /* Detect IP source routing */
2380 # endif /* ! IP_SRCROUTE */
2381
2382 # ifndef HASGETUSERSHELL
2383 #  define HASGETUSERSHELL 1     /* libc has getusershell(3) call */
2384 # endif /* ! HASGETUSERSHELL */
2385
2386 # ifndef NETUNIX
2387 #  define NETUNIX       1       /* include unix domain support */
2388 # endif /* ! NETUNIX */
2389
2390 # ifndef HASRANDOM
2391 #  define HASRANDOM     1       /* has random(3) support */
2392 # endif /* ! HASRANDOM */
2393
2394 # ifndef HASFLOCK
2395 #  define HASFLOCK      0       /* assume no flock(2) support */
2396 # endif /* ! HASFLOCK */
2397
2398 # ifndef HASSETREUID
2399 #  define HASSETREUID   0       /* assume no setreuid(2) call */
2400 # endif /* ! HASSETREUID */
2401
2402 # ifndef HASFCHMOD
2403 #  define HASFCHMOD     0       /* assume no fchmod(2) syscall */
2404 # endif /* ! HASFCHMOD */
2405
2406 # ifndef USESETEUID
2407 #  define USESETEUID    0       /* assume no seteuid(2) call or no saved ids */
2408 # endif /* ! USESETEUID */
2409
2410 # ifndef HASSETRLIMIT
2411 #  define HASSETRLIMIT  0       /* assume no setrlimit(2) support */
2412 # endif /* ! HASSETRLIMIT */
2413
2414 # ifndef HASULIMIT
2415 #  define HASULIMIT     0       /* assume no ulimit(2) support */
2416 # endif /* ! HASULIMIT */
2417
2418 # ifndef SECUREWARE
2419 #  define SECUREWARE    0       /* assume no SecureWare C2 auditing hooks */
2420 # endif /* ! SECUREWARE */
2421
2422 # ifndef USE_DOUBLE_FORK
2423 #  define USE_DOUBLE_FORK       1       /* avoid intermediate zombies */
2424 # endif /* ! USE_DOUBLE_FORK */
2425
2426 # ifndef USE_ENVIRON
2427 #  define USE_ENVIRON   0       /* use main() envp instead of extern environ */
2428 # endif /* ! USE_ENVIRON */
2429
2430 # ifndef USE_SIGLONGJMP
2431 #  define USE_SIGLONGJMP        0       /* assume setjmp handles signals properly */
2432 # endif /* ! USE_SIGLONGJMP */
2433
2434 # ifndef FDSET_CAST
2435 #  define FDSET_CAST            /* (empty) cast for fd_set arg to select */
2436 # endif /* ! FDSET_CAST */
2437
2438 /*
2439 **  Pick a mailer setuid method for changing the current uid
2440 */
2441
2442 # define USE_SETEUID    0
2443 # define USE_SETREUID   1
2444 # define USE_SETUID     2
2445
2446 # if USESETEUID
2447 #  define MAILER_SETUID_METHOD  USE_SETEUID
2448 # else /* USESETEUID */
2449 #  if HASSETREUID
2450 #   define MAILER_SETUID_METHOD USE_SETREUID
2451 #  else /* HASSETREUID */
2452 #   define MAILER_SETUID_METHOD USE_SETUID
2453 #  endif /* HASSETREUID */
2454 # endif /* USESETEUID */
2455
2456 /*
2457 **  If no type for argument two of getgroups call is defined, assume
2458 **  it's an integer -- unfortunately, there seem to be several choices
2459 **  here.
2460 */
2461
2462 # ifndef GIDSET_T
2463 #  define GIDSET_T      int
2464 # endif /* ! GIDSET_T */
2465
2466 # ifndef UID_T
2467 #  define UID_T         uid_t
2468 # endif /* ! UID_T */
2469
2470 # ifndef GID_T
2471 #  define GID_T         gid_t
2472 # endif /* ! GID_T */
2473
2474 # ifndef MODE_T
2475 #  define MODE_T                mode_t
2476 # endif /* ! MODE_T */
2477
2478 # ifndef ARGV_T
2479 #  define ARGV_T                char **
2480 # endif /* ! ARGV_T */
2481
2482 # ifndef SOCKADDR_LEN_T
2483 #  define SOCKADDR_LEN_T        int
2484 # endif /* ! SOCKADDR_LEN_T */
2485
2486 # ifndef SOCKOPT_LEN_T
2487 #  define SOCKOPT_LEN_T int
2488 # endif /* ! SOCKOPT_LEN_T */
2489
2490 # ifndef QUAD_T
2491 #  define QUAD_T        unsigned long
2492 # endif /* ! QUAD_T */
2493 /**********************************************************************
2494 **  Remaining definitions should never have to be changed.  They are
2495 **  primarily to provide back compatibility for older systems -- for
2496 **  example, it includes some POSIX compatibility definitions
2497 **********************************************************************/
2498
2499 /* System 5 compatibility */
2500 # ifndef S_ISREG
2501 #  define S_ISREG(foo)  ((foo & S_IFMT) == S_IFREG)
2502 # endif /* ! S_ISREG */
2503 # ifndef S_ISDIR
2504 #  define S_ISDIR(foo)  ((foo & S_IFMT) == S_IFDIR)
2505 # endif /* ! S_ISDIR */
2506 # if !defined(S_ISLNK) && defined(S_IFLNK)
2507 #  define S_ISLNK(foo)  ((foo & S_IFMT) == S_IFLNK)
2508 # endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
2509 # if !defined(S_ISFIFO)
2510 #  if defined(S_IFIFO)
2511 #   define S_ISFIFO(foo)        ((foo & S_IFMT) == S_IFIFO)
2512 #  else /* defined(S_IFIFO) */
2513 #   define S_ISFIFO(foo)        false
2514 #  endif /* defined(S_IFIFO) */
2515 # endif /* !defined(S_ISFIFO) */
2516 # ifndef S_IRUSR
2517 #  define S_IRUSR               0400
2518 # endif /* ! S_IRUSR */
2519 # ifndef S_IWUSR
2520 #  define S_IWUSR               0200
2521 # endif /* ! S_IWUSR */
2522 # ifndef S_IRGRP
2523 #  define S_IRGRP               0040
2524 # endif /* ! S_IRGRP */
2525 # ifndef S_IWGRP
2526 #  define S_IWGRP               0020
2527 # endif /* ! S_IWGRP */
2528 # ifndef S_IROTH
2529 #  define S_IROTH               0004
2530 # endif /* ! S_IROTH */
2531 # ifndef S_IWOTH
2532 #  define S_IWOTH               0002
2533 # endif /* ! S_IWOTH */
2534
2535 /* close-on-exec flag */
2536 # ifndef FD_CLOEXEC
2537 #  define FD_CLOEXEC    1
2538 # endif /* ! FD_CLOEXEC */
2539
2540 /*
2541 **  Older systems don't have this error code -- it should be in
2542 **  /usr/include/sysexits.h.
2543 */
2544
2545 # ifndef EX_CONFIG
2546 #  define EX_CONFIG     78      /* configuration error */
2547 # endif /* ! EX_CONFIG */
2548
2549 /* pseudo-codes */
2550 # define EX_QUIT                22      /* drop out of server immediately */
2551 # define EX_RESTART     23      /* restart sendmail daemon */
2552 # define EX_SHUTDOWN    24      /* shutdown sendmail daemon */
2553
2554 #ifndef EX_NOTFOUND
2555 # define EX_NOTFOUND    EX_NOHOST
2556 #endif /* ! EX_NOTFOUND */
2557
2558 /* pseudo-code used for mci_setstat */
2559 # define EX_NOTSTICKY   -5      /* don't save persistent status */
2560
2561
2562 /*
2563 **  An "impossible" file mode to indicate that the file does not exist.
2564 */
2565
2566 # define ST_MODE_NOFILE 0171147         /* unlikely to occur */
2567
2568
2569 /* type of arbitrary pointer */
2570 # ifndef ARBPTR_T
2571 #  define ARBPTR_T      void *
2572 # endif /* ! ARBPTR_T */
2573
2574 # ifndef __P
2575 #  include "sm/cdefs.h"
2576 # endif /* ! __P */
2577
2578 # if HESIOD && !defined(NAMED_BIND)
2579 #  define NAMED_BIND    1       /* not one without the other */
2580 # endif /* HESIOD && !defined(NAMED_BIND) */
2581
2582 #  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
2583 extern int      h_errno;
2584 #  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
2585
2586 # if NEEDPUTENV
2587 extern int      putenv __P((char *));
2588 # endif /* NEEDPUTENV */
2589
2590 #if !HASUNSETENV
2591 extern void     unsetenv __P((char *));
2592 #endif /* !HASUNSETENV */
2593
2594 # ifdef LDAPMAP
2595 #  include <sys/time.h>
2596 #  include <lber.h>
2597 #  include <ldap.h>
2598
2599 /* Some LDAP constants */
2600 #  define LDAPMAP_FALSE         0
2601 #  define LDAPMAP_TRUE          1
2602
2603 /*
2604 **  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
2605 **  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
2606 **  and assume (falsely) that all old API implementations are broken.
2607 **  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
2608 */
2609
2610 #  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
2611 #   define USE_LDAP_INIT        1
2612 #  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
2613
2614 /*
2615 **  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
2616 **  hence ldap_set_option() must not exist.
2617 */
2618
2619 #  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
2620 #   define USE_LDAP_SET_OPTION  1
2621 #  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
2622
2623 # endif /* LDAPMAP */
2624
2625 # if HASUNAME
2626 #  include <sys/utsname.h>
2627 #  ifdef newstr
2628 #   undef newstr
2629 #  endif /* newstr */
2630 # else /* HASUNAME */
2631 #  define NODE_LENGTH 32
2632 struct utsname
2633 {
2634         char nodename[NODE_LENGTH + 1];
2635 };
2636 # endif /* HASUNAME */
2637
2638 # if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
2639 #  define MAXHOSTNAMELEN        256
2640 # endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
2641
2642 # if !defined(SIGCHLD) && defined(SIGCLD)
2643 #  define SIGCHLD       SIGCLD
2644 # endif /* !defined(SIGCHLD) && defined(SIGCLD) */
2645
2646 # ifndef STDIN_FILENO
2647 #  define STDIN_FILENO  0
2648 # endif /* ! STDIN_FILENO */
2649
2650 # ifndef STDOUT_FILENO
2651 #  define STDOUT_FILENO 1
2652 # endif /* ! STDOUT_FILENO */
2653
2654 # ifndef STDERR_FILENO
2655 #  define STDERR_FILENO 2
2656 # endif /* ! STDERR_FILENO */
2657
2658 # ifndef LOCK_SH
2659 #  define LOCK_SH       0x01    /* shared lock */
2660 #  define LOCK_EX       0x02    /* exclusive lock */
2661 #  define LOCK_NB       0x04    /* non-blocking lock */
2662 #  define LOCK_UN       0x08    /* unlock */
2663 # endif /* ! LOCK_SH */
2664
2665 # ifndef S_IXOTH
2666 #  define S_IXOTH       (S_IEXEC >> 6)
2667 # endif /* ! S_IXOTH */
2668
2669 # ifndef S_IXGRP
2670 #  define S_IXGRP       (S_IEXEC >> 3)
2671 # endif /* ! S_IXGRP */
2672
2673 # ifndef S_IXUSR
2674 #  define S_IXUSR       (S_IEXEC)
2675 # endif /* ! S_IXUSR */
2676
2677 #ifndef O_ACCMODE
2678 # define O_ACCMODE      (O_RDONLY|O_WRONLY|O_RDWR)
2679 #endif /* ! O_ACCMODE */
2680
2681 # ifndef SEEK_SET
2682 #  define SEEK_SET      0
2683 #  define SEEK_CUR      1
2684 #  define SEEK_END      2
2685 # endif /* ! SEEK_SET */
2686
2687 # ifndef SIG_ERR
2688 #  define SIG_ERR       ((void (*)()) -1)
2689 # endif /* ! SIG_ERR */
2690
2691 # ifndef WEXITSTATUS
2692 #  define WEXITSTATUS(st)       (((st) >> 8) & 0377)
2693 # endif /* ! WEXITSTATUS */
2694 # ifndef WIFEXITED
2695 #  define WIFEXITED(st)         (((st) & 0377) == 0)
2696 # endif /* ! WIFEXITED */
2697 # ifndef WIFSTOPPED
2698 #  define WIFSTOPPED(st)                (((st) & 0100) == 0)
2699 # endif /* ! WIFSTOPPED */
2700 # ifndef WCOREDUMP
2701 #  define WCOREDUMP(st)         (((st) & 0200) != 0)
2702 # endif /* ! WCOREDUMP */
2703 # ifndef WTERMSIG
2704 #  define WTERMSIG(st)          (((st) & 0177))
2705 # endif /* ! WTERMSIG */
2706
2707 # ifndef SIGFUNC_DEFINED
2708 typedef void            (*sigfunc_t) __P((int));
2709 # endif /* ! SIGFUNC_DEFINED */
2710 # ifndef SIGFUNC_RETURN
2711 #  define SIGFUNC_RETURN
2712 # endif /* ! SIGFUNC_RETURN */
2713 # ifndef SIGFUNC_DECL
2714 #  define SIGFUNC_DECL  void
2715 # endif /* ! SIGFUNC_DECL */
2716
2717 /* size of syslog buffer */
2718 # ifndef SYSLOG_BUFSIZE
2719 #  define SYSLOG_BUFSIZE        1024
2720 # endif /* ! SYSLOG_BUFSIZE */
2721
2722 /* for FD_SET() */
2723 #ifndef FD_SETSIZE
2724 # define FD_SETSIZE     256
2725 #endif /* ! FD_SETSIZE */
2726
2727 /*
2728 **  Size of prescan buffer.
2729 **      Despite comments in the _sendmail_ book, this probably should
2730 **      not be changed; there are some hard-to-define dependencies.
2731 */
2732
2733 # define PSBUFSIZE      (MAXNAME + MAXATOM)     /* size of prescan buffer */
2734
2735 /* fork routine -- set above using #ifdef _osname_ or in Makefile */
2736 # ifndef FORK
2737 #  define FORK          fork            /* function to call to fork mailer */
2738 # endif /* ! FORK */
2739
2740 /* setting h_errno */
2741 # ifndef SM_SET_H_ERRNO
2742 #  define SM_SET_H_ERRNO(err)   h_errno = (err)
2743 # endif /* SM_SET_H_ERRNO */
2744
2745 # ifndef SM_CONF_GETOPT
2746 #  define SM_CONF_GETOPT        1
2747 # endif /* ! SM_CONF_GETOPT */
2748
2749 /* random routine -- set above using #ifdef _osname_ or in Makefile */
2750 # if HASRANDOM
2751 #  define get_random()  random()
2752 # else /* HASRANDOM */
2753 #  define get_random()  ((long) rand())
2754 #  ifndef RANDOMSHIFT
2755 #   define RANDOMSHIFT  8
2756 #  endif /* ! RANDOMSHIFT */
2757 # endif /* HASRANDOM */
2758
2759 /*
2760 **  Default to using scanf in readcf.
2761 */
2762
2763 # ifndef SCANF
2764 #  define SCANF         1
2765 # endif /* ! SCANF */
2766
2767 /* XXX  32 bit type */
2768 # ifndef SM_INT32
2769 #  define SM_INT32      int32_t
2770 # endif /* ! SM_INT32 */
2771
2772 /*
2773 **  SVr4 and similar systems use different routines for setjmp/longjmp
2774 **  with signal support
2775 */
2776
2777 # if USE_SIGLONGJMP
2778 #  ifdef jmp_buf
2779 #   undef jmp_buf
2780 #  endif /* jmp_buf */
2781 #  define jmp_buf               sigjmp_buf
2782 #  ifdef setjmp
2783 #   undef setjmp
2784 #  endif /* setjmp */
2785 #  define setjmp(env)           sigsetjmp(env, 1)
2786 #  ifdef longjmp
2787 #   undef longjmp
2788 #  endif /* longjmp */
2789 #  define longjmp(env, val)     siglongjmp(env, val)
2790 # endif /* USE_SIGLONGJMP */
2791
2792 # if !defined(NGROUPS_MAX) && defined(NGROUPS)
2793 #  define NGROUPS_MAX   NGROUPS         /* POSIX naming convention */
2794 # endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
2795
2796 /*
2797 **  Some snprintf() implementations are rumored not to NUL terminate.
2798 */
2799 # if SNPRINTF_IS_BROKEN
2800 #  ifdef snprintf
2801 #   undef snprintf
2802 #  endif /* snprintf */
2803 #  define snprintf      sm_snprintf
2804 #  ifdef vsnprintf
2805 #   undef vsnprintf
2806 #  endif /* vsnprintf */
2807 #  define vsnprintf     sm_vsnprintf
2808 # endif /* SNPRINTF_IS_BROKEN */
2809
2810 /*
2811 **  If we don't have a system syslog, simulate it.
2812 */
2813
2814 # if !LOG
2815 #  define LOG_EMERG     0       /* system is unusable */
2816 #  define LOG_ALERT     1       /* action must be taken immediately */
2817 #  define LOG_CRIT      2       /* critical conditions */
2818 #  define LOG_ERR       3       /* error conditions */
2819 #  define LOG_WARNING   4       /* warning conditions */
2820 #  define LOG_NOTICE    5       /* normal but significant condition */
2821 #  define LOG_INFO      6       /* informational */
2822 #  define LOG_DEBUG     7       /* debug-level messages */
2823 # endif /* !LOG */
2824
2825 # ifndef SM_CONF_SYSLOG
2826 #  define SM_CONF_SYSLOG 1      /* syslog.h has prototype for syslog() */
2827 # endif /* SM_CONF_SYSLOG */
2828
2829 # if !SM_CONF_SYSLOG
2830 #   ifdef __STDC__
2831 extern void     syslog(int, const char *, ...);
2832 #   else /* __STDC__ */
2833 extern void     syslog();
2834 #   endif /* __STDC__ */
2835 # endif /* !SM_CONF_SYSLOG */
2836
2837 /* portable(?) definition for alignment */
2838 # ifndef SM_ALIGN_SIZE
2839 struct sm_align
2840 {
2841         char al_c;
2842         union
2843         {
2844                 long    al_l;
2845                 void    *al_p;
2846                 double  al_d;
2847                 void    (*al_f)();
2848         } al_u;
2849 };
2850 #  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
2851 # endif /* ! SM_ALIGN_SIZE */
2852 # define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
2853
2854 #endif /* ! SM_CONF_H */