r9369: an attempt to fix the build on HPUX. This is based on work by Don
authorAndrew Tridgell <tridge@samba.org>
Thu, 18 Aug 2005 00:20:40 +0000 (00:20 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:33:28 +0000 (13:33 -0500)
McCall, but takes a slightly different approach that I hope will be
more generic
(This used to be commit e8260a81cf99be2ccae64135ca0572c8a6ae62ad)

source4/build/m4/rewrite.m4
source4/heimdal_build/config.h
source4/lib/replace/config.m4
source4/lib/replace/replace.c
source4/ntvfs/unixuid/config.m4 [deleted file]

index 792b4bcba66147bc40e45922a509808e2dde06b7..ecde4ae32968399f6f7d6e3de554136f2ffb66b8 100644 (file)
@@ -121,7 +121,7 @@ AC_HAVE_DECL(snprintf, [#include <stdio.h>])
 
 AC_FUNC_MEMCMP
 
-AC_CHECK_FUNCS(dlopen dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strtoull strtouq strerror chroot)
+AC_CHECK_FUNCS(dlopen dlsym dlerror waitpid getcwd strdup strndup strnlen strerror chroot)
 AC_CHECK_FUNCS(bzero memset strlcpy strlcat)
 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid pipe crypt16 getauthuid)
 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
index 5ce029e83cf3c7e9e774ace9bff11f847f0db15c..c3737cb75e7b47cea5177eddbb84f7d14dc62b45 100644 (file)
@@ -45,4 +45,9 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg }
 #include "lib/replace/replace.h"
 #endif
 
+/* we need to tell roken about the functions that Samba replaces in lib/replace */
+#ifndef HAVE_SETEUID
+#define HAVE_SETEUID 1
+#endif
+
 #endif
index 8c85663d3bd3c266ba8d3255d661dcf3f2109cc6..33dc33a50be2dcf5aa5a2124a3914975f4c1717a 100644 (file)
@@ -14,3 +14,5 @@ exit(1);}],
 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
     AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
 fi
+
+AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq seteuid)
index 9ef3999769270ab3b3d6305e1f7c41aed178748b..ae70634215be54bf94285530cf0dec28886007fb 100644 (file)
@@ -340,75 +340,6 @@ duplicate a string
 #endif /* REPLACE_INET_NTOA */
 #endif
 
-#ifndef HAVE_STRTOUL
-#ifndef ULONG_MAX
-#define        ULONG_MAX       ((unsigned long)(~0L))          /* 0xFFFFFFFF */
-#endif
-
-/*
- * Convert a string to an unsigned long integer.
- * Taken from libg++ - libiberty code.
- *
- * Ignores `locale' stuff.  Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
- unsigned long strtoul(const char *nptr, char **endptr, int base)
-{
-       const char *s = nptr;
-       unsigned long acc;
-       int c;
-       unsigned long cutoff;
-       int neg = 0, any, cutlim;
-
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       do {
-               c = *s++;
-       } while (isspace(c));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else if (c == '+')
-               c = *s++;
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
-       cutlim = (int)((unsigned long)ULONG_MAX % (unsigned long)base);
-       for (acc = 0, any = 0;; c = *s++) {
-               if (isdigit(c))
-                       c -= '0';
-               else if (isalpha(c))
-                       c -= isupper(c) ? 'A' - 10 : 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = ULONG_MAX;
-               errno = ERANGE;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != 0)
-               *endptr = (char *) (any ? s - 1 : nptr);
-       return (acc);
-}
-#endif /* HAVE_STRTOUL */
-
 #ifndef HAVE_SETLINEBUF
  int setlinebuf(FILE *stream)
 {
@@ -511,17 +442,23 @@ int get_time_zone(time_t t)
 {
 #ifdef HAVE_STRTOUQ
        return strtouq(str, endptr, base);
+#elif defined(HAVE___STRTOULL) 
+       return __strtoull(str, endptr, base);
 #else
-       unsigned long long int v;
-       if (sscanf(str, "%lli", &v) != 1) {
-               errno = EINVAL;
-               return 0;
-       }
-       if (endptr) {
-               /* try to get endptr right - uggh */
-               strtoul(str, endptr, base);
-       }
-       return v;
+# error "You need a strtoull function"
+#endif
+}
+#endif
+
+#ifndef HAVE_STRTOLL
+ long long int strtoll(const char *str, char **endptr, int base)
+{
+#ifdef HAVE_STRTOQ
+       return strtoq(str, endptr, base);
+#elif defined(HAVE___STRTOLL) 
+       return __strtoll(str, endptr, base);
+#else
+# error "You need a strtoll function"
 #endif
 }
 #endif
@@ -567,3 +504,14 @@ int sys_waitpid(pid_t pid,int *status,int options)
   return wait4(pid, status, options, NULL);
 #endif /* USE_WAITPID */
 }
+
+#ifndef HAVE_SETEUID
+ int seteuid(uid_t euid)
+{
+#ifdef HAVE_SETRESUID
+       return setresuid(-1, euid, -1);
+#else
+#  error "You need a seteuid function"
+#endif
+}
+#endif
diff --git a/source4/ntvfs/unixuid/config.m4 b/source4/ntvfs/unixuid/config.m4
deleted file mode 100644 (file)
index 2c6777f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-################################################
-# look for a method of setting the effective uid
-seteuid=no;
-if test $seteuid = no; then
-AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[
-AC_TRY_RUN([
-#define AUTOCONF_TEST 1
-#define USE_SETRESUID 1
-#include "confdefs.h"
-#include "${srcdir-.}/lib/util_sec.c"],
-           samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
-if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
-fi
-fi
-
-
-if test $seteuid = no; then
-AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[
-AC_TRY_RUN([
-#define AUTOCONF_TEST 1
-#define USE_SETREUID 1
-#include "confdefs.h"
-#include "${srcdir-.}/lib/util_sec.c"],
-           samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
-if test x"$samba_cv_USE_SETREUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
-fi
-fi
-
-if test $seteuid = no; then
-AC_CACHE_CHECK([for seteuid],samba_cv_USE_SETEUID,[
-AC_TRY_RUN([
-#define AUTOCONF_TEST 1
-#define USE_SETEUID 1
-#include "confdefs.h"
-#include "${srcdir-.}/lib/util_sec.c"],
-           samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
-if test x"$samba_cv_USE_SETEUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
-fi
-fi
-
-if test $seteuid = no; then
-AC_CACHE_CHECK([for setuidx],samba_cv_USE_SETUIDX,[
-AC_TRY_RUN([
-#define AUTOCONF_TEST 1
-#define USE_SETUIDX 1
-#include "confdefs.h"
-#include "${srcdir-.}/lib/util_sec.c"],
-           samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
-if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
-fi
-fi