summaryrefslogtreecommitdiff
path: root/source3/include/includes.h
blob: 6f3450c4fd5f602bbfa911c254e4b730c4668e77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
#ifndef _INCLUDES_H
#define _INCLUDES_H
/* 
   Unix SMB/Netbios implementation.
   Version 1.9.
   Machine customisation and include handling
   Copyright (C) Andrew Tridgell 1994-1997
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
   This file does all the #includes's. This makes it easier to
   port to a new unix. Hopefully a port will only have to edit the Makefile
   and add a section for the new unix below.
*/


/* the first OS dependent section is to setup what includes will be used.
   the main OS dependent section comes later on 
*/

#ifdef ALTOS
#define NO_UTIMEH
#endif

#ifdef MIPS
#define POSIX_H
#define NO_UTIMEH
#endif

#ifdef sun386
#define NO_UTIMEH
#endif

#ifdef NEXT2
#define NO_UTIMEH
#endif

#ifdef NEXT3_0
#define NO_UTIMEH
#define NO_UNISTDH
#endif

#ifdef APOLLO
#define NO_UTIMEH
#define NO_SYSMOUNTH
#define NO_UNISTDH
#endif

#ifdef AIX
#define NO_SYSMOUNTH
#endif

#ifdef M88K_R3
#define SVR3H
#define NO_RESOURCEH
#endif

#ifdef DNIX
#define NO_SYSMOUNTH
#define NO_NETIFH
#define NO_RESOURCEH
#define PRIME_NMBD 0
#define NO_SETGROUPS
#endif


#ifdef ISC
#define SYSSTREAMH
#define NO_RESOURCEH
#endif

#ifdef QNX
#define NO_RESOURCEH
#define NO_SYSMOUNTH
#define USE_MMAP 1
#ifdef __386__
   #define __i386__
#endif
#endif

#ifdef NEWS42
#define NO_UTIMEH
#define NO_STRFTIME
#define NO_UTIMBUF
#define REPLACE_MKTIME
#define NO_TM_NAME
#endif

#ifdef OS2
#define NO_SYSMOUNTH
#define NO_NETIFH
#endif

#ifdef LYNX
#define NO_SYSMOUNTH
#endif


#if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
#define PASSWORD_LENGTH 16
#endif

/* here is the general includes section - with some ifdefs generated 
   by the previous section 
*/
#include "local.h"
#include "ubi_dLinkList.h"
#include <stdio.h>
#ifdef POSIX_STDLIBH
#include <posix/stdlib.h>
#else
#include <stdlib.h>
#endif
#include <ctype.h>
#include <time.h>
#ifndef NO_UTIMEH
#include <utime.h>
#endif
#include <sys/types.h>

#ifdef SVR3H
#include <sys/statfs.h>
#include <sys/stream.h>
#include <netinet/types.h>
#include <netinet/ether.h>
#include <netinet/ip_if.h>
#endif

#include <sys/socket.h>
#ifdef AXPROC
#include <termio.h>
#endif
#include <sys/ioctl.h>
#include <stddef.h>
#ifdef POSIX_H
#include <posix/utime.h>
#include <bsd/sys/time.h>
#include <bsd/netinet/in.h>
#else
#include <sys/time.h>
#include <netinet/in.h>
#endif 
#include <netdb.h>
#include <signal.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <grp.h>
#ifndef NO_RESOURCEH
#include <sys/resource.h>
#endif
#ifndef NO_SYSMOUNTH
#include <sys/mount.h>
#endif
#include <pwd.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#ifndef NO_UNISTDH
#include <unistd.h>
#endif
#include <sys/wait.h>
#ifdef SYSSTREAMH
#include <sys/stream.h>
#endif
#ifndef NO_NETIFH
#ifdef POSIX_H
#include <bsd/net/if.h>
#else
#include <net/if.h>
#endif
#endif

#if defined(GETPWANAM)
#include <sys/types.h>
#include <sys/label.h>
#include <sys/audit.h>
#include <pwdadj.h>
#endif

#if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX)
#include <shadow.h>
#endif

#ifdef SYSLOG
#include <syslog.h>
#endif



/***************************************************************************
Here come some platform specific sections
***************************************************************************/


