diff --git a/config.h.in b/config.h.in index 5ed8b0c85..6ee7f616f 100644 --- a/config.h.in +++ b/config.h.in @@ -129,6 +129,10 @@ don't. */ #undef HAVE_DECL_GETRESUID +/* Define to 1 if you have the declaration of `getusershell', and to 0 if you + don't. */ +#undef HAVE_DECL_GETUSERSHELL + /* Define to 1 if you have the declaration of `h_errno', and to 0 if you don't. */ #undef HAVE_DECL_H_ERRNO diff --git a/configure b/configure index cad9ee52e..db0f72ff0 100755 --- a/configure +++ b/configure @@ -19940,6 +19940,17 @@ if test "x$ac_cv_func_getusershell" = xyes then : printf "%s\n" "#define HAVE_GETUSERSHELL 1" >>confdefs.h + # Older Solaris has getusershell() et al but does not declare it. + ac_fn_check_decl "$LINENO" "getusershell" "ac_cv_have_decl_getusershell" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getusershell" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETUSERSHELL $ac_have_decl" >>confdefs.h + + else $as_nop case " $LIBOBJS " in diff --git a/configure.ac b/configure.ac index e9e22e0fa..d8701d30e 100644 --- a/configure.ac +++ b/configure.ac @@ -2600,7 +2600,10 @@ AC_CHECK_FUNCS([getdelim], [ SUDO_APPEND_COMPAT_EXP(sudo_getdelim) COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }getdelim_test" ]) -AC_CHECK_FUNCS([getusershell], [], [ +AC_CHECK_FUNCS([getusershell], [ + # Older Solaris has getusershell() et al but does not declare it. + AC_CHECK_DECLS([getusershell]) +], [ AC_LIBOBJ(getusershell) SUDO_APPEND_COMPAT_EXP(sudo_getusershell) ]) diff --git a/include/sudo_compat.h b/include/sudo_compat.h index 99a62ded2..05e479974 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -441,6 +441,11 @@ sudo_dso_public void sudo_setusershell(void); sudo_dso_public void sudo_endusershell(void); # undef endusershell # define endusershell() sudo_endusershell() +#elif HAVE_DECL_GETUSERSHELL == 0 +/* Older Solaris has getusershell() et al but does not declare it. */ +char *getusershell(void); +void setusershell(void); +void endusershell(void); #endif /* HAVE_GETUSERSHELL */ #ifndef HAVE_UTIMENSAT sudo_dso_public int sudo_utimensat(int fd, const char *file, const struct timespec *times, int flag);