Author: tridge Date: 2005-08-18 00:20:40 +0000 (Thu, 18 Aug 2005) New Revision: 9369
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9369 Log: an attempt to fix the build on HPUX. This is based on work by Don McCall, but takes a slightly different approach that I hope will be more generic Removed: branches/SAMBA_4_0/source/ntvfs/unixuid/config.m4 Modified: branches/SAMBA_4_0/source/build/m4/rewrite.m4 branches/SAMBA_4_0/source/heimdal_build/config.h branches/SAMBA_4_0/source/lib/replace/config.m4 branches/SAMBA_4_0/source/lib/replace/replace.c Changeset: Modified: branches/SAMBA_4_0/source/build/m4/rewrite.m4 =================================================================== --- branches/SAMBA_4_0/source/build/m4/rewrite.m4 2005-08-17 20:26:09 UTC (rev 9368) +++ branches/SAMBA_4_0/source/build/m4/rewrite.m4 2005-08-18 00:20:40 UTC (rev 9369) @@ -121,7 +121,7 @@ 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) Modified: branches/SAMBA_4_0/source/heimdal_build/config.h =================================================================== --- branches/SAMBA_4_0/source/heimdal_build/config.h 2005-08-17 20:26:09 UTC (rev 9368) +++ branches/SAMBA_4_0/source/heimdal_build/config.h 2005-08-18 00:20:40 UTC (rev 9369) @@ -45,4 +45,9 @@ #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 Modified: branches/SAMBA_4_0/source/lib/replace/config.m4 =================================================================== --- branches/SAMBA_4_0/source/lib/replace/config.m4 2005-08-17 20:26:09 UTC (rev 9368) +++ branches/SAMBA_4_0/source/lib/replace/config.m4 2005-08-18 00:20:40 UTC (rev 9369) @@ -14,3 +14,5 @@ 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) Modified: branches/SAMBA_4_0/source/lib/replace/replace.c =================================================================== --- branches/SAMBA_4_0/source/lib/replace/replace.c 2005-08-17 20:26:09 UTC (rev 9368) +++ branches/SAMBA_4_0/source/lib/replace/replace.c 2005-08-18 00:20:40 UTC (rev 9369) @@ -340,75 +340,6 @@ #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,22 +442,28 @@ { #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 + #ifndef HAVE_STRNDUP /** Some platforms don't have strndup. @@ -567,3 +504,14 @@ 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 Deleted: branches/SAMBA_4_0/source/ntvfs/unixuid/config.m4 =================================================================== --- branches/SAMBA_4_0/source/ntvfs/unixuid/config.m4 2005-08-17 20:26:09 UTC (rev 9368) +++ branches/SAMBA_4_0/source/ntvfs/unixuid/config.m4 2005-08-18 00:20:40 UTC (rev 9369) @@ -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
