mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Check JSON output with jq if present.
This commit is contained in:
parent
7c2204d34d
commit
4d47acf69b
50
configure
vendored
50
configure
vendored
@ -704,6 +704,7 @@ host_os
|
||||
host_vendor
|
||||
host_cpu
|
||||
host
|
||||
JQ
|
||||
LDFLAGS_FOR_BUILD
|
||||
CPPFLAGS_FOR_BUILD
|
||||
CFLAGS_FOR_BUILD
|
||||
@ -8804,6 +8805,55 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
for ac_prog in jq
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; 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_prog_JQ+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) if test -n "$JQ"; then
|
||||
ac_cv_prog_JQ="$JQ" # Let the user override the test.
|
||||
else
|
||||
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_prog_JQ="$ac_prog"
|
||||
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
|
||||
|
||||
fi ;;
|
||||
esac
|
||||
fi
|
||||
JQ=$ac_cv_prog_JQ
|
||||
if test -n "$JQ"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JQ" >&5
|
||||
printf "%s\n" "$JQ" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$JQ" && break
|
||||
done
|
||||
test -n "$JQ" || JQ=":"
|
||||
|
||||
|
||||
if test "x$ac_cv_prog_cc_c89" = "xno"
|
||||
then :
|
||||
|
@ -1583,6 +1583,7 @@ AS_IF([test X"$AR" = X"false"], [
|
||||
AC_MSG_ERROR([the "ar" utility is required to build sudo])
|
||||
])
|
||||
AX_PROG_CC_FOR_BUILD
|
||||
AC_CHECK_PROGS(JQ, jq, :)
|
||||
|
||||
AS_IF([test "x$ac_cv_prog_cc_c89" = "xno"], [
|
||||
AC_MSG_ERROR([Sudo version $PACKAGE_VERSION requires an ANSI C compiler to build.])
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2022 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||
# Copyright (c) 2022, 2024 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
@ -20,6 +20,7 @@
|
||||
srcdir="@abs_srcdir@"
|
||||
builddir="@abs_builddir@"
|
||||
SHELL=@SHELL@
|
||||
JQ=@JQ@
|
||||
verbose=0
|
||||
rval=0
|
||||
ntests=0
|
||||
@ -97,7 +98,11 @@ sudoers)
|
||||
$builddir/cvtsudoers -c "" -f json $in >$json 2>/dev/null || true
|
||||
ntests=`expr $ntests + 1`
|
||||
if cmp $json $json_ok >/dev/null; then
|
||||
if [ $verbose -eq 1 ]; then
|
||||
$JQ empty < $json
|
||||
if [ $? -ne 0 ]; then
|
||||
errors=`expr $errors + 1`
|
||||
echo "$group/$test (json): FAIL"
|
||||
elif [ $verbose -eq 1 ]; then
|
||||
echo "$group/$test (json): OK"
|
||||
fi
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user