Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef NO_CONFIG_H /* for some tests */
#include "config.h"
+#endif
+
#include "local.h"
#ifdef AIX
#define DEFAULT_PRINTING PRINT_AIX
+#define PRINTCAP_NAME "/etc/qconfig"
#endif
#ifdef HPUX
#endif
#ifdef SUNOS4
-#define REPLACE_GETPASS
/* on SUNOS4 termios.h conflicts with sys/ioctl.h */
#undef HAVE_TERMIOS_H
#endif
-#ifdef SUNOS5
-#define REPLACE_GETPASS
+
+/* if we have both SYSV IPC and shared mmap then we need to choose. For most
+ systems it is much faster to use SYSV IPC, but under Linux it is
+ about 5 times faster to use fcntl, so for Linux systems we force
+ fcntl based locking */
+#if (defined(HAVE_SYSV_IPC) && defined(HAVE_SHARED_MMAP))
+# ifdef LINUX
+# undef HAVE_SYSV_IPC
+# else
+# undef HAVE_SHARED_MMAP
+# endif
#endif
#include <stdio.h>
#include <stddef.h>
+#include <netinet/in.h>
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif
+
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/socket.h>
#endif
+#ifdef HAVE_SYS_SYSCALL_H
+#include <sys/syscall.h>
+#elif HAVE_SYSCALL_H
+#include <syscall.h>
+#endif
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <memory.h>
#endif
+#ifdef MEM_MAN
+#include "../mem_man/mem_man.h"
+#else
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
+#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#endif
-#ifdef HAVE_GLOB
+#ifdef HAVE_GLOB_H
#include <glob.h>
#endif
#include <varargs.h>
#endif
-#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <syslog.h>
# endif
#endif
-#ifdef HAVE_SHARED_MMAP
+#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <sys/sem.h>
#endif
+#if 0
+/*
+ * I have removed this as it prevents compilation under SCO Server
+ * 3.2. If you need to add it back in then please add a comment as to
+ * why it's needed and what OS it's needed for so we can work out how
+ * to test for it properly (tridge) */
+#ifdef HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#endif
+
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#include <sys/vfs.h>
#endif
+#ifdef HAVE_SYS_ACL_H
+#include <sys/acl.h>
+#endif
+
#ifdef HAVE_SYS_FS_S5PARAM_H
#include <sys/fs/s5param.h>
#endif
#include <poll.h>
#endif
+#ifdef HAVE_SYS_CAPABILITY_H
+#include <sys/capability.h>
+#endif
+
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif
+
+#if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
+#define HAVE_NETGROUP 1
+#endif
+
+#if defined (HAVE_NETGROUP)
+#if defined(HAVE_RPCSVC_YP_PROT_H)
+#include <rpcsvc/yp_prot.h>
+#endif
+#if defined(HAVE_RPCSVC_YPCLNT_H)
+#include <rpcsvc/ypclnt.h>
+#endif
+#endif /* HAVE_NETGROUP */
+
+#if defined(HAVE_MYSQL_H)
+#include <mysql.h>
+#else
+/* needed to get make proto to work with no <mysql.h> */
+#define MYSQL void
+#define MYSQL_ROW void
+#endif
+
#ifndef uchar
#define uchar unsigned char
#endif
#define uint8 unsigned char
#endif
-#ifndef int16
+#if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
#if (SIZEOF_SHORT == 4)
#define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
#else /* SIZEOF_SHORT != 4 */
#endif /* SIZEOF_SHORT != 4 */
#endif
-#ifndef uint16
-#define uint16 unsigned int16
+/*
+ * Note we duplicate the size tests in the unsigned
+ * case as int16 may be a typedef from rpc/rpc.h
+ */
+
+#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
+#if (SIZEOF_SHORT == 4)
+#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
+#else /* SIZEOF_SHORT != 4 */
+#define uint16 unsigned short
+#endif /* SIZEOF_SHORT != 4 */
#endif
-#ifndef int32
+#if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
#if (SIZEOF_INT == 4)
#define int32 int
#elif (SIZEOF_LONG == 4)
#endif
#endif
-#ifndef uint32
-#define uint32 unsigned int32
+/*
+ * Note we duplicate the size tests in the unsigned
+ * case as int32 may be a typedef from rpc/rpc.h
+ */
+
+#if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
+#if (SIZEOF_INT == 4)
+#define uint32 unsigned int
+#elif (SIZEOF_LONG == 4)
+#define uint32 unsigned long
+#elif (SIZEOF_SHORT == 4)
+#define uint32 unsigned short
+#endif
#endif
/*
# endif
#endif
+#ifdef LARGE_SMB_INO_T
+#define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
+#else
+#define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
+#endif
+
#ifndef SMB_OFF_T
# ifdef HAVE_OFF64_T
# define SMB_OFF_T off64_t
# endif
#endif
+#ifdef LARGE_SMB_OFF_T
+#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
+#else
+#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
+#endif
+
/*
* Type for stat structure.
*/
# endif
#endif
-/*
- * Type for statvfs structure.
- * Unfortunately, due to the make proto structure
- * we still need to define this as void * for platforms
- * that don't have either statvfs or statvfs64. JRA.
- */
-
-#ifndef SMB_STRUCT_STATVFS
-# if defined(STAT_STATVFS64)
-# define SMB_STRUCT_STATVFS struct statvfs64
-# elif defined(STAT_STATVFS)
-# define SMB_STRUCT_STATVFS struct statvfs
-# else
-# define SMB_STRUCT_STATVFS void *
-# endif
-#endif
-
/*
* Defines for 64 bit fcntl locks.
*/
#include "version.h"
#include "smb.h"
+#include "smbw.h"
#include "nameserv.h"
#include "byteorder.h"
#ifndef DEFAULT_PRINTING
#ifdef SYSV
#define DEFAULT_PRINTING PRINT_SYSV
+#define PRINTCAP_NAME "lpstat"
#else
#define DEFAULT_PRINTING PRINT_BSD
+#define PRINTCAP_NAME "/etc/printcap"
#endif
#endif
+#ifndef PRINTCAP_NAME
+#define PRINTCAP_NAME "/etc/printcap"
+#endif
+
#ifndef SIGCLD
#define SIGCLD SIGCHLD
#endif
#if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
#define USE_SMBPASS_DB 1
+#define USE_SMBUNIX_DB 1
#endif
#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
#define HAVE_PAM 1
#endif
-#if defined(HAVE_YP_GET_DEFAULT_DOMAIN)
-#define HAVE_NETGROUP 1
-#endif
-
-#if defined (HAVE_NETGROUP) && defined(HAVE_RPCSVC_YPCLNT_H)
-#include "rpcsvc/ypclnt.h"
-#endif
-
#ifndef ALLOW_CHANGE_PASSWORD
#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
#define ALLOW_CHANGE_PASSWORD 1
#define crypt ufc_crypt
#endif
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
+
#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
#define ULTRIX_AUTH 1
#endif
+#ifdef HAVE_LIBREADLINE
+# ifdef HAVE_READLINE_READLINE_H
+# include <readline/readline.h>
+# ifdef HAVE_READLINE_HISTORY_H
+# include <readline/history.h>
+# endif
+# else
+# ifdef HAVE_READLINE_H
+# include <readline.h>
+# ifdef HAVE_HISTORY_H
+# include <history.h>
+# endif
+# else
+# undef HAVE_LIBREADLINE
+# endif
+# endif
+#endif
+
#ifndef HAVE_STRDUP
char *strdup(const char *s);
#endif
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
#endif
+#if (defined(HAVE_CRYPT) && !defined(HAVE_CRYPT_DECL) && !defined(KRB4_AUTH))
+/* stupid glibc */
+int crypt(const char *key, const char *salt);
+#endif
+
#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
#define bzero(a,b) memset((a),'\0',(b))
#endif
+#ifdef REPLACE_GETPASS
+#define getpass(prompt) getsmbpass((prompt))
+#endif
+
+/* yuck, I'd like a better way of doing this */
+#define DIRP_SIZE (256 + 32)
+
#endif /* _INCLUDES_H */