2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Add a test for the 4-argument au_close() function found in Solaris

11 instead of assuming it is present if __sun is defined.  Fixes a
compilation error on OpenIndiana and older Solaris versions.
This commit is contained in:
Todd C. Miller
2018-08-27 13:50:23 -06:00
parent a22296788c
commit fdd7296122
5 changed files with 73 additions and 2 deletions

View File

@@ -69,6 +69,10 @@
/* Define to 1 if you have the `auth_challenge' function. */
#undef HAVE_AUTH_CHALLENGE
/* Define to 1 if the `au_close' functions takes 4 arguments like Solaris 11.
*/
#undef HAVE_AU_CLOSE_SOLARIS11
/* Define to 1 if you have the `bigcrypt' function. */
#undef HAVE_BIGCRYPT

40
configure vendored
View File

@@ -24601,6 +24601,46 @@ done
fi
fi
if test X"$with_bsm_audit" = X"yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether au_close() takes 4 arguments" >&5
$as_echo_n "checking whether au_close() takes 4 arguments... " >&6; }
if ${sudo_cv_func_au_close_solaris11+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#include <bsm/audit.h>
#include <bsm/libbsm.h>
#include <bsm/audit_uevents.h>
int au_close(int d, int keep, au_event_t event, au_emod_t emod) {return 0;}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
sudo_cv_func_au_close_solaris11=yes
else
sudo_cv_func_au_close_solaris11=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_au_close_solaris11" >&5
$as_echo "$sudo_cv_func_au_close_solaris11" >&6; }
if test $sudo_cv_func_au_close_solaris11 = yes; then
$as_echo "#define HAVE_AU_CLOSE_SOLARIS11 1" >>confdefs.h
fi
fi
if test X"$enable_poll" = X""; then
for ac_func in ppoll poll
do :

View File

@@ -3774,6 +3774,13 @@ if test ${with_passwd-'no'} != "no"; then
fi
fi
dnl
dnl Solaris 11 added a 4th argument to the au_close() function
dnl
if test X"$with_bsm_audit" = X"yes"; then
SUDO_FUNC_AU_CLOSE_SOLARIS11
fi
dnl
dnl Choose event subsystem backend: poll or select
dnl

View File

@@ -265,6 +265,26 @@ int putenv(const char *string) {return 0;}], [])],
fi
])
dnl
dnl check whether au_close() takes 3 or 4 arguments
dnl
AC_DEFUN([SUDO_FUNC_AU_CLOSE_SOLARIS11],
[AC_CACHE_CHECK([whether au_close() takes 4 arguments],
sudo_cv_func_au_close_solaris11,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
#include <bsm/audit.h>
#include <bsm/libbsm.h>
#include <bsm/audit_uevents.h>
int au_close(int d, int keep, au_event_t event, au_emod_t emod) {return 0;}], [])],
[sudo_cv_func_au_close_solaris11=yes],
[sudo_cv_func_au_close_solaris11=no])
])
if test $sudo_cv_func_au_close_solaris11 = yes; then
AC_DEFINE(HAVE_AU_CLOSE_SOLARIS11, 1, [Define to 1 if the `au_close' functions takes 4 arguments like Solaris 11.])
fi
])
dnl
dnl Check if the data argument for the sha2 functions is void * or u_char *
dnl

View File

@@ -174,7 +174,7 @@ bsm_audit_success(char *exec_args[])
debug_return_int(-1);
}
au_write(aufd, tok);
#ifdef __sun
#ifdef HAVE_AU_CLOSE_SOLARIS11
if (au_close(aufd, 1, sudo_audit_event, 0) == -1)
#else
if (au_close(aufd, 1, sudo_audit_event) == -1)
@@ -265,7 +265,7 @@ bsm_audit_failure(char *exec_args[], char const *const fmt, va_list ap)
debug_return_int(-1);
}
au_write(aufd, tok);
#ifdef __sun
#ifdef HAVE_AU_CLOSE_SOLARIS11
if (au_close(aufd, 1, sudo_audit_event, PAD_FAILURE) == -1)
#else
if (au_close(aufd, 1, sudo_audit_event) == -1)