diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-09-06 04:44:32 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:17:36 -0500 |
commit | a983b06d37c3b87a02444d9a9862777b88629344 (patch) | |
tree | 531e396a45b073f476fd091e068c2d6f175a618b /source4/lib/replace | |
parent | 3e11f4c06131542565149496d659f0050411a68f (diff) | |
download | samba-a983b06d37c3b87a02444d9a9862777b88629344.tar.gz samba-a983b06d37c3b87a02444d9a9862777b88629344.tar.bz2 samba-a983b06d37c3b87a02444d9a9862777b88629344.zip |
r18129: moved the system includes into libreplace - this gives much more
isolation of our portability environment from the main code, and also
simplifies the includes system (no separate #ifdef _SAMBA_BUILD for
tdb. ldb etc now)
(This used to be commit 77d1a468e06290aba789e2f3affc769fc5159a21)
Diffstat (limited to 'source4/lib/replace')
23 files changed, 1160 insertions, 41 deletions
diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index ce36ee39b4..1465756261 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -168,6 +168,7 @@ AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],, m4_include(getpass.m4) m4_include(cc_features.m4) +m4_include(system/config.m4) LIBREPLACE_C99_STRUCT_INIT(c99_struct_initialization=yes, c99_struct_initialization=no) diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index b9c106d582..733cb758bd 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -24,20 +24,10 @@ #include "replace.h" -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> - -#if HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -#if HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif +#include "system/filesys.h" +#include "system/time.h" +#include "system/passwd.h" +#include "system/syslog.h" void replace_dummy(void); void replace_dummy(void) {} diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index 566be225be..38b4e08704 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -29,8 +29,11 @@ #define _replace_h #include "config.h" + +#include <stdio.h> #include <stdlib.h> #include <stdarg.h> +#include <errno.h> #if defined(_MSC_VER) || defined(__MINGW32__) #include "lib/replace/win32/replace.h" @@ -50,6 +53,15 @@ #include <inttypes.h> #endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + + #ifndef HAVE_STRERROR extern char *sys_errlist[]; #define strerror(i) sys_errlist[i] @@ -70,7 +82,7 @@ void *rep_memmove(void *dest,const void *src,int size); #endif #if !defined(HAVE_MKTIME) || !defined(HAVE_TIMEGM) -#include <sys/time.h> +#include "system/time.h" #endif #ifndef HAVE_MKTIME @@ -286,6 +298,4 @@ typedef int bool; #define __STRING(x) #x #endif - - #endif diff --git a/source4/lib/replace/system/README b/source4/lib/replace/system/README new file mode 100644 index 0000000000..69a2b80b56 --- /dev/null +++ b/source4/lib/replace/system/README @@ -0,0 +1,4 @@ +This directory contains wrappers around logical groups of system +include files. The idea is to avoid #ifdef blocks in the main code, +and instead put all the necessary conditional includes in subsystem +specific header files in this directory. diff --git a/source4/lib/replace/system/capability.h b/source4/lib/replace/system/capability.h new file mode 100644 index 0000000000..6ed8ae8de0 --- /dev/null +++ b/source4/lib/replace/system/capability.h @@ -0,0 +1,41 @@ +#ifndef _system_capability_h +#define _system_capability_h +/* + Unix SMB/CIFS implementation. + + capability system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_SYS_CAPABILITY_H + +#if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H) +#define _I386_STATFS_H +#define BROKEN_REDHAT_7_STATFS_WORKAROUND +#endif + +#include <sys/capability.h> + +#ifdef BROKEN_REDHAT_7_STATFS_WORKAROUND +#undef _I386_STATFS_H +#undef BROKEN_REDHAT_7_STATFS_WORKAROUND +#endif + +#endif + +#endif diff --git a/source4/lib/replace/system/config.m4 b/source4/lib/replace/system/config.m4 new file mode 100644 index 0000000000..4d66317a5e --- /dev/null +++ b/source4/lib/replace/system/config.m4 @@ -0,0 +1,31 @@ +# filesys +AC_HEADER_DIRENT +AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/acl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h ) + +# select +AC_CHECK_HEADERS(sys/select.h) + +# time +AC_CHECK_HEADERS(sys/time.h utime.h) +AC_HEADER_TIME + +# wait +AC_HEADER_SYS_WAIT + +# capability +AC_CHECK_HEADERS(sys/capability.h) + +# passwd +AC_CHECK_HEADERS(grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h) + +# locale +AC_CHECK_HEADERS(ctype.h locale.h) + +# glob +AC_CHECK_HEADERS(fnmatch.h) + +# shmem +AC_CHECK_HEADERS(sys/ipc.h sys/mman.h sys/shm.h ) + +# terminal +AC_CHECK_HEADERS(termios.h termio.h sys/termio.h ) diff --git a/source4/lib/replace/system/dir.h b/source4/lib/replace/system/dir.h new file mode 100644 index 0000000000..64e413c907 --- /dev/null +++ b/source4/lib/replace/system/dir.h @@ -0,0 +1,64 @@ +#ifndef _system_dir_h +#define _system_dir_h +/* + Unix SMB/CIFS implementation. + + directory system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#if HAVE_DIRENT_H +# include <dirent.h> +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include <sys/ndir.h> +# endif +# if HAVE_SYS_DIR_H +# include <sys/dir.h> +# endif +# if HAVE_NDIR_H +# include <ndir.h> +# endif +#endif + +#ifndef HAVE_MKDIR_MODE +#define mkdir(dir, mode) mkdir(dir) +#endif + +/* Test whether a file name is the "." or ".." directory entries. + * These really should be inline functions. + */ +#ifndef ISDOT +#define ISDOT(path) ( \ + *((const char *)(path)) == '.' && \ + *(((const char *)(path)) + 1) == '\0' \ + ) +#endif + +#ifndef ISDOTDOT +#define ISDOTDOT(path) ( \ + *((const char *)(path)) == '.' && \ + *(((const char *)(path)) + 1) == '.' && \ + *(((const char *)(path)) + 2) == '\0' \ + ) +#endif + +#endif diff --git a/source4/lib/replace/system/filesys.h b/source4/lib/replace/system/filesys.h new file mode 100644 index 0000000000..1e48f7ab40 --- /dev/null +++ b/source4/lib/replace/system/filesys.h @@ -0,0 +1,170 @@ +#ifndef _system_filesys_h +#define _system_filesys_h +/* + Unix SMB/CIFS implementation. + + filesystem system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#include <unistd.h> +#include <sys/stat.h> + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif + +#ifdef HAVE_SYS_VFS_H +#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 + +#if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY) +#include <sys/filsys.h> +#endif + +#ifdef HAVE_SYS_STATFS_H +# include <sys/statfs.h> +#endif + +#ifdef HAVE_DUSTAT_H +#include <sys/dustat.h> +#endif + +#ifdef HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif + +#ifdef HAVE_SYS_FILIO_H +#include <sys/filio.h> +#endif + +#include <sys/file.h> + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#else +#ifdef HAVE_SYS_FCNTL_H +#include <sys/fcntl.h> +#endif +#endif + +#ifdef HAVE_SYS_MODE_H +/* apparently AIX needs this for S_ISLNK */ +#ifndef S_ISLNK +#include <sys/mode.h> +#endif +#endif + +#ifdef HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif + +/* + * Veritas File System. Often in addition to native. + * Quotas different. + */ +#if defined(HAVE_SYS_FS_VX_QUOTA_H) +#define VXFS_QUOTA +#endif + +#if HAVE_SYS_ATTRIBUTES_H +#include <sys/attributes.h> +#endif + +/* mutually exclusive (SuSE 8.2) */ +#if HAVE_ATTR_XATTR_H +#include <attr/xattr.h> +#elif HAVE_SYS_XATTR_H +#include <sys/xattr.h> +#endif + + +#ifdef HAVE_SYS_RESOURCE_H +#include <sys/resource.h> +#endif + +/* Some POSIX definitions for those without */ + +#ifndef S_IFDIR +#define S_IFDIR 0x4000 +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR) +#endif +#ifndef S_IRWXU +#define S_IRWXU 00700 /* read, write, execute: owner */ +#endif +#ifndef S_IRUSR +#define S_IRUSR 00400 /* read permission: owner */ +#endif +#ifndef S_IWUSR +#define S_IWUSR 00200 /* write permission: owner */ +#endif +#ifndef S_IXUSR +#define S_IXUSR 00100 /* execute permission: owner */ +#endif +#ifndef S_IRWXG +#define S_IRWXG 00070 /* read, write, execute: group */ +#endif +#ifndef S_IRGRP +#define S_IRGRP 00040 /* read permission: group */ +#endif +#ifndef S_IWGRP +#define S_IWGRP 00020 /* write permission: group */ +#endif +#ifndef S_IXGRP +#define S_IXGRP 00010 /* execute permission: group */ +#endif +#ifndef S_IRWXO +#define S_IRWXO 00007 /* read, write, execute: other */ +#endif +#ifndef S_IROTH +#define S_IROTH 00004 /* read permission: other */ +#endif +#ifndef S_IWOTH +#define S_IWOTH 00002 /* write permission: other */ +#endif +#ifndef S_IXOTH +#define S_IXOTH 00001 /* execute permission: other */ +#endif + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN 256 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +#endif diff --git a/source4/lib/replace/system/glob.h b/source4/lib/replace/system/glob.h new file mode 100644 index 0000000000..0e51f397c6 --- /dev/null +++ b/source4/lib/replace/system/glob.h @@ -0,0 +1,33 @@ +#ifndef _system_glob_h +#define _system_glob_h +/* + Unix SMB/CIFS implementation. + + glob system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_GLOB_H +#include <glob.h> +#endif + +#ifdef HAVE_FNMATCH_H +#include <fnmatch.h> +#endif + +#endif diff --git a/source4/lib/replace/system/iconv.h b/source4/lib/replace/system/iconv.h new file mode 100644 index 0000000000..75ee1d83ba --- /dev/null +++ b/source4/lib/replace/system/iconv.h @@ -0,0 +1,40 @@ +#ifndef _system_iconv_h +#define _system_iconv_h +/* + Unix SMB/CIFS implementation. + + iconv memory system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_NATIVE_ICONV +#ifdef HAVE_ICONV_H +#include <iconv.h> +#endif +#ifdef HAVE_GICONV_H +#include <giconv.h> +#endif +#endif + +/* needed for some systems without iconv. Doesn't really matter + what error code we use */ +#ifndef EILSEQ +#define EILSEQ EIO +#endif + +#endif diff --git a/source4/lib/replace/system/kerberos.h b/source4/lib/replace/system/kerberos.h new file mode 100644 index 0000000000..b24196fc25 --- /dev/null +++ b/source4/lib/replace/system/kerberos.h @@ -0,0 +1,133 @@ +#ifndef _system_kerberos_h +#define _system_kerberos_h + +/* + Unix SMB/CIFS implementation. + + kerberos system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_KRB5 +/* Whether the krb5_address struct has a addrtype property */ +/* #undef HAVE_ADDRTYPE_IN_KRB5_ADDRESS */ +/* Whether the krb5_address struct has a addr_type property */ +#define HAVE_ADDR_TYPE_IN_KRB5_ADDRESS 1 +/* Define to 1 if you have the `gsskrb5_extract_authz_data_from_sec_context' */ +#define HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT 1 +/* Define to 1 if you have the `gsskrb5_get_initiator_subkey' function. */ +#define HAVE_GSSKRB5_GET_INITIATOR_SUBKEY 1 +/* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function. */ +#define HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY 1 +/* Define to 1 if you have the `gss_krb5_ccache_name' function. */ +#define HAVE_GSS_KRB5_CCACHE_NAME 1 +/* Define to 1 if you have the `krb5_addlog_func' function. */ +#define HAVE_KRB5_ADDLOG_FUNC 1 +/* Define to 1 if you have the `krb5_auth_con_setkey' function. */ +#define HAVE_KRB5_AUTH_CON_SETKEY 1 +/* Define to 1 if you have the `krb5_auth_con_setuseruserkey' function. */ +/* #undef HAVE_KRB5_AUTH_CON_SETUSERUSERKEY */ +/* Define to 1 if you have the `krb5_c_enctype_compare' function. */ +#define HAVE_KRB5_C_ENCTYPE_COMPARE 1 +/* Define to 1 if you have the `krb5_c_verify_checksum' function. */ +#define HAVE_KRB5_C_VERIFY_CHECKSUM 1 +/* Whether the type krb5_encrypt_block exists */ +/* #undef HAVE_KRB5_ENCRYPT_BLOCK */ +/* Define to 1 if you have the `krb5_encrypt_data' function. */ +/* #undef HAVE_KRB5_ENCRYPT_DATA */ +/* Define to 1 if you have the `krb5_enctypes_compatible_keys' function. */ +#define HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS 1 +/* Define to 1 if you have the `krb5_free_data_contents' function. */ +#define HAVE_KRB5_FREE_DATA_CONTENTS 1 +/* Define to 1 if you have the `krb5_free_error_string' function. */ +#define HAVE_KRB5_FREE_ERROR_STRING 1 +/* Define to 1 if you have the `krb5_free_keytab_entry_contents' function. */ +/* #undef HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS */ +/* Define to 1 if you have the `krb5_free_ktypes' function. */ +/* #undef HAVE_KRB5_FREE_KTYPES */ +/* Define to 1 if you have the `krb5_free_unparsed_name' function. */ +/* #undef HAVE_KRB5_FREE_UNPARSED_NAME */ +/* Define to 1 if you have the `krb5_get_default_in_tkt_etypes' function. */ +#define HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES 1 +/* Define to 1 if you have the `krb5_get_error_string' function. */ +#define HAVE_KRB5_GET_ERROR_STRING 1 +/* Define to 1 if you have the `krb5_get_permitted_enctypes' function. */ +/* #undef HAVE_KRB5_GET_PERMITTED_ENCTYPES */ +/* Define to 1 if you have the `krb5_get_pw_salt' function. */ +#define HAVE_KRB5_GET_PW_SALT 1 +/* Define to 1 if you have the <krb5.h> header file. */ +#define HAVE_KRB5_H 1 +/* Define to 1 if you have the `krb5_initlog' function. */ +#define HAVE_KRB5_INITLOG 1 +/* Define to 1 if you have the `krb5_kdc_default_config' function. */ +#define HAVE_KRB5_KDC_DEFAULT_CONFIG 1 +/* Whether the krb5_creds struct has a keyblock property */ +/* #undef HAVE_KRB5_KEYBLOCK_IN_CREDS */ +/* Whether the krb5_keyblock struct has a keyvalue property */ +#define HAVE_KRB5_KEYBLOCK_KEYVALUE 1 +/* Whether krb5_keytab_entry has key member */ +/* #undef HAVE_KRB5_KEYTAB_ENTRY_KEY */ +/* Whether krb5_keytab_entry has keyblock member */ +#define HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK 1 +/* Define to 1 if you have the `krb5_krbhst_get_addrinfo' function. */ +#define HAVE_KRB5_KRBHST_GET_ADDRINFO 1 +/* Define to 1 if you have the `krb5_kt_compare' function. */ +#define HAVE_KRB5_KT_COMPARE 1 +/* Define to 1 if you have the `krb5_kt_free_entry' function. */ +#define HAVE_KRB5_KT_FREE_ENTRY 1 +/* Whether the type krb5_log_facility exists */ +#define HAVE_KRB5_LOG_FACILITY 1 +/* Define to 1 if you have the `krb5_mk_req_extended' function. */ +#define HAVE_KRB5_MK_REQ_EXTENDED 1 +/* Define to 1 if you have the `krb5_principal2salt' function. */ +/* #undef HAVE_KRB5_PRINCIPAL2SALT */ +/* Define to 1 if you have the `krb5_principal_get_comp_string' function. */ +#define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING 1 +/* Whether krb5_princ_component is available */ +/* #undef HAVE_KRB5_PRINC_COMPONENT */ +/* Whether the krb5_creds struct has a session property */ +#define HAVE_KRB5_SESSION_IN_CREDS 1 +/* Define to 1 if you have the `krb5_set_default_in_tkt_etypes' function. */ +#define HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES 1 +/* Define to 1 if you have the `krb5_set_default_tgs_ktypes' function. */ +/* #undef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES */ +/* Define to 1 if you have the `krb5_set_real_time' function. */ +#define HAVE_KRB5_SET_REAL_TIME 1 +/* Define to 1 if you have the `krb5_set_warn_dest' function. */ +#define HAVE_KRB5_SET_WARN_DEST 1 +/* Define to 1 if you have the `krb5_string_to_key' function. */ +#define HAVE_KRB5_STRING_TO_KEY 1 +/* Define to 1 if you have the `krb5_string_to_key_salt' function. */ +#define HAVE_KRB5_STRING_TO_KEY_SALT 1 +/* Define to 1 if you have the `krb5_ticket_get_authorization_data_type' */ +#define HAVE_KRB5_TICKET_GET_AUTHORIZATION_DATA_TYPE 1 +/* Whether the krb5_ticket struct has a enc_part2 property */ +/* #undef HAVE_KRB5_TKT_ENC_PART2 */ +/* Define to 1 if you have the `krb5_use_enctype' function. */ +/* #undef HAVE_KRB5_USE_ENCTYPE */ +/* Define to 1 if you have the `krb5_verify_checksum' function. */ +#define HAVE_KRB5_VERIFY_CHECKSUM 1 +/* Whether krb5_princ_realm returns krb5_realm or krb5_data */ +#define KRB5_PRINC_REALM_RETURNS_REALM 1 + +#include "heimdal/lib/krb5/krb5.h" +#include "heimdal/lib/gssapi/gssapi.h" +#include "heimdal/lib/com_err/com_err.h" +#endif + +#endif diff --git a/source4/lib/replace/system/locale.h b/source4/lib/replace/system/locale.h new file mode 100644 index 0000000000..82b179dc5b --- /dev/null +++ b/source4/lib/replace/system/locale.h @@ -0,0 +1,34 @@ +#ifndef _system_locale_h +#define _system_locale_h + +/* + Unix SMB/CIFS implementation. + + locale include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_CTYPE_H +#include <ctype.h> +#endif + +#ifdef HAVE_LOCALE_H +#include <locale.h> +#endif + +#endif diff --git a/source4/lib/replace/system/network.h b/source4/lib/replace/system/network.h new file mode 100644 index 0000000000..9b73466924 --- /dev/null +++ b/source4/lib/replace/system/network.h @@ -0,0 +1,103 @@ +#ifndef _system_network_h +#define _system_network_h +/* + Unix SMB/CIFS implementation. + + networking system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif + +#ifdef HAVE_UNIXSOCKET +#include <sys/un.h> +#endif + +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif + +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif + +#ifdef HAVE_NETINET_TCP_H +#include <netinet/tcp.h> +#endif + +/* + * The next three defines are needed to access the IPTOS_* options + * on some systems. + */ + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include <netinet/in_systm.h> +#endif + +#ifdef HAVE_NETINET_IN_IP_H +#include <netinet/in_ip.h> +#endif + +#ifdef HAVE_NETINET_IP_H +#include <netinet/ip.h> +#endif + +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif + +#ifdef SOCKET_WRAPPER +#define SOCKET_WRAPPER_REPLACE +#include "lib/socket_wrapper/socket_wrapper.h" +#endif + +#ifdef REPLACE_INET_NTOA +char *rep_inet_ntoa(struct in_addr ip); +#define inet_ntoa rep_inet_ntoa +#endif + +/* + * glibc on linux doesn't seem to have MSG_WAITALL + * defined. I think the kernel has it though.. + */ +#ifndef MSG_WAITALL +#define MSG_WAITALL 0 +#endif + +/* + * Some older systems seem not to have MAXHOSTNAMELEN + * defined. + */ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 254 +#endif + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7f000001 +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +#endif diff --git a/source4/lib/replace/system/passwd.h b/source4/lib/replace/system/passwd.h new file mode 100644 index 0000000000..6f8d729a7c --- /dev/null +++ b/source4/lib/replace/system/passwd.h @@ -0,0 +1,96 @@ +#ifndef _system_passwd_h +#define _system_passwd_h + +/* + Unix SMB/CIFS implementation. + + passwd system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_PWD_H +#include <pwd.h> +#endif +#ifdef HAVE_GRP_H +#include <grp.h> +#endif +#ifdef HAVE_SYS_PRIV_H +#include <sys/priv.h> +#endif +#ifdef HAVE_SYS_ID_H +#include <sys/id.h> +#endif + +#ifdef HAVE_CRYPT_H +#include <crypt.h> +#endif + +#ifdef HAVE_SHADOW_H +#include <shadow.h> +#endif + +#ifdef HAVE_SYS_SECURITY_H +#include <sys/security.h> +#include <prot.h> +#define PASSWORD_LENGTH 16 +#endif /* HAVE_SYS_SECURITY_H */ + +#ifdef HAVE_GETPWANAM +#include <sys/label.h> +#include <sys/audit.h> +#include <pwdadj.h> +#endif + +#ifdef HAVE_COMPAT_H +#include <compat.h> +#endif + +#ifdef REPLACE_GETPASS +#define getpass(prompt) getsmbpass((prompt)) +#endif + +#ifndef NGROUPS_MAX +#define NGROUPS_MAX 32 /* Guess... */ +#endif + +/* what is the longest significant password available on your system? + Knowing this speeds up password searches a lot */ +#ifndef PASSWORD_LENGTH +#define PASSWORD_LENGTH 8 +#endif + +#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS) +#define OSF1_ENH_SEC 1 +#endif + +#ifndef ALLOW_CHANGE_PASSWORD +#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID)) +#define ALLOW_CHANGE_PASSWORD 1 +#endif +#endif + +#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID) +#define ULTRIX_AUTH 1 +#endif + + +#ifndef HAVE_INITGROUPS +int initgroups(char *name,gid_t id); +#endif + +#endif diff --git a/source4/lib/replace/system/printing.h b/source4/lib/replace/system/printing.h new file mode 100644 index 0000000000..489ccb1da8 --- /dev/null +++ b/source4/lib/replace/system/printing.h @@ -0,0 +1,46 @@ +#ifndef _system_printing_h +#define _system_printing_h + +/* + Unix SMB/CIFS implementation. + + printing system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef AIX +#define DEFAULT_PRINTING PRINT_AIX +#define PRINTCAP_NAME "/etc/qconfig" +#endif + +#ifdef HPUX +#define DEFAULT_PRINTING PRINT_HPUX +#endif + +#ifdef QNX +#define DEFAULT_PRINTING PRINT_QNX +#endif + +#ifndef DEFAULT_PRINTING +#define DEFAULT_PRINTING PRINT_BSD +#endif +#ifndef PRINTCAP_NAME +#define PRINTCAP_NAME "/etc/printcap" +#endif + +#endif diff --git a/source4/lib/replace/system/readline.h b/source4/lib/replace/system/readline.h new file mode 100644 index 0000000000..4a64ef1376 --- /dev/null +++ b/source4/lib/replace/system/readline.h @@ -0,0 +1,48 @@ +#ifndef _system_readline_h +#define _system_readline_h +/* + Unix SMB/CIFS implementation. + + readline wrappers + + 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. +*/ + +#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 + +#ifdef HAVE_NEW_LIBREADLINE +# define RL_COMPLETION_CAST (rl_completion_func_t *) +#else +/* This type is missing from libreadline<4.0 (approximately) */ +# define RL_COMPLETION_CAST +#endif /* HAVE_NEW_LIBREADLINE */ + +#endif diff --git a/source4/lib/replace/system/select.h b/source4/lib/replace/system/select.h new file mode 100644 index 0000000000..0d1eabbc35 --- /dev/null +++ b/source4/lib/replace/system/select.h @@ -0,0 +1,42 @@ +#ifndef _system_select_h +#define _system_select_h +/* + Unix SMB/CIFS implementation. + + select system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif + +#ifndef SELECT_CAST +#define SELECT_CAST +#endif + +/* use epoll if it is available */ +#if defined(HAVE_EPOLL_CREATE) && defined(HAVE_SYS_EPOLL_H) +#define WITH_EPOLL 1 +#endif + +#if WITH_EPOLL +#include <sys/epoll.h> +#endif + +#endif diff --git a/source4/lib/replace/system/shmem.h b/source4/lib/replace/system/shmem.h new file mode 100644 index 0000000000..9c0458363a --- /dev/null +++ b/source4/lib/replace/system/shmem.h @@ -0,0 +1,51 @@ +#ifndef _system_shmem_h +#define _system_shmem_h +/* + Unix SMB/CIFS implementation. + + shared memory system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#if defined(HAVE_SYS_IPC_H) +#include <sys/ipc.h> +#endif /* HAVE_SYS_IPC_H */ + +#if defined(HAVE_SYS_SHM_H) +#include <sys/shm.h> +#endif /* HAVE_SYS_SHM_H */ + +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +/* NetBSD doesn't have these */ +#ifndef SHM_R +#define SHM_R 0400 +#endif + +#ifndef SHM_W +#define SHM_W 0200 +#endif + + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif + +#endif diff --git a/source4/lib/replace/system/syslog.h b/source4/lib/replace/system/syslog.h new file mode 100644 index 0000000000..e123830a70 --- /dev/null +++ b/source4/lib/replace/system/syslog.h @@ -0,0 +1,66 @@ +#ifndef _system_syslog_h +#define _system_syslog_h +/* + Unix SMB/CIFS implementation. + + syslog system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_SYSLOG_H +#include <syslog.h> +#else +#ifdef HAVE_SYS_SYSLOG_H +#include <sys/syslog.h> +#endif +#endif + +/* For sys_adminlog(). */ +#ifndef LOG_EMERG +#define LOG_EMERG 0 /* system is unusable */ +#endif + +#ifndef LOG_ALERT +#define LOG_ALERT 1 /* action must be taken immediately */ +#endif + +#ifndef LOG_CRIT +#define LOG_CRIT 2 /* critical conditions */ +#endif + +#ifndef LOG_ERR +#define LOG_ERR 3 /* error conditions */ +#endif + +#ifndef LOG_WARNING +#define LOG_WARNING 4 /* warning conditions */ +#endif + +#ifndef LOG_NOTICE +#define LOG_NOTICE 5 /* normal but significant condition */ +#endif + +#ifndef LOG_INFO +#define LOG_INFO 6 /* informational */ +#endif + +#ifndef LOG_DEBUG +#define LOG_DEBUG 7 /* debug-level messages */ +#endif + +#endif diff --git a/source4/lib/replace/system/terminal.h b/source4/lib/replace/system/terminal.h new file mode 100644 index 0000000000..94d6b5cc98 --- /dev/null +++ b/source4/lib/replace/system/terminal.h @@ -0,0 +1,42 @@ +#ifndef _system_terminal_h +#define _system_terminal_h +/* + Unix SMB/CIFS implementation. + + terminal system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef SUNOS4 +/* on SUNOS4 termios.h conflicts with sys/ioctl.h */ +#undef HAVE_TERMIOS_H +#endif + + +#if defined(HAVE_TERMIOS_H) +/* POSIX terminal handling. */ +#include <termios.h> +#elif defined(HAVE_TERMIO_H) +/* Older SYSV terminal handling - don't use if we can avoid it. */ +#include <termio.h> +#elif defined(HAVE_SYS_TERMIO_H) +/* Older SYSV terminal handling - don't use if we can avoid it. */ +#include <sys/termio.h> +#endif + +#endif diff --git a/source4/lib/replace/system/time.h b/source4/lib/replace/system/time.h new file mode 100644 index 0000000000..e7c88f133d --- /dev/null +++ b/source4/lib/replace/system/time.h @@ -0,0 +1,40 @@ +#ifndef _system_time_h +#define _system_time_h +/* + Unix SMB/CIFS implementation. + + time system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef TIME_WITH_SYS_TIME +#include <sys/time.h> +#include <time.h> +#else +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#else +#include <time.h> +#endif +#endif + +#ifdef HAVE_UTIME_H +#include <utime.h> +#endif + +#endif diff --git a/source4/lib/replace/system/wait.h b/source4/lib/replace/system/wait.h new file mode 100644 index 0000000000..be8c203f73 --- /dev/null +++ b/source4/lib/replace/system/wait.h @@ -0,0 +1,37 @@ +#ifndef _system_wait_h +#define _system_wait_h +/* + Unix SMB/CIFS implementation. + + waitpid system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + 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. +*/ + +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif + +#ifndef SIGNAL_CAST +#define SIGNAL_CAST (RETSIGTYPE (*)(int)) +#endif + +#endif diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c index af50edc2a3..9dddc017be 100644 --- a/source4/lib/replace/test/testsuite.c +++ b/source4/lib/replace/test/testsuite.c @@ -24,31 +24,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../replace.h" -#include <stdio.h> +#include "replace.h" -#if HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#if HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#if HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -#include <unistd.h> -#endif - -#if HAVE_STRING_H -#include <string.h> -#endif - -#include <fcntl.h> -#include <errno.h> +/* + we include all the system/*.h include files here so that libreplace tests + them in the build farm +*/ +#include "system/capability.h" +#include "system/dir.h" +#include "system/filesys.h" +#include "system/glob.h" +#include "system/iconv.h" +#include "system/locale.h" +#include "system/network.h" +#include "system/passwd.h" +#include "system/printing.h" +#include "system/readline.h" +#include "system/select.h" +#include "system/shmem.h" +#include "system/syslog.h" +#include "system/terminal.h" +#include "system/time.h" +#include "system/wait.h" #define TESTFILE "testfile.dat" |