2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Check whether getdomainname(), innetgr(), setresuid() and setresgid()

are declared and add prototypes in sudo_compat.h as needed.
This commit is contained in:
Todd C. Miller 2015-02-05 11:08:55 -07:00
parent 3f82c8e578
commit 1bb633a210
4 changed files with 134 additions and 10 deletions

View File

@ -89,6 +89,10 @@
*/
#undef HAVE_DECL_ERRNO
/* Define to 1 if you have the declaration of `getdomainname', and to 0 if you
don't. */
#undef HAVE_DECL_GETDOMAINNAME
/* 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
@ -97,6 +101,10 @@
don't. */
#undef HAVE_DECL_H_ERRNO
/* Define to 1 if you have the declaration of `innetgr', and to 0 if you
don't. */
#undef HAVE_DECL_INNETGR
/* Define to 1 if you have the declaration of `LLONG_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_LLONG_MAX
@ -125,6 +133,10 @@
don't. */
#undef HAVE_DECL_SETAUTHDB
/* Define to 1 if you have the declaration of `setresuid', and to 0 if you
don't. */
#undef HAVE_DECL_SETRESUID
/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_SIZE_MAX
@ -157,6 +169,10 @@
don't. */
#undef HAVE_DECL_USRINFO
/* Define to 1 if you have the declaration of `_innetgr', and to 0 if you
don't. */
#undef HAVE_DECL__INNETGR
/* Define to 1 if you have the declaration of `_POSIX_HOST_NAME_MAX', and to 0
if you don't. */
#undef HAVE_DECL__POSIX_HOST_NAME_MAX

87
configure vendored
View File

@ -18610,6 +18610,17 @@ if test "x$ac_cv_func_setresuid" = xyes; then :
_ACEOF
SKIP_SETREUID=yes
ac_fn_c_check_decl "$LINENO" "setresuid" "ac_cv_have_decl_setresuid" "$ac_includes_default"
if test "x$ac_cv_have_decl_setresuid" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SETRESUID $ac_have_decl
_ACEOF
for ac_func in getresuid
do :
ac_fn_c_check_func "$LINENO" "getresuid" "ac_cv_func_getresuid"
@ -18677,15 +18688,67 @@ _ACEOF
fi
done
for ac_func in innetgr _innetgr
for ac_func in innetgr
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
ac_fn_c_check_func "$LINENO" "innetgr" "ac_cv_func_innetgr"
if test "x$ac_cv_func_innetgr" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
#define HAVE_INNETGR 1
_ACEOF
break
ac_fn_c_check_decl "$LINENO" "innetgr" "ac_cv_have_decl_innetgr" "
$ac_includes_default
#ifdef HAVE_NETGROUP_H
# include <netgroup.h>
#else
# include <netdb.h>
#endif /* HAVE_NETGROUP_H */
"
if test "x$ac_cv_have_decl_innetgr" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_INNETGR $ac_have_decl
_ACEOF
else
for ac_func in _innetgr
do :
ac_fn_c_check_func "$LINENO" "_innetgr" "ac_cv_func__innetgr"
if test "x$ac_cv_func__innetgr" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__INNETGR 1
_ACEOF
ac_fn_c_check_decl "$LINENO" "_innetgr" "ac_cv_have_decl__innetgr" "
$ac_includes_default
#ifdef HAVE_NETGROUP_H
# include <netgroup.h>
#else
# include <netdb.h>
#endif /* HAVE_NETGROUP_H */
"
if test "x$ac_cv_have_decl__innetgr" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL__INNETGR $ac_have_decl
_ACEOF
fi
done
fi
done
@ -18697,6 +18760,18 @@ 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"
if test "x$ac_cv_have_decl_getdomainname" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_GETDOMAINNAME $ac_have_decl
_ACEOF
else
for ac_func in sysinfo

View File

@ -2451,6 +2451,7 @@ SUDO_FUNC_PUTENV_CONST
if test -z "$SKIP_SETRESUID"; then
AC_CHECK_FUNCS([setresuid], [
SKIP_SETREUID=yes
AC_CHECK_DECLS([setresuid])
AC_CHECK_FUNCS([getresuid])
])
fi
@ -2462,8 +2463,29 @@ if test X"$with_interfaces" != X"no"; then
AC_CHECK_FUNCS([getifaddrs], [AC_CHECK_FUNCS([freeifaddrs])])
fi
AC_CHECK_FUNCS([lockf flock], [break])
AC_CHECK_FUNCS([innetgr _innetgr], [break])
AC_CHECK_FUNCS([getdomainname], [], [
AC_CHECK_FUNCS([innetgr], [
AC_CHECK_DECLS([innetgr], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_NETGROUP_H
# include <netgroup.h>
#else
# include <netdb.h>
#endif /* HAVE_NETGROUP_H */
])], [
AC_CHECK_FUNCS([_innetgr], [
AC_CHECK_DECLS([_innetgr], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_NETGROUP_H
# include <netgroup.h>
#else
# include <netdb.h>
#endif /* HAVE_NETGROUP_H */
])
])
])
AC_CHECK_FUNCS([getdomainname], [
AC_CHECK_DECLS([getdomainname])
], [
AC_CHECK_FUNCS([sysinfo], [AC_CHECK_HEADERS([sys/systeminfo.h])])
])
AC_CHECK_FUNCS([utimes], [

View File

@ -339,14 +339,25 @@ extern int errno;
# endif
#endif /* HAVE_SETEUID */
/*
* 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);
#endif
/*
* HP-UX does not declare innetgr() or getdomainname().
* Solaris does not declare getdomainname().
*/
#if defined(__hpux)
#if defined(HAVE_DECL_INNETGR) && !HAVE_DECL_INNETGR
int innetgr(const char *, const char *, const char *, const char *);
#endif
#if defined(__hpux) || defined(__sun)
#if defined(HAVE_DECL__INNETGR) && !HAVE_DECL__INNETGR
int _innetgr(const char *, const char *, const char *, const char *);
#endif
#if defined(HAVE_DECL_GETDOMAINNAME) && !HAVE_DECL_GETDOMAINNAME
int getdomainname(char *, size_t);
#endif