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