4 Unix SMB/Netbios implementation.
6 Machine customisation and include handling
9 #ifndef NO_CONFIG_H /* for some tests */
16 #define DEFAULT_PRINTING PRINT_AIX
17 #define PRINTCAP_NAME "/etc/qconfig"
21 #define DEFAULT_PRINTING PRINT_HPUX
25 #define DEFAULT_PRINTING PRINT_QNX
28 #include <sys/types.h>
40 #ifdef HAVE_SYS_RESOURCE_H
41 #include <sys/resource.h>
44 #ifdef HAVE_SYS_PARAM_H
45 #include <sys/param.h>
48 #ifdef HAVE_SYS_SOCKET_H
49 #include <sys/socket.h>
52 #ifdef HAVE_SYS_SYSCALL_H
53 #include <sys/syscall.h>
71 #include "../mem_man/mem_man.h"
82 #ifdef HAVE_SYS_IOCTL_H
83 #include <sys/ioctl.h>
86 #ifdef HAVE_SYS_FILIO_H
87 #include <sys/filio.h>
99 /* AIX 4.1 and previous needs this for setpriv */
100 #if defined(HAVE_SETPRIV) && defined(HAVE_SYS_PRIV_H)
101 #include <sys/priv.h>
110 #ifdef HAVE_SYS_SELECT_H
111 #include <sys/select.h>
114 #ifdef HAVE_SYS_MODE_H
115 /* apparently AIX needs this for S_ISLNK */
117 #include <sys/mode.h>
133 #include <netinet/in.h>
134 #include <arpa/inet.h>
137 #include <sys/file.h>
139 #ifdef HAVE_NETINET_TCP_H
140 #include <netinet/tcp.h>
144 * The next two defines are needed to the IPTOS_* options
148 #ifdef HAVE_NETINET_IN_SYSTM_H
149 #include <netinet/in_systm.h>
152 #ifdef HAVE_NETINET_IN_IP_H
153 #include <netinet/ip.h>
156 /* POSIX terminal handling. */
161 #ifdef HAVE_SYS_MMAN_H
162 #include <sys/mman.h>
176 #ifdef HAVE_SYS_MOUNT_H
177 #include <sys/mount.h>
180 #ifdef HAVE_SYS_VFS_H
184 #ifdef HAVE_SYS_ACL_H
188 #ifdef HAVE_SYS_FS_S5PARAM_H
189 #include <sys/fs/s5param.h>
192 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
193 #include <sys/filsys.h>
196 #ifdef HAVE_SYS_STATFS_H
197 #include <sys/statfs.h>
201 #include <sys/dustat.h>
204 #ifdef HAVE_SYS_STATVFS_H
205 #include <sys/statvfs.h>
212 #ifdef HAVE_GETPWANAM
213 #include <sys/label.h>
214 #include <sys/audit.h>
218 #ifdef HAVE_SYS_SECURITY_H
219 #include <sys/security.h>
221 #define PASSWORD_LENGTH 16
222 #endif /* HAVE_SYS_SECURITY_H */
228 #ifdef HAVE_STROPTS_H
236 #if defined(HAVE_RPC_RPC_H)
238 * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
240 #if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
246 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
247 #define HAVE_NETGROUP 1
250 #if defined (HAVE_NETGROUP)
251 #if defined(HAVE_RPCSVC_YP_PROT_H)
252 #include <rpcsvc/yp_prot.h>
254 #if defined(HAVE_RPCSVC_YPCLNT_H)
255 #include <rpcsvc/ypclnt.h>
257 #endif /* HAVE_NETGROUP */
260 #define uchar unsigned char
263 #define schar signed char
266 Samba needs type definitions for int16, int32, uint16 and uint32.
268 Normally these are signed and unsigned 16 and 32 bit integers, but
269 they actually only need to be at least 16 and 32 bits
270 respectively. Thus if your word size is 8 bytes just defining them
271 as signed and unsigned int will work.
275 #define uint8 unsigned char
278 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
279 #if (SIZEOF_SHORT == 4)
280 #define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
281 #else /* SIZEOF_SHORT != 4 */
283 #endif /* SIZEOF_SHORT != 4 */
287 * Note we duplicate the size tests in the unsigned
288 * case as int16 may be a typedef from rpc/rpc.h
291 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
292 #if (SIZEOF_SHORT == 4)
293 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
294 #else /* SIZEOF_SHORT != 4 */
295 #define uint16 unsigned short
296 #endif /* SIZEOF_SHORT != 4 */
299 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
300 #if (SIZEOF_INT == 4)
302 #elif (SIZEOF_LONG == 4)
304 #elif (SIZEOF_SHORT == 4)
310 * Note we duplicate the size tests in the unsigned
311 * case as int32 may be a typedef from rpc/rpc.h
314 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
315 #if (SIZEOF_INT == 4)
316 #define uint32 unsigned int
317 #elif (SIZEOF_LONG == 4)
318 #define uint32 unsigned long
319 #elif (SIZEOF_SHORT == 4)
320 #define uint32 unsigned short
325 * Types for devices, inodes and offsets.
329 #define SMB_DEV_T dev_t
333 * Setup the correctly sized inode type.
337 #define SMB_INO_T ino_t
340 #ifndef LARGE_SMB_INO_T
341 #if defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8)
342 #define LARGE_SMB_INO_T 1
346 #ifdef LARGE_SMB_INO_T
347 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
349 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
353 #define SMB_OFF_T off_t
356 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
359 * Set the define that tells us if we can do 64 bit
363 #ifndef LARGE_SMB_OFF_T
364 #if defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)
365 #define LARGE_SMB_OFF_T 1
369 #ifdef LARGE_SMB_OFF_T
370 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
372 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
376 * Type for stat structure.
379 #ifndef SMB_STRUCT_STAT
380 #define SMB_STRUCT_STAT struct stat
384 * Type for dirent structure.
387 #ifndef SMB_STRUCT_DIRENT
388 #define SMB_STRUCT_DIRENT struct dirent
392 * Defines for 64 bit fcntl locks.
395 #ifndef SMB_STRUCT_FLOCK
396 #define SMB_STRUCT_FLOCK struct flock
400 #define SMB_F_SETLKW F_SETLKW
404 #define SMB_F_SETLK F_SETLK
408 #define SMB_F_GETLK F_GETLK
411 #if defined(HAVE_LONGLONG)
412 #define SMB_BIG_UINT unsigned long long
413 #define SMB_BIG_INT long long
414 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
416 #define SMB_BIG_UINT unsigned long
417 #define SMB_BIG_INT long
418 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
422 #define MIN(a,b) ((a)<(b)?(a):(b))
426 #define MAX(a,b) ((a)>(b)?(a):(b))
429 #ifdef HAVE_BROKEN_GETGROUPS
438 #include "nameserv.h"
440 #include "byteorder.h"
447 #ifndef MAXCODEPAGELINES
448 #define MAXCODEPAGELINES 256
451 /***** automatically generated prototypes *****/
457 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
459 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
460 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
461 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
462 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
465 #define QSORT_CAST (__compar_fn_t)
469 #define QSORT_CAST (int (*)(const void *, const void *))
472 /* this guess needs to be improved (tridge) */
473 #if (defined(STAT_STATVFS) || defined(STAT_STATVFS64)) && !defined(SYSV)
477 #ifndef DEFAULT_PRINTING
479 #define DEFAULT_PRINTING PRINT_SYSV
480 #define PRINTCAP_NAME "lpstat"
482 #define DEFAULT_PRINTING PRINT_BSD
483 #define PRINTCAP_NAME "/etc/printcap"
487 #ifndef PRINTCAP_NAME
488 #define PRINTCAP_NAME "/etc/printcap"
492 #define SIGCLD SIGCHLD
495 #if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
496 #define FAST_SHARE_MODES 1
503 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
504 #define USE_SMBPASS_DB 1
507 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
508 #define OSF1_ENH_SEC 1
511 #ifndef ALLOW_CHANGE_PASSWORD
512 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
513 #define ALLOW_CHANGE_PASSWORD 1
517 /* what is the longest significant password available on your system?
518 Knowing this speeds up password searches a lot */
519 #ifndef PASSWORD_LENGTH
520 #define PASSWORD_LENGTH 8
528 #define MAXPATHLEN 256
535 #ifndef INADDR_LOOPBACK
536 #define INADDR_LOOPBACK 0x7f000001
540 #define INADDR_NONE 0xffffffff
544 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
547 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
548 #define ULTRIX_AUTH 1
551 #ifndef HAVE_INITGROUPS
552 int initgroups (char *name
, gid_t id
);
556 int rename (const char *zfrom
, const char *zto
);
560 time_t mktime (struct tm
*t
);
564 unsigned long strtoul (const char *nptr
, char **endptr
, int base
);
567 #ifdef REPLACE_GETPASS
568 #define getpass(prompt) getsmbpass((prompt))
572 * Some older systems seem not to have MAXHOSTNAMELEN
575 #ifndef MAXHOSTNAMELEN
576 #define MAXHOSTNAMELEN 254
579 /* yuck, I'd like a better way of doing this */
580 #define DIRP_SIZE (256 + 32)
582 #endif /* _INCLUDES_H */