#ifdef LINUX
#include <arpa/inet.h>
#include <dirent.h>
#include <string.h>
#include <sys/vfs.h>
#include <netinet/in.h>
#ifndef NO_ASMSIGNALH
#include <asm/signal.h>
#endif
#ifdef GLIBC2
#define _LINUX_C_LIB_VERSION_MAJOR     6
#include <termios.h>
#include <rpcsvc/ypclnt.h>
#include <crypt.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#endif
#define SIGNAL_CAST (__sighandler_t)
#define USE_GETCWD
#define USE_SETSID
#define HAVE_BZERO
#define HAVE_MEMMOVE
#define USE_SIGPROCMASK
#define USE_WAITPID
#define USE_SYSV_IPC
#if 0
/* SETFS disabled until we can check on some bug reports */
#if _LINUX_C_LIB_VERSION_MAJOR >= 5
#define USE_SETFS
#endif
#endif
#ifdef SHADOW_PWD
#if _LINUX_C_LIB_VERSION_MAJOR < 5
#ifndef crypt
#define crypt pw_encrypt
#endif
#endif
#endif
#endif

#ifdef SUNOS4
#define SIGNAL_CAST (void (*)(int))
#include <netinet/tcp.h>
#include <dirent.h>
#include <sys/acct.h>
#include <sys/vfs.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <signal.h>
/* #include <termios.h> */
#ifdef sun386
#define NO_STRFTIME
#define NO_UTIMBUF
#define mktime timelocal
typedef unsigned short mode_t;
#else
#include <utime.h>
#define NO_STRERROR
#endif
#ifndef REPLACE_GETPASS
#define REPLACE_GETPASS
#endif
#ifndef BSD_TERMIO
#define BSD_TERMIO
#endif
#ifndef USE_SIGPROCMASK
#define USE_SIGPROCMASK
#endif
#ifndef USE_WAITPID
#define USE_WAITPID
#endif
/* SunOS doesn't have POSIX atexit */
#define atexit on_exit
#endif


#ifdef SUNOS5
#include <fcntl.h>
#include <dirent.h>
#include <sys/acct.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <sys/filio.h>
#include <sys/sockio.h>
#include <netinet/in_systm.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include <string.h>
#include <arpa/inet.h>
#include <rpcsvc/ypclnt.h>
#include <termios.h>
#include <sys/stropts.h>
#ifndef USE_LIBDES
#include <crypt.h>
#endif /* USE_LIBDES */
extern int gettimeofday (struct timeval *, void *);
extern int gethostname (char *name, int namelen);
extern int innetgr (const char *, const char *, const char *, const char *);
#define USE_SETVBUF
#define SIGNAL_CAST (void (*)(int))
#ifndef SYSV
#define SYSV
#endif
#define USE_WAITPID
#define REPLACE_STRLEN
#define USE_STATVFS
#define USE_GETCWD
#define USE_SETSID
#define USE_SYSV_IPC
#ifndef REPLACE_GETPASS
#define REPLACE_GETPASS
#endif /* REPLACE_GETPASS */
#define USE_SIGPROCMASK
#endif


#ifdef ULTRIX
#include <strings.h>
#include <nfs/nfs_clnt.h>
#include <nfs/vfs.h>
#include <netinet/tcp.h>
#ifdef ULTRIX_AUTH
#include <auth.h>
#endif
char *getwd(char *);
#define NOSTRDUP
#ifdef __STDC__
#define SIGNAL_CAST (void(*)(int))
#endif
#define USE_DIRECT
#define USE_WAITPID
#endif

#ifdef SGI4
#include <netinet/tcp.h>
#include <sys/statfs.h>
#include <string.h>
#include <signal.h>
#ifndef SYSV
#define SYSV
#endif
#define SIGNAL_CAST (void (*)())
#define STATFS4
#define USE_WAITPID
#define USE_DIRECT
#define USE_SETSID
#define USE_SYSV_IPC
#endif

#if defined(SGI5) || defined(SGI6)
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <sys/statvfs.h>
#include <string.h>
#include <signal.h>
#include <dirent.h>
#define USE_WAITPID
#define NETGROUP 
#ifndef SYSV
#define SYSV
#endif
#define SIGNAL_CAST (void (*)())
#define USE_STATVFS
#define USE_WAITPID
#define USE_SETSID
#define USE_SYSV_IPC
#endif


