home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / samba.idb / usr / samba / src / source / includes.h.z / includes.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  27.1 KB  |  1,404 lines

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