Add configure check for sha1sum and use "openssh dgst -sha1" if missing.

Only needed when building the seed corpus zip files.
This commit is contained in:
Todd C. Miller
2021-11-10 13:31:42 -07:00
parent c2d03f7cca
commit 09b82a22ca
6 changed files with 61 additions and 8 deletions

47
configure vendored
View File

@@ -684,6 +684,7 @@ NROFFPROG
MANDOCPROG
TRPROG
UNAMEPROG
SHA1SUM
LT_SYS_LIBRARY_PATH
OTOOL64
OTOOL
@@ -16785,6 +16786,52 @@ fi
NOEXECFILE="sudo_noexec.so"
NOEXECDIR="`echo $noexec_file|sed -e 's:^${\([^}]*\)}:$(\1):' -e 's:^\(.*\)/[^/]*:\1:'`"
# Extract the first word of "sha1sum", so it can be a program name with args.
set dummy sha1sum; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_SHA1SUM+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $SHA1SUM in
[\\/]* | ?:[\\/]*)
ac_cv_path_SHA1SUM="$SHA1SUM" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_SHA1SUM="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_SHA1SUM" && ac_cv_path_SHA1SUM="openssl dgst -sha1"
;;
esac
fi
SHA1SUM=$ac_cv_path_SHA1SUM
if test -n "$SHA1SUM"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SHA1SUM" >&5
printf "%s\n" "$SHA1SUM" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Extract the first word of "uname", so it can be a program name with args.
set dummy uname; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5

View File

@@ -1714,6 +1714,7 @@ NOEXECDIR="`echo $noexec_file|sed -e 's:^${\([[^}]]*\)}:$(\1):' -e 's:^\(.*\)/[[
dnl
dnl Find programs we use
dnl
AC_PATH_PROG(SHA1SUM, [sha1sum], [openssl dgst -sha1])
AC_PATH_PROG(UNAMEPROG, [uname], [uname])
AC_PATH_PROG(TRPROG, [tr], [tr])
AC_PATH_PROG(MANDOCPROG, [mandoc], [mandoc])

View File

@@ -34,6 +34,8 @@ cross_compiling = @CROSS_COMPILING@
# Compiler & tools to use
CC = @CC@
LIBTOOL = @LIBTOOL@
SHA1SUM = @SHA1SUM@
SED = @SED@
# Libraries
LT_LIBS = $(top_builddir)/lib/eventlog/libsudo_eventlog.la \
@@ -188,7 +190,7 @@ fuzz_iolog_json_seed_corpus.zip:
tdir=fuzz_iolog_json.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_IOLOG_JSON_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir
@@ -214,7 +216,7 @@ fuzz_iolog_legacy_seed_corpus.zip:
tdir=fuzz_iolog_legacy.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_IOLOG_LEGACY_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir
@@ -240,7 +242,7 @@ fuzz_iolog_timing_seed_corpus.zip:
tdir=fuzz_iolog_timing.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_IOLOG_TIMING_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir

View File

@@ -54,6 +54,7 @@ HOSTCC = @CC_FOR_BUILD@
CPP = @CPP@
HOSTCPP = @CPP_FOR_BUILD@
LIBTOOL = @LIBTOOL@
SHA1SUM = @SHA1SUM@
SED = @SED@
AWK = @AWK@
@@ -318,7 +319,7 @@ fuzz_sudo_conf_seed_corpus.zip:
tdir=fuzz_sudo_conf.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_SUDO_CONF_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir

View File

@@ -35,6 +35,7 @@ cross_compiling = @CROSS_COMPILING@
# Compiler & tools to use
CC = @CC@
LIBTOOL = @LIBTOOL@
SHA1SUM = @SHA1SUM@
SED = @SED@
# Our install program supports extra flags...
@@ -174,7 +175,7 @@ fuzz_logsrvd_conf_seed_corpus.zip:
tdir=fuzz_logsrvd_conf.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_LOGSRVD_CONF_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir

View File

@@ -44,6 +44,7 @@ cross_compiling = @CROSS_COMPILING@
# Compiler & tools to use
CC = @CC@
LIBTOOL = @LIBTOOL@
SHA1SUM = @SHA1SUM@
FLEX = @FLEX@
YACC = @YACC@
SED = @SED@
@@ -407,7 +408,7 @@ fuzz_policy_seed_corpus.zip:
tdir=fuzz_policy.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_POLICY_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir
@@ -433,7 +434,7 @@ fuzz_sudoers_seed_corpus.zip:
tdir=fuzz_sudoers.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_SUDOERS_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir
@@ -459,7 +460,7 @@ fuzz_sudoers_ldif_seed_corpus.zip:
tdir=fuzz_sudoers_ldif.$$$$; \
mkdir $$tdir; \
for f in $(FUZZ_SUDOERS_LDIF_CORPUS); do \
cp $$f $$tdir/`sha1sum $$f | cut -d' ' -f1`; \
cp $$f $$tdir/`$(SHA1SUM) $$f | $(SED) -e 's/^.*= *//' -e 's/ .*//'`; \
done; \
zip -j $@ $$tdir/*; \
rm -rf $$tdir