Make path checks in sudo.m4 cachable.

This commit is contained in:
Todd C. Miller
2022-12-06 13:40:12 -07:00
parent 1b76f76122
commit 3cdd044c68
2 changed files with 401 additions and 281 deletions

382
configure vendored
View File

@@ -20208,9 +20208,16 @@ printf "%s\n" "$sudo_cv_xopen_source_extended" >&6; }
;; ;;
esac esac
maildir=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the user mail spool directory" >&5
if test X"$ac_cv_header_paths_h" = X"yes"; then printf %s "checking for the user mail spool directory... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext if test ${sudo_cv_mail_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_mail_dir=no
if test X"$ac_cv_header_paths_h" = X"yes"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
$ac_includes_default $ac_includes_default
#include <paths.h> #include <paths.h>
@@ -20224,48 +20231,59 @@ char *p = _PATH_MAILDIR;
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO" if ac_fn_c_try_compile "$LINENO"
then : then :
maildir=yes sudo_cv_mail_dir="paths.h"
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi fi
if test $maildir = no; then if test $sudo_cv_mail_dir = no; then
# Solaris has maillock.h which defines MAILDIR # Solaris has maillock.h which defines MAILDIR
for ac_header in maillock.h for ac_header in maillock.h
do : do :
ac_fn_c_check_header_compile "$LINENO" "maillock.h" "ac_cv_header_maillock_h" "$ac_includes_default" ac_fn_c_check_header_compile "$LINENO" "maillock.h" "ac_cv_header_maillock_h" "$ac_includes_default"
if test "x$ac_cv_header_maillock_h" = xyes if test "x$ac_cv_header_maillock_h" = xyes
then : then :
printf "%s\n" "#define HAVE_MAILLOCK_H 1" >>confdefs.h printf "%s\n" "#define HAVE_MAILLOCK_H 1" >>confdefs.h
sudo_cv_mail_dir=maillock.h
else case e in #(
e)
sudo_cv_mail_dir=/var/mail
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
sudo_cv_mail_dir="$d"
break
fi
done
;;
esac
fi
done
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_mail_dir" >&5
printf "%s\n" "$sudo_cv_mail_dir" >&6; }
case "$sudo_cv_mail_dir" in
paths.h)
# _PATH_MAILDIR already present in paths.h.
;;
maillock.h)
# Use MAILDIR from maillock.h
cat >>confdefs.h <<\EOF cat >>confdefs.h <<\EOF
#define _PATH_MAILDIR MAILDIR #define _PATH_MAILDIR MAILDIR
EOF EOF
maildir=yes ;;
*)
fi cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "$sudo_cv_mail_dir"
done
if test $maildir = no; then
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
maildir=yes
cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "$d"
EOF EOF
break ;;
fi esac
done
if test $maildir = no; then
# unable to find mail dir, hope for the best
cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "/var/mail"
EOF
fi
fi
fi
if test ${with_logincap-'no'} != "no"; then if test ${with_logincap-'no'} != "no"; then
for ac_header in login_cap.h for ac_header in login_cap.h
@@ -31228,180 +31246,260 @@ fi
esac esac
if test "$utmp_style" = "LEGACY"; then if test "$utmp_style" = "LEGACY"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for utmp file path" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for utmp file path" >&5
printf %s "checking for utmp file path... " >&6; } printf %s "checking for utmp file path... " >&6; }
found=no if test ${sudo_cv_path_UTMP+y}
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do then :
if test -r "$p"; then printf %s "(cached) " >&6
found=yes else case e in #(
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $p" >&5 e)
printf "%s\n" "$p" >&6; } sudo_cv_path_UTMP=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then
sudo_cv_path_UTMP="$p"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_path_UTMP" >&5
printf "%s\n" "$sudo_cv_path_UTMP" >&6; }
if test X"$sudo_cv_path_UTMP" != X"no"; then
cat >>confdefs.h <<EOF cat >>confdefs.h <<EOF
#define _PATH_UTMP "$p" #define _PATH_UTMP "$sudo_cv_path_UTMP"
EOF EOF
break
fi fi
done
if test X"$found" != X"yes"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
printf "%s\n" "not found" >&6; }
fi
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log dir location" >&5
printf %s "checking for log dir location... " >&6; }
if test "${with_logdir-yes}" != "yes"; then if test "${with_logdir-yes}" != "yes"; then
log_dir="$with_logdir" log_dir="$with_logdir"
else else
# Default value of log_dir set in configure.ac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log dir location" >&5
for d in /var/log /var/adm /usr/adm; do printf %s "checking for log dir location... " >&6; }
if test -d "$d"; then if test ${sudo_cv_log_dir+y}
log_dir="$d" then :
break printf %s "(cached) " >&6
fi else case e in #(
done e)
# Default value of log_dir set in configure.ac
sudo_cv_log_dir="$log_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_log_dir="$d"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_log_dir" >&5
printf "%s\n" "$sudo_cv_log_dir" >&6; }
log_dir="$sudo_cv_log_dir"
fi fi
if test "${with_logdir}" != "no"; then cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_LOGDIR "$log_dir" #define _PATH_SUDO_LOGDIR "$log_dir"
EOF EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $log_dir" >&5
printf "%s\n" "$log_dir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5
printf %s "checking for log file location... " >&6; } if test -n "$with_logpath"; then
if test "${with_logpath-yes}" != "yes"; then
logpath="$with_logpath" logpath="$with_logpath"
else else
# Default value of logpath set in configure.ac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5
for d in /var/log /var/adm /usr/adm; do printf %s "checking for log file location... " >&6; }
if test -d "$d"; then if test ${sudo_cv_log_path+y}
logpath="$d/sudo.log" then :
break printf %s "(cached) " >&6
fi else case e in #(
done e)
# Default value of logpath set in configure.ac
sudo_cv_log_path="$logpath"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_log_path="$d/sudo.log"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_log_path" >&5
printf "%s\n" "$sudo_cv_log_path" >&6; }
logpath="$sudo_cv_log_path"
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $logpath" >&5
printf "%s\n" "$logpath" >&6; }
cat >>confdefs.h <<EOF cat >>confdefs.h <<EOF
#define _PATH_SUDO_LOGFILE "$logpath" #define _PATH_SUDO_LOGFILE "$logpath"
EOF EOF
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo_logsrvd relay dir location" >&5
printf %s "checking for sudo_logsrvd relay dir location... " >&6; }
if test "${with_relaydir-yes}" != "yes"; then if test "${with_relaydir-yes}" != "yes"; then
relay_dir="$with_relaydir" relay_dir="$with_relaydir"
else else
# Default value of relay_dir set in configure.ac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo_logsrvd relay dir location" >&5
for d in /var/log /var/adm /usr/adm; do printf %s "checking for sudo_logsrvd relay dir location... " >&6; }
if test -d "$d"; then if test ${sudo_cv_relay_dir+y}
relay_dir="$d/sudo_logsrvd" then :
break printf %s "(cached) " >&6
fi else case e in #(
done e)
# Default value of relay_dir set in configure.ac
sudo_cv_relay_dir="$relay_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_relay_dir="$d/sudo_logsrvd"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_relay_dir" >&5
printf "%s\n" "$sudo_cv_relay_dir" >&6; }
relay_dir="$sudo_cv_relay_dir"
fi fi
if test "${with_relaydir}" != "no"; then cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_RELAY_DIR "$relay_dir" #define _PATH_SUDO_RELAY_DIR "$relay_dir"
EOF EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $relay_dir" >&5
printf "%s\n" "$relay_dir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo run dir location" >&5
if test -n "$with_rundir"; then
rundir="$with_rundir"
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
rundir="$runstatedir/sudo"
else
# No --with-rundir or --runstatedir specified
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo run dir location" >&5
printf %s "checking for sudo run dir location... " >&6; } printf %s "checking for sudo run dir location... " >&6; }
if test -n "$with_rundir"; then if test ${sudo_cv_run_dir+y}
rundir="$with_rundir" then :
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then printf %s "(cached) " >&6
rundir="$runstatedir/sudo" else case e in #(
else e)
# No --with-rundir or --runstatedir specified sudo_cv_run_dir=no
for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
rundir="$d/sudo" sudo_cv_run_dir="$d/sudo"
break break
fi fi
done done
;;
esac
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $rundir" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_run_dir" >&5
printf "%s\n" "$rundir" >&6; } printf "%s\n" "$sudo_cv_run_dir" >&6; }
cat >>confdefs.h <<EOF rundir="$sudo_cv_run_dir"
fi
if test X"$rundir" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_SUDO_TIMEDIR "$rundir/ts" #define _PATH_SUDO_TIMEDIR "$rundir/ts"
EOF EOF
cat >>confdefs.h <<EOF cat >>confdefs.h <<EOF
#define _PATH_SUDO_LOGSRVD_PID "$rundir/sudo_logsrvd.pid" #define _PATH_SUDO_LOGSRVD_PID "$rundir/sudo_logsrvd.pid"
EOF EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo var dir location" >&5
if test -n "$with_vardir"; then
vardir="$with_vardir"
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo var dir location" >&5
printf %s "checking for sudo var dir location... " >&6; } printf %s "checking for sudo var dir location... " >&6; }
vardir="$with_vardir" if test ${sudo_cv_var_dir+y}
if test -z "$vardir"; then then :
for d in /var/db /var/lib /var/adm /usr/adm; do printf %s "(cached) " >&6
if test -d "$d"; then else case e in #(
vardir="$d/sudo" e)
break sudo_cv_var_dir=no
fi for d in /var/db /var/lib /var/adm /usr/adm; do
done if test -d "$d"; then
sudo_cv_var_dir="$d/sudo"
break
fi
done
;;
esac
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vardir" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_dir" >&5
printf "%s\n" "$vardir" >&6; } printf "%s\n" "$sudo_cv_var_dir" >&6; }
cat >>confdefs.h <<EOF vardir="$sudo_cv_var_dir"
fi
if test X"$vardir" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_SUDO_LECTURE_DIR "$vardir/lectured" #define _PATH_SUDO_LECTURE_DIR "$vardir/lectured"
EOF EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for I/O log dir location" >&5
printf %s "checking for I/O log dir location... " >&6; }
if test "${with_iologdir-yes}" != "yes"; then if test "${with_iologdir-yes}" != "yes"; then
iolog_dir="$with_iologdir" iolog_dir="$with_iologdir"
else else
# Default value of iolog_dir set in configure.ac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for I/O log dir location" >&5
for d in /var/log /var/adm /usr/adm; do printf %s "checking for I/O log dir location... " >&6; }
if test -d "$d"; then if test ${sudo_cv_iolog_dir+y}
iolog_dir="$d/sudo-io" then :
break printf %s "(cached) " >&6
fi else case e in #(
done e)
# Default value of iolog_dir set in configure.ac
sudo_cv_iolog_dir="$iolog_dir"
for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then
sudo_cv_iolog_dir="$d/sudo-io"
break
fi
done
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_iolog_dir" >&5
printf "%s\n" "$sudo_cv_iolog_dir" >&6; }
iolog_dir="$sudo_cv_iolog_dir"
fi fi
if test "${with_iologdir}" != "no"; then cat >>confdefs.h <<EOF
cat >>confdefs.h <<EOF
#define _PATH_SUDO_IO_LOGDIR "$iolog_dir" #define _PATH_SUDO_IO_LOGDIR "$iolog_dir"
EOF EOF
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $iolog_dir" >&5
printf "%s\n" "$iolog_dir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking time zone data directory" >&5
if test -n "$with_tzdir"; then
tzdir="$with_tzdir"
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking time zone data directory" >&5
printf %s "checking time zone data directory... " >&6; } printf %s "checking time zone data directory... " >&6; }
tzdir="$with_tzdir" if test ${sudo_cv_tz_dir+y}
if test -z "$tzdir"; then then :
tzdir=no printf %s "(cached) " >&6
for d in /usr/share /usr/share/lib /usr/lib /etc; do else case e in #(
if test -d "$d/zoneinfo"; then e)
tzdir="$d/zoneinfo" sudo_cv_tz_dir=no
break for d in /usr/share /usr/share/lib /usr/lib /etc; do
fi if test -d "$d/zoneinfo"; then
done sudo_cv_tz_dir="$d/zoneinfo"
break
fi
done
;;
esac
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tzdir" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_tz_dir" >&5
printf "%s\n" "$tzdir" >&6; } printf "%s\n" "$sudo_cv_tz_dir" >&6; }
if test "${tzdir}" != "no"; then tzdir="$sudo_cv_tz_dir"
cat >>confdefs.h <<EOF fi
if test X"$tzdir" != X"no"; then
cat >>confdefs.h <<EOF
#define _PATH_ZONEINFO "$tzdir" #define _PATH_ZONEINFO "$tzdir"
EOF EOF
fi fi

