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