From 3eb9a854d806ca5195fb5089e4ba868dadb1ee45 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 6 Feb 2015 11:33:30 -0700 Subject: [PATCH] Add check for getresuid() declaration, which may be missing on HP-UX. When checking for getdomainname() prototype, look in netdb.h too. --- config.h.in | 4 ++++ configure | 16 +++++++++++++++- configure.ac | 7 +++++-- include/sudo_compat.h | 8 ++++++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/config.h.in b/config.h.in index 371c07a4a..884030c97 100644 --- a/config.h.in +++ b/config.h.in @@ -93,6 +93,10 @@ don't. */ #undef HAVE_DECL_GETDOMAINNAME +/* Define to 1 if you have the declaration of `getresuid', and to 0 if you + don't. */ +#undef HAVE_DECL_GETRESUID + /* Define to 1 if you have the declaration of `HOST_NAME_MAX', and to 0 if you don't. */ #undef HAVE_DECL_HOST_NAME_MAX diff --git a/configure b/configure index d3666f667..fdfe9b847 100755 --- a/configure +++ b/configure @@ -18630,6 +18630,16 @@ do : if test "x$ac_cv_func_getresuid" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETRESUID 1 +_ACEOF + ac_fn_c_check_decl "$LINENO" "getresuid" "ac_cv_have_decl_getresuid" "$ac_includes_default" +if test "x$ac_cv_have_decl_getresuid" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETRESUID $ac_have_decl _ACEOF fi @@ -18763,7 +18773,11 @@ if test "x$ac_cv_func_getdomainname" = xyes; then : #define HAVE_GETDOMAINNAME 1 _ACEOF - ac_fn_c_check_decl "$LINENO" "getdomainname" "ac_cv_have_decl_getdomainname" "$ac_includes_default" + ac_fn_c_check_decl "$LINENO" "getdomainname" "ac_cv_have_decl_getdomainname" " +$ac_includes_default +#include + +" if test "x$ac_cv_have_decl_getdomainname" = xyes; then : ac_have_decl=1 else diff --git a/configure.ac b/configure.ac index 48e263b27..38f816043 100644 --- a/configure.ac +++ b/configure.ac @@ -2458,7 +2458,7 @@ if test -z "$SKIP_SETRESUID"; then AC_CHECK_FUNCS([setresuid], [ SKIP_SETREUID=yes AC_CHECK_DECLS([setresuid]) - AC_CHECK_FUNCS([getresuid]) + AC_CHECK_FUNCS([getresuid], [AC_CHECK_DECLS([getresuid])]) ]) fi if test -z "$SKIP_SETREUID"; then @@ -2490,7 +2490,10 @@ AC_INCLUDES_DEFAULT ]) ]) AC_CHECK_FUNCS([getdomainname], [ - AC_CHECK_DECLS([getdomainname]) + AC_CHECK_DECLS([getdomainname], [], [], [ +AC_INCLUDES_DEFAULT +#include + ]) ], [ AC_CHECK_FUNCS([sysinfo], [AC_CHECK_HEADERS([sys/systeminfo.h])]) ]) diff --git a/include/sudo_compat.h b/include/sudo_compat.h index c79777cbe..f20513dcc 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -343,8 +343,12 @@ extern int errno; * Older HP-UX does not declare setresuid() or setresgid(). */ #if defined(HAVE_DECL_SETRESUID) && !HAVE_DECL_SETRESUID -int setresuid(uid_t ruid, uid_t euid, uid_t suid); -int setresgid(gid_t rgid, gid_t egid, gid_t sgid); +int setresuid(uid_t, uid_t, uid_t); +int setresgid(gid_t, gid_t, gid_t); +#endif +#if defined(HAVE_DECL_GETRESUID) && !HAVE_DECL_GETRESUID +int getresuid(uid_t *, uid_t *, uid_t *); +int getresgid(gid_t *, gid_t *, gid_t *); #endif /* -- 2.40.0