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

258
configure vendored
View File

@@ -20208,7 +20208,14 @@ 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
printf %s "checking for the user mail spool directory... " >&6; }
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 if test X"$ac_cv_header_paths_h" = X"yes"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@@ -20224,11 +20231,11 @@ 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 :
@@ -20237,35 +20244,46 @@ 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
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 cat >>confdefs.h <<EOF
#define _PATH_MAILDIR "$d" #define _PATH_MAILDIR "$sudo_cv_mail_dir"
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,110 +31246,156 @@ 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}
then :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_path_UTMP=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then if test -r "$p"; then
found=yes sudo_cv_path_UTMP="$p"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $p" >&5
printf "%s\n" "$p" >&6; }
cat >>confdefs.h <<EOF
#define _PATH_UTMP "$p"
EOF
break break
fi fi
done done
if test X"$found" != X"yes"; then ;;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 esac
printf "%s\n" "not found" >&6; } 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
#define _PATH_UTMP "$sudo_cv_path_UTMP"
EOF
fi 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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log dir location" >&5
printf %s "checking for log dir location... " >&6; }
if test ${sudo_cv_log_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of log_dir set in configure.ac # 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 for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
log_dir="$d" sudo_cv_log_dir="$d"
break break
fi fi
done 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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log file location" >&5
printf %s "checking for log file location... " >&6; }
if test ${sudo_cv_log_path+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of logpath set in configure.ac # Default value of logpath set in configure.ac
sudo_cv_log_path="$logpath"
for d in /var/log /var/adm /usr/adm; do for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
logpath="$d/sudo.log" sudo_cv_log_path="$d/sudo.log"
break break
fi fi
done 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
{ 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 ${sudo_cv_relay_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of relay_dir set in configure.ac # 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 for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
relay_dir="$d/sudo_logsrvd" sudo_cv_relay_dir="$d/sudo_logsrvd"
break break
fi fi
done 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
printf %s "checking for sudo run dir location... " >&6; }
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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sudo run dir location" >&5
printf %s "checking for sudo run dir location... " >&6; }
if test ${sudo_cv_run_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
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; }
rundir="$sudo_cv_run_dir"
fi
if test X"$rundir" != X"no"; then
cat >>confdefs.h <<EOF cat >>confdefs.h <<EOF
#define _PATH_SUDO_TIMEDIR "$rundir/ts" #define _PATH_SUDO_TIMEDIR "$rundir/ts"
EOF EOF
@@ -31340,63 +31404,97 @@ 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
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\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 :
printf %s "(cached) " >&6
else case e in #(
e)
sudo_cv_var_dir=no
for d in /var/db /var/lib /var/adm /usr/adm; do for d in /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
vardir="$d/sudo" sudo_cv_var_dir="$d/sudo"
break break
fi fi
done 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; }
vardir="$sudo_cv_var_dir"
fi
if test X"$vardir" != X"no"; then
cat >>confdefs.h <<EOF 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
{ 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 ${sudo_cv_iolog_dir+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
# Default value of iolog_dir set in configure.ac # 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 for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
iolog_dir="$d/sudo-io" sudo_cv_iolog_dir="$d/sudo-io"
break break
fi fi
done 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; }
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\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
else case e in #(
e)
sudo_cv_tz_dir=no
for d in /usr/share /usr/share/lib /usr/lib /etc; do for d in /usr/share /usr/share/lib /usr/lib /etc; do
if test -d "$d/zoneinfo"; then if test -d "$d/zoneinfo"; then
tzdir="$d/zoneinfo" sudo_cv_tz_dir="$d/zoneinfo"
break break
fi fi
done 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"
fi
if test X"$tzdir" != X"no"; then
cat >>confdefs.h <<EOF cat >>confdefs.h <<EOF
#define _PATH_ZONEINFO "$tzdir" #define _PATH_ZONEINFO "$tzdir"
EOF EOF

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], [
sudo_cv_path_UTMP=no
for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do for p in "/var/run/utmp" "/var/adm/utmp" "/etc/utmp"; do
if test -r "$p"; then if test -r "$p"; then
found=yes sudo_cv_path_UTMP="$p"
AC_MSG_RESULT([$p])
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$p")
break break
fi fi
done done
if test X"$found" != X"yes"; then ])
AC_MSG_RESULT([not found]) if test X"$sudo_cv_path_UTMP" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_UTMP, "$sudo_cv_path_UTMP")
fi 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
AC_CACHE_CHECK([for log file location], [sudo_cv_log_path], [
# Default value of logpath set in configure.ac # Default value of logpath set in configure.ac
sudo_cv_log_path="$logpath"
for d in /var/log /var/adm /usr/adm; do for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
logpath="$d/sudo.log" sudo_cv_log_path="$d/sudo.log"
break break
fi fi
done 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], [
if test -n "$with_tzdir"; then
tzdir="$with_tzdir" tzdir="$with_tzdir"
if test -z "$tzdir"; then else
tzdir=no AC_CACHE_CHECK([time zone data directory], [sudo_cv_tz_dir], [
sudo_cv_tz_dir=no
for d in /usr/share /usr/share/lib /usr/lib /etc; do for d in /usr/share /usr/share/lib /usr/lib /etc; do
if test -d "$d/zoneinfo"; then if test -d "$d/zoneinfo"; then
tzdir="$d/zoneinfo" sudo_cv_tz_dir="$d/zoneinfo"
break break
fi fi
done done
])
tzdir="$sudo_cv_tz_dir"
fi fi
AC_MSG_RESULT([$tzdir]) if test X"$tzdir" != X"no"; then
if test "${tzdir}" != "no"; then
SUDO_DEFINE_UNQUOTED(_PATH_ZONEINFO, "$tzdir") SUDO_DEFINE_UNQUOTED(_PATH_ZONEINFO, "$tzdir")
fi fi
])dnl ])
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
AC_CACHE_CHECK([for sudo run dir location], [sudo_cv_run_dir], [
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
])
rundir="$sudo_cv_run_dir"
fi fi
AC_MSG_RESULT([$rundir]) if test X"$rundir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$rundir/ts") SUDO_DEFINE_UNQUOTED(_PATH_SUDO_TIMEDIR, "$rundir/ts")
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGSRVD_PID, "$rundir/sudo_logsrvd.pid") SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LOGSRVD_PID, "$rundir/sudo_logsrvd.pid")
])dnl 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], [
if test -n "$with_vardir"; then
vardir="$with_vardir" vardir="$with_vardir"
if test -z "$vardir"; then else
AC_CACHE_CHECK([for sudo var dir location], [sudo_cv_var_dir], [
sudo_cv_var_dir=no
for d in /var/db /var/lib /var/adm /usr/adm; do for d in /var/db /var/lib /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
vardir="$d/sudo" sudo_cv_var_dir="$d/sudo"
break break
fi fi
done done
])
vardir="$sudo_cv_var_dir"
fi fi
AC_MSG_RESULT([$vardir]) if test X"$vardir" != X"no"; then
SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LECTURE_DIR, "$vardir/lectured") SUDO_DEFINE_UNQUOTED(_PATH_SUDO_LECTURE_DIR, "$vardir/lectured")
])dnl 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
AC_CACHE_CHECK([for sudo_logsrvd relay dir location], [sudo_cv_relay_dir], [
# Default value of relay_dir set in configure.ac # 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 for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
relay_dir="$d/sudo_logsrvd" sudo_cv_relay_dir="$d/sudo_logsrvd"
break break
fi fi
done 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
AC_CACHE_CHECK([for I/O log dir location], [sudo_cv_iolog_dir], [
# Default value of iolog_dir set in configure.ac # 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 for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
iolog_dir="$d/sudo-io" sudo_cv_iolog_dir="$d/sudo-io"
break break
fi fi
done 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
AC_CACHE_CHECK([for log dir location], [sudo_cv_log_dir], [
# Default value of log_dir set in configure.ac # 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 for d in /var/log /var/adm /usr/adm; do
if test -d "$d"; then if test -d "$d"; then
log_dir="$d" sudo_cv_log_dir="$d"
break break
fi fi
done 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,33 +534,41 @@ 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], [
sudo_cv_mail_dir=no
if test X"$ac_cv_header_paths_h" = X"yes"; then if test X"$ac_cv_header_paths_h" = X"yes"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT 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 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
AC_CHECK_HEADERS(maillock.h, [ AC_CHECK_HEADERS(maillock.h, [
SUDO_DEFINE(_PATH_MAILDIR, MAILDIR) sudo_cv_mail_dir=maillock.h
maildir=yes ], [
]) sudo_cv_mail_dir=/var/mail
if test $maildir = no; then
for d in /var/mail /var/spool/mail /usr/spool/mail; do for d in /var/mail /var/spool/mail /usr/spool/mail; do
if test -d "$d"; then if test -d "$d"; then
maildir=yes sudo_cv_mail_dir="$d"
SUDO_DEFINE_UNQUOTED(_PATH_MAILDIR, "$d")
break break
fi fi
done 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 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
dnl Create PVS-Studio.cfg for supported platforms or throw an error. dnl Create PVS-Studio.cfg for supported platforms or throw an error.