diff options
| author | bubulle <bubulle@alioth.debian.org> | 2010-09-06 20:54:34 +0000 |
|---|---|---|
| committer | bubulle <bubulle@alioth.debian.org> | 2010-09-06 20:54:34 +0000 |
| commit | 53601faba8f69c3454ad07acaceeef9165cb3743 (patch) | |
| tree | b31a4174a7f4d2650717c1902a6bc3f922e13117 /lib/replace | |
| parent | 1b77db997b6a2ce389356509415a6e5e540bcfe0 (diff) | |
| download | samba-53601faba8f69c3454ad07acaceeef9165cb3743.tar.gz | |
Merge 3.5.4 in upstream branch
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@3574 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'lib/replace')
| -rwxr-xr-x | lib/replace/config.guess | 4 | ||||
| -rwxr-xr-x | lib/replace/config.sub | 2 | ||||
| -rw-r--r-- | lib/replace/crypt.m4 | 2 | ||||
| -rw-r--r-- | lib/replace/dlfcn.m4 | 2 | ||||
| -rw-r--r-- | lib/replace/getpass.m4 | 4 | ||||
| -rw-r--r-- | lib/replace/libreplace.m4 | 11 | ||||
| -rw-r--r-- | lib/replace/libreplace_cc.m4 | 4 | ||||
| -rw-r--r-- | lib/replace/libreplace_ld.m4 | 42 | ||||
| -rw-r--r-- | lib/replace/libreplace_network.m4 | 66 | ||||
| -rw-r--r-- | lib/replace/repdir.m4 | 4 | ||||
| -rw-r--r-- | lib/replace/replace.c | 12 | ||||
| -rw-r--r-- | lib/replace/replace.h | 35 | ||||
| -rw-r--r-- | lib/replace/samba.m4 | 7 | ||||
| -rw-r--r-- | lib/replace/snprintf.c | 1 | ||||
| -rw-r--r-- | lib/replace/strptime.m4 | 2 | ||||
| -rw-r--r-- | lib/replace/system/config.m4 | 3 | ||||
| -rw-r--r-- | lib/replace/system/filesys.h | 20 | ||||
| -rw-r--r-- | lib/replace/system/kerberos.h | 6 | ||||
| -rw-r--r-- | lib/replace/system/locale.h | 4 | ||||
| -rw-r--r-- | lib/replace/system/network.h | 23 | ||||
| -rw-r--r-- | lib/replace/system/passwd.h | 8 | ||||
| -rw-r--r-- | lib/replace/system/wait.h | 4 | ||||
| -rw-r--r-- | lib/replace/test/os2_delete.c | 4 | ||||
| -rw-r--r-- | lib/replace/timegm.m4 | 2 |
24 files changed, 213 insertions, 59 deletions
diff --git a/lib/replace/config.guess b/lib/replace/config.guess index 4af85584ae..da83314608 100755 --- a/lib/replace/config.guess +++ b/lib/replace/config.guess @@ -808,7 +808,7 @@ EOF echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; @@ -984,7 +984,7 @@ EOF echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so diff --git a/lib/replace/config.sub b/lib/replace/config.sub index 80a785297e..a39437d015 100755 --- a/lib/replace/config.sub +++ b/lib/replace/config.sub @@ -1454,7 +1454,7 @@ case $basic_machine in os=-aout ;; c4x-* | tic4x-*) - os=-coff + os=-coff ;; # This must come before the *-dec entry. pdp10-*) diff --git a/lib/replace/crypt.m4 b/lib/replace/crypt.m4 index 684c3519f2..fae2a58685 100644 --- a/lib/replace/crypt.m4 +++ b/lib/replace/crypt.m4 @@ -3,4 +3,4 @@ AC_CHECK_HEADERS(crypt.h) AC_SEARCH_LIBS_EXT(crypt, [crypt], CRYPT_LIBS, [ AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function]) ], - [ LIBREPLACEOBJ="${LIBREPLACEOBJ} crypt.o" ]) + [ LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/crypt.o" ]) diff --git a/lib/replace/dlfcn.m4 b/lib/replace/dlfcn.m4 index 42f56f26be..722e0246b7 100644 --- a/lib/replace/dlfcn.m4 +++ b/lib/replace/dlfcn.m4 @@ -23,7 +23,7 @@ AC_VERIFY_C_PROTOTYPE([void *dlopen(const char* filename, unsigned int flags)], ]) if test x"${libreplace_cv_dlfcn}" = x"yes";then - LIBREPLACEOBJ="${LIBREPLACEOBJ} dlfcn.o" + LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/dlfcn.o" fi LIBDL="$LIBS" diff --git a/lib/replace/getpass.m4 b/lib/replace/getpass.m4 index b93817f9d3..78a0afe453 100644 --- a/lib/replace/getpass.m4 +++ b/lib/replace/getpass.m4 @@ -3,7 +3,7 @@ AC_CHECK_FUNC(getpassphrase, libreplace_cv_HAVE_GETPASSPHRASE=yes) if test x"$libreplace_cv_HAVE_GETPASS" = x"yes" -a x"$libreplace_cv_HAVE_GETPASSPHRASE" = x"yes"; then AC_DEFINE(REPLACE_GETPASS_BY_GETPASSPHRASE, 1, [getpass returns <9 chars where getpassphrase returns <265 chars]) AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced]) - LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o" + LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o" else AC_CACHE_CHECK([whether getpass should be replaced],libreplace_cv_REPLACE_GETPASS,[ @@ -18,7 +18,7 @@ CPPFLAGS="$SAVE_CPPFLAGS" ]) if test x"$libreplace_cv_REPLACE_GETPASS" = x"yes"; then AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced]) - LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o" + LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o" fi fi diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index 30d7017d0f..af8587938d 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -16,7 +16,7 @@ done if test x"$libreplacedir" = "x"; then AC_MSG_ERROR([cannot find libreplace in $libreplacepaths]) fi -LIBREPLACEOBJ="replace.o" +LIBREPLACEOBJ="$libreplacedir/replace.o" AC_SUBST(LIBREPLACEOBJ) AC_CANONICAL_BUILD @@ -46,10 +46,10 @@ if test x"$libreplacedir" = "x"; then AC_MSG_ERROR([cannot find libreplace in $libreplacepaths]) fi -LIBREPLACEOBJ="replace.o" +LIBREPLACEOBJ="$libreplacedir/replace.o" AC_SUBST(LIBREPLACEOBJ) -LIBREPLACEOBJ="${LIBREPLACEOBJ} snprintf.o" +LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/snprintf.o" AC_TYPE_SIGNAL AC_TYPE_UID_T @@ -103,10 +103,11 @@ AC_CHECK_HEADERS(sys/time.h time.h) AC_CHECK_HEADERS(stdarg.h vararg.h) AC_CHECK_HEADERS(sys/mount.h mntent.h) AC_CHECK_HEADERS(stropts.h) +AC_CHECK_HEADERS(unix.h) AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) -AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup) +AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup) AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2) AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath) AC_HAVE_DECL(setresuid, [#include <unistd.h>]) @@ -279,7 +280,7 @@ m4_include(timegm.m4) m4_include(repdir.m4) m4_include(crypt.m4) -AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])]) +AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])]) echo "LIBREPLACE_BROKEN_CHECKS: END" ]) dnl end AC_LIBREPLACE_BROKEN_CHECKS diff --git a/lib/replace/libreplace_cc.m4 b/lib/replace/libreplace_cc.m4 index 30c63f2f05..a26dee498e 100644 --- a/lib/replace/libreplace_cc.m4 +++ b/lib/replace/libreplace_cc.m4 @@ -141,9 +141,7 @@ AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(size_t) AC_CHECK_SIZEOF(ssize_t) -AC_CHECK_TYPE(intptr_t, long long) -AC_CHECK_TYPE(uintptr_t, unsigned long long) -AC_CHECK_TYPE(ptrdiff_t, unsigned long long) +AC_CHECK_TYPES([intptr_t, uintptr_t, ptrdiff_t]) if test x"$ac_cv_type_long_long" != x"yes";then AC_MSG_ERROR([LIBREPLACE needs type 'long long']) diff --git a/lib/replace/libreplace_ld.m4 b/lib/replace/libreplace_ld.m4 index 9529c5e0a5..bf0df6186d 100644 --- a/lib/replace/libreplace_ld.m4 +++ b/lib/replace/libreplace_ld.m4 @@ -40,7 +40,7 @@ LDFLAGS="$saved_LDFLAGS" AC_DEFUN([AC_LD_PICFLAG], [ case "$host_os" in - *linux*) + *linux*|*gnu*) PICFLAG="-fPIC" ;; *solaris*) @@ -71,13 +71,12 @@ case "$host_os" in PICFLAG="-O2" ;; *hpux*) - if test $ac_cv_prog_cc_Ae = yes; then - PICFLAG="+z +ESnolit" - elif test "${GCC}" = "yes"; then + if test "${GCC}" = "yes"; then PICFLAG="-fPIC" - fi - if test "$host_cpu" = "ia64"; then - PICFLAG="+z" + elif test "$host_cpu" = "ia64"; then + PICFLAG="+z" + elif test $ac_cv_prog_cc_Ae = yes; then + PICFLAG="+z +ESnolit" fi ;; *osf*) @@ -111,7 +110,7 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_FLAGS], LD_SHLIB_FLAGS="-shared" case "$host_os" in - *linux*) + *linux*|*gnu*) LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic" ;; *solaris*) @@ -209,7 +208,7 @@ AC_DEFUN([AC_LD_SONAMEFLAG], AC_SUBST(SONAMEFLAG) SONAMEFLAG="" case "$host_os" in - *linux*) + *linux*|*gnu*|*qnx*) SONAMEFLAG="-Wl,-soname=" ;; *solaris*) @@ -249,6 +248,22 @@ AC_DEFUN([AC_LD_SONAMEFLAG], esac ]) +AC_DEFUN([AC_LD_VERSIONSCRIPT], +[ + AC_SUBST(VERSIONSCRIPT) + VERSIONSCRIPT="" + case "$host_os" in + *linux*|*gnu*) + VERSIONSCRIPT="-Wl,--version-script" + ;; + *solaris*) + if test "${GCC}" = "yes"; then + VERSIONSCRIPT="-Wl,--version-script" + fi + ;; + esac +]) + AC_DEFUN([AC_LIBREPLACE_MDLD], [ AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER]) @@ -261,7 +276,7 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG], LD_ALLOW_SHLIB_UNDEF_FLAG="" case "$host_os" in - *linux*) + *linux*|*gnu*) LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined" ;; *osf*) @@ -289,7 +304,7 @@ AC_DEFUN([AC_LIBREPLACE_MDLD_FLAGS], AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR], [ case "$host_os" in - *linux*) + *linux*|*gnu*) LIB_PATH_VAR=LD_LIBRARY_PATH ;; *bsd*) @@ -305,7 +320,7 @@ AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR], LIB_PATH_VAR=LD_LIBRARY_PATH ;; *aix*) - LIB_PATH_VAR=LIB_PATH + LIB_PATH_VAR=LIBPATH ;; *irix*) LIB_PATH_VAR=LD_LIBRARY_PATH @@ -313,6 +328,9 @@ AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR], *darwin*) LIB_PATH_VAR=DYLD_LIBRARY_PATH ;; + *) + LIB_PATH_VAR=LD_LIBRARY_PATH + ;; esac AC_SUBST(LIB_PATH_VAR) diff --git a/lib/replace/libreplace_network.m4 b/lib/replace/libreplace_network.m4 index 2af02312ab..d8ed8a1d53 100644 --- a/lib/replace/libreplace_network.m4 +++ b/lib/replace/libreplace_network.m4 @@ -173,7 +173,7 @@ LIBS="${LIBREPLACE_NETWORK_LIBS}" libreplace_SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$libreplacedir" -AC_CHECK_FUNCS(socketpair,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} socketpair.o"]) +AC_CHECK_FUNCS(socketpair,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/socketpair.o"]) AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ AC_TRY_RUN([ @@ -193,14 +193,14 @@ exit(1);}], AC_CHECK_FUNCS(inet_ntoa,[],[libreplace_cv_REPLACE_INET_NTOA=yes]) if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) - LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_ntoa.o" + LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_ntoa.o" fi -AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_aton.o"]) +AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_aton.o"]) -AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_ntop.o"]) +AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_ntop.o"]) -AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_pton.o"]) +AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_pton.o"]) dnl test for getaddrinfo/getnameinfo AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[ @@ -232,7 +232,7 @@ if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror]) else - LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} getaddrinfo.o" + LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/getaddrinfo.o" fi AC_CHECK_HEADERS([ifaddrs.h]) @@ -287,7 +287,7 @@ AC_TRY_RUN([ if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) else - LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} getifaddrs.o" + LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/getifaddrs.o" fi @@ -350,6 +350,50 @@ if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then fi fi +dnl Some old Linux systems have broken header files and +dnl miss the IPV6_V6ONLY define in netinet/in.h, +dnl but have it in linux/in6.h. +dnl We can't include both files so we just check if the value +dnl if defined and do the replacement in system/network.h +AC_CACHE_CHECK([for IPV6_V6ONLY support],libreplace_cv_HAVE_IPV6_V6ONLY,[ + AC_TRY_COMPILE([ +#include <stdlib.h> /* for NULL */ +#include <sys/socket.h> +#include <sys/types.h> +#include <netdb.h> +#include <netinet/in.h> + ], + [ +#ifndef IPV6_V6ONLY +#error no IPV6_V6ONLY +#endif + ],[ + libreplace_cv_HAVE_IPV6_V6ONLY=yes + ],[ + libreplace_cv_HAVE_IPV6_V6ONLY=no + ]) +]) +if test x"$libreplace_cv_HAVE_IPV6_V6ONLY" != x"yes"; then + dnl test for IPV6_V6ONLY + AC_CACHE_CHECK([for IPV6_V6ONLY in linux/in6.h],libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26,[ + AC_TRY_COMPILE([ + #include <linux/in6.h> + ], + [ + #if (IPV6_V6ONLY != 26) + #error no linux IPV6_V6ONLY + #endif + ],[ + libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26=yes + ],[ + libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26=no + ]) + ]) + if test x"$libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26" = x"yes"; then + AC_DEFINE(HAVE_LINUX_IPV6_V6ONLY_26,1,[Whether the system has IPV6_V6ONLY in linux/in6.h]) + fi +fi + dnl test for ipv6 AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[ AC_TRY_LINK([ @@ -370,6 +414,14 @@ if (ret != 0) { const char *es = gai_strerror(ret); } freeaddrinfo(ai); +{ + int val = 1; + #ifdef HAVE_LINUX_IPV6_V6ONLY_26 + #define IPV6_V6ONLY 26 + #endif + ret = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + (const void *)&val, sizeof(val)); +} ],[ libreplace_cv_HAVE_IPV6=yes ],[ diff --git a/lib/replace/repdir.m4 b/lib/replace/repdir.m4 index fb3f414c95..682ab44c56 100644 --- a/lib/replace/repdir.m4 +++ b/lib/replace/repdir.m4 @@ -45,7 +45,7 @@ fi if test x"$libreplace_cv_READDIR_GETDIRENTRIES" = x"yes"; then AC_DEFINE(REPLACE_READDIR,1,[replace readdir]) AC_DEFINE(REPLACE_READDIR_GETDIRENTRIES,1,[replace readdir using getdirentries()]) - LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir_getdirentries.o" + LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdirentries.o" libreplace_cv_READDIR_NEEDED=no fi @@ -68,7 +68,7 @@ fi if test x"$libreplace_cv_READDIR_GETDENTS" = x"yes"; then AC_DEFINE(REPLACE_READDIR,1,[replace readdir]) AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()]) - LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir_getdents.o" + LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdents.o" libreplace_cv_READDIR_NEEDED=no fi diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 78c688d50c..fc15717349 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -31,6 +31,10 @@ #include "system/locale.h" #include "system/wait.h" +#ifdef _WIN32 +#define mkdir(d,m) _mkdir(d) +#endif + void replace_dummy(void); void replace_dummy(void) {} @@ -355,7 +359,7 @@ char *rep_strndup(const char *s, size_t n) } #endif -#ifndef HAVE_WAITPID +#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4) int rep_waitpid(pid_t pid,int *status,int options) { return wait4(pid, status, options, NULL); @@ -368,7 +372,8 @@ int rep_seteuid(uid_t euid) #ifdef HAVE_SETRESUID return setresuid(-1, euid, -1); #else -# error "You need a seteuid function" + errno = ENOSYS; + return -1; #endif } #endif @@ -379,7 +384,8 @@ int rep_setegid(gid_t egid) #ifdef HAVE_SETRESGID return setresgid(-1, egid, -1); #else -# error "You need a setegid function" + errno = ENOSYS; + return -1; #endif } #endif diff --git a/lib/replace/replace.h b/lib/replace/replace.h index c5b8676acf..6424d10c0f 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -258,6 +258,10 @@ char *rep_realpath(const char *path, char *resolved_path); int rep_lchown(const char *fname,uid_t uid,gid_t gid); #endif +#ifdef HAVE_UNIX_H +#include <unix.h> +#endif + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); @@ -535,6 +539,18 @@ typedef int bool; #endif #endif +#if !defined(HAVE_INTPTR_T) +typedef long long intptr_t ; +#endif + +#if !defined(HAVE_UINTPTR_T) +typedef unsigned long long uintptr_t ; +#endif + +#if !defined(HAVE_PTRDIFF_T) +typedef unsigned long long ptrdiff_t ; +#endif + /* * to prevent <rpcsvc/yp_prot.h> from doing a redefine of 'bool' * @@ -688,4 +704,23 @@ char *ufc_crypt(const char *key, const char *salt); #endif #endif +/* these macros gain us a few percent of speed on gcc */ +#if (__GNUC__ >= 3) +/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 + as its first argument */ +#ifndef likely +#define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely +#define unlikely(x) __builtin_expect(!!(x), 0) +#endif +#else +#ifndef likely +#define likely(x) (x) +#endif +#ifndef unlikely +#define unlikely(x) (x) +#endif +#endif + #endif /* _LIBREPLACE_REPLACE_H */ diff --git a/lib/replace/samba.m4 b/lib/replace/samba.m4 index ccb6f2e20d..b7582202f1 100644 --- a/lib/replace/samba.m4 +++ b/lib/replace/samba.m4 @@ -17,10 +17,7 @@ LIBREPLACE_DIR=`echo ${libreplacedir} |sed -e 's/^\.\///g'` # build directory. LIBREPLACE_DIR=`echo ${LIBREPLACE_DIR} | sed -e "s|^$srcdir/||g"` -LIBREPLACE_OBJS="" -for obj in ${LIBREPLACEOBJ}; do - LIBREPLACE_OBJS="${LIBREPLACE_OBJS} ${LIBREPLACE_DIR}/${obj}" -done +LIBREPLACE_OBJS="${LIBREPLACEOBJ}" SMB_SUBSYSTEM(LIBREPLACE, [${LIBREPLACE_OBJS}], @@ -33,3 +30,5 @@ SMB_SUBSYSTEM(LIBREPLACE_HOSTCC, [${LIBREPLACE_HOSTCC_OBJS}], [], [-Ilib/replace]) + +AC_CHECK_FUNCS([syslog],,[AC_MSG_ERROR([Required function not found])]) diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c index c54d721ce5..bca774263e 100644 --- a/lib/replace/snprintf.c +++ b/lib/replace/snprintf.c @@ -504,6 +504,7 @@ static int dopr(char *buffer, size_t maxlen, const char *format, va_list args_in break; case 'p': cnk->type = CNK_PTR; + cnk->flags |= DP_F_UNSIGNED; break; case 'n': cnk->type = CNK_NUM; diff --git a/lib/replace/strptime.m4 b/lib/replace/strptime.m4 index da22fc5a97..b1a56b4aab 100644 --- a/lib/replace/strptime.m4 +++ b/lib/replace/strptime.m4 @@ -9,5 +9,5 @@ AC_CACHE_CHECK([whether strptime is available and works],libreplace_cv_STRPTIME_ ]) if test x"$libreplace_cv_STRPTIME_OK" != x"yes"; then AC_DEFINE(REPLACE_STRPTIME,1,[Whether strptime should be replaced]) - LIBREPLACEOBJ="${LIBREPLACEOBJ} strptime.o" + LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/strptime.o" fi diff --git a/lib/replace/system/config.m4 b/lib/replace/system/config.m4 index 5c9b53d5c5..39c2f58283 100644 --- a/lib/replace/system/config.m4 +++ b/lib/replace/system/config.m4 @@ -116,9 +116,10 @@ AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, si #include <unistd.h> #include <grp.h> ]) +AC_CHECK_FUNCS(getgrouplist) # locale -AC_CHECK_HEADERS(ctype.h locale.h) +AC_CHECK_HEADERS(ctype.h locale.h langinfo.h) # glob AC_CHECK_HEADERS(fnmatch.h) diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h index 4bf1f64865..22e3d23f3e 100644 --- a/lib/replace/system/filesys.h +++ b/lib/replace/system/filesys.h @@ -1,16 +1,16 @@ #ifndef _system_filesys_h #define _system_filesys_h -/* +/* Unix SMB/CIFS implementation. filesystem system include wrappers Copyright (C) Andrew Tridgell 2004 - + ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -53,23 +53,23 @@ #include <acl/libacl.h> #endif -#ifdef HAVE_SYS_FS_S5PARAM_H +#ifdef HAVE_SYS_FS_S5PARAM_H #include <sys/fs/s5param.h> #endif #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY) -#include <sys/filsys.h> +#include <sys/filsys.h> #endif #ifdef HAVE_SYS_STATFS_H # include <sys/statfs.h> #endif -#ifdef HAVE_DUSTAT_H +#ifdef HAVE_DUSTAT_H #include <sys/dustat.h> #endif -#ifdef HAVE_SYS_STATVFS_H +#ifdef HAVE_SYS_STATVFS_H #include <sys/statvfs.h> #endif @@ -123,7 +123,7 @@ #endif /* Some POSIX definitions for those without */ - + #ifndef S_IFDIR #define S_IFDIR 0x4000 #endif @@ -179,4 +179,8 @@ #define SEEK_SET 0 #endif +#ifdef _WIN32 +#define mkdir(d,m) _mkdir(d) +#endif + #endif diff --git a/lib/replace/system/kerberos.h b/lib/replace/system/kerberos.h index 2981024bee..a1685ad333 100644 --- a/lib/replace/system/kerberos.h +++ b/lib/replace/system/kerberos.h @@ -59,7 +59,9 @@ /* 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 +/* #undef HAVE_KRB5_FREE_ERROR_STRING */ +/* Define to 1 if you have the `krb5_free_error_message' function. */ +#define HAVE_KRB5_FREE_ERROR_MESSAGE 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. */ @@ -70,6 +72,8 @@ #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_error_message' function. */ +#define HAVE_KRB5_GET_ERROR_MESSAGE 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. */ diff --git a/lib/replace/system/locale.h b/lib/replace/system/locale.h index e73a9bb274..504a3bb470 100644 --- a/lib/replace/system/locale.h +++ b/lib/replace/system/locale.h @@ -35,4 +35,8 @@ #include <locale.h> #endif +#ifdef HAVE_LANGINFO_H +#include <langinfo.h> +#endif + #endif diff --git a/lib/replace/system/network.h b/lib/replace/system/network.h index 4fe1084c1a..93d533c9b9 100644 --- a/lib/replace/system/network.h +++ b/lib/replace/system/network.h @@ -321,6 +321,22 @@ typedef unsigned short int sa_family_t; #endif #endif +#ifndef IOV_MAX +# ifdef UIO_MAXIOV +# define IOV_MAX UIO_MAXIOV +# else +# ifdef __sgi + /* + * IRIX 6.5 has sysconf(_SC_IOV_MAX) + * which might return 512 or bigger + */ +# define IOV_MAX 512 +# else +# error IOV_MAX and UIO_MAXIOV undefined +# endif +# endif +#endif + #ifndef HAVE_STRUCT_ADDRINFO #define HAVE_STRUCT_ADDRINFO struct addrinfo { @@ -344,6 +360,13 @@ struct addrinfo { #define ifr_netmask ifr_addr #endif +/* Some old Linux systems have broken header files */ +#ifdef HAVE_IPV6 +#ifdef HAVE_LINUX_IPV6_V6ONLY_26 +#define IPV6_V6ONLY 26 +#endif /* HAVE_LINUX_IPV6_V6ONLY_26 */ +#endif /* HAVE_IPV6 */ + #ifdef SOCKET_WRAPPER #ifndef SOCKET_WRAPPER_DISABLE #ifndef SOCKET_WRAPPER_NOT_REPLACE diff --git a/lib/replace/system/passwd.h b/lib/replace/system/passwd.h index 9d7de34bce..b41608c551 100644 --- a/lib/replace/system/passwd.h +++ b/lib/replace/system/passwd.h @@ -1,17 +1,17 @@ #ifndef _system_passwd_h #define _system_passwd_h -/* +/* Unix SMB/CIFS implementation. passwd system include wrappers Copyright (C) Andrew Tridgell 2004 - + ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -80,7 +80,7 @@ char *rep_getpass(const char *prompt); #define NGROUPS_MAX 32 /* Guess... */ #endif -/* what is the longest significant password available on your system? +/* 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 diff --git a/lib/replace/system/wait.h b/lib/replace/system/wait.h index 5784b1ae92..79583ad2ab 100644 --- a/lib/replace/system/wait.h +++ b/lib/replace/system/wait.h @@ -52,4 +52,8 @@ typedef int sig_atomic_t; #endif +#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4) +int rep_waitpid(pid_t pid,int *status,int options) +#endif + #endif diff --git a/lib/replace/test/os2_delete.c b/lib/replace/test/os2_delete.c index 44efeea08a..8b52837018 100644 --- a/lib/replace/test/os2_delete.c +++ b/lib/replace/test/os2_delete.c @@ -27,6 +27,10 @@ static int test_readdir_os2_delete_ret; #define MIN(a,b) ((a)<(b)?(a):(b)) #endif +#ifdef _WIN32 +#define mkdir(d,m) _mkdir(d) +#endif + static void cleanup(void) { /* I'm a lazy bastard */ diff --git a/lib/replace/timegm.m4 b/lib/replace/timegm.m4 index 59f3ae0521..9b76d0c727 100644 --- a/lib/replace/timegm.m4 +++ b/lib/replace/timegm.m4 @@ -1 +1 @@ -AC_CHECK_FUNCS(timegm,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} timegm.o"]) +AC_CHECK_FUNCS(timegm,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/timegm.o"]) |
