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