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

Add check for _PATH_UTMP

This commit is contained in:
Todd C. Miller 2011-03-15 11:56:49 -04:00
parent bf5f17bd63
commit 5e6bc4017b
4 changed files with 53 additions and 4 deletions

18
aclocal.m4 vendored
View File

@ -79,6 +79,24 @@ if test X"$found" != X"yes"; then
fi fi
])dnl ])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
dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm dnl Where the log file goes, use /var/log if it exists, else /{var,usr}/adm
dnl dnl

27
configure vendored
View File

@ -15398,6 +15398,7 @@ done
fi fi
done done
utmp_style=LEGACY
for ac_func in getutxid getutid for ac_func in getutxid getutid
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 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 cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF _ACEOF
utmp=POSIX; break utmp_style=POSIX; break
fi fi
done done
if test "${utmp-NONE}" = "NONE"; then if test "$utmp_style" = "LEGACY"; then
for ac_func in getttyent ttyslot for ac_func in getttyent ttyslot
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@ -18842,6 +18843,28 @@ if test -n "$blibpath"; then
fi fi
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 <<EOF
#define _PATH_UTMP "$p"
EOF
break
fi
done
if test X"$found" != X"yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5
$as_echo_n "checking for log file location... " >&6; } $as_echo_n "checking for log file location... " >&6; }
if test -n "$with_logpath"; then if test -n "$with_logpath"; then

View File

@ -1992,8 +1992,9 @@ AC_CHECK_FUNCS(getline, [], [
AC_LIBOBJ(getline) AC_LIBOBJ(getline)
AC_CHECK_FUNCS(fgetln) AC_CHECK_FUNCS(fgetln)
]) ])
AC_CHECK_FUNCS(getutxid getutid, [utmp=POSIX; break]) utmp_style=LEGACY
if test "${utmp-NONE}" = "NONE"; then AC_CHECK_FUNCS(getutxid getutid, [utmp_style=POSIX; break])
if test "$utmp_style" = "LEGACY"; then
AC_CHECK_FUNCS(getttyent ttyslot, [break]) AC_CHECK_FUNCS(getttyent ttyslot, [break])
fi fi
@ -2815,6 +2816,9 @@ fi
dnl dnl
dnl Check for log file, timestamp and iolog locations dnl Check for log file, timestamp and iolog locations
dnl dnl
if test "$utmp_style" = "LEGACY"; then
SUDO_PATH_UTMP
fi
SUDO_LOGFILE SUDO_LOGFILE
SUDO_TIMEDIR SUDO_TIMEDIR
SUDO_IO_LOGDIR SUDO_IO_LOGDIR

View File

@ -141,6 +141,10 @@
#undef _PATH_MAILDIR #undef _PATH_MAILDIR
#endif /* _PATH_MAILDIR */ #endif /* _PATH_MAILDIR */
#ifndef _PATH_UTMP
#undef _PATH_UTMP
#endif /* _PATH_UTMP */
#ifndef _PATH_SUDO_SESH #ifndef _PATH_SUDO_SESH
#undef _PATH_SUDO_SESH #undef _PATH_SUDO_SESH
#endif /* _PATH_SUDO_SESH */ #endif /* _PATH_SUDO_SESH */