diff --git a/aclocal.m4 b/aclocal.m4 index 7124e86f5..e3ef236a4 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -79,6 +79,24 @@ if test X"$found" != X"yes"; then fi ])dnl +dnl +dnl check for utmp file +dnl +AC_DEFUN(SUDO_PATH_UTMP, [AC_MSG_CHECKING([for utmp file path]) +found=no +for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do + if test -r "$p"; then + found=yes + AC_MSG_RESULT([$p]) + SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$p") + break + fi +done +if test X"$found" != X"yes"; then + AC_MSG_RESULT([not found]) +fi +])dnl + dnl dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm dnl diff --git a/configure b/configure index c5ba7cfd4..057c4c893 100755 --- a/configure +++ b/configure @@ -15398,6 +15398,7 @@ done fi done +utmp_style=LEGACY for ac_func in getutxid getutid do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -15407,11 +15408,11 @@ eval as_val=\$$as_ac_var cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - utmp=POSIX; break + utmp_style=POSIX; break fi done -if test "${utmp-NONE}" = "NONE"; then +if test "$utmp_style" = "LEGACY"; then for ac_func in getttyent ttyslot do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -18842,6 +18843,28 @@ if test -n "$blibpath"; then fi fi +if test "$utmp_style" = "LEGACY"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utmp file path" >&5 +$as_echo_n "checking for utmp file path... " >&6; } +found=no +for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do + if test -r "$p"; then + found=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $p" >&5 +$as_echo "$p" >&6; } + cat >>confdefs.h <&5 +$as_echo "not found" >&6; } +fi + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5 $as_echo_n "checking for log file location... " >&6; } if test -n "$with_logpath"; then diff --git a/configure.in b/configure.in index 86f925b1c..7f849164c 100644 --- a/configure.in +++ b/configure.in @@ -1992,8 +1992,9 @@ AC_CHECK_FUNCS(getline, [], [ AC_LIBOBJ(getline) AC_CHECK_FUNCS(fgetln) ]) -AC_CHECK_FUNCS(getutxid getutid, [utmp=POSIX; break]) -if test "${utmp-NONE}" = "NONE"; then +utmp_style=LEGACY +AC_CHECK_FUNCS(getutxid getutid, [utmp_style=POSIX; break]) +if test "$utmp_style" = "LEGACY"; then AC_CHECK_FUNCS(getttyent ttyslot, [break]) fi @@ -2815,6 +2816,9 @@ fi dnl dnl Check for log file, timestamp and iolog locations dnl +if test "$utmp_style" = "LEGACY"; then + SUDO_PATH_UTMP +fi SUDO_LOGFILE SUDO_TIMEDIR SUDO_IO_LOGDIR diff --git a/pathnames.h.in b/pathnames.h.in index 2dcbef1bf..32bff86b7 100644 --- a/pathnames.h.in +++ b/pathnames.h.in @@ -141,6 +141,10 @@ #undef _PATH_MAILDIR #endif /* _PATH_MAILDIR */ +#ifndef _PATH_UTMP +#undef _PATH_UTMP +#endif /* _PATH_UTMP */ + #ifndef _PATH_SUDO_SESH #undef _PATH_SUDO_SESH #endif /* _PATH_SUDO_SESH */