#ifdef MIPS
#include <bsd/net/soioctl.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/statfs.h>
#include <sys/wait.h>
#include <sys/termio.h>
#define SIGNAL_CAST (void (*)())
typedef int mode_t;
extern struct group *getgrnam();
extern struct passwd *getpwnam();
#define STATFS4
#define NO_STRERROR
#define REPLACE_STRSTR
#endif /* MIPS */



#ifdef DGUX
#include <string.h>
#include <dirent.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <fcntl.h>
#include <termios.h>
#define SYSV
#define USE_WAITPID
#define SIGNAL_CAST (void (*)(int))
#define STATFS4
#define USE_GETCWD
#endif


#ifdef SVR4
#include <string.h>
#include <sys/dir.h>
#include <dirent.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <sys/vfs.h>
#include <sys/filio.h>
#include <fcntl.h>
#include <sys/sockio.h>
#include <netinet/tcp.h>
#include <stropts.h>
#include <termios.h>
#define SYSV
#define USE_WAITPID
#define SIGNAL_CAST (void (*)(int))
#define USE_STATVFS
#define USE_GETCWD
#define USE_SETSID
#define USE_SYSV_IPC
#endif


#ifdef OSF1
#include <termios.h>
#include <strings.h>
#include <dirent.h>
char *getwd(char *);
char *mktemp(char *); /* No standard include */
#include <netinet/in.h>
#include <arpa/inet.h> /* both for inet_ntoa */
#define SIGNAL_CAST ( void (*) (int) )
#define STATFS3
#define USE_F_FSIZE
#define USE_SETSID
#include <netinet/tcp.h>
#ifdef OSF1_ENH_SEC
#include <pwd.h>
#include <sys/types.h>
#include <sys/security.h>
#include <prot.h>
#include <unistd.h>
#define PASSWORD_LENGTH 16
#define NEED_AUTH_PARAMETERS
#endif  /* OSF1_ENH_SEC */
#endif


#ifdef CLIX
#include <dirent.h>
#define SIGNAL_CAST	(void (*)())
#include <sys/fcntl.h>
#include <sys/statfs.h>
#include <string.h>
#define NO_EID
#define USE_WAITPID
#define STATFS4
#define NO_FSYNC
#define USE_GETCWD
#define USE_SETSID
#ifndef REPLACE_GETPASS
#define REPLACE_GETPASS
#endif /* REPLACE_GETPASS */
#define NO_GETRLIMIT
#endif	/* CLIX */



#ifdef BSDI
#include <string.h>
#include <netinet/tcp.h>
#define SIGNAL_CAST (void (*)())
#define USE_DIRECT
#endif


#ifdef NETBSD
#include <strings.h>
#include <netinet/tcp.h>
/* you may not need this */
#define NO_GETSPNAM
#define SIGNAL_CAST (void (*)())
#define USE_DIRECT
#define REPLACE_INNETGR
#endif 



#ifdef FreeBSD
#include <arpa/inet.h>
#include <strings.h>
#include <netinet/tcp.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#define SIGNAL_CAST (void (*)())
#define USE_SETVBUF
#define USE_SETSID
#define USE_GETCWD
#define USE_WAITPID
#define USE_DIRECT
#define HAVE_MEMMOVE
#define HAVE_BZERO
#define HAVE_GETTIMEOFDAY
#define HAVE_PATHCONF
#define HAVE_GETGRNAM 1
#endif 



#ifdef AIX
#include <strings.h>
#include <sys/dir.h>
#include <sys/select.h>
#include <dirent.h>
#include <sys/statfs.h>
#include <sys/vfs.h>
#include <sys/id.h>
#include <sys/priv.h>
#include <netinet/tcp.h>
#include <locale.h>
#define SYSV
#define USE_WAITPID
#define USE_SIGBLOCK
#define SIGNAL_CAST (void (*)())
#define DEFAULT_PRINTING PRINT_AIX
/* we undef this because sys/param.h is broken in aix. uggh. */
#undef MAXHOSTNAMELEN
#endif


#ifdef HPUX
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/vfs.h>
#include <sys/types.h>
#include <sys/termios.h>
#include <netinet/tcp.h>
#ifdef HPUX_10_TRUSTED
#include <hpsecurity.h>
#include <prot.h>
#define NEED_AUTH_PARAMETERS
#endif
#define SIGNAL_CAST (void (*)(__harg))
#ifndef HPUX10 /* This is only needed for HPUX 9.x */
#define SELECT_CAST (int *)
#endif /* HPUX10 */
#define SYSV
#define USE_WAITPID
#define WAIT3_CAST2 (int *)
#define USE_GETCWD
#define USE_SETSID
#define USE_SETRES
#define USE_SYSV_IPC
#define DEFAULT_PRINTING PRINT_HPUX
/* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
   not good for HPUX */
