4 Unix SMB/CIFS implementation.
5 Machine customisation and include handling
6 Copyright (C) Andrew Tridgell 1994-1998
7 Copyright (C) 2002 by Martin Pool <mbp@samba.org>
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 3 of the License, or
12 (at your option) any later version.
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.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "lib/replace/replace.h"
25 /* make sure we have included the correct config.h */
26 #ifndef NO_CONFIG_H /* for some tests */
27 #ifndef CONFIG_H_IS_FROM_SAMBA
28 #error "make sure you have removed all config.h files from standalone builds!"
29 #error "the included config.h isn't from samba!"
31 #endif /* NO_CONFIG_H */
33 /* only do the C++ reserved word check when we compile
34 to include --with-developer since too many systems
35 still have comflicts with their header files (e.g. IRIX 6.4) */
37 #if !defined(__cplusplus) && defined(DEVELOPER)
38 #define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
39 #define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
40 #define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
41 #define protected #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
42 #define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
43 #define this #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
44 #define new #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
45 #define delete #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
46 #define friend #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
52 #define DEFAULT_PRINTING PRINT_AIX
53 #define PRINTCAP_NAME "/etc/qconfig"
57 #define DEFAULT_PRINTING PRINT_HPUX
61 #define DEFAULT_PRINTING PRINT_QNX
65 /* on SUNOS4 termios.h conflicts with sys/ioctl.h */
70 #ifdef HAVE_VISIBILITY_ATTR
71 # define _PUBLIC_ __attribute__((visibility("default")))
77 #if defined(__GNUC__) && !defined(__cplusplus)
78 /** gcc attribute used on function parameters so that it does not emit
79 * warnings about them being unused. **/
80 # define UNUSED(param) param __attribute__ ((unused))
82 # define UNUSED(param) param
83 /** Feel free to add definitions for other compilers here. */
88 * <unistd.h> has to be included before any other to get
89 * large file support on Reliant UNIX. Yes, it's broken :-).
94 #endif /* RELIANTUNIX */
96 #include "system/capability.h"
97 #include "system/dir.h"
98 #include "system/filesys.h"
99 #include "system/glob.h"
100 #include "system/iconv.h"
101 #include "system/locale.h"
102 #include "system/network.h"
103 #include "system/passwd.h"
104 #include "system/readline.h"
105 #include "system/select.h"
106 #include "system/shmem.h"
107 #include "system/syslog.h"
108 #include "system/terminal.h"
109 #include "system/time.h"
110 #include "system/wait.h"
112 #if defined(HAVE_RPC_RPC_H)
114 * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
116 #if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
120 * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
121 * was included above. However <rpc/rpc.h> includes <sys/xti.h> which defines
122 * them again without checking if they already exsist. This generates
123 * two "Redefinition of macro" warnings for every single .c file that is
126 #if defined(HPUX) && defined(TCP_NODELAY)
129 #if defined(HPUX) && defined(TCP_MAXSEG)
135 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
136 #define HAVE_NETGROUP 1
139 #if defined (HAVE_NETGROUP)
140 #if defined(HAVE_RPCSVC_YP_PROT_H)
142 * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which
143 * was included above. However <rpc/rpc.h> includes <sys/xti.h> which defines
144 * them again without checking if they already exsist. This generates
145 * two "Redefinition of macro" warnings for every single .c file that is
148 #if defined(HPUX) && defined(TCP_NODELAY)
151 #if defined(HPUX) && defined(TCP_MAXSEG)
154 #include <rpcsvc/yp_prot.h>
156 #if defined(HAVE_RPCSVC_YPCLNT_H)
157 #include <rpcsvc/ypclnt.h>
159 #endif /* HAVE_NETGROUP */
167 #if defined(HPUX) && !defined(_LBER_TYPES_H)
168 /* Define ber_tag_t and ber_int_t for using
169 * HP LDAP-UX Integration products' LDAP libraries.
172 typedef unsigned long ber_tag_t
;
173 typedef int ber_int_t
;
175 #endif /* defined(HPUX) && !defined(_LBER_TYPES_H) */
177 #define LBER_USE_DER 0x01
184 #define LDAP_CONST const
186 #ifndef LDAP_OPT_SUCCESS
187 #define LDAP_OPT_SUCCESS 0
189 /* Solaris 8 and maybe other LDAP implementations spell this "..._INPROGRESS": */
190 #if defined(LDAP_SASL_BIND_INPROGRESS) && !defined(LDAP_SASL_BIND_IN_PROGRESS)
191 #define LDAP_SASL_BIND_IN_PROGRESS LDAP_SASL_BIND_INPROGRESS
193 /* Solaris 8 defines SSL_LDAP_PORT, not LDAPS_PORT and it only does so if
194 LDAP_SSL is defined - but SSL is not working. We just want the
195 port number! Let's just define LDAPS_PORT correct. */
196 #if !defined(LDAPS_PORT)
197 #define LDAPS_PORT 636
203 #if HAVE_GSSAPI_GSSAPI_H
204 #include <gssapi/gssapi.h>
205 #elif HAVE_GSSAPI_GSSAPI_GENERIC_H
206 #include <gssapi/gssapi_generic.h>
215 #if HAVE_SYS_ATTRIBUTES_H
216 #include <sys/attributes.h>
220 #define ENOATTR ENODATA
223 /* mutually exclusive (SuSE 8.2) */
224 #if HAVE_ATTR_XATTR_H
225 #include <attr/xattr.h>
226 #elif HAVE_SYS_XATTR_H
227 #include <sys/xattr.h>
234 #ifdef HAVE_SYS_EXTATTR_H
235 #include <sys/extattr.h>
238 #ifdef HAVE_SYS_UIO_H
243 #include <langinfo.h>
247 #include <netgroup.h>
250 #if defined(HAVE_AIO_H) && defined(WITH_AIO)
254 /* skip valgrind headers on 64bit AMD boxes */
255 #ifndef HAVE_64BIT_LINUX
256 /* Special macros that are no-ops except when run under Valgrind on
257 * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
258 #if HAVE_VALGRIND_MEMCHECK_H
259 /* memcheck.h includes valgrind.h */
260 #include <valgrind/memcheck.h>
261 #elif HAVE_VALGRIND_H
262 #include <valgrind.h>
266 /* If we have --enable-developer and the valgrind header is present,
267 * then we're OK to use it. Set a macro so this logic can be done only
269 #if defined(DEVELOPER) && !defined(HAVE_64BIT_LINUX)
270 #if (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H)
276 /* we support ADS if we want it and have krb5 and ldap libs */
277 #if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
282 * Define VOLATILE if needed.
285 #if defined(HAVE_VOLATILE)
286 #define VOLATILE volatile
292 * Define additional missing types
294 #if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX)
295 typedef sig_atomic_t SIG_ATOMIC_T
;
296 #elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX)
297 typedef sig_atomic_t VOLATILE SIG_ATOMIC_T
;
299 typedef int VOLATILE SIG_ATOMIC_T
;
303 #define uchar unsigned char
306 #ifdef HAVE_UNSIGNED_CHAR
307 #define schar signed char
313 Samba needs type definitions for int16, int32, uint16 and uint32.
315 Normally these are signed and unsigned 16 and 32 bit integers, but
316 they actually only need to be at least 16 and 32 bits
317 respectively. Thus if your word size is 8 bytes just defining them
318 as signed and unsigned int will work.
322 #define uint8 unsigned char
325 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
326 # if (SIZEOF_SHORT == 4)
327 # define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
328 # else /* SIZEOF_SHORT != 4 */
330 # endif /* SIZEOF_SHORT != 4 */
331 /* needed to work around compile issue on HP-UX 11.x */
336 * Note we duplicate the size tests in the unsigned
337 * case as int16 may be a typedef from rpc/rpc.h
340 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
341 #if (SIZEOF_SHORT == 4)
342 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
343 #else /* SIZEOF_SHORT != 4 */
344 #define uint16 unsigned short
345 #endif /* SIZEOF_SHORT != 4 */
348 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
349 # if (SIZEOF_INT == 4)
351 # elif (SIZEOF_LONG == 4)
353 # elif (SIZEOF_SHORT == 4)
356 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
359 /* needed to work around compile issue on HP-UX 11.x */
364 * Note we duplicate the size tests in the unsigned
365 * case as int32 may be a typedef from rpc/rpc.h
368 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
369 #if (SIZEOF_INT == 4)
370 #define uint32 unsigned int
371 #elif (SIZEOF_LONG == 4)
372 #define uint32 unsigned long
373 #elif (SIZEOF_SHORT == 4)
374 #define uint32 unsigned short
376 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
377 #define uint32 unsigned
382 * check for 8 byte long long
386 #if (SIZEOF_LONG == 8)
387 #define uint64 unsigned long
388 #elif (SIZEOF_LONG_LONG == 8)
389 #define uint64 unsigned long long
390 #endif /* don't lie. If we don't have it, then don't use it */
394 #if (SIZEOF_LONG == 8)
396 #elif (SIZEOF_LONG_LONG == 8)
397 #define int64 long long
398 #endif /* don't lie. If we don't have it, then don't use it */
403 * Types for devices, inodes and offsets.
407 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
408 # define SMB_DEV_T dev64_t
410 # define SMB_DEV_T dev_t
414 #ifndef LARGE_SMB_DEV_T
415 # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)) || (defined(SIZEOF_DEV_T) && (SIZEOF_DEV_T == 8))
416 # define LARGE_SMB_DEV_T 1
420 #ifdef LARGE_SMB_DEV_T
421 #define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
422 #define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(((SMB_BIG_UINT)(IVAL((p),(ofs))))| (((SMB_BIG_UINT)(IVAL((p),(ofs)+4))) << 32)))
424 #define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),v),SIVAL((p),(ofs)+4,0))
425 #define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(IVAL((p),(ofs))))
429 * Setup the correctly sized inode type.
433 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
434 # define SMB_INO_T ino64_t
436 # define SMB_INO_T ino_t
440 #ifndef LARGE_SMB_INO_T
441 # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
442 # define LARGE_SMB_INO_T 1
446 #ifdef LARGE_SMB_INO_T
447 #define SINO_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
448 #define INO_T_VAL(p, ofs) ((SMB_INO_T)(((SMB_BIG_UINT)(IVAL(p,ofs)))| (((SMB_BIG_UINT)(IVAL(p,(ofs)+4))) << 32)))
450 #define SINO_T_VAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
451 #define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs))))
455 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
456 # define SMB_OFF_T off64_t
458 # define SMB_OFF_T off_t
462 #if defined(HAVE_LONGLONG)
463 #define SMB_BIG_UINT unsigned long long
464 #define SMB_BIG_INT long long
465 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
466 #define BIG_UINT(p, ofs) ((((SMB_BIG_UINT) IVAL(p,(ofs)+4))<<32)|IVAL(p,ofs))
468 #define SMB_BIG_UINT unsigned long
469 #define SMB_BIG_INT long
470 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
471 #define BIG_UINT(p, ofs) (IVAL(p,ofs))
474 #define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
476 /* this should really be a 64 bit type if possible */
477 #define br_off SMB_BIG_UINT
479 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
482 * Set the define that tells us if we can do 64 bit
486 #ifndef LARGE_SMB_OFF_T
487 # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
488 # define LARGE_SMB_OFF_T 1
492 #ifdef LARGE_SMB_OFF_T
493 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
494 #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
495 #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) )))
496 #define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
497 (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
499 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
500 #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
501 #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
502 #define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
503 (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
507 * Type for stat structure.
510 #ifndef SMB_STRUCT_STAT
511 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
512 # define SMB_STRUCT_STAT struct stat64
514 # define SMB_STRUCT_STAT struct stat
519 * Type for dirent structure.
522 #ifndef SMB_STRUCT_DIRENT
523 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
524 # define SMB_STRUCT_DIRENT struct dirent64
526 # define SMB_STRUCT_DIRENT struct dirent
531 * Type for DIR structure.
534 #ifndef SMB_STRUCT_DIR
535 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64)
536 # define SMB_STRUCT_DIR DIR64
538 # define SMB_STRUCT_DIR DIR
543 * Defines for 64 bit fcntl locks.
546 #ifndef SMB_STRUCT_FLOCK
547 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
548 # define SMB_STRUCT_FLOCK struct flock64
550 # define SMB_STRUCT_FLOCK struct flock
555 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
556 # define SMB_F_SETLKW F_SETLKW64
558 # define SMB_F_SETLKW F_SETLKW
563 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
564 # define SMB_F_SETLK F_SETLK64
566 # define SMB_F_SETLK F_SETLK
571 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
572 # define SMB_F_GETLK F_GETLK64
574 # define SMB_F_GETLK F_GETLK
579 * Type for aiocb structure.
582 #ifndef SMB_STRUCT_AIOCB
583 # if defined(WITH_AIO)
584 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64)
585 # define SMB_STRUCT_AIOCB struct aiocb64
587 # define SMB_STRUCT_AIOCB struct aiocb
590 # define SMB_STRUCT_AIOCB int /* AIO not being used but we still need the define.... */
594 #ifndef HAVE_STRUCT_TIMESPEC
596 time_t tv_sec
; /* Seconds. */
597 long tv_nsec
; /* Nanoseconds. */
602 #define MIN(a,b) ((a)<(b)?(a):(b))
606 #define MAX(a,b) ((a)>(b)?(a):(b))
609 #ifdef HAVE_BROKEN_GETGROUPS
616 #define NGROUPS_MAX 32 /* Guess... */
619 /* Our own fstrings */
628 | The infamous pstring |
635 _________)/\\_//(\/(/\)/\//\/\///|_)_______
639 #define FSTRING_LEN 256
640 typedef char fstring
[FSTRING_LEN
];
643 /* Lists, trees, caching, database... */
646 #include "dlinklist.h"
648 #include "util_tdb.h"
650 #include "lib/talloc/talloc.h"
651 /* And a little extension. Abort on type mismatch */
652 #define talloc_get_type_abort(ptr, type) \
653 (type *)talloc_check_name_abort(ptr, #type)
656 #include "nt_status.h"
659 #include "interfaces.h"
664 #include "dynconfig.h"
665 #include "util_getent.h"
666 #include "debugparse.h"
668 #include "privileges.h"
669 #include "messages.h"
672 #include "nameserv.h"
674 #include "byteorder.h"
675 #include "privileges.h"
676 #include "rpc_misc.h"
680 #include "rpc_secdes.h"
688 #include "ntdomain.h"
689 #include "rpc_svcctl.h"
690 #include "rpc_ntsvcs.h"
692 #include "reg_objects.h"
694 #include "rpc_spoolss.h"
695 #include "rpc_eventlog.h"
696 #include "rpc_perfcount.h"
697 #include "rpc_perfcount_defs.h"
698 #include "librpc/gen_ndr/notify.h"
699 #include "librpc/gen_ndr/xattr.h"
700 #include "librpc/gen_ndr/ndr_nbt.h"
701 #include "librpc/gen_ndr/messaging.h"
702 #include "librpc/rpc/dcerpc.h"
703 #include "nt_printing.h"
712 #include "nsswitch/winbind_client.h"
714 #include "rpc_client.h"
717 #include "ctdbd_conn.h"
718 #include "talloc_stack.h"
719 #include "memcache.h"
720 #include "async_req.h"
721 #include "async_smb.h"
722 #include "async_sock.h"
724 #include "lib/smbconf/smbconf.h"
725 #include "lib/smbconf/smbconf_init.h"
726 #include "lib/smbconf/smbconf_reg.h"
727 #include "lib/smbconf/smbconf_txt.h"
729 /* Defines for wisXXX functions. */
730 #define UNI_UPPER 0x1
731 #define UNI_LOWER 0x2
732 #define UNI_DIGIT 0x4
733 #define UNI_XDIGIT 0x8
734 #define UNI_SPACE 0x10
736 #include "nsswitch/winbind_nss.h"
738 /* forward declaration from printing.h to get around
739 header file dependencies */
743 /* forward declarations from smbldap.c */
747 #include "smb_ldap.h"
749 struct dns_reg_state
;
751 void dns_register_smbd(struct dns_reg_state
** dns_state_ptr
,
755 struct timeval
*timeout
);
757 void dns_register_close(struct dns_reg_state
** dns_state_ptr
);
760 bool dns_register_smbd_reply(struct dns_reg_state
*dns_state
,
761 fd_set
*lfds
, struct timeval
*timeout
);
764 * Reasons for cache flush.
767 enum flush_reason_enum
{
772 OPLOCK_RELEASE_FLUSH
,
776 /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */
779 #include "nss_info.h"
780 #include "modules/nfs4_acls.h"
781 #include "nsswitch/libwbclient/wbclient.h"
783 /* generated rpc server implementation functions */
784 #include "librpc/gen_ndr/srv_echo.h"
785 #include "librpc/gen_ndr/srv_svcctl.h"
786 #include "librpc/gen_ndr/srv_lsa.h"
787 #include "librpc/gen_ndr/srv_eventlog.h"
788 #include "librpc/gen_ndr/srv_winreg.h"
789 #include "librpc/gen_ndr/srv_initshutdown.h"
790 #include "librpc/gen_ndr/srv_netlogon.h"
791 #include "librpc/gen_ndr/srv_samr.h"
792 #include "librpc/gen_ndr/srv_wkssvc.h"
793 #include "librpc/gen_ndr/srv_srvsvc.h"
794 #include "librpc/gen_ndr/srv_ntsvcs.h"
795 #include "librpc/gen_ndr/srv_dssetup.h"
796 #include "librpc/gen_ndr/srv_dfs.h"
798 /***** automatically generated prototypes *****/
803 #if defined(HAVE_POSIX_ACLS)
804 #include "modules/vfs_posixacl.h"
807 #if defined(HAVE_TRU64_ACLS)
808 #include "modules/vfs_tru64acl.h"
811 #if defined(HAVE_SOLARIS_ACLS) || defined(HAVE_UNIXWARE_ACLS)
812 #include "modules/vfs_solarisacl.h"
815 #if defined(HAVE_HPUX_ACLS)
816 #include "modules/vfs_hpuxacl.h"
819 #if defined(HAVE_IRIX_ACLS)
820 #include "modules/vfs_irixacl.h"
824 #include "ads_protos.h"
827 /* We need this after proto.h to reference GetTimeOfDay(). */
828 #include "smbprofile.h"
830 /* String routines */
833 #include "safe_string.h"
835 /* prototypes from lib/util_transfer_file.c */
836 #include "transfer_file.h"
839 #define QSORT_CAST (__compar_fn_t)
843 #define QSORT_CAST (int (*)(const void *, const void *))
846 #ifndef DEFAULT_PRINTING
848 #define DEFAULT_PRINTING PRINT_CUPS
849 #define PRINTCAP_NAME "cups"
851 #define DEFAULT_PRINTING PRINT_SYSV
852 #define PRINTCAP_NAME "lpstat"
854 #define DEFAULT_PRINTING PRINT_BSD
855 #define PRINTCAP_NAME "/etc/printcap"
859 #ifndef PRINTCAP_NAME
860 #define PRINTCAP_NAME "/etc/printcap"
864 #define SIGCLD SIGCHLD
875 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
876 #define OSF1_ENH_SEC 1
879 #ifndef ALLOW_CHANGE_PASSWORD
880 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
881 #define ALLOW_CHANGE_PASSWORD 1
885 /* what is the longest significant password available on your system?
886 Knowing this speeds up password searches a lot */
887 #ifndef PASSWORD_LENGTH
888 #define PASSWORD_LENGTH 8
899 #ifndef INADDR_LOOPBACK
900 #define INADDR_LOOPBACK 0x7f000001
904 #define INADDR_NONE 0xffffffff
908 #define crypt ufc_crypt
912 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
915 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
916 #define ULTRIX_AUTH 1
919 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
921 int setresuid(uid_t ruid
, uid_t euid
, uid_t suid
);
923 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
924 int setresgid(gid_t rgid
, gid_t egid
, gid_t sgid
);
928 * Some older systems seem not to have MAXHOSTNAMELEN
931 #ifndef MAXHOSTNAMELEN
932 #define MAXHOSTNAMELEN 255
935 /* yuck, I'd like a better way of doing this */
936 #define DIRP_SIZE (256 + 32)
939 * glibc on linux doesn't seem to have MSG_WAITALL
940 * defined. I think the kernel has it though..
944 #define MSG_WAITALL 0
947 /* default socket options. Dave Miller thinks we should default to TCP_NODELAY
948 given the socket IO pattern that Samba uses */
950 #define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
952 #define DEFAULT_SOCKET_OPTIONS ""
955 /* dmalloc -- free heap debugger (dmalloc.org). This should be near
956 * the *bottom* of include files so as not to conflict. */
957 #ifdef ENABLE_DMALLOC
958 # include <dmalloc.h>
962 /* Some POSIX definitions for those without */
965 #define S_IFDIR 0x4000
968 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
971 #define S_IRWXU 00700 /* read, write, execute: owner */
974 #define S_IRUSR 00400 /* read permission: owner */
977 #define S_IWUSR 00200 /* write permission: owner */
980 #define S_IXUSR 00100 /* execute permission: owner */
983 #define S_IRWXG 00070 /* read, write, execute: group */
986 #define S_IRGRP 00040 /* read permission: group */
989 #define S_IWGRP 00020 /* write permission: group */
992 #define S_IXGRP 00010 /* execute permission: group */
995 #define S_IRWXO 00007 /* read, write, execute: other */
998 #define S_IROTH 00004 /* read permission: other */
1001 #define S_IWOTH 00002 /* write permission: other */
1004 #define S_IXOTH 00001 /* execute permission: other */
1007 /* For sys_adminlog(). */
1009 #define LOG_EMERG 0 /* system is unusable */
1013 #define LOG_ALERT 1 /* action must be taken immediately */
1017 #define LOG_CRIT 2 /* critical conditions */
1021 #define LOG_ERR 3 /* error conditions */
1025 #define LOG_WARNING 4 /* warning conditions */
1029 #define LOG_NOTICE 5 /* normal but significant condition */
1033 #define LOG_INFO 6 /* informational */
1037 #define LOG_DEBUG 7 /* debug-level messages */
1040 #if HAVE_KERNEL_SHARE_MODES
1042 #define LOCK_MAND 32 /* This is a mandatory flock */
1043 #define LOCK_READ 64 /* ... Which allows concurrent read operations */
1044 #define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
1045 #define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
1049 extern int DEBUGLEVEL
;
1051 #define MAX_SEC_CTX_DEPTH 8 /* Maximum number of security contexts */
1054 #ifdef GLIBC_HACK_FCNTL64
1055 /* this is a gross hack. 64 bit locking is completely screwed up on
1056 i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack
1057 "fixes" the problem with the current 2.4.0test kernels
1059 #define fcntl fcntl64
1067 /* Needed for sys_dlopen/sys_dlsym/sys_dlclose */
1069 #define RTLD_GLOBAL 0
1080 /* needed for some systems without iconv. Doesn't really matter
1081 what error code we use */
1086 /* add varargs prototypes with printf checking */
1088 int fdprintf(int , const char *, ...) PRINTF_ATTRIBUTE(2,3);
1090 int d_printf(const char *, ...) PRINTF_ATTRIBUTE(1,2);
1092 int d_fprintf(FILE *f
, const char *, ...) PRINTF_ATTRIBUTE(2,3);
1095 void sys_adminlog(int priority
, const char *format_str
, ...) PRINTF_ATTRIBUTE(2,3);
1098 int fstr_sprintf(fstring s
, const char *fmt
, ...) PRINTF_ATTRIBUTE(2,3);
1100 int d_vfprintf(FILE *f
, const char *format
, va_list ap
) PRINTF_ATTRIBUTE(2,0);
1102 int smb_xvasprintf(char **ptr
, const char *format
, va_list ap
) PRINTF_ATTRIBUTE(2,0);
1104 int asprintf_strupper_m(char **strp
, const char *fmt
, ...) PRINTF_ATTRIBUTE(2,3);
1105 char *talloc_asprintf_strupper_m(TALLOC_CTX
*t
, const char *fmt
, ...) PRINTF_ATTRIBUTE(2,3);
1107 /* we used to use these fns, but now we have good replacements
1108 for snprintf and vsnprintf */
1109 #define slprintf snprintf
1110 #define vslprintf vsnprintf
1112 /* we need to use __va_copy() on some platforms */
1114 #define VA_COPY(dest, src) va_copy(dest, src)
1116 #ifdef HAVE___VA_COPY
1117 #define VA_COPY(dest, src) __va_copy(dest, src)
1119 #define VA_COPY(dest, src) (dest) = (src)
1124 * Veritas File System. Often in addition to native.
1127 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
1131 #ifndef XATTR_CREATE
1132 #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
1135 #ifndef XATTR_REPLACE
1136 #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
1141 /* function declarations not included in proto.h */
1142 LDAP
*ldap_open_with_timeout(const char *server
, int port
, unsigned int to
);
1144 #endif /* HAVE_LDAP */
1146 #if defined(HAVE_LINUX_READAHEAD) && ! defined(HAVE_READAHEAD_DECL)
1147 ssize_t
readahead(int fd
, off64_t offset
, size_t count
);
1150 /* TRUE and FALSE are part of the C99 standard and gcc, but
1151 unfortunately many vendor compilers don't support them. Use True
1152 and False instead. */
1157 #define TRUE __ERROR__XX__DONT_USE_TRUE
1162 #define FALSE __ERROR__XX__DONT_USE_FALSE
1164 /* If we have blacklisted mmap() try to avoid using it accidentally by
1165 undefining the HAVE_MMAP symbol. */
1167 #ifdef MMAP_BLACKLIST
1171 #define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
1172 #define CONST_ADD(type, ptr) ((type) ((const void *) (ptr)))
1174 #ifndef NORETURN_ATTRIBUTE
1176 #define NORETURN_ATTRIBUTE __attribute__ ((noreturn))
1178 #define NORETURN_ATTRIBUTE
1182 void smb_panic( const char *why
) NORETURN_ATTRIBUTE
;
1183 void dump_core(void) NORETURN_ATTRIBUTE
;
1184 void exit_server(const char *const reason
) NORETURN_ATTRIBUTE
;
1185 void exit_server_cleanly(const char *const reason
) NORETURN_ATTRIBUTE
;
1186 void exit_server_fault(void) NORETURN_ATTRIBUTE
;
1189 #include "libnscd.h"
1192 #if defined(HAVE_IPV6)
1193 void in6_addr_to_sockaddr_storage(struct sockaddr_storage
*ss
,
1194 struct in6_addr ip
);
1197 #endif /* _INCLUDES_H */