Add check for LONG_IS_QUAD

#undef MAXINT before including hpsecurity.h to silence an HP-UX warning
Check for U?LONG_LONG_MAX in snprintf.c and use LONG_IS_QUAD
This commit is contained in:
Todd C. Miller
1999-08-22 09:59:28 +00:00
parent ab0c1eae13
commit b13e8006ec
7 changed files with 219 additions and 176 deletions

3
aclocal.m4 vendored
View File

@@ -326,7 +326,10 @@ fi
dnl dnl
dnl check for "long long" dnl check for "long long"
dnl XXX cache
dnl dnl
AC_DEFUN(SUDO_LONG_LONG, [AC_MSG_CHECKING(for long long support) AC_DEFUN(SUDO_LONG_LONG, [AC_MSG_CHECKING(for long long support)
AC_TRY_COMPILE(, [long long foo; foo = 1;], AC_DEFINE(HAVE_LONG_LONG) AC_TRY_COMPILE(, [long long foo; foo = 1;], AC_DEFINE(HAVE_LONG_LONG)
[AC_TRY_RUN([main() {if (sizeof(long long) == sizeof(long)) exit(0); else exit(1);}], AC_DEFINE(LONG_IS_QUAD))]
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))])

View File

@@ -51,6 +51,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <pwd.h> #include <pwd.h>
#ifdef __hpux #ifdef __hpux
# undef MAXINT
# include <hpsecurity.h> # include <hpsecurity.h>
#else #else
# include <sys/security.h> # include <sys/security.h>

View File

@@ -99,6 +99,9 @@
/* Define if your compiler supports the "long long" type. */ /* Define if your compiler supports the "long long" type. */
#undef HAVE_LONG_LONG #undef HAVE_LONG_LONG
/* Define if sizeof(long) == sizeof(long long). */
#undef LONG_IS_QUAD
/* Solaris doesn't use const qualifiers in PAM. */ /* Solaris doesn't use const qualifiers in PAM. */
#ifdef sun #ifdef sun
#define PAM_CONST #define PAM_CONST

335
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -36,36 +36,37 @@
#include <stdio.h> #include <stdio.h>
#ifdef STDC_HEADERS #ifdef STDC_HEADERS
#include <stdlib.h> # include <stdlib.h>
#endif /* STDC_HEADERS */ #endif /* STDC_HEADERS */
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> # include <string.h>
#endif /* HAVE_STRING_H */ #endif /* HAVE_STRING_H */
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif /* HAVE_UNISTD_H */ #endif /* HAVE_UNISTD_H */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h> #include <sys/param.h>
#include <pwd.h> #include <pwd.h>
#ifdef HAVE_GETSPNAM #ifdef HAVE_GETSPNAM
# include <shadow.h> # include <shadow.h>
#endif /* HAVE_GETSPNAM */ #endif /* HAVE_GETSPNAM */
#ifdef HAVE_GETPRPWNAM #ifdef HAVE_GETPRPWNAM
# ifdef __hpux # ifdef __hpux
# include <hpsecurity.h> # undef MAXINT
# else # include <hpsecurity.h>
# include <sys/security.h> # else
# endif /* __hpux */ # include <sys/security.h>
# include <prot.h> # endif /* __hpux */
# include <prot.h>
#endif /* HAVE_GETPRPWNAM */ #endif /* HAVE_GETPRPWNAM */
#ifdef HAVE_GETPWANAM #ifdef HAVE_GETPWANAM
# include <sys/label.h> # include <sys/label.h>
# include <sys/audit.h> # include <sys/audit.h>
# include <pwdadj.h> # include <pwdadj.h>
#endif /* HAVE_GETPWANAM */ #endif /* HAVE_GETPWANAM */
#ifdef HAVE_GETAUTHUID #ifdef HAVE_GETAUTHUID
# include <auth.h> # include <auth.h>
#endif /* HAVE_GETAUTHUID */ #endif /* HAVE_GETAUTHUID */
#include "sudo.h" #include "sudo.h"

View File

@@ -86,10 +86,18 @@ static int xxxprintf __P((char **, size_t, int, const char *, va_list));
#endif #endif
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
# ifndef UQUAD_MAX # ifndef UQUAD_MAX
# define UQUAD_MAX ((unsigned long long)-1) # ifdef ULONG_LONG_MAX
# define UQUAD_MAX ULONG_LONG_MAX
# else
# define UQUAD_MAX ((unsigned long long)-1)
# endif
# endif # endif
# ifndef QUAD_MAX # ifndef QUAD_MAX
# define QUAD_MAX (UQUAD_MAX / 2) # ifdef LONG_LONG_MAX
# define QUAD_MAX LONG_LONG_MAX
# else
# define QUAD_MAX (UQUAD_MAX / 2)
# endif
# endif # endif
#endif /* HAVE_LONG_LONG */ #endif /* HAVE_LONG_LONG */
@@ -200,7 +208,7 @@ __ultoa(val, endp, base, octzero, xdigs)
/* Identical to __ultoa, but for quads. */ /* Identical to __ultoa, but for quads. */
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
# if UQUAD_MAX == ULONG_MAX # ifdef LONG_IS_QUAD
# define __uqtoa(v, e, b, o, x) __ultoa((unsigned long)(v), (e), (b), (o), (x)) # define __uqtoa(v, e, b, o, x) __ultoa((unsigned long)(v), (e), (b), (o), (x))
# else # else
static char * static char *
@@ -723,7 +731,7 @@ snprintf(str, n, fmt, va_alist)
} }
#endif /* HAVE_SNPRINTF */ #endif /* HAVE_SNPRINTF */
#ifdef HAVE_VASPRINTF #ifndef HAVE_VASPRINTF
int int
vasprintf(str, fmt, ap) vasprintf(str, fmt, ap)
char **str; char **str;

8
sudo.c
View File

@@ -64,7 +64,13 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS) #if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS)
#include <prot.h> # ifdef __hpux
# undef MAXINT
# include <hpsecurity.h>
# else
# include <sys/security.h>
# endif /* __hpux */
# include <prot.h>
#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */ #endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */
#include "sudo.h" #include "sudo.h"