/* #define SIGCLD_IGNORE */
#endif /* HPUX */


#ifdef SEQUENT
#include <signal.h>
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/statfs.h>
#include <sys/stat.h>
#include <sys/buf.h>
#include <sys/socket.h>
#include <unistd.h>
#include <fcntl.h>
#define SIGNAL_CAST (void (*)(int))
#define USE_WAITPID
#define USE_GETCWD
#define NO_EID
#define STATFS4
#define USE_DIRECT
#ifdef PTX4
#undef USE_DIRECT
#endif
#endif



#ifdef SEQUENT_PTX4
#include <string.h>
#include <sys/dir.h>
#include <dirent.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <sys/vfs.h>
#include <fcntl.h>
#include <sys/sockio.h>
#include <netinet/tcp.h>
#include <stropts.h>
#include <termios.h>
#define SYSV
#define USE_WAITPID
#define SIGNAL_CAST (void (*)(int))
#define USE_STATVFS
#define USE_GETCWD
#ifndef seteuid
#define seteuid(uid) setreuid(-1,uid)
#endif
#ifndef setegid
#define setegid(gid) setregid(-1,gid)
#endif
#endif


#ifdef NEXT2
#include <sys/types.h>
#include <strings.h>
#include <dirent.h>
#include <sys/vfs.h>
#define bzero(b,len) memset(b,0,len)
#define mode_t int
#define NO_UTIMBUF
#include <libc.h>
#define NOSTRDUP
#define USE_DIRECT
#define USE_WAITPID
#endif 


#ifdef NEXT3_0
#include <strings.h>
#include <sys/dir.h>
#include <sys/vfs.h>
#define bzero(b,len) memset(b,0,len)
#define NO_UTIMBUF
#include <libc.h>
#define NOSTRDUP
#define USE_DIRECT
#define mode_t int
#define GID_TYPE int
#define gid_t int
#define pid_t int
#define SIGNAL_CAST (void (*)(int))
#define WAIT3_CAST1 (union wait *)
#define HAVE_GMTOFF
#endif



#ifdef APOLLO
#include <string.h>
#include <fcntl.h>
#include <sys/statfs.h>
#define NO_UTIMBUF
#define USE_DIRECT
#define USE_GETCWD
#define SIGNAL_CAST     (void (*)())
#define HAVE_FCNTL_LOCK 0
#define HAVE_GETTIMEOFDAY
#define STATFS4
#endif



#ifdef SCO
#include <sys/netinet/tcp.h>
#include <sys/netinet/in_systm.h>
#include <sys/netinet/ip.h>
#include <dirent.h>
#include <string.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/statfs.h>
#include <sys/stropts.h>
#include <limits.h>
#include <locale.h>
#ifdef EVEREST
#include <unistd.h> 
#endif /* EVEREST */
#ifdef NETGROUP
#include <rpcsvc/ypclnt.h>
#endif /* NETGROUP */
#ifdef SecureWare
#include <sys/security.h>
#include <sys/audit.h>
#include <prot.h>
#define crypt bigcrypt
#endif /* SecureWare */
#define SIGNAL_CAST (void (*)(int))
#define USE_WAITPID
#define USE_GETCWD
#define USE_SETSID
#ifdef SCO3_2_2
#define setuid(u) setreuid(u,-1)
#define seteuid(u) setreuid(-1,u)
#else /* SCO3_2_2 */
#ifndef EVEREST
#define ftruncate(f,l) syscall(0x0a28,f,l)
#define USE_IFREQ
#define NO_INITGROUPS
#endif /* EVEREST */
#endif /* SCO3_2_2 */
#define STATFS4
#define NO_FSYNC
#define HAVE_PATHCONF
#define NO_GETRLIMIT
#endif /* SCO */



/* Definitions for RiscIX */
#ifdef RiscIX
#define SIGNAL_CAST (void (*)(int))
#include <sys/dirent.h>
#include <sys/acct.h>
#include <sys/vfs.h>
#include <string.h>
#include <utime.h>
#include <signal.h>
#define HAVE_GETTIMEOFDAY
#define NOSTRCASECMP
#define NOSTRDUP
#endif