View File

@@ -2,7 +2,7 @@ dnl Local m4 macros for autoconf (used by sudo)
dnl dnl
dnl SPDX-License-Identifier: ISC dnl SPDX-License-Identifier: ISC
dnl dnl
dnl Copyright (c) 1994-1996, 1998-2005, 2007-2015 dnl Copyright (c) 1994-1996, 1998-2005, 2007-2022
dnl Todd C. Miller <Todd.Miller@sudo.ws> dnl Todd C. Miller <Todd.Miller@sudo.ws>
dnl dnl
dnl Permission to use, copy, modify, and distribute this software for any dnl Permission to use, copy, modify, and distribute this software for any
@@ -17,9 +17,6 @@ dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl dnl
dnl XXX - should cache values in all cases!!!
dnl
dnl checks for programs
dnl dnl
dnl check for sendmail in well-known locations dnl check for sendmail in well-known locations
@@ -58,100 +55,117 @@ AC_DEFUN([SUDO_PROG_BSHELL], [
])dnl ])dnl
dnl dnl
dnl check for utmp file dnl Check for path to utmp file if not using getutid(), etc.
dnl dnl
AC_DEFUN([SUDO_PATH_UTMP], [AC_MSG_CHECKING([for utmp file path]) AC_DEFUN([SUDO_PATH_UTMP], [
found=no AC_CACHE_CHECK([for utmp file path], [sudo_cv_path_UTMP], [
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do sudo_cv_path_UTMP=no
if test -r "$p"; then for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
found=yes if test -r "$p"; then
AC_MSG_RESULT([$p]) sudo_cv_path_UTMP="$p"
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$p") break
break fi
done
])
if test X"$sudo_cv_path_UTMP" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$sudo_cv_path_UTMP")
fi 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
AC_DEFUN([SUDO_LOGFILE], [AC_MSG_CHECKING(for log file location) AC_DEFUN([SUDO_LOGFILE], [
if test "${with_logpath-yes}" != "yes"; then if test -n "$with_logpath"; then
logpath="$with_logpath" logpath="$with_logpath"
else else
# Default value of logpath set in configure.ac AC_CACHE_CHECK([for log file location], [sudo_cv_log_path], [
for d in /var/log /var/adm /usr/adm; do # Default value of logpath set in configure.ac
if test -d "$d"; then sudo_cv_log_path="$logpath"
logpath="$d/sudo.log" for d in /var/log /var/adm /usr/adm; do
break if test -d "$d"; then
fi sudo_cv_log_path="$d/sudo.log"
done break
fi
done
])
logpath="$sudo_cv_log_path"
fi fi
AC_MSG_RESULT($logpath)
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGFILE, "$logpath") SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGFILE, "$logpath")
])dnl ])
dnl dnl
dnl Detect time zone file directory, if any. dnl Detect time zone file directory, if any.
dnl dnl
AC_DEFUN([SUDO_TZDIR], [AC_MSG_CHECKING(time zone data directory) AC_DEFUN([SUDO_TZDIR], [
tzdir="$with_tzdir" if test -n "$with_tzdir"; then
if test -z "$tzdir"; then tzdir="$with_tzdir"
tzdir=no else
for d in /usr/share /usr/share/lib /usr/lib /etc; do AC_CACHE_CHECK([time zone data directory], [sudo_cv_tz_dir], [
if test -d "$d/zoneinfo"; then sudo_cv_tz_dir=no
tzdir="$d/zoneinfo" for d in /usr/share /usr/share/lib /usr/lib /etc; do
break if test -d "$d/zoneinfo"; then
fi sudo_cv_tz_dir="$d/zoneinfo"
done break
fi fi
AC_MSG_RESULT([$tzdir]) done
if test "${tzdir}" != "no"; then ])
SUDO_DEFINE_UNQUOTED(_PATH_ZONEINFO, "$tzdir") tzdir="$sudo_cv_tz_dir"
fi fi
])dnl if test X"$tzdir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_ZONEINFO, "$tzdir")
fi
])
dnl dnl
dnl Parent directory for time stamp dir. dnl Parent directory for time stamp dir.
dnl dnl
AC_DEFUN([SUDO_RUNDIR], [AC_MSG_CHECKING(for sudo run dir location) AC_DEFUN([SUDO_RUNDIR], [
if test -n "$with_rundir"; then if test -n "$with_rundir"; then
rundir="$with_rundir" rundir="$with_rundir"
elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then elif test -n "$runstatedir" && test "$runstatedir" != '${localstatedir}/run'; then
rundir="$runstatedir/sudo" rundir="$runstatedir/sudo"
else else
# No --with-rundir or --runstatedir specified # No --with-rundir or --runstatedir specified
for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do AC_CACHE_CHECK([for sudo run dir location], [sudo_cv_run_dir], [
if test -d "$d"; then sudo_cv_run_dir=no
rundir="$d/sudo" for d in /run /var/run /var/db /var/lib /var/adm /usr/adm; do
break if test -d "$d"; then
fi sudo_cv_run_dir="$d/sudo"
done break
fi fi
AC_MSG_RESULT([$rundir]) done
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$rundir/ts") ])
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGSRVD_PID, "$rundir/sudo_logsrvd.pid") rundir="$sudo_cv_run_dir"
])dnl fi
if test X"$rundir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$rundir/ts")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGSRVD_PID, "$rundir/sudo_logsrvd.pid")
fi
])
dnl dnl
dnl Parent directory for the lecture status dir. dnl Parent directory for the lecture status dir.
dnl dnl
AC_DEFUN([SUDO_VARDIR], [AC_MSG_CHECKING(for sudo var dir location) AC_DEFUN([SUDO_VARDIR], [
vardir="$with_vardir" if test -n "$with_vardir"; then
if test -z "$vardir"; then vardir="$with_vardir"
for d in /var/db /var/lib /var/adm /usr/adm; do else
if test -d "$d"; then AC_CACHE_CHECK([for sudo var dir location], [sudo_cv_var_dir], [
vardir="$d/sudo" sudo_cv_var_dir=no
break for d in /var/db /var/lib /var/adm /usr/adm; do
fi if test -d "$d"; then
done sudo_cv_var_dir="$d/sudo"
fi break
AC_MSG_RESULT([$vardir]) fi
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LECTURE_DIR, "$vardir/lectured") done
])dnl ])
vardir="$sudo_cv_var_dir"
fi
if test X"$vardir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LECTURE_DIR, "$vardir/lectured")
fi
])
dnl dnl
dnl Where the sudo_logsrvd relay temporary log files go, use dnl Where the sudo_logsrvd relay temporary log files go, use
@@ -159,68 +173,68 @@ dnl /var/log/sudo_logsrvd if /var/log exists, else
dnl /{var,usr}/adm/sudo_logsrvd dnl /{var,usr}/adm/sudo_logsrvd
dnl dnl
AC_DEFUN([SUDO_RELAY_DIR], [ AC_DEFUN([SUDO_RELAY_DIR], [
AC_MSG_CHECKING(for sudo_logsrvd relay dir location)
if test "${with_relaydir-yes}" != "yes"; then if test "${with_relaydir-yes}" != "yes"; then
relay_dir="$with_relaydir" relay_dir="$with_relaydir"
else else
# Default value of relay_dir set in configure.ac AC_CACHE_CHECK([for sudo_logsrvd relay dir location], [sudo_cv_relay_dir], [
for d in /var/log /var/adm /usr/adm; do # Default value of relay_dir set in configure.ac
if test -d "$d"; then sudo_cv_relay_dir="$relay_dir"
relay_dir="$d/sudo_logsrvd" for d in /var/log /var/adm /usr/adm; do
break if test -d "$d"; then
fi sudo_cv_relay_dir="$d/sudo_logsrvd"
done break
fi
done
])
relay_dir="$sudo_cv_relay_dir"
fi fi
if test "${with_relaydir}" != "no"; then SUDO_DEFINE_UNQUOTED(_PATH_SUDO_RELAY_DIR, "$relay_dir")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_RELAY_DIR, "$relay_dir") ])
fi
AC_MSG_RESULT($relay_dir)
])dnl
dnl dnl
dnl Where the I/O log files go, use /var/log/sudo-io if dnl Where the I/O log files go, use /var/log/sudo-io if
dnl /var/log exists, else /{var,usr}/adm/sudo-io dnl /var/log exists, else /{var,usr}/adm/sudo-io
dnl dnl
AC_DEFUN([SUDO_IO_LOGDIR], [ AC_DEFUN([SUDO_IO_LOGDIR], [
AC_MSG_CHECKING(for I/O log dir location)
if test "${with_iologdir-yes}" != "yes"; then if test "${with_iologdir-yes}" != "yes"; then
iolog_dir="$with_iologdir" iolog_dir="$with_iologdir"
else else
# Default value of iolog_dir set in configure.ac AC_CACHE_CHECK([for I/O log dir location], [sudo_cv_iolog_dir], [
for d in /var/log /var/adm /usr/adm; do # Default value of iolog_dir set in configure.ac
if test -d "$d"; then sudo_cv_iolog_dir="$iolog_dir"
iolog_dir="$d/sudo-io" for d in /var/log /var/adm /usr/adm; do
break if test -d "$d"; then
fi sudo_cv_iolog_dir="$d/sudo-io"
done break
fi
done
])
iolog_dir="$sudo_cv_iolog_dir"
fi fi
if test "${with_iologdir}" != "no"; then SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$iolog_dir")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_IO_LOGDIR, "$iolog_dir") ])
fi
AC_MSG_RESULT($iolog_dir)
])dnl
dnl dnl
dnl Where the log files go, use /var/log if it exists, else /{var,usr}/adm dnl Where the log files go, use /var/log if it exists, else /{var,usr}/adm
dnl dnl
AC_DEFUN([SUDO_LOGDIR], [ AC_DEFUN([SUDO_LOGDIR], [
AC_MSG_CHECKING(for log dir location)
if test "${with_logdir-yes}" != "yes"; then if test "${with_logdir-yes}" != "yes"; then
log_dir="$with_logdir" log_dir="$with_logdir"
else else
# Default value of log_dir set in configure.ac AC_CACHE_CHECK([for log dir location], [sudo_cv_log_dir], [
for d in /var/log /var/adm /usr/adm; do # Default value of log_dir set in configure.ac
if test -d "$d"; then sudo_cv_log_dir="$log_dir"
log_dir="$d" for d in /var/log /var/adm /usr/adm; do
break if test -d "$d"; then
fi sudo_cv_log_dir="$d"
done break
fi
done
])
log_dir="$sudo_cv_log_dir"
fi fi
if test "${with_logdir}" != "no"; then SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGDIR, "$log_dir")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGDIR, "$log_dir") ])
fi
AC_MSG_RESULT($log_dir)
])dnl
dnl dnl
dnl check for working fnmatch(3) dnl check for working fnmatch(3)
@@ -520,32 +534,40 @@ dnl Determine the mail spool location
dnl NOTE: must be run *after* check for paths.h dnl NOTE: must be run *after* check for paths.h
dnl dnl
AC_DEFUN([SUDO_MAILDIR], [ AC_DEFUN([SUDO_MAILDIR], [
maildir=no AC_CACHE_CHECK([for the user mail spool directory], [sudo_cv_mail_dir], [
if test X"$ac_cv_header_paths_h" = X"yes"; then sudo_cv_mail_dir=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT if test X"$ac_cv_header_paths_h" = X"yes"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
#include <paths.h>], #include <paths.h>],
[char *p = _PATH_MAILDIR;])], [maildir=yes], []) [char *p = _PATH_MAILDIR;])], [sudo_cv_mail_dir="paths.h"], [])
fi
if test $maildir = no; then
# Solaris has maillock.h which defines MAILDIR
AC_CHECK_HEADERS(maillock.h, [
SUDO_DEFINE(_PATH_MAILDIR, MAILDIR)
maildir=yes
])
if test $maildir = no; then
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
maildir=yes
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "$d")
break
fi
done
if test $maildir = no; then
# unable to find mail dir, hope for the best
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "/var/mail")
fi fi
fi if test $sudo_cv_mail_dir = no; then
fi # Solaris has maillock.h which defines MAILDIR
AC_CHECK_HEADERS(maillock.h, [
sudo_cv_mail_dir=maillock.h
], [
sudo_cv_mail_dir=/var/mail
for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then
sudo_cv_mail_dir="$d"
break
fi
done
])
fi
])
case "$sudo_cv_mail_dir" in
paths.h)
# _PATH_MAILDIR already present in paths.h.
;;
maillock.h)
# Use MAILDIR from maillock.h
SUDO_DEFINE(_PATH_MAILDIR, MAILDIR)
;;
*)
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "$sudo_cv_mail_dir")
;;
esac
]) ])
dnl dnl