This is a security audit change of the main source.
[jra/samba/.git] / source3 / include / includes.h
1 #ifndef _INCLUDES_H
2 #define _INCLUDES_H
3 /* 
4    Unix SMB/Netbios implementation.
5    Version 1.9.
6    Machine customisation and include handling
7    Copyright (C) Andrew Tridgell 1994-1998
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23 /*
24    This file does all the #includes's. This makes it easier to
25    port to a new unix. Hopefully a port will only have to edit the Makefile
26    and add a section for the new unix below.
27 */
28
29
30 /* the first OS dependent section is to setup what includes will be used.
31    the main OS dependent section comes later on 
32 */
33
34 #ifdef ALTOS
35 #define NO_UTIMEH
36 #endif
37
38 #ifdef MIPS
39 #define POSIX_H
40 #define NO_UTIMEH
41 #endif
42
43 #ifdef sun386
44 #define NO_UTIMEH
45 #endif
46
47 #ifdef NEXT2
48 #define NO_UTIMEH
49 #endif
50
51 #ifdef NEXT3_0
52 #define NO_UTIMEH
53 #define NO_UNISTDH
54 #endif
55
56 #ifdef APOLLO
57 #define NO_UTIMEH
58 #define NO_SYSMOUNTH
59 #define NO_UNISTDH
60 #endif
61
62 #ifdef AIX
63 #define NO_SYSMOUNTH
64 #endif
65
66 #ifdef M88K_R3
67 #define SVR3H
68 #define NO_RESOURCEH
69 #endif
70
71 #ifdef DNIX
72 #define NO_SYSMOUNTH
73 #define NO_NETIFH
74 #define NO_RESOURCEH
75 #define PRIME_NMBD 0
76 #define NO_SETGROUPS
77 #endif
78
79
80 #ifdef ISC
81 #define SYSSTREAMH
82 #define NO_RESOURCEH
83 #endif
84
85 #ifdef QNX
86 #define NO_RESOURCEH
87 #define NO_SYSMOUNTH
88 #define USE_MMAP 1
89 #ifdef __386__
90    #define __i386__
91 #endif
92 #endif
93
94 #ifdef NEWS42
95 #define NO_UTIMEH
96 #define NO_STRFTIME
97 #define NO_UTIMBUF
98 #define REPLACE_MKTIME
99 #define NO_TM_NAME
100 #endif
101
102 #ifdef OS2
103 #define NO_SYSMOUNTH
104 #define NO_NETIFH
105 #endif
106
107 #ifdef LYNX
108 #define NO_SYSMOUNTH
109 #endif
110
111
112 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
113 #define PASSWORD_LENGTH 16
114 #endif
115
116 /* here is the general includes section - with some ifdefs generated 
117    by the previous section 
118 */
119 #include "local.h"
120 #include <stdio.h>
121 #ifdef POSIX_STDLIBH
122 #include <posix/stdlib.h>
123 #else
124 #include <stdlib.h>
125 #endif
126 #include <ctype.h>
127 #include <time.h>
128 #ifndef NO_UTIMEH
129 #include <utime.h>
130 #endif
131 #include <sys/types.h>
132
133 #ifdef SVR3H
134 #include <sys/statfs.h>
135 #include <sys/stream.h>
136 #include <netinet/types.h>
137 #include <netinet/ether.h>
138 #include <netinet/ip_if.h>
139 #endif
140
141 #include <sys/socket.h>
142 #ifdef AXPROC
143 #include <termio.h>
144 #endif
145 #include <sys/ioctl.h>
146 #include <stddef.h>
147 #ifdef POSIX_H
148 #include <posix/utime.h>
149 #include <bsd/sys/time.h>
150 #include <bsd/netinet/in.h>
151 #else
152 #include <sys/time.h>
153 #include <netinet/in.h>
154 #endif 
155 #include <netdb.h>
156 #include <signal.h>
157 #include <errno.h>
158 #include <sys/file.h>
159 #include <sys/stat.h>
160 #include <sys/param.h>
161 #include <grp.h>
162 #ifndef NO_RESOURCEH
163 #include <sys/resource.h>
164 #endif
165 #ifndef NO_SYSMOUNTH
166 #include <sys/mount.h>
167 #endif
168 #include <pwd.h>
169 #ifdef __STDC__
170 #include <stdarg.h>
171 #else
172 #include <varargs.h>
173 #endif
174 #ifndef NO_UNISTDH
175 #include <unistd.h>
176 #endif
177 #include <sys/wait.h>
178 #ifdef SYSSTREAMH
179 #include <sys/stream.h>
180 #endif
181 #ifndef NO_NETIFH
182 #ifdef POSIX_H
183 #include <bsd/net/if.h>
184 #else
185 #ifdef OSF1
186 #include <net/route.h>
187 #include <sys/mbuf.h>
188 #endif
189 #include <net/if.h>
190 #endif
191 #endif
192
193 #if defined(GETPWANAM)
194 #include <sys/types.h>
195 #include <sys/label.h>
196 #include <sys/audit.h>
197 #include <pwdadj.h>
198 #endif
199
200 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX) && !defined(__OpenBSD__)
201 #include <shadow.h>
202 #endif
203
204 #ifdef SYSLOG
205 #include <syslog.h>
206 #endif
207
208 #ifdef HAVE_REGEX_H
209 #include <regex.h>
210 #endif
211
212
213 /***************************************************************************
214 Here come some platform specific sections
215 ***************************************************************************/
216
217
218 #ifdef LINUX
219 #include <arpa/inet.h>
220 #include <dirent.h>
221 #include <string.h>
222 #include <sys/vfs.h>
223 #include <netinet/in.h>
224 #ifdef GLIBC2
225 #define _LINUX_C_LIB_VERSION_MAJOR     6
226 #include <termios.h>
227 #include <rpcsvc/ypclnt.h>
228 #include <crypt.h>
229 #include <netinet/tcp.h>
230 #include <netinet/ip.h>
231 #endif
232 #ifndef QSORT_CAST
233 #define QSORT_CAST (int (*)(const void *, const void *))
234 #endif /* QSORT_CAST */
235 #define SIGNAL_CAST (__sighandler_t)
236 #define USE_GETCWD
237 #define USE_SETSID
238 #define HAVE_BZERO
239 #define HAVE_MEMMOVE
240 #define HAVE_VSNPRINTF
241 #define USE_SIGPROCMASK
242 #define USE_WAITPID
243 #define USE_SYSV_IPC
244 #if 0
245 /* SETFS disabled until we can check on some bug reports */
246 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
247 #define USE_SETFS
248 #endif
249 #endif
250 #ifdef SHADOW_PWD
251 #if _LINUX_C_LIB_VERSION_MAJOR < 5
252 #ifndef crypt
253 #define crypt pw_encrypt
254 #endif
255 #endif
256 #endif
257 #endif
258
259 #ifdef SUNOS4
260 #define SIGNAL_CAST (void (*)(int))
261 #include <netinet/tcp.h>
262 #include <dirent.h>
263 #include <sys/acct.h>
264 #include <sys/vfs.h>
265 #include <string.h>
266 #include <errno.h>
267 #include <sys/wait.h>
268 #include <signal.h>
269 /* #include <termios.h> */
270 #ifdef sun386
271 #define NO_STRFTIME
272 #define NO_UTIMBUF
273 #define mktime timelocal
274 typedef unsigned short mode_t;
275 #else
276 #include <utime.h>
277 #define NO_STRERROR
278 #endif
279 #ifndef REPLACE_GETPASS
280 #define REPLACE_GETPASS
281 #endif
282 #ifndef BSD_TERMIO
283 #define BSD_TERMIO
284 #endif
285 #ifndef USE_SIGPROCMASK
286 #define USE_SIGPROCMASK
287 #endif
288 #ifndef USE_WAITPID
289 #define USE_WAITPID
290 #endif
291 #define USE_SYSV_IPC
292 /* SunOS doesn't have POSIX atexit */
293 #define atexit on_exit
294 #endif
295
296
297 #ifdef SUNOS5
298 #include <fcntl.h>
299 #include <dirent.h>
300 #include <sys/acct.h>
301 #include <sys/statfs.h>
302 #include <sys/statvfs.h>
303 #include <sys/filio.h>
304 #include <sys/sockio.h>
305 #include <netinet/in_systm.h>
306 #include <netinet/tcp.h>
307 #include <netinet/ip.h>
308 #include <string.h>
309 #include <arpa/inet.h>
310 #include <rpcsvc/ypclnt.h>
311 #include <termios.h>
312 #include <sys/stropts.h>
313 #if !defined(USE_LIBDES) && !defined(KRB4_AUTH)
314 #include <crypt.h>
315 #endif /* !USE_LIBDES && !KRB4_AUTH */
316 extern int gettimeofday (struct timeval *, void *);
317 extern int gethostname (char *name, int namelen);
318 extern int innetgr (const char *, const char *, const char *, const char *);
319 #define USE_SETVBUF
320 #define SIGNAL_CAST (void (*)(int))
321 #ifndef SYSV
322 #define SYSV
323 #endif
324 #define USE_WAITPID
325 #define REPLACE_STRLEN
326 #define USE_STATVFS
327 #define USE_GETCWD
328 #define USE_SETSID
329 #define USE_SYSV_IPC
330 #define NO_SEMUN
331 #ifndef REPLACE_GETPASS
332 #define REPLACE_GETPASS
333 #endif /* REPLACE_GETPASS */
334 #define USE_SIGPROCMASK
335 #ifndef QSORT_CAST
336 #define QSORT_CAST (int (*)(const void *, const void *))
337 #endif /* QSORT_CAST */
338 #define HAVE_VSNPRINTF
339 #endif
340
341
342 #ifdef ULTRIX
343 #include <strings.h>
344 #include <nfs/nfs_clnt.h>
345 #include <nfs/vfs.h>
346 #include <netinet/tcp.h>
347 #ifdef ULTRIX_AUTH
348 #include <auth.h>
349 #endif
350 char *getwd(char *);
351 #define NOSTRDUP
352 #ifdef __STDC__
353 #define SIGNAL_CAST (void(*)(int))
354 #endif
355 #define USE_DIRECT
356 #define USE_WAITPID
357 #endif
358
359 #ifdef SGI4
360 #include <netinet/tcp.h>
361 #include <sys/statfs.h>
362 #include <string.h>
363 #include <signal.h>
364 #ifndef SYSV
365 #define SYSV
366 #endif
367 #define SIGNAL_CAST (void (*)())
368 #define STATFS4
369 #define USE_WAITPID
370 #define USE_DIRECT
371 #define USE_SETSID
372 #define USE_SYSV_IPC
373 #endif
374
375 #if defined(SGI5) || defined(SGI6)
376 #include <arpa/inet.h>
377 #include <netinet/tcp.h>
378 #include <netinet/in_systm.h>
379 #include <netinet/ip.h>
380 #include <sys/statvfs.h>
381 #include <string.h>
382 #include <signal.h>
383 #include <dirent.h>
384 #define USE_WAITPID
385 #define NETGROUP 
386 #ifndef SYSV
387 #define SYSV
388 #endif
389 #define SIGNAL_CAST (void (*)())
390 #define USE_STATVFS
391 #define USE_WAITPID
392 #define USE_SETSID
393 #define USE_SYSV_IPC
394 #ifndef QSORT_CAST
395 #define QSORT_CAST (int (*)(const void *, const void *))
396 #endif /* QSORT_CAST */
397 #endif
398
399
400 #ifdef MIPS
401 #include <bsd/net/soioctl.h>
402 #include <string.h>
403 #include <dirent.h>
404 #include <fcntl.h>
405 #include <sys/statfs.h>
406 #include <sys/wait.h>
407 #include <sys/termio.h>
408 #define SIGNAL_CAST (void (*)())
409 typedef int mode_t;
410 extern struct group *getgrnam();
411 extern struct passwd *getpwnam();
412 #define STATFS4
413 #define NO_STRERROR
414 #define REPLACE_STRSTR
415 #endif /* MIPS */
416
417
418
419 #ifdef DGUX
420 #include <string.h>
421 #include <dirent.h>
422 #include <sys/statfs.h>
423 #include <sys/statvfs.h>
424 #include <fcntl.h>
425 #include <termios.h>
426 #define SYSV
427 #define USE_WAITPID
428 #define SIGNAL_CAST (void (*)(int))
429 #define STATFS4
430 #define USE_GETCWD
431 #endif
432
433
434 #ifdef SVR4
435 #include <string.h>
436 #include <sys/dir.h>
437 #include <dirent.h>
438 #include <sys/statfs.h>
439 #include <sys/statvfs.h>
440 #include <sys/vfs.h>
441 #include <sys/filio.h>
442 #include <fcntl.h>
443 #include <sys/sockio.h>
444 #include <netinet/tcp.h>
445 #include <stropts.h>
446 #include <termios.h>
447 #define SYSV
448 #define USE_WAITPID
449 #define SIGNAL_CAST (void (*)(int))
450 #define USE_STATVFS
451 #define USE_GETCWD
452 #define USE_SETSID
453 #define USE_SYSV_IPC
454 #define NO_SEMUN
455 #endif
456
457
458 #ifdef OSF1
459 #include <termios.h>
460 #include <strings.h>
461 #include <dirent.h>
462 char *getwd(char *);
463 char *mktemp(char *); /* No standard include */
464 #include <netinet/in.h>
465 #include <arpa/inet.h> /* both for inet_ntoa */
466 #define SIGNAL_CAST ( void (*) (int) )
467 #define STATFS3
468 #define USE_F_FSIZE
469 #define USE_SETSID
470 #include <netinet/tcp.h>
471 #ifdef OSF1_ENH_SEC
472 #include <pwd.h>
473 #include <sys/types.h>
474 #include <sys/security.h>
475 #include <prot.h>
476 #include <unistd.h>
477 #define PASSWORD_LENGTH 16
478 #define NEED_AUTH_PARAMETERS
479 #endif  /* OSF1_ENH_SEC */
480 #define USE_SYSV_IPC
481 #define NO_SEMUN
482 #endif
483
484
485 #ifdef CLIX
486 #include <dirent.h>
487 #define SIGNAL_CAST     (void (*)())
488 #include <sys/fcntl.h>
489 #include <sys/statfs.h>
490 #include <string.h>
491 #define NO_EID
492 #define USE_WAITPID
493 #define STATFS4
494 #define NO_FSYNC
495 #define USE_GETCWD
496 #define USE_SETSID
497 #ifndef REPLACE_GETPASS
498 #define REPLACE_GETPASS
499 #endif /* REPLACE_GETPASS */
500 #define NO_GETRLIMIT
501 #endif  /* CLIX */
502
503
504
505 #ifdef BSDI
506 #include <string.h>
507 #include <netinet/tcp.h>
508 #define SIGNAL_CAST (void (*)())
509 #define USE_DIRECT
510 #endif
511
512
513 #ifdef NETBSD  
514 #ifdef NetBSD1_3  
515 #include <string.h>  
516 #ifdef ALLOW_CHANGE_PASSWORD  
517 #include <termios.h>  
518 #endif /* ALLOW_CHANGE_PASSWORD */  
519 #else /* NetBSD1_3 */
520 #include <strings.h>  
521 #endif /* NetBSD1_3 */  
522 #include <netinet/tcp.h>
523 /* you may not need this */
524 #define NO_GETSPNAM 
525 #define SIGNAL_CAST (void (*)())
526 #define USE_DIRECT
527 #define REPLACE_INNETGR
528 #endif
529
530
531 #ifdef FreeBSD
532 #include <arpa/inet.h>
533 #include <strings.h>
534 #include <netinet/tcp.h>
535 #include <netinet/in_systm.h>
536 #include <netinet/ip.h>
537 #include <termios.h>
538 #include <fcntl.h>
539 #if __FreeBSD__ >= 3
540 #include <dirent.h>
541 #else
542 #define USE_DIRECT
543 #endif
544 #define SIGNAL_CAST (void (*)(int))
545 #define USE_SETVBUF
546 #define USE_SETSID
547 #define USE_GETCWD
548 #define USE_WAITPID
549 #define HAVE_MEMMOVE
550 #define HAVE_BZERO
551 #define HAVE_GETTIMEOFDAY
552 #define HAVE_PATHCONF
553 #define HAVE_GETGRNAM 1
554 #define HAVE_VSNPRINTF
555 #define QSORT_CAST (int (*)(const void *, const void *))
556 #if !defined(O_SYNC)
557 #if defined(O_FSYNC)
558 #define O_SYNC O_FSYNC
559 #else /* defined(O_FSYNC) */
560 #define O_SYNC 0
561 #endif /* defined(O_FSYNC) */
562 #endif /* !defined(O_SYNC) */
563 #endif /* FreeBSD */
564
565 #ifdef __OpenBSD__
566 #include <strings.h>
567 #include <netinet/tcp.h>
568 #define NO_GETSPNAM
569 #define SIGNAL_CAST (void (*)())
570 #define USE_DIRECT
571 #define REPLACE_INNETGR
572 #define HAVE_BZERO
573 #define HAVE_PATHCONF
574 #define HAVE_GETGRNAM 1
575 #define HAVE_GETTIMEOFDAY
576 #define HAVE_MEMMOVE
577 #define USE_GETCWD
578 #define USE_SETSID
579 #endif 
580
581 #ifdef AIX
582 #include <strings.h>
583 #include <sys/dir.h>
584 #include <sys/select.h>
585 #include <dirent.h>
586 #include <sys/statfs.h>
587 #include <sys/vfs.h>
588 #include <sys/id.h>
589 #include <sys/priv.h>
590 /* According to AIX 4.1 man pages, inet_ntoa needs the following headers */
591 #include <sys/socket.h>
592 #include <netinet/in.h>
593 #include <arpa/inet.h>
594 #include <netinet/tcp.h>
595 #include <locale.h>
596 #define SYSV
597 #define USE_WAITPID
598 #define USE_SIGBLOCK
599 #define SIGNAL_CAST (void (*)())
600 #define DEFAULT_PRINTING PRINT_AIX
601 /* we undef this because sys/param.h is broken in aix. uggh. */
602 #undef MAXHOSTNAMELEN
603 #endif
604
605
606 #ifdef HPUX
607 #include <string.h>
608 #include <dirent.h>
609 #include <fcntl.h>
610 #include <sys/vfs.h>
611 #include <sys/types.h>
612 #include <sys/termios.h>
613 #include <netinet/tcp.h>
614 #include <arpa/inet.h>                /* needed for inet_ntoa proto */
615 #ifdef HPUX_10_TRUSTED
616 #include <hpsecurity.h>
617 #include <prot.h>
618 #define NEED_AUTH_PARAMETERS
619 #endif
620 #define SIGNAL_CAST (void (*)(__harg))
621 #ifndef HPUX10 /* This is only needed for HPUX 9.x */
622 #define SELECT_CAST (int *)
623 #endif /* HPUX10 */
624 #define SYSV
625 #define USE_WAITPID
626 #define WAIT3_CAST2 (int *)
627 #define USE_GETCWD
628 #define USE_SETSID
629 #define USE_SETRES
630 #define USE_SYSV_IPC
631 #define NO_SEMUN
632 #define HAVE_VALLOC
633 #define DEFAULT_PRINTING PRINT_HPUX
634 /* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
635    not good for HPUX */
636 /* #define SIGCLD_IGNORE */
637 #define USE_SIGPROCMASK /* Needed to stop zombie processes on HPUX 9.x and 10.x.*/
638 #endif /* HPUX */
639
640
641 #ifdef SEQUENT
642 #include <signal.h>
643 #include <string.h>
644 #include <dirent.h>
645 #include <sys/types.h>
646 #include <sys/statfs.h>
647 #include <sys/stat.h>
648 #include <sys/buf.h>
649 #include <sys/socket.h>
650 #include <unistd.h>
651 #include <fcntl.h>
652 #define SIGNAL_CAST (void (*)(int))
653 #define USE_WAITPID
654 #define USE_GETCWD
655 #define NO_EID
656 #define STATFS4
657 #define USE_DIRECT
658 #ifdef PTX4
659 #undef USE_DIRECT
660 #endif
661 #endif
662
663
664
665 #ifdef SEQUENT_PTX4
666 #include <string.h>
667 #include <sys/dir.h>
668 #include <dirent.h>
669 #include <sys/statfs.h>
670 #include <sys/statvfs.h>
671 #include <sys/vfs.h>
672 #include <fcntl.h>
673 #include <sys/sockio.h>
674 #include <netinet/tcp.h>
675 #include <stropts.h>
676 #include <termios.h>
677 #define SYSV
678 #define USE_WAITPID
679 #define SIGNAL_CAST (void (*)(int))
680 #define USE_STATVFS
681 #define USE_GETCWD
682 #ifndef seteuid
683 #define seteuid(uid) setreuid(-1,uid)
684 #endif
685 #ifndef setegid
686 #define setegid(gid) setregid(-1,gid)
687 #endif
688 #endif
689
690
691 #ifdef NEXT2
692 #include <sys/types.h>
693 #include <strings.h>
694 #include <dirent.h>
695 #include <sys/vfs.h>
696 #define bzero(b,len) memset(b,0,len)
697 #define mode_t int
698 #define NO_UTIMBUF
699 #include <libc.h>
700 #define NOSTRDUP
701 #define USE_DIRECT
702 #define USE_WAITPID
703 #endif 
704
705
706 #ifdef NEXT3_0
707 #include <strings.h>
708 #include <sys/dir.h>
709 #include <sys/vfs.h>
710 #define bzero(b,len) memset(b,0,len)
711 #define NO_UTIMBUF
712 #include <libc.h>
713 #define NOSTRDUP
714 #define USE_DIRECT
715 #define mode_t int
716 #define GID_TYPE int
717 #define gid_t int
718 #define pid_t int
719 #define SIGNAL_CAST (void (*)(int))
720 #define WAIT3_CAST1 (union wait *)
721 #define HAVE_GMTOFF
722 #endif
723
724
725
726 #ifdef APOLLO
727 #include <string.h>
728 #include <fcntl.h>
729 #include <sys/statfs.h>
730 #define NO_UTIMBUF
731 #define USE_DIRECT
732 #define USE_GETCWD
733 #define SIGNAL_CAST     (void (*)())
734 #define HAVE_FCNTL_LOCK 0
735 #define HAVE_GETTIMEOFDAY
736 #define STATFS4
737 #endif
738
739
740
741 #ifdef SCO
742 #include <sys/netinet/tcp.h>
743 #include <sys/netinet/in_systm.h>
744 #include <sys/netinet/ip.h>
745 #include <dirent.h>
746 #include <string.h>
747 #include <termios.h>
748 #include <fcntl.h>
749 #include <sys/statfs.h>
750 #include <sys/stropts.h>
751 #include <limits.h>
752 #include <locale.h>
753 #ifdef EVEREST
754 #include <unistd.h> 
755 #endif /* EVEREST */
756 #ifdef NETGROUP
757 #include <rpcsvc/ypclnt.h>
758 #endif /* NETGROUP */
759 #ifdef SecureWare
760 #include <sys/security.h>
761 #include <sys/audit.h>
762 #include <prot.h>
763 #define crypt bigcrypt
764 #endif /* SecureWare */
765 #define SIGNAL_CAST (void (*)(int))
766 #define USE_WAITPID
767 #define USE_GETCWD
768 #define USE_SETSID
769 #ifdef SCO3_2_2
770 #define setuid(u) setreuid(u,-1)
771 #define seteuid(u) setreuid(-1,u)
772 #else /* SCO3_2_2 */
773 #ifndef EVEREST
774 #define ftruncate(f,l) syscall(0x0a28,f,l)
775 #define USE_IFREQ
776 #define NO_INITGROUPS
777 #endif /* EVEREST */
778 #endif /* SCO3_2_2 */
779 #define STATFS4
780 #define NO_FSYNC
781 #define HAVE_PATHCONF
782 #define NO_GETRLIMIT
783 #endif /* SCO */
784
785
786
787 /* Definitions for RiscIX */
788 #ifdef RiscIX
789 #define SIGNAL_CAST (void (*)(int))
790 #include <sys/dirent.h>
791 #include <sys/acct.h>
792 #include <sys/vfs.h>
793 #include <string.h>
794 #include <utime.h>
795 #include <signal.h>
796 #define HAVE_GETTIMEOFDAY
797 #define NOSTRCASECMP
798 #define NOSTRDUP
799 #endif
800
801
802
803 #ifdef ISC
804 #include <net/errno.h>
805 #include <string.h>
806 #include <sys/dir.h>
807 #include <dirent.h>
808 #include <sys/statfs.h>
809 #include <fcntl.h>
810 #include <sys/sioctl.h>
811 #include <stropts.h>
812 #include <limits.h>
813 #include <netinet/tcp.h>
814 #define FIONREAD FIORDCHK
815 #define SYSV
816 #define USE_WAITPID
817 #define SIGNAL_CAST (void (*)(int))
818 #define USE_GETCWD
819 #define USE_SETSID
820 #define USE_IFREQ
821 #define NO_FTRUNCATE
822 #define STATFS4
823 #define NO_FSYNC
824 #endif
825
826
827
828 #ifdef AUX
829 #include <fstab.h>
830 #include <string.h>
831 #include <dirent.h>
832 #include <sys/vfs.h>
833 #include <fcntl.h>
834 #include <termios.h>
835 #define SYSV
836 #define USE_WAITPID
837 #define SIGNAL_CAST (void (*)(int))
838 char *strdup (char *);
839 #define USE_GETCWD
840 #endif
841
842
843 #ifdef M88K_R3
844 #include <string.h>
845 #include <dirent.h>
846 #include <fcntl.h>
847 #include <termios.h>
848 #define STATFS4
849 #define SYSV
850 #define USE_WAITPID
851 #define SIGNAL_CAST (void (*)(int))
852 char *strdup (char *);
853 #define USE_GETCWD
854 #define NO_FSYNC
855 #define NO_EID
856 #endif
857
858
859 #ifdef DNIX
860 #include <dirent.h>
861 #include <string.h>
862 #include <fcntl.h>
863 #include <sys/statfs.h>
864 #include <sys/stropts.h>
865 #define NO_GET_BROADCAST
866 #define USE_WAITPID
867 #define USE_GETCWD
868 #define USE_SETSID
869 #define STATFS4
870 #define NO_EID
871 #define PF_INET AF_INET
872 #define NO_STRERROR
873 #define ftruncate(f,l) chsize(f,l)
874 #endif /* DNIX */
875
876 #ifdef CONVEX
877 #include <netinet/tcp.h>
878 #include <arpa/inet.h>
879 #include <dirent.h>
880 #include <string.h>
881 #include <sys/vfs.h>
882 #include <fcntl.h>
883 #define DONT_REINSTALL_SIG
884 #define USE_SIGBLOCK
885 #define USE_WAITPID
886 #define SIGNAL_CAST (_SigFunc_Ptr_t)
887 #define NO_GETSPNAM
888 #define HAVE_MEMMOVE
889 extern char *mktemp(char *);
890 extern int  fsync(int);
891 extern int  seteuid(uid_t);
892 extern int  setgroups(int, int *);
893 extern int  initgroups(char *, int);
894 extern int  statfs(char *, struct statfs *);
895 extern int  setegid(gid_t);
896 extern int  getopt(int, char *const *, const char *);
897 extern int  chroot(char *);
898 extern int  gettimeofday(struct timeval *, struct timezone *);
899 extern int  gethostname(char *, int);
900 extern char *crypt(char *, char *);
901 extern char *getpass(char *);
902 #endif
903
904
905 #ifdef CRAY
906 #define MAXPATHLEN 1024
907 #include <dirent.h>
908 #include <string.h>
909 #include <fcntl.h>
910 #include <sys/statfs.h>
911 #define SIGNAL_CAST (void (*)(int))
912 #define SIGCLD_IGNORE
913 #define HAVE_FCNTL_LOCK 1
914 #define USE_SETSID
915 #define STATFS4
916 #endif
917
918
919 #ifdef ALTOS
920 #include <unistd.h>
921 #include <string.h>
922 #include <dirent.h>
923 #include <sys/fcntl.h>
924 #include <sys/statfs.h>
925 #define        const
926 #define        uid_t           int
927 #define        gid_t           int
928 #define        mode_t          int
929 #define        ptrdiff_t       int
930 #define HAVE_GETGRNAM  0
931 #define NO_EID
932 #define NO_FSYNC
933 #define        NO_FTRUNCATE
934 #define        NO_GETRLIMIT
935 #define        NO_INITGROUPS
936 #define NO_SELECT
937 #define NO_SETGROUPS
938 #define NO_STRERROR
939 #define NO_STRFTIME
940 #define        NO_TM_NAME
941 #define NO_UTIMEH
942 #define NOSTRCASECMP
943 #define REPLACE_MKTIME
944 #define REPLACE_RENAME
945 #define REPLACE_STRSTR
946 #define STATFS4
947 #define        USE_GETCWD
948 #endif
949
950 #ifdef QNX
951 #define STATFS4
952 #include <sys/statfs.h>
953 #include <sys/select.h>
954 #include <signal.h>
955 #include <sys/dir.h>
956 #define SIGNAL_CAST (void (*)())
957 #define USE_WAITPID
958 #define NO_INITGROUPS
959 #define NO_SETGROUPS
960 #define HAVE_TIMEZONE
961 #define USE_GETCWD
962 #define USE_SETSID
963 #define HAVE_FCNTL_LOCK 1
964 #define DEFAULT_PRINTING PRINT_QNX
965 #endif
966
967
968 #ifdef NEWS42
969 #include <string.h>
970 #include <dirent.h>
971 #include <sys/vfs.h>
972 #include <sys/timeb.h>
973 typedef int mode_t;
974 #endif
975
976 #ifdef OS2
977 #include <dirent.h>
978 #include <sys/statfs.h>
979 #include <string.h>
980 #include <limits.h>
981 #define SIGNAL_CAST (void (*)())
982 #define HAVE_FCNTL_LOCK 0
983 #define USE_WAITPID
984 #define NO_GET_BROADCAST
985 #define NO_EID
986 #define NO_SETGROUPS
987 #define NO_INITGROUPS
988 #define NO_CRYPT
989 #define NO_STATFS
990 #define NO_CHROOT
991 #define NO_CHOWN
992 #define strcasecmp stricmp
993 #define strncasecmp strnicmp
994 #endif
995
996
997 #ifdef LYNX
998 #define SIGNAL_CAST (void (*)())
999 #define WAIT3_CAST1 (union wait *)
1000 #define STATFS4
1001 #include <fcntl.h>
1002 #include <resource.h>
1003 #include <stat.h>
1004 #include <string.h>
1005 #include <dirent.h>
1006 #include <sys/statfs.h>
1007 #define USE_GETCWD
1008 #define USE_GETSID
1009 #endif
1010
1011
1012 #ifdef BOS
1013 #define SIGNAL_CAST (void (*)(int))
1014 #include <string.h>
1015 #include <sys/dir.h>
1016 #include <sys/select.h>
1017 #include <dirent.h>
1018 #include <fcntl.h>
1019 #include <signal.h>
1020 #include <sys/statfs.h>
1021 #include <sys/bsdioctl.h>
1022 #endif
1023
1024 #ifdef AMIGA
1025 #include <arpa/inet.h>
1026 #include <dirent.h>
1027 #include <string.h>
1028 #include <netinet/tcp.h>
1029 #include <sys/acct.h>
1030 #include <sys/fcntl.h>
1031 #include <sys/filio.h>
1032 #include <sys/sockio.h>
1033 #include <netinet/in_systm.h>
1034 #include <netinet/ip.h>
1035 #include <sys/termios.h>
1036 #include <limits.h>
1037 #include <sys/timeb.h>
1038
1039 #define SIGNAL_CAST (void (*)(int))
1040 #define USE_GETCWD
1041 #define HAVE_BZERO
1042 #define HAVE_MEMMOVE
1043 #define USE_SIGPROCMASK
1044 #define USE_WAITPID
1045 #define USE_DIRECT
1046 #define USE_F_FSIZE
1047 #define HAVE_FCNTL_LOCK 0
1048 #define HAVE_GETTIMEOFDAY
1049 #define HAVE_PATHCONF
1050
1051 #define HAVE_NO_PROC
1052 #define NO_FORK_DEBUG
1053 #define HAVE_FORK 0
1054 #define HAVE_VFORK 1
1055 #endif
1056
1057 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
1058 #ifdef IA_UINFO
1059 #include <iaf.h>
1060 #include <ia.h>
1061 #endif
1062
1063
1064 /*******************************************************************
1065 end of the platform specific sections
1066 ********************************************************************/
1067
1068 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
1069 #include <sys/mman.h>
1070 #endif
1071
1072 #ifdef SecureWare
1073 #define NEED_AUTH_PARAMETERS
1074 #endif
1075
1076 #ifdef REPLACE_GETPASS
1077 extern char    *getsmbpass(char *);
1078 #define getpass(s) getsmbpass(s)
1079 #endif
1080
1081 #ifdef REPLACE_INNETGR
1082 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
1083 #endif
1084
1085 #ifndef FD_SETSIZE
1086 #define FD_SETSIZE 255
1087 #endif
1088
1089 #ifndef __STDC__
1090 #define const
1091 #endif
1092
1093 /* Now for some other grungy stuff */
1094 #ifdef NO_GETSPNAM
1095 struct spwd { /* fake shadow password structure */
1096        char *sp_pwdp;
1097 };
1098 #endif
1099
1100 #ifndef HAVE_BZERO
1101 #ifndef bzero
1102 #define bzero(p,s) memset(p,0,s)
1103 #endif
1104 #endif
1105
1106 #ifndef HAVE_MEMMOVE
1107 #ifndef memmove
1108 #define memmove(d,s,n) MemMove(d,s,n)
1109 #endif
1110 #endif
1111
1112 #ifdef USE_DIRECT
1113 #include <sys/dir.h>
1114 #endif
1115
1116 /* some unixes have ENOTTY instead of TIOCNOTTY */
1117 #ifndef TIOCNOTTY
1118 #ifdef ENOTTY
1119 #define TIOCNOTTY ENOTTY
1120 #endif
1121 #endif
1122
1123 #ifndef SIGHUP
1124 #define SIGHUP 1
1125 #endif
1126
1127 /* if undefined then use bsd or sysv printing */
1128 #ifndef DEFAULT_PRINTING
1129 #ifdef SYSV
1130 #define DEFAULT_PRINTING PRINT_SYSV
1131 #else
1132 #define DEFAULT_PRINTING PRINT_BSD
1133 #endif
1134 #endif
1135
1136 /* This defines the name of the printcap file. It is MOST UNLIKELY that
1137    this will change BUT! Specifying a file with the format of a printcap
1138    file but containing only a subset of the printers actually in your real 
1139    printcap file is a quick-n-dirty way to allow dynamic access to a subset
1140    of available printers.
1141 */
1142 #ifndef PRINTCAP_NAME
1143 #ifdef AIX
1144 #define PRINTCAP_NAME "/etc/qconfig"
1145 #elif defined(SYSV)
1146 #define PRINTCAP_NAME "lpstat"
1147 #else
1148 #define PRINTCAP_NAME "/etc/printcap"
1149 #endif
1150 #endif
1151
1152
1153 #ifdef USE_SYSV_IPC
1154 #include <sys/ipc.h>
1155 #include <sys/sem.h>
1156 #include <sys/shm.h>
1157 #ifdef NO_SEMUN
1158 union semun {
1159         int val;
1160         struct semid_ds *buf;
1161         unsigned short *array;
1162 };
1163 #endif
1164 #if defined(HPUX) && defined(HPUX10)
1165 #ifdef SEMMSL
1166 #undef SEMMSL
1167 #endif /* SEMMSL */
1168 #endif /* HPUX && HPUX10 */
1169 #endif
1170
1171 #ifdef AFS_AUTH
1172 #include <afs/stds.h>
1173 #include <afs/kautils.h>
1174 #endif
1175
1176 #ifdef DFS_AUTH
1177 #include <dce/dce_error.h>
1178 #include <dce/sec_login.h>
1179 #endif
1180
1181 #ifdef KRB5_AUTH
1182 #include <krb5.h>
1183 #endif
1184
1185 #ifdef KRB4_AUTH
1186 #include <krb.h>
1187 #endif
1188
1189 #ifdef USE_LDAP
1190 #include <lber.h>
1191 #include <ldap.h>
1192 #endif
1193
1194 #ifdef NO_UTIMBUF
1195 struct utimbuf {
1196   time_t actime;
1197   time_t modtime;
1198 };
1199 #endif
1200
1201 #ifdef NO_STRERROR
1202 #ifndef strerror
1203 extern char *sys_errlist[];
1204 #define strerror(i) sys_errlist[i]
1205 #endif
1206 #endif
1207
1208 #ifndef perror
1209 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1210 #endif
1211
1212 #ifndef MAXHOSTNAMELEN
1213 #define MAXHOSTNAMELEN 255
1214 #endif
1215
1216 #include "version.h"
1217 #include "smb.h"
1218 #include "nameserv.h"
1219 #include "ubiqx/ubi_dLinkList.h"
1220
1221 #include "byteorder.h"
1222
1223 #include "kanji.h"
1224 #include "charset.h"
1225
1226 #ifndef MAXCODEPAGELINES
1227 #define MAXCODEPAGELINES 256
1228 #endif
1229
1230 /***** automatically generated prototypes *****/
1231 #include "proto.h"
1232
1233
1234
1235 #ifndef S_IFREG
1236 #define S_IFREG 0100000
1237 #endif
1238
1239 #ifndef S_ISREG
1240 #define S_ISREG(x) ((S_IFREG & (x))!=0)
1241 #endif
1242
1243 #ifndef S_ISDIR
1244 #define S_ISDIR(x) ((S_IFDIR & (x))!=0)
1245 #endif
1246
1247 #if !defined(S_ISLNK) && defined(S_IFLNK)
1248 #define S_ISLNK(x) ((S_IFLNK & (x))!=0)
1249 #endif
1250
1251 #ifdef UFC_CRYPT
1252 #define crypt ufc_crypt
1253 #endif
1254
1255 #ifdef REPLACE_STRLEN
1256 #define strlen(s) Strlen(s)
1257 #endif
1258
1259 #ifdef REPLACE_STRSTR
1260 #define strstr(s,p) Strstr(s,p)
1261 #endif
1262
1263 #ifdef REPLACE_MKTIME
1264 #define mktime(t) Mktime(t)
1265 #endif
1266
1267 #ifndef NGROUPS_MAX
1268 #define NGROUPS_MAX 128
1269 #endif
1270
1271 #ifndef EDQUOT
1272 #define EDQUOT ENOSPC
1273 #endif
1274
1275 #ifndef HAVE_GETGRNAM
1276 #define HAVE_GETGRNAM 1
1277 #endif
1278
1279 #ifndef SOL_TCP
1280 #define SOL_TCP 6
1281 #endif
1282
1283 /* default to using ftruncate workaround as this is safer than assuming
1284 it works and getting lots of bug reports */
1285 #ifndef FTRUNCATE_CAN_EXTEND
1286 #define FTRUNCATE_CAN_EXTEND 0
1287 #endif
1288
1289 /* maybe this unix doesn't separate RD and WR locks? */
1290 #ifndef F_RDLCK
1291 #define F_RDLCK F_WRLCK
1292 #endif
1293
1294 #ifndef ENOTSOCK
1295 #define ENOTSOCK EINVAL
1296 #endif
1297
1298 #ifndef SIGCLD
1299 #define SIGCLD SIGCHLD
1300 #endif 
1301
1302 #ifndef MAP_FILE
1303 #define MAP_FILE 0
1304 #endif
1305
1306 #ifndef HAVE_FCNTL_LOCK
1307 #define HAVE_FCNTL_LOCK 1
1308 #endif
1309
1310 #ifndef WAIT3_CAST2
1311 #define WAIT3_CAST2 (struct rusage *)
1312 #endif
1313
1314 #ifndef WAIT3_CAST1
1315 #define WAIT3_CAST1 (int *)
1316 #endif
1317
1318 #ifndef QSORT_CAST
1319 #define QSORT_CAST (int (*)())
1320 #endif
1321
1322 #ifndef INADDR_LOOPBACK
1323 #define INADDR_LOOPBACK 0x7f000001
1324 #endif /* INADDR_LOOPBACK */
1325
1326 /* this is a rough check to see if this machine has a lstat() call.
1327    it is not guaranteed to work */
1328 #if !defined(S_ISLNK)
1329 #define lstat stat
1330 #endif
1331
1332 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1333 #ifndef errno
1334 extern int errno;
1335 #endif 
1336
1337
1338 #ifdef NO_EID
1339 #define geteuid() getuid()
1340 #define getegid() getgid()
1341 #define seteuid(x) setuid(x)
1342 #define setegid(x) setgid(x)
1343 #endif
1344
1345
1346 #if (HAVE_FCNTL_LOCK == 0)
1347 /* since there is no locking available, system includes  */
1348 /* for DomainOS 10.4 do not contain any of the following */
1349 /* #define's. So, to satisfy the compiler, add these     */
1350 /* #define's, although they arn't really necessary.      */
1351 #define F_GETLK 0
1352 #define F_SETLK 0
1353 #define F_WRLCK 0
1354 #define F_UNLCK 0
1355 #endif /* HAVE_FCNTL_LOCK == 0 */
1356
1357 #ifdef NOSTRCASECMP
1358 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1359 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1360 #endif
1361
1362 #ifdef strcpy
1363 #undef strcpy
1364 #endif /* strcpy */
1365 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
1366
1367 #ifdef strcat
1368 #undef strcat
1369 #endif /* strcat */
1370 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
1371
1372 #ifdef sprintf
1373 #undef sprintf
1374 #endif /* sprintf */
1375 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__>;
1376
1377 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
1378 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
1379 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
1380 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
1381
1382 #if MEM_MAN
1383 #include "mem_man/mem_man.h"
1384 #endif /* MEM_MAN */
1385
1386
1387 #endif