#ifdef ISC
#include <net/errno.h>
#include <string.h>
#include <sys/dir.h>
#include <dirent.h>
#include <sys/statfs.h>
#include <fcntl.h>
#include <sys/sioctl.h>
#include <stropts.h>
#include <limits.h>
#include <netinet/tcp.h>
#define FIONREAD FIORDCHK
#define SYSV
#define USE_WAITPID
#define SIGNAL_CAST (void (*)(int))
#define USE_GETCWD
#define USE_SETSID
#define USE_IFREQ
#define NO_FTRUNCATE
#define STATFS4
#define NO_FSYNC
#endif



#ifdef AUX
#include <fstab.h>
#include <string.h>
#include <dirent.h>
#include <sys/vfs.h>
#include <fcntl.h>
#include <termios.h>
#define SYSV
#define USE_WAITPID
#define SIGNAL_CAST (void (*)(int))
char *strdup (char *);
#define USE_GETCWD
#endif


#ifdef M88K_R3
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <termios.h>
#define STATFS4
#define SYSV
#define USE_WAITPID
#define SIGNAL_CAST (void (*)(int))
char *strdup (char *);
#define USE_GETCWD
#define NO_FSYNC
#define NO_EID
#endif


#ifdef DNIX
#include <dirent.h>
#include <string.h>
#include <fcntl.h>
#include <sys/statfs.h>
#include <sys/stropts.h>
#define NO_GET_BROADCAST
#define USE_WAITPID
#define USE_GETCWD
#define USE_SETSID
#define STATFS4
#define NO_EID
#define PF_INET AF_INET
#define NO_STRERROR
#define ftruncate(f,l) chsize(f,l)
#endif /* DNIX */

#ifdef CONVEX
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <dirent.h>
#include <string.h>
#include <sys/vfs.h>
#include <fcntl.h>
#define DONT_REINSTALL_SIG
#define USE_SIGBLOCK
#define USE_WAITPID
#define SIGNAL_CAST (_SigFunc_Ptr_t)
#define NO_GETSPNAM
#define HAVE_MEMMOVE
extern char *mktemp(char *);
extern int  fsync(int);
extern int  seteuid(uid_t);
extern int  setgroups(int, int *);
extern int  initgroups(char *, int);
extern int  statfs(char *, struct statfs *);
extern int  setegid(gid_t);
extern int  getopt(int, char *const *, const char *);
extern int  chroot(char *);
extern int  gettimeofday(struct timeval *, struct timezone *);
extern int  gethostname(char *, int);
extern char *crypt(char *, char *);
extern char *getpass(char *);
#endif


#ifdef CRAY
#define MAXPATHLEN 1024
#include <dirent.h>
#include <string.h>
#include <fcntl.h>
#include <sys/statfs.h>
#define SIGNAL_CAST (void (*)(int))
#define SIGCLD_IGNORE
#define HAVE_FCNTL_LOCK 1
#define USE_SETSID
#define STATFS4
#endif


#ifdef ALTOS
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#include <sys/fcntl.h>
#include <sys/statfs.h>
#define        const
#define        uid_t           int
#define        gid_t           int
#define        mode_t          int
#define        ptrdiff_t       int
#define HAVE_GETGRNAM  0
#define NO_EID
#define NO_FSYNC
#define        NO_FTRUNCATE
#define        NO_GETRLIMIT
#define        NO_INITGROUPS
#define NO_SELECT
#define NO_SETGROUPS
#define NO_STRERROR
#define NO_STRFTIME
#define        NO_TM_NAME
#define NO_UTIMEH
#define NOSTRCASECMP
#define REPLACE_MKTIME
#define REPLACE_RENAME
#define REPLACE_STRSTR
#define STATFS4
#define        USE_GETCWD
#endif

#ifdef QNX
#define STATFS4
#include <sys/statfs.h>
#include <sys/select.h>
#include <signal.h>
#include <sys/dir.h>
#define SIGNAL_CAST (void (*)())
#define USE_WAITPID
#define NO_INITGROUPS
#define NO_SETGROUPS
#define HAVE_TIMEZONE
#define USE_GETCWD
#define USE_SETSID
#define HAVE_FCNTL_LOCK 1
#define DEFAULT_PRINTING PRINT_QNX
#endif


