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