diff --git a/configure b/configure index 494a639b0..82ab20339 100755 --- a/configure +++ b/configure @@ -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 : diff --git a/configure.ac b/configure.ac index 53f9cc35f..b3c6181cc 100644 --- a/configure.ac +++ b/configure.ac @@ -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.]) diff --git a/plugins/sudoers/regress/harness.in b/plugins/sudoers/regress/harness.in index 9aa6e7677..c9e0d4aa4 100755 --- a/plugins/sudoers/regress/harness.in +++ b/plugins/sudoers/regress/harness.in @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2022 Todd C. Miller +# Copyright (c) 2022, 2024 Todd C. Miller # # 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