#ifdef NEWS42
#include <string.h>
#include <dirent.h>
#include <sys/vfs.h>
#include <sys/timeb.h>
typedef int mode_t;
#endif

#ifdef OS2
#include <dirent.h>
#include <sys/statfs.h>
#include <string.h>
#include <limits.h>
#define SIGNAL_CAST (void (*)())
#define HAVE_FCNTL_LOCK 0
#define USE_WAITPID
#define NO_GET_BROADCAST
#define NO_EID
#define NO_SETGROUPS
#define NO_INITGROUPS
#define NO_CRYPT
#define NO_STATFS
#define NO_CHROOT
#define NO_CHOWN
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif


#ifdef LYNX
#define SIGNAL_CAST (void (*)())
#define WAIT3_CAST1 (union wait *)
#define STATFS4
#include <fcntl.h>
#include <resource.h>
#include <stat.h>
#include <string.h>
#include <dirent.h>
#include <sys/statfs.h>
#define USE_GETCWD
#define USE_GETSID
#endif


#ifdef BOS
#define SIGNAL_CAST (void (*)(int))
#include <string.h>
#include <sys/dir.h>
#include <sys/select.h>
#include <dirent.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/statfs.h>
#include <sys/bsdioctl.h>
#endif

#ifdef AMIGA
#include <arpa/inet.h>
#include <dirent.h>
#include <string.h>
#include <netinet/tcp.h>
#include <sys/acct.h>
#include <sys/fcntl.h>
#include <sys/filio.h>
#include <sys/sockio.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <sys/termios.h>
#include <limits.h>
#include <sys/timeb.h>

#define SIGNAL_CAST (void (*)(int))
#define USE_GETCWD
#define HAVE_BZERO
#define HAVE_MEMMOVE
#define USE_SIGPROCMASK
#define USE_WAITPID
#define USE_DIRECT
#define USE_F_FSIZE
#define HAVE_FCNTL_LOCK 0
#define HAVE_GETTIMEOFDAY
#define HAVE_PATHCONF

#define HAVE_NO_PROC
#define NO_FORK_DEBUG
#define HAVE_FORK 0
#define HAVE_VFORK 1
#endif

/* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
#ifdef IA_UINFO
#include <iaf.h>
#include <ia.h>
#endif


/*******************************************************************
end of the platform specific sections
********************************************************************/

#if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
#include <sys/mman.h>
#endif

#ifdef SecureWare
#define NEED_AUTH_PARAMETERS
#endif

#ifdef REPLACE_GETPASS
extern char    *getsmbpass(char *);
#define getpass(s) getsmbpass(s)
#endif

#ifdef REPLACE_INNETGR
#define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
#endif

#ifndef FD_SETSIZE
#define FD_SETSIZE 255
#endif

#ifndef __STDC__
#define const
#endif

/* Now for some other grungy stuff */
#ifdef NO_GETSPNAM
struct spwd { /* fake shadow password structure */
       char *sp_pwdp;
};
#endif

#ifndef HAVE_BZERO
#ifndef bzero
#define bzero(p,s) memset(p,0,s)
#endif
#endif

#ifndef HAVE_MEMMOVE
#ifndef memmove
#define memmove(d,s,n) MemMove(d,s,n)
#endif
#endif

#ifdef USE_DIRECT
#include <sys/dir.h>
#endif

/* some unixes have ENOTTY instead of TIOCNOTTY */
#ifndef TIOCNOTTY
#ifdef ENOTTY
#define TIOCNOTTY ENOTTY
#endif
#endif

#ifndef SIGHUP
#define SIGHUP 1
#endif

/* if undefined then use bsd or sysv printing */
#ifndef DEFAULT_PRINTING
#ifdef SYSV
#define DEFAULT_PRINTING PRINT_SYSV
#else
#define DEFAULT_PRINTING PRINT_BSD
#endif
#endif

#ifdef USE_SYSV_IPC
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#endif

#ifdef AFS_AUTH
#include <afs/stds.h>
#include <afs/kautils.h>
#endif

#ifdef DFS_AUTH
#include <dce/dce_error.h>
#include <dce/sec_login.h>
#endif

#ifdef KRB5_AUTH
#include <krb5.h>
#endif

#ifdef NO_UTIMBUF
struct utimbuf {
  time_t actime;
  time_t modtime;
};
#endif

#ifdef NO_STRERROR
#ifndef strerror
extern char *sys_errlist[];
#define strerror(i) sys_errlist[i]
#endif
#endif

#ifndef perror
#define perror(m) printf("%s: %s\n",m,strerror(errno))
#endif

#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 255
#endif

#include "version.h"
#include "smb.h"
#include "nameserv.h"
#include "proto.h"
#include "byteorder.h"

#include "kanji.h"
#include "charset.h"

#ifndef S_IFREG
#define S_IFREG 0100000
#endif

#ifndef S_ISREG
#define S_ISREG(x) ((S_IFREG & (x))!=0)
#endif

#ifndef S_ISDIR
#define S_ISDIR(x) ((S_IFDIR & (x))!=0)
#endif

#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(x) ((S_IFLNK & (x))!=0)
#endif

#ifdef UFC_CRYPT
#define crypt ufc_crypt
#endif

#ifdef REPLACE_STRLEN
#define strlen(s) Strlen(s)
#endif

#ifdef REPLACE_STRSTR
#define strstr(s,p) Strstr(s,p)
#endif

#ifdef REPLACE_MKTIME
#define mktime(t) Mktime(t)
#endif

#ifndef NGROUPS_MAX
#define NGROUPS_MAX 128
#endif

#ifndef EDQUOT
#define EDQUOT ENOSPC
#endif

#ifndef HAVE_GETGRNAM
#define HAVE_GETGRNAM 1
#endif

#ifndef SOL_TCP
#define SOL_TCP 6
#endif

/* default to using ftruncate workaround as this is safer than assuming
it works and getting lots of bug reports */
#ifndef FTRUNCATE_CAN_EXTEND
#define FTRUNCATE_CAN_EXTEND 0
#endif

/* maybe this unix doesn't separate RD and WR locks? */
#ifndef F_RDLCK
#define F_RDLCK F_WRLCK
#endif

#ifndef ENOTSOCK
#define ENOTSOCK EINVAL
#endif

#ifndef SIGCLD
#define SIGCLD SIGCHLD
#endif 

#ifndef MAP_FILE
#define MAP_FILE 0
#endif

#ifndef HAVE_FCNTL_LOCK
#define HAVE_FCNTL_LOCK 1
#endif

#ifndef WAIT3_CAST2
#define WAIT3_CAST2 (struct rusage *)
#endif

#ifndef WAIT3_CAST1
#define WAIT3_CAST1 (int *)
#endif

#ifndef QSORT_CAST
#define QSORT_CAST (int (*)())
#endif

#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001
#endif /* INADDR_LOOPBACK */

/* this is a rough check to see if this machine has a lstat() call.
   it is not guaranteed to work */
#if !defined(S_ISLNK)
#define lstat stat
#endif

/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
#ifndef errno
extern int errno;
#endif 


#ifdef NO_EID
#define geteuid() getuid()
#define getegid() getgid()
#define seteuid(x) setuid(x)
#define setegid(x) setgid(x)
#endif


#if (HAVE_FCNTL_LOCK == 0)
/* since there is no locking available, system includes  */
/* for DomainOS 10.4 do not contain any of the following */
/* #define's. So, to satisfy the compiler, add these     */
/* #define's, although they arn't really necessary.      */
#define F_GETLK 0
#define F_SETLK 0
#define F_WRLCK 0
#define F_UNLCK 0
#endif /* HAVE_FCNTL_LOCK == 0 */

#ifdef NOSTRCASECMP
#define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
#define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
#endif

#ifndef strcpy
#define strcpy(dest,src) StrCpy(dest,src)
#endif


/* possibly wrap the malloc calls */
#if WRAP_MALLOC

/* undo the old malloc def if necessary */
#ifdef malloc
#define xx_old_malloc malloc
#undef malloc
#endif

#define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)

/* undo the old realloc def if necessary */
#ifdef realloc
#define xx_old_realloc realloc
#undef realloc
#endif

#define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)

/* undo the old free def if necessary */
#ifdef free
#define xx_old_free free
#undef free
#endif

#define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)

/* and the malloc prototypes */
void *malloc_wrapped(int,char *,int);
void *realloc_wrapped(void *,int,char *,int);
void free_wrapped(void *,char *,int);

#endif


#if WRAP_MEMCPY
/* undo the old memcpy def if necessary */
#ifdef memcpy
#define xx_old_memcpy memcpy
#undef memcpy
#endif

#define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
#endif

#endif