diff -Nru openscap-1.2.17/acinclude.m4 openscap-1.3.4/acinclude.m4 --- openscap-1.2.17/acinclude.m4 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/acinclude.m4 1969-12-31 19:00:00.000000000 -0500 @@ -1,207 +0,0 @@ -# =========================================================================== -# http://autoconf-archive.cryp.to/ac_pkg_swig.html -# =========================================================================== -# -# SYNOPSIS -# -# AC_PROG_SWIG([major.minor.micro]) -# -# DESCRIPTION -# -# This macro searches for a SWIG installation on your system. If found you -# should call SWIG via $(SWIG). You can use the optional first argument to -# check if the version of the available SWIG is greater than or equal to -# the value of the argument. It should have the format: N[.N[.N]] (N is a -# number between 0 and 999. Only the first N is mandatory.) -# -# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that -# the swig package is this version number or higher. -# -# In configure.in, use as: -# -# AC_PROG_SWIG(1.3.17) -# SWIG_ENABLE_CXX -# SWIG_MULTI_MODULE_SUPPORT -# SWIG_PYTHON -# -# LAST MODIFICATION -# -# 2008-04-12 -# -# COPYLEFT -# -# Copyright (c) 2008 Sebastian Huber -# Copyright (c) 2008 Alan W. Irwin -# Copyright (c) 2008 Rafael Laboissiere -# Copyright (c) 2008 Andrew Collier -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Macro Archive. When you make and -# distribute a modified version of the Autoconf Macro, you may extend this -# special exception to the GPL to apply to your modified version as well. - -AC_DEFUN([AC_PROG_SWIG],[ - AC_PATH_PROG([SWIG],[swig]) - if test -z "$SWIG" ; then - AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' - elif test -n "$1" ; then - AC_MSG_CHECKING([for SWIG version]) - [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] - AC_MSG_RESULT([$swig_version]) - if test -n "$swig_version" ; then - # Calculate the required version number components - [required=$1] - [required_major=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_major" ; then - [required_major=0] - fi - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] - [required_minor=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_minor" ; then - [required_minor=0] - fi - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] - [required_patch=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_patch" ; then - [required_patch=0] - fi - # Calculate the available version number components - [available=$swig_version] - [available_major=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_major" ; then - [available_major=0] - fi - [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] - [available_minor=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_minor" ; then - [available_minor=0] - fi - [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] - [available_patch=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_patch" ; then - [available_patch=0] - fi - if test $available_major -ne $required_major \ - -o $available_minor -ne $required_minor \ - -o $available_patch -lt $required_patch ; then - AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' - else - AC_MSG_NOTICE([SWIG executable is '$SWIG']) - SWIG_LIB=`$SWIG -swiglib` - AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) - fi - else - AC_MSG_WARN([cannot determine SWIG version]) - SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' - fi - fi - AC_SUBST([SWIG_LIB]) -]) - -dnl AM_CHECK_PYTHON_HEADERS: Find location of python include files. -dnl Taken from: -dnl http://source.macgimp.org/ -dnl which is GPL and is attributed to James Henstridge. -dnl -dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) -dnl Imports: -dnl $PYTHON -dnl Exports: -dnl PYTHON_INCLUDES - -AC_DEFUN([AM_CHECK_PYTHON_HEADERS], -[AC_REQUIRE([AM_PATH_PYTHON]) -AC_MSG_CHECKING(for headers required to compile python extensions) -dnl deduce PYTHON_INCLUDES -py_prefix=`$PYTHON -c "import sys; print sys.prefix"` -py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` -PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -if test "$py_prefix" != "$py_exec_prefix"; then - PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" -fi -AC_SUBST(PYTHON_INCLUDES) -dnl check if the headers exist: -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" -AC_TRY_CPP([#include ],dnl -[AC_MSG_RESULT(found) -$1],dnl -[AC_MSG_RESULT(not found) -$2]) -CPPFLAGS="$save_CPPFLAGS" -]) - -dnl -dnl Useful macros for autoconf to check for ssp-patched gcc -dnl 1.0 - September 2003 - Tiago Sousa -dnl -dnl About ssp: -dnl GCC extension for protecting applications from stack-smashing attacks -dnl http://www.research.ibm.com/trl/projects/security/ssp/ -dnl -dnl Usage: -dnl After calling the correct AC_LANG_*, use the corresponding macro: -dnl -dnl GCC_STACK_PROTECT_CC -dnl checks -fstack-protector with the C compiler, if it exists then updates -dnl CFLAGS and defines ENABLE_SSP_CC -dnl -dnl GCC_STACK_PROTECT_CXX -dnl checks -fstack-protector with the C++ compiler, if it exists then updates -dnl CXXFLAGS and defines ENABLE_SSP_CXX -dnl - -AC_DEFUN([GCC_STACK_PROTECT_CC],[ - ssp_cc=yes - if test "X$CC" != "X"; then - AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector]) - ssp_old_cflags="$CFLAGS" - CFLAGS="$CFLAGS -fstack-protector" - AC_TRY_COMPILE(,,, ssp_cc=no) - echo $ssp_cc - if test "X$ssp_cc" = "Xno"; then - CFLAGS="$ssp_old_cflags" - else - AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) - fi - fi -]) - -AC_DEFUN([GCC_STACK_PROTECT_CXX],[ - ssp_cxx=yes - if test "X$CXX" != "X"; then - AC_MSG_CHECKING([whether ${CXX} accepts -fstack-protector]) - ssp_old_cxxflags="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -fstack-protector" - AC_TRY_COMPILE(,,, ssp_cxx=no) - echo $ssp_cxx - if test "X$ssp_cxx" = "Xno"; then - CXXFLAGS="$ssp_old_cxxflags" - else - AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.]) - fi - fi -]) diff -Nru openscap-1.2.17/ac_probes/ac_probes.sh openscap-1.3.4/ac_probes/ac_probes.sh --- openscap-1.2.17/ac_probes/ac_probes.sh 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/ac_probes.sh 1969-12-31 19:00:00.000000000 -0500 @@ -1,330 +0,0 @@ -#!/usr/bin/env bash -# -# Generate autoconf probe stuff -# - -if [[ -z "$1" || -z "$2" || -z "$3" ]]; then - echo "Usage: $(basename $0) " - exit 1 -fi - -TEMPLATE="$1" -AC_PROBES_DIR="$2" -PROBE_SRCDIR="$3" - -TEMPLATE_DECL_SECTION="@@@@PROBE_DECL@@@@" -TEMPLATE_HEADER_SECTION="@@@@PROBE_HEADERS@@@@" -TEMPLATE_LIBRARY_SECTION="@@@@PROBE_LIBRARIES@@@@" -TEMPLATE_TABLE_SECTION="@@@@PROBE_TABLE@@@@" -TEMPLATE_EVAL_SECTION="@@@@PROBE_EVAL@@@@" - -TEMPDIR="$(mktemp -d)" -HEADERS_INTERNAL=( - alloc.h - bfind.h - config.h - probe/[a-zA-Z]*.h - common/assume.h - common/bfind.h - common/debug_priv.h - crapi/crapi.h - cstdio - cstring - iostream - oval_fts.h - probe-api.h - procfs.h - seap.h - sexp.h - pcre.h - regex.h) - -SOURCES_REGEXP='(probe_.*_SOURCES|/.*\.[Cch][a-zA-Z]*\\?$)' -PROBES_SEDEXP='s|^.*probe_\(.*\)_SOURCES.*$|\1|p' -HEADER_SEDEXP='s|^.*include.*<[[:space:]]*\([^>]*\)[[:space:]]*>.*$|\1|p' - -HEADER_OPT_START='^[[:space:]]*#[[:space:]]*[ie][lf].*[Hh][Aa][Vv][Ee].*$' -HEADER_OPT_END='^[[:space:]]*#[[:space:]]*e[ln].*$' - -HEADER_OPT_SEDEXP="/${HEADER_OPT_START}/,/${HEADER_OPT_END}/ ${HEADER_SEDEXP}" - -function ac_gen_probe_decl() { - local name="$1" - - echo "probe_${name}_req_deps_ok=yes" - echo "probe_${name}_req_deps_missing=" - echo "probe_${name}_opt_deps_ok=yes" - echo "probe_${name}_opt_deps_missing=" -} - -# -# ac_gen_headerscheck -# -function ac_gen_probe_headercheck() { - local name="$1" - local required="$2" - local headers="$3" - - if [[ -z "$headers" ]]; then - return - fi - - # - # AC_CHECK_HEADERS (header-file..., [action-if-found], [action-if-not-found], [includes]) - # - if [[ "$required" == "yes" ]]; then - d="required" - else - d="optional" - fi - - echo "echo" - echo "echo ' * Checking presence of $d headers for the $name probe'" - - if [[ "$required" == "yes" ]]; then - echo "AC_CHECK_HEADERS([${headers}],[],[probe_${name}_req_deps_ok=no; probe_${name}_req_deps_missing='header files'],[-])" - else - echo "AC_CHECK_HEADERS([${headers}],[],[probe_${name}_opt_deps_ok=no],[-])" - fi - echo -} - -function ac_gen_probe_librarycheck() { - local libinfodir="$1" - local cflagsfile="$2" - - for libname in $(ls -1 "$libinfodir" | grep -v '~$'); do - local name= - local pkgconfig= - local pkgconfig_name= - local pkgconfig_minver="0.0" - local functions_req= - local functions_opt= - local functions_lang= - local probes_req= - local probes_opt= - - . "${libinfodir}/${libname}" # load library info - - if [[ -z "$name" ]]; then - continue - fi - - echo "echo" - echo "echo '* Checking for ${libname} library used by: ${probes_req[*]} ${probes_opt[*]}'" - if [[ "${pkgconfig}" == "yes" ]]; then - # - # PKG_CHECK_MODULES(prefix, list-of-modules, action-if-found, action-if-not-found) - # - echo "PKG_CHECK_MODULES([${libname}], [${pkgconfig_name} >= ${pkgconfig_minver}],[],[" - - # non-pkgconfig check - fallback - echo "SAVE_LIBS=\$LIBS" - echo "AC_SEARCH_LIBS([${functions_req[0]}],[${name}],[" - echo "${libname}_CFLAGS=;" - echo "${libname}_LIBS=-l${name};" - echo "],[" - - for probe_name in ${probes_req[*]}; do - echo "probe_${probe_name}_req_deps_ok=no;" - echo "probe_${probe_name}_req_deps_missing+=', ${libname}';" - done - - for probe_name in ${probes_opt[*]}; do - echo "probe_${probe_name}_opt_deps_ok=no;" - echo "probe_${probe_name}_opt_deps_missing+=', ${libname}';" - done - - echo "],[])" - echo "AC_SUBST([${libname}_CFLAGS])" - echo "AC_SUBST([${libname}_LIBS])" - echo "LIBS=\$SAVE_LIBS" - echo "])" - - # - # Collect CFLAGS for header checks - # - pkg-config ${pkgconfig_name} --modversion > /dev/null || exit 123 - - echo -n "\$(pkg-config ${pkgconfig_name} --cflags) " >> "${cflagsfile}" - else - # non-pkgconfig check - echo "SAVE_LIBS=\$LIBS" - echo "AC_SEARCH_LIBS([${functions_req[0]}],[${name}],[" - - echo "${libname}_CFLAGS=;" - echo "${libname}_LIBS=-l${name};" - - echo "],[" - - for probe_name in ${probes_req[*]}; do - echo "probe_${probe_name}_req_deps_ok=no;" - echo "probe_${probe_name}_req_deps_missing+=', ${libname} lib';" - done - - for probe_name in ${probes_opt[*]}; do - echo "probe_${probe_name}_opt_deps_ok=no;" - echo "probe_${probe_name}_opt_deps_missing+=', ${libname} lib';" - done - - echo "],[])" - - echo "AC_SUBST([${libname}_CFLAGS])" - echo "AC_SUBST([${libname}_LIBS])" - - echo "LIBS=\$SAVE_LIBS" - fi - - echo "SAVE_LIBS=\$LIBS" - echo "LIBS=\$${libname}_LIBS" - - if [[ -n "${functions_req[0]}" ]]; then - if [[ -n "${functions_lang}" ]]; then - echo "AC_LANG_PUSH([${functions_lang}])" - fi - - echo -n "AC_CHECK_FUNCS([${functions_req[*]}], [], [" - - for probe_name in ${probes_req[*]}; do - echo - echo "probe_${probe_name}_req_deps_ok=no;" - echo "probe_${probe_name}_req_deps_missing+=\", \$ac_func func\";" - done - - echo "])" - - if [[ -n "${functions_lang}" ]]; then - echo "AC_LANG_POP([${functions_lang}])" - fi - fi - - if [[ -n "${functions_opt[0]}" ]]; then - if [[ -n "${functions_lang}" ]]; then - echo "AC_LANG_PUSH([${functions_lang}])" - fi - - echo "AC_CHECK_FUNCS([${functions_opt[*]}],[],[])" - - if [[ -n "${functions_lang}" ]]; then - echo "AC_LANG_POP([${functions_lang}])" - fi - fi - - echo "LIBS=\$SAVE_LIBS" - - unset functions_opt - unset functions_req - unset probes_opt - unset probes_req - done -} - -function ac_gen_probe_tableentry() { - local name="$1" - - echo 'if test "$probe_'${name}'_req_deps_ok" = "yes"; then' - echo ' probe_'${name}'_table_result="yes"' - echo 'else' - echo ' probe_'${name}'_table_result="NO (missing: $probe_'${name}'_req_deps_missing)"' - echo 'fi' - echo 'printf " %-28s %s\n" "'${name}':" "$probe_'${name}'_table_result"' -} - -function ac_gen_probe_compileeval() { - local name="$1" - echo "AM_CONDITIONAL([probe_${name}_enabled], test \"\$probe_${name}_req_deps_ok\" = yes)" - echo "probe_${name}_enabled=\$probe_${name}_req_deps_ok" -} - -function replace_pattern_with_file() { - local pattern="$1" - local repfile="$2" - - sed "/${pattern}/ {r ${repfile} -d}" $3 -} - -# Cleanup -rm -rf "${TEMPDIR}" -mkdir "${TEMPDIR}" - -cd "${PROBE_SRCDIR}" || exit 9 - -# Generate source file list for each probe from Makefile.am -# skip system_info because we always build system_info -grep -E "${SOURCES_REGEXP}" Makefile.am | \ - grep -v "probe_system_info" | \ - sed -e '{:q;N;s/\\\n//g;t q;/\\$/ b q;}' | \ - sed 's|^[[:space:]]*\(probe_.*SOURCES\)[[:space:]]*=[[:space:]]*\(.*\)[[:space:]]*$|export \1="\2"|' > "${TEMPDIR}/vars" || exit 1 - -sed -n "${PROBES_SEDEXP}" "${TEMPDIR}/vars" > "${TEMPDIR}/names" || exit 2 - -# Load _SOURCES -. "${TEMPDIR}/vars" - -# Make a list of excluded header files separated by '|' (and then construct a regexp from it) -OIFS=$IFS -export IFS="|" -EXCLUDE_HEADERS="${HEADERS_INTERNAL[*]}" -export IFS=$OIFS - -echo > "${TEMPDIR}/ac_probes.check.out" -echo "echo ' === probes ==='" > "${TEMPDIR}/ac_probes.table.out" -echo > "${TEMPDIR}/ac_probes.decl.out" -echo > "${TEMPDIR}/ac_probes.eval.out" -echo > "${TEMPDIR}/ac_probes.check_cflags.out" - -while read probe_name; do - src_files=$(eval "echo \$probe_${probe_name}_SOURCES") - - # extract all header files - sed -n "${HEADER_SEDEXP}" $src_files | grep -vE "($EXCLUDE_HEADERS)" | sort | uniq > "${TEMPDIR}/headers.${probe_name}" - # extract optional header files - sed -n "${HEADER_OPT_SEDEXP}" $src_files | grep -vE "($EXCLUDE_HEADERS)" | sort | uniq > "${TEMPDIR}/headers.${probe_name}.opt" - # generate list of required header files (required = all - optional) - diff --left-column "${TEMPDIR}/headers.${probe_name}.opt" "${TEMPDIR}/headers.${probe_name}" | sed -n 's|> \(.*\)$|\1|p' > "${TEMPDIR}/headers.${probe_name}.req" - - # - # Generate autoconf code - # - - # declaration - ac_gen_probe_decl "$probe_name" >> "${TEMPDIR}/ac_probes.decl.out" - - # required header check - ac_gen_probe_headercheck "$probe_name" "yes" "$(cat ${TEMPDIR}/headers.${probe_name}.req | tr '\n' ' ')" >> "${TEMPDIR}/ac_probes.check.out" - - # optional header check - ac_gen_probe_headercheck "$probe_name" "no" "$(cat ${TEMPDIR}/headers.${probe_name}.opt | tr '\n' ' ')" >> "${TEMPDIR}/ac_probes.check.out" - - # table entry - ac_gen_probe_tableentry "$probe_name" >> "${TEMPDIR}/ac_probes.table.out" - - # result evaluation - ac_gen_probe_compileeval "$probe_name" >> "${TEMPDIR}/ac_probes.eval.out" - -done < /dev/null - -# library check -ac_gen_probe_librarycheck "${AC_PROBES_DIR}/libs" "${TEMPDIR}/ac_probes.check_cflags.out" > "${TEMPDIR}/ac_probes.libs.out" - -# regen check.out file and include CFLAGS handling -echo "SAVE_CPPFLAGS=\"\$CPPFLAGS\"" > "${TEMPDIR}/ac_probes.check.out2" -echo "CPPFLAGS=\"\$CPPFLAGS $(cat "${TEMPDIR}/ac_probes.check_cflags.out" | tr '\n' ' ')\"" >> "${TEMPDIR}/ac_probes.check.out2" -cat "${TEMPDIR}/ac_probes.check.out" >> "${TEMPDIR}/ac_probes.check.out2" -echo "CPPFLAGS=\"\$SAVE_CPPFLAGS\"" >> "${TEMPDIR}/ac_probes.check.out2" -mv "${TEMPDIR}/ac_probes.check.out2" "${TEMPDIR}/ac_probes.check.out" - -# Generate configure.ac from the template -cat "${TEMPLATE}" |\ -replace_pattern_with_file "${TEMPLATE_DECL_SECTION}" "${TEMPDIR}/ac_probes.decl.out" |\ -replace_pattern_with_file "${TEMPLATE_HEADER_SECTION}" "${TEMPDIR}/ac_probes.check.out"|\ -replace_pattern_with_file "${TEMPLATE_LIBRARY_SECTION}" "${TEMPDIR}/ac_probes.libs.out" |\ -replace_pattern_with_file "${TEMPLATE_EVAL_SECTION}" "${TEMPDIR}/ac_probes.eval.out" |\ -replace_pattern_with_file "${TEMPLATE_TABLE_SECTION}" "${TEMPDIR}/ac_probes.table.out" - -rm -f "${TEMPDIR}"/* && rmdir "${TEMPDIR}" diff -Nru openscap-1.2.17/ac_probes/configure.ac.tpl openscap-1.3.4/ac_probes/configure.ac.tpl --- openscap-1.2.17/ac_probes/configure.ac.tpl 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/configure.ac.tpl 1969-12-31 19:00:00.000000000 -0500 @@ -1,802 +0,0 @@ -# ! MAKE SURE YOU ARE EDITING THE ac_probes/configure.ac.tpl FILE, -# ! THE configure.ac FILE ITSELF IS GENERATED FROM THE TEMPLATE USING -# ! ac_probes/ac_probes.sh - -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. -AC_PREREQ(2.59) -AC_INIT([openscap], [1.2.17], [open-scap-list@redhat.com]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_AUX_DIR([config]) -AC_CONFIG_MACRO_DIR([m4]) - -AM_INIT_AUTOMAKE([foreign tar-pax]) - -# If automake supports "silent rules", enable them by default -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AC_DISABLE_STATIC -#build dll on windows(cygwin) -AC_LIBTOOL_WIN32_DLL - -# Checks for programs. -AC_PROG_CC -gl_EARLY -gl_INIT -AM_PROG_LIBTOOL -AM_PROG_CC_C_O -AC_PROG_CXX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL - -# swig -AC_PROG_SWIG([]) - -# libtool versioning -# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details - -## increment if the interface has additions, changes, removals. -LT_CURRENT=22 - -## increment any time the source changes; set 0 to if you increment CURRENT -LT_REVISION=1 - -## increment if any interfaces have been added; set to 0 -## if any interfaces have been changed or removed. removal has -## precedence over adding, so set to 0 if both happened. -LT_AGE=14 - -LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` - -AC_SUBST(LT_CURRENT) -AC_SUBST(LT_REVISION) -AC_SUBST(LT_AGE) -AC_SUBST(LT_CURRENT_MINUS_AGE) - -AC_DEFINE_UNQUOTED([LT_CURRENT_MINUS_AGE], [$LT_CURRENT_MINUS_AGE], [LT_CURRENT - LT_AGE]) - -AC_DEFUN([canonical_wrap], [AC_REQUIRE([AC_CANONICAL_HOST])]) -canonical_wrap - -# Compiler flags -CFLAGS="$CFLAGS -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas -D_GNU_SOURCE -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L" - -case $host in - *solaris*) : - CFLAGS="$CFLAGS -D__EXTENSIONS__" ;; -esac - -CFLAGS_OPTIMIZED="-O2 -finline-functions" -CFLAGS_DEBUGGING="-fno-inline-functions -O0 -g3" -CFLAGS_NODEBUG="-Wno-unused-function" - -my_save_cflags="$CFLAGS" -CFLAGS="$CFLAGS -Werror=format-security" -AC_MSG_CHECKING([whether CC supports -Werror=format-security]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [AC_MSG_RESULT([yes])] - [AM_CFLAGS="-Werror=format-security"], - [AC_MSG_RESULT([no])] -) -CFLAGS="$my_save_cflags" -AC_SUBST([AM_CFLAGS]) - -@@@@PROBE_DECL@@@@ - -# -# env -# -AC_CHECK_PROG( - [HAVE_ENV], - [env], - [yes],,, -) - -AM_CONDITIONAL(ENV_PRESENT, [test x"${HAVE_ENV}" = xyes]) - -# -# Valgrind -# -AC_CHECK_PROG( - [HAVE_VALGRIND], - [valgrind], - [yes],,, -) - -AM_CONDITIONAL(VALGRIND_PRESENT, [test x"${HAVE_VALGRIND}" = xyes]) - -AC_HEADER_STDC -AC_HEADER_STDBOOL -AC_TYPE_SIZE_T - -AC_FUNC_MALLOC -AC_FUNC_REALLOC - -# Check for pthreads support: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_pthread.m4 -AX_PTHREAD() - -if test "x$ax_pthread_ok" != "xyes"; then - AC_MSG_FAILURE(pthread library is missing) -fi - -SAVE_LIBS=$LIBS -SAVE_CFLAGS=$CFLAGS - -CFLAGS="$CFLAGS -D_GNU_SOURCE" -LIBS="$PTHREAD_LIBS" - -AC_CHECK_FUNCS([pthread_timedjoin_np pthread_setname_np pthread_getname_np clock_gettime]) - -CFLAGS=$SAVE_CFLAGS -LIBS=$SAVE_LIBS - -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_LIBS]) - - -PKG_CHECK_MODULES([curl], [libcurl >= 7.12.0],[], - AC_MSG_FAILURE([libcurl devel support is missing])) - -PKG_CHECK_MODULES([xml2], [libxml-2.0 >= 2.0],[], - AC_MSG_FAILURE([libxml-2.0 devel support is missing])) - -PKG_CHECK_MODULES([xslt], [libxslt >= 1.1],[], - AC_MSG_FAILURE([libxslt devel support is missing])) - -PKG_CHECK_MODULES([exslt], [libexslt >= 0.8],[], - AC_MSG_FAILURE([libexslt devel support is missing])) - -AC_CHECK_HEADER(pcre.h, , [AC_MSG_ERROR([pcre.h is missing] )]) - -crapi_CFLAGS="" -crapi_LIBS="" - -if test "${with_crypto}" = ""; then - with_crypto=gcrypt -fi - -case "${with_crypto}" in - nss3) - PKG_CHECK_MODULES([nss3], [nss >= 3.0],[], - AC_MSG_FAILURE([libnss3 devel support is missing])) - - crapi_libname="NSS 3.x" - crapi_CFLAGS=$nss3_CFLAGS - crapi_LIBS=$nss3_LIBS - AC_DEFINE([HAVE_NSS3], [1], [Define to 1 if you have 'NSS' library.]) - ;; - gcrypt) - SAVE_LIBS=$LIBS - AC_CHECK_LIB([gcrypt], [gcry_check_version], - [crapi_CFLAGS=`libgcrypt-config --cflags`; - crapi_LIBS=`libgcrypt-config --libs`; - crapi_libname="GCrypt";], - [AC_MSG_ERROR([library 'gcrypt' is required for GCrypt.])], - []) - AC_DEFINE([HAVE_GCRYPT], [1], [Define to 1 if you have 'gcrypt' library.]) - AC_CACHE_CHECK([for GCRYCTL_SET_ENFORCED_FIPS_FLAG], - [ac_cv_gcryctl_set_enforced_fips_flag], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include], - [return GCRYCTL_SET_ENFORCED_FIPS_FLAG;])], - [ac_cv_gcryctl_set_enforced_fips_flag=yes], - [ac_cv_gcryctl_set_enforced_fips_flag=no])]) - - if test "${ac_cv_gcryctl_set_enforced_fips_flag}" == "yes"; then - AC_DEFINE([HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG], [1], [Define to 1 if you have 'gcrypt' library with GCRYCTL_SET_ENFORCED_FIPS_FLAG.]) - fi - LIBS=$SAVE_LIBS - ;; - *) - AC_MSG_ERROR([unknown crypto backend]) - ;; -esac - -AC_SUBST(crapi_CFLAGS) -AC_SUBST(crapi_LIBS) - -AC_CHECK_FUNCS([fts_open posix_memalign memalign]) -AC_CHECK_FUNC(sigwaitinfo, [sigwaitinfo_LIBS=""], [sigwaitinfo_LIBS="-lrt"]) -AC_SUBST(sigwaitinfo_LIBS) - -# libopenscap links against librpm if found. Otherwise we carry own implementation of rpmvercmp. -echo -echo '* Checking for rpm library (optional dependency of libopenscap) ' -PKG_CHECK_MODULES([rpm], [rpm >= 4.4],[ - SAVE_LIBS=$LIBS - AC_DEFINE([HAVE_RPMVERCMP], [1], [Define to 1 if there is rpmvercmp available.]) - AC_SUBST([rpm_CFLAGS]) - AC_SUBST([rpm_LIBS]) - LIBS=$SAVE_LIBS -],[ - AC_MSG_NOTICE([!!! librpm not found. The rpmvercmp function will be emulated. !!!]) -]) -PKG_CHECK_MODULES([rpm], [rpm >= 4.6],[ - AC_DEFINE([HAVE_RPM46], [1], [Define to 1 if rpm is newer than 4.6.]) -],[ - AC_MSG_NOTICE([librpm is older than 4.6]) -]) -PKG_CHECK_MODULES([rpm], [rpm >= 4.7],[ - AC_DEFINE([HAVE_RPM47], [1], [Define to 1 if rpm is newer than 4.7.]) -],[ - AC_MSG_NOTICE([librpm is older than 4.7]) -]) -echo -echo '* Checking for bz2 library (optional dependency of libopenscap)' -AC_CHECK_LIB([bz2], [BZ2_bzReadOpen], - [ - AC_DEFINE([HAVE_BZ2], [1], [Define to 1 if there is libbz2 available.]) - LIBS="$LIBS -lbz2" - AC_CHECK_PROG([HAVE_BZIP2],[bzip2],[yes],,,) - ],[ - AC_MSG_NOTICE([!!! libbz2 not found. Bzip2 support will be disabled !!!]) - ]) -AM_CONDITIONAL([HAVE_BZIP2], [test "x${HAVE_BZIP2}" = xyes]) - - -@@@@PROBE_HEADERS@@@@ - -@@@@PROBE_LIBRARIES@@@@ -echo - - -#check for atomic functions -case $host_cpu in - i386 | i486 | i586 | i686) - CFLAGS="$CFLAGS -march=i686" - ;; -esac - -AC_CACHE_CHECK([for atomic builtins], [ac_cv_atomic_builtins], -[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include - uint16_t foovar=0; uint16_t old=1; uint16_t new=2;], - [__sync_bool_compare_and_swap(&foovar,old,new); return __sync_fetch_and_add(&foovar, 1);])], - [ac_cv_atomic_builtins=yes], - [ac_cv_atomic_builtins=no])]) -if test $ac_cv_atomic_builtins = yes; then - AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Define to 1 if the compiler supports atomic builtins.]) -else - AC_MSG_NOTICE([!!! Compiler does not support atomic builtins. Atomic operation will be emulated using mutex-based locking. !!!]) -fi - - -AC_ARG_ENABLE([probes-independent], - [AC_HELP_STRING([--enable-probes-independent], [enable compilation of probes independent of the base system (default=yes)])], - [case "${enableval}" in - yes) probes_independent=yes ;; - no) probes_independent=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-independent]) ;; - esac],[probes_independent=yes]) - -AC_ARG_ENABLE([probes-unix], - [AC_HELP_STRING([--enable-probes-unix], [enable compilation of probes for UNIX based systems (default=yes)])], - [case "${enableval}" in - yes) probes_unix=yes ;; - no) probes_unix=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-unix]) ;; - esac],[probes_unix=yes]) -if test "x${probes_unix}" = xyes; then - AC_DEFINE([PLATFORM_UNIX], [1], [Indicator for a Unix type OS]) -fi - - -probes_linux=no -case "${host}" in - *-*-linux*) - probes_linux=yes - ;; -esac -AC_ARG_ENABLE([probes-linux], - [AC_HELP_STRING([--enable-probes-linux], [enable compilation of probes for Linux based systems (default=autodetect)])], - [case "${enableval}" in - yes) probes_linux=yes ;; - no) probes_linux=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-linux]) ;; - esac],) - -probes_solaris=no -case "${host}" in - *-*-solaris*) - probes_solaris=yes - ;; -esac -AC_ARG_ENABLE([probes-solaris], - [AC_HELP_STRING([--enable-probes-solaris], [enable compilation of probes for Solaris based systems (default=autodetect)])], - [case "${enableval}" in - yes) probes_solaris=yes ;; - no) probes_solaris=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-solaris]) ;; - esac],) - -AC_ARG_ENABLE([cce], - [AC_HELP_STRING([--enable-cce], [include support for CCE (default=no)])], - [case "${enableval}" in - yes) cce=yes ;; - no) cce=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-cce]) ;; - esac],[cce=no]) - -AC_ARG_ENABLE([python], - [AC_HELP_STRING([--enable-python], [enable compilation of python2 bindings (default=auto)])], - [case "${enableval}" in - yes) python2_bind=yes ;; - no) python2_bind=no ;; - auto) python2_bind=auto ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; - esac],[python2_bind=auto]) - -AC_ARG_ENABLE([python3], - [AC_HELP_STRING([--enable-python3], [enable compilation of python3 bindings (default=auto)])], - [case "${enableval}" in - yes) python3_bind=yes ;; - no) python3_bind=no ;; - auto) python3_bind=auto ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python3]);; - esac],[python3_bind=auto]) - -AC_ARG_ENABLE([perl], - [AC_HELP_STRING([--enable-perl], [enable compilation of perl bindings (default=no)])], - [case "${enableval}" in - yes) perl_bind=yes ;; - no) perl_bind=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-perl]) ;; - esac],[perl_bind=no]) - -AC_ARG_ENABLE([regex-posix], - [AC_HELP_STRING([--enable-regex-posix], [compile with POSIX instead of PCRE regex (default=no)])], - [case "${enableval}" in - yes) regex_posix=yes ;; - no) regex_posix=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-regex-posix]) ;; - esac],[regex_posix=no]) - -AC_ARG_ENABLE([debug], - [AC_HELP_STRING([--enable-debug], [enable debugging flags (default=no)])], - [case "${enableval}" in - yes) debug=yes ;; - no) debug=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; - esac], [debug=no]) - -AC_ARG_ENABLE([valgrind], - [AC_HELP_STRING([--enable-valgrind], [enable valgrind checks (default=no)])], - [case "${enableval}" in - yes) vgdebug=yes ;; - no) vgdebug=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-valgrind]) ;; - esac], [vgdebug=no]) - - -AC_ARG_ENABLE([ssp], - [AC_HELP_STRING([--enable-ssp], [enable SSP (fstack-protector, default=no)])], - [case "${enableval}" in - yes) ssp=yes ;; - no) ssp=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-ssp]) ;; - esac], [ssp=no]) - -AC_ARG_WITH([crypto], - [AS_HELP_STRING([--with-crypto], - [use different crypto backend. Available options: nss3, gcrypt [default=gcrypt]])], - [], - [crypto=gcrypt]) - -if test "x${libexecdir}" = xNONE; then - probe_dir="/usr/local/libexec/openscap" -else - EXPAND_DIR(probe_dir,"${libexecdir}/openscap") -fi - -AC_SUBST(probe_dir) - -if test "x${prefix}" = xNONE; then - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_SCHEMA_PATH], ["/usr/local/share/openscap/schemas"], [Path to xml schemas]) -else - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_SCHEMA_PATH], ["${prefix}/share/openscap/schemas"], [Path to xml schemas]) -fi - -if test "x${prefix}" = xNONE; then - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_XSLT_PATH], ["/usr/local/share/openscap/xsl"], [Path to xslt files]) -else - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_XSLT_PATH], ["${prefix}/share/openscap/xsl"], [Path to xslt files]) -fi - -if test "x${prefix}" = xNONE; then - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_CPE_PATH], ["/usr/local/share/openscap/cpe"], [Path to cpe files]) -else - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_CPE_PATH], ["${prefix}/share/openscap/cpe"], [Path to cpe files]) -fi - -if test "$regex_posix" = "yes"; then - AC_DEFINE([USE_REGEX_POSIX], [1], [Use POSIX regular expressions]) -else - AC_DEFINE([USE_REGEX_PCRE], [1], [Use PCRE]) -fi - -if test "$ssp" = "yes"; then - GCC_STACK_PROTECT_CC - GCC_STACK_PROTECT_CXX -fi - -if test "$debug" = "yes"; then - CFLAGS="$CFLAGS $CFLAGS_DEBUGGING" -else - CFLAGS="$CFLAGS $CFLAGS_NODEBUG" - AC_DEFINE([NDEBUG], [1], [No Debug defined]) -fi - -AC_ARG_ENABLE([sce], - [AC_HELP_STRING([--enable-sce], [enable script check engine (default=no)])], - [case "${enableval}" in - yes) sce=yes ;; - no) sce=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-sce]) ;; - esac],[sce=no]) - -AC_ARG_WITH([oscap-temp-dir], - [AS_HELP_STRING([--with-oscap-temp-dir], - [use different temporary directory to execute sce scripts [default=/tmp]])], - [], - [with_oscap_temp_dir="/tmp"]) - -if test "x${sce}" = xyes; then - AC_DEFINE([ENABLE_SCE], [1], [compilation of script check engine enabled]) - CFLAGS="$CFLAGS -DOSCAP_TEMP_DIR=\\\"${with_oscap_temp_dir}\\\"" # double escape needed for compilation on some systems -fi - -AC_ARG_ENABLE([util-oscap], - [AC_HELP_STRING([--enable-util-oscap], [enable compilation of the oscap utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap=yes ;; - no) util_oscap=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap]) ;; - esac],[util_oscap=yes]) - -AC_ARG_ENABLE([util-scap-as-rpm], - [AC_HELP_STRING([--enable-util-scap-as-rpm], [enable compilation of the scap-as-rpm utility (default=yes)])], - [case "${enableval}" in - yes) util_scap_as_rpm=yes ;; - no) util_scap_as_rpm=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-scap-as-rpm]) ;; - esac],[util_scap_as_rpm=yes]) - -AC_ARG_ENABLE([util-oscap-ssh], - [AC_HELP_STRING([--enable-util-oscap-ssh], [enable compilation of the oscap-ssh utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_ssh=yes ;; - no) util_oscap_ssh=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-ssh]) ;; - esac],[util_oscap_ssh=yes]) - -AC_ARG_ENABLE([util-oscap-docker], - [AC_HELP_STRING([--enable-util-oscap-docker], [enable compilation of the oscap-docker utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_docker=yes ;; - no) util_oscap_docker=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-docker]) ;; - esac],[util_oscap_docker=yes]) - -AC_ARG_ENABLE([util-oscap-vm], - [AC_HELP_STRING([--enable-util-oscap-vm], [enable compilation of the oscap-vm utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_vm=yes ;; - no) util_oscap_vm=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-vm]) ;; - esac],[util_oscap_vm=yes]) - -AC_ARG_ENABLE([util-oscap-chroot], - [AC_HELP_STRING([--enable-util-oscap-chroot], [enable compilation of the oscap-chroot utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_chroot=yes ;; - no) util_oscap_chroot=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-chroot]) ;; - esac],[util_oscap_chroot=yes]) - -if test "$vgdebug" = "yes"; then - if test "$HAVE_VALGRIND" = "yes"; then - vgcheck="yes" - else - AC_MSG_ERROR([valgrind not installed]) - fi -else - vgcheck="no" -fi -AC_SUBST([vgcheck]) - -if test "x${util_oscap_docker}" = "xyes"; then - if test ! "x${HAVE_BZIP2}" = xyes; then - AC_MSG_FAILURE(oscap-docker requires bzip2! Either disable oscap-docker or install bzip2 development support.) - fi -fi - -if test "x${perl_bind}" = xyes; then - AC_PATH_PROG(PERL, perl) - PERL_INCLUDES="`$PERL -e 'use Config; print $Config{archlib}'`/CORE" - vendorlib="$( $PERL -e 'use Config; print $Config{vendorlib}' | sed "s|$($PERL -e 'use Config; print $Config{prefix}')||" )" - vendorarch="$( $PERL -e 'use Config; print $Config{vendorarch}' | sed "s|$($PERL -e 'use Config; print $Config{prefix}')||" )" - AC_SUBST([PERL_INCLUDES], ["-I$PERL_INCLUDES"]) - AC_SUBST([perl_vendorlibdir], ['${prefix}'$vendorlib]) - AC_SUBST([perl_vendorarchdir], ['${prefix}'$vendorarch]) - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $PERL_INCLUDES" - AC_CHECK_HEADERS([EXTERN.h],[],[AC_MSG_ERROR(Perl development librarier are needed for perl bindings)],[-]) - CPPFLAGS="$save_CPPFLAGS" -fi - - -dnl $1: Python major version -dnl $2: How to announce it -m4_define([TELL_PYTHON_NOT_PRESENT], [$2( - [python $1 bindings were requested, but the appropriate python interpreter was not found in the search path. -Please ensure that it is installed and available, or run configure with --disable-python$1 option.])]) - -dnl $1: Python major version -dnl $2: How to announce it -m4_define([TELL_PYTHON_DEVEL_NOT_PRESENT], [$2( - [python $1 bindings were requested and there is an interpreter, but the development support is missing. -Please ensure that it is installed and available, or run configure with --disable-python$1 option.])]) - -# TODO: Handle the bindings yes/no -> interpreter yes/no -> devel yes/no situation - -dnl python_bind can be set either to yes, no or auto. It will be set to yes or no after the evaluation. -dnl -dnl $1: Python major version -m4_define([EVALUATE_PYTHON_CHECK_RESULT], - [m4_if([$1], , [m4_fatal([The $0 macro needs Python major version as its first argument.])]) - AS_IF([test "x${python$1_bind}" = xyes && test "x$HAVE_PYTHON$1" = xno], - [python$1_bind=no - TELL_PYTHON_NOT_PRESENT([$1], [AC_MSG_ERROR])], - [test "x$python$1_bind" = xauto && test "x$HAVE_PYTHON$1" = xno], - [python$1_bind=no - TELL_PYTHON_NOT_PRESENT([$1], [AC_MSG_NOTICE])], - [test "x$python$1_bind" != xno && test "x$HAVE_PYTHON$1" = xyes], - [AM_CONFIGURE_PYTHON_FLAGS([PYTHON$1], - [${PYTHON$1}], - [python$1_bind=yes], - [AS_IF([test "x$python$1_bind" = xauto], - [python$1_bind=no - TELL_PYTHON_DEVEL_NOT_PRESENT([$1], [AC_MSG_NOTICE])], - [TELL_PYTHON_DEVEL_NOT_PRESENT([$1], [AC_MSG_ERROR])])])])]) - -dnl -dnl $1: The Python interpreter to check -dnl $2: The module to check -dnl $3: Action if OK -dnl $4: Action if not OK -m4_define([PYTHON_CHECK_FOR_INSTALLED_MODULE], - [AS_IF(["$1" -c 'import $2' 2> /dev/null], - [$3], [$4])]) - -dnl -dnl $1: Python major version -m4_define([_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER], - [AS_IF([test "$HAVE_PYTHON$1" = yes], - [AC_MSG_CHECKING([whether ${PYTHON$1} can import Atomic]) - PYTHON_CHECK_FOR_INSTALLED_MODULE( - [${PYTHON$1}], [Atomic], - [AC_MSG_RESULT([yes]) - preferred_python="${PYTHON$1}"], - AC_MSG_RESULT([no]))])]) - -AM_PATH_PYTHON_OF_MAJOR_VERSION([2], [2.6], [HAVE_PYTHON2=yes], [HAVE_PYTHON2=no]) -AM_PATH_PYTHON_OF_MAJOR_VERSION([3], [3.4], [HAVE_PYTHON3=yes], [HAVE_PYTHON3=no]) - -EVALUATE_PYTHON_CHECK_RESULT(3) -EVALUATE_PYTHON_CHECK_RESULT(2) - -# Just to have PYTHON defined so Automake doesn't freak out. -# Therefore, we define it to one of available interpreters in favor of Python 3 -PYTHON=: -test "x$HAVE_PYTHON2" = xyes && PYTHON="$PYTHON2" -test "x$HAVE_PYTHON3" = xyes && PYTHON="$PYTHON3" -AC_SUBST([PYTHON]) - -preferred_python=: - -AS_IF([test "x$util_oscap_docker" = xyes], - [_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER(2) - _ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER(3) - AS_IF([test "$preferred_python" = :], - [AS_IF([test "$PYTHON" != :], - [AC_MSG_NOTICE([Couldnt detect preferred python interpreter for oscap-docker. If you can, make sure one can import the 'Atomic' module and re-run the configure script.]) - AC_MSG_NOTICE([Setting the oscap-docker python to '$PYTHON'.]) - preferred_python="$PYTHON"], - [AC_MSG_ERROR([Not found a working Python interpreter and oscap-docker needs it. Aborting, as oscap-docker has been requested.])])])]) - -# oscap-docker determine python dir on default python version -OSCAPDOCKER_PYTHONDIR=`$preferred_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,prefix='$' '{prefix}'))"` -# oscap-docker uses preferred_python substitution -AC_SUBST([preferred_python]) -AC_SUBST(oscapdocker_pythondir, $OSCAPDOCKER_PYTHONDIR) - -@@@@PROBE_EVAL@@@@ - -AM_CONDITIONAL([WANT_CCE], test "$cce" = yes) - -AM_CONDITIONAL([WANT_PROBES_INDEPENDENT], test "$probes_independent" = yes) -AM_CONDITIONAL([WANT_PROBES_UNIX], test "$probes_unix" = yes) -AM_CONDITIONAL([WANT_PROBES_LINUX], test "$probes_linux" = yes) -AM_CONDITIONAL([WANT_PROBES_SOLARIS], test "$probes_solaris" = yes) - -AM_CONDITIONAL([WANT_SCE], test "$sce" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP], test "$util_oscap" = yes) -AM_CONDITIONAL([WANT_UTIL_SCAP_AS_RPM], test "$util_scap_as_rpm" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_SSH], test "$util_oscap_ssh" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_DOCKER], test "$util_oscap_docker" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_VM], test "$util_oscap_vm" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_CHROOT], test "$util_oscap_chroot" = yes) -AM_CONDITIONAL([WANT_PYTHON2], test "$python2_bind" = yes) -AM_CONDITIONAL([WANT_PYTHON3], test "$python3_bind" = yes) -AM_CONDITIONAL([WANT_PERL], test "$perl_bind" = yes) -AM_CONDITIONAL([ENABLE_VALGRIND_TESTS], test "$vgcheck" = yes) - -# -# Core -# -AC_CONFIG_FILES([Makefile - lib/Makefile - src/Makefile - xsl/Makefile - schemas/Makefile - cpe/Makefile - libopenscap.pc - src/common/Makefile - src/source/Makefile - tests/Makefile - tests/API/Makefile - - swig/Makefile - swig/perl/Makefile - swig/python2/Makefile - swig/python3/Makefile - - utils/Makefile - - src/OVAL/Makefile - src/OVAL/adt/Makefile - src/OVAL/results/Makefile - tests/API/OVAL/Makefile - tests/API/OVAL/glob_to_regex/Makefile - tests/API/OVAL/schema_version/Makefile - tests/oscap_string/Makefile - tests/API/OVAL/unittests/Makefile - tests/API/OVAL/validate/Makefile - tests/API/OVAL/report_variable_values/Makefile - tests/mitre/Makefile - - src/OVAL/probes/Makefile - src/OVAL/probes/probe/Makefile - src/OVAL/probes/crapi/Makefile - src/OVAL/probes/SEAP/Makefile - src/OVAL/probes/SEAP/generic/rbt/Makefile - tests/probes/Makefile - tests/API/crypt/Makefile - tests/API/SEAP/Makefile - tests/API/probes/Makefile - tests/sources/Makefile - tests/CPE/Makefile - tests/probes/file/Makefile - tests/probes/fileextendedattribute/Makefile - tests/probes/uname/Makefile - tests/probes/shadow/Makefile - tests/probes/sql57/Makefile - tests/probes/symlink/Makefile - tests/probes/family/Makefile - tests/probes/process58/Makefile - tests/probes/sysinfo/Makefile - tests/probes/rpminfo/Makefile - tests/probes/rpmverifyfile/Makefile - tests/probes/rpmverifypackage/Makefile - tests/probes/rpmverify/Makefile - tests/probes/systemdunitproperty/Makefile - tests/probes/systemdunitdependency/Makefile - tests/probes/runlevel/Makefile - tests/probes/filehash/Makefile - tests/probes/filehash58/Makefile - tests/probes/password/Makefile - tests/probes/interface/Makefile - tests/probes/textfilecontent54/Makefile - tests/probes/environmentvariable/Makefile - tests/probes/environmentvariable58/Makefile - tests/probes/xinetd/Makefile - tests/probes/selinuxboolean/Makefile - tests/probes/isainfo/Makefile - tests/probes/iflisteners/Makefile - tests/probes/maskattr/Makefile - tests/probes/sysctl/Makefile - - src/CVSS/Makefile - tests/API/CVSS/Makefile - - src/CVE/Makefile - tests/API/CVE/Makefile - - src/CVRF/Makefile - tests/API/CVRF/Makefile - - src/CPE/Makefile - tests/API/CPE/Makefile - tests/API/CPE/name/Makefile - tests/API/CPE/lang/Makefile - tests/API/CPE/dict/Makefile - tests/API/CPE/inbuilt/Makefile - - src/CCE/Makefile - tests/API/CCE/Makefile - - src/DS/Makefile - tests/DS/Makefile - tests/DS/ds_sds_index/Makefile - tests/DS/signed/Makefile - tests/DS/validate/Makefile - - tests/bindings/Makefile - - src/XCCDF/Makefile - src/XCCDF_POLICY/Makefile - tests/API/XCCDF/Makefile - tests/API/XCCDF/applicability/Makefile - tests/API/XCCDF/default_cpe/Makefile - tests/API/XCCDF/fix/Makefile - tests/API/XCCDF/guide/Makefile - tests/API/XCCDF/unittests/Makefile - tests/API/XCCDF/parser/Makefile - tests/API/XCCDF/progress/Makefile - tests/API/XCCDF/report/Makefile - tests/API/XCCDF/result_files/Makefile - tests/API/XCCDF/tailoring/Makefile - tests/API/XCCDF/variable_instance/Makefile - - tests/schemas/Makefile - tests/bz2/Makefile - tests/codestyle/Makefile - tests/oval_details/Makefile - tests/nist/Makefile - tests/offline_mode/Makefile - - src/SCE/Makefile - tests/sce/Makefile]) - -AC_CONFIG_FILES([run], - [chmod +x,-w run]) -AC_CONFIG_FILES([tests/test_common.sh], - [chmod +x,-w tests/test_common.sh]) -AC_CONFIG_FILES([utils/oscap-docker], - [chmod +x,-w utils/oscap-docker]) - -AC_OUTPUT - -echo "******************************************************" -echo "OpenSCAP will be compiled with the following settings:" -echo -echo "oscap tool: $util_oscap" -echo "scap-as-rpm tool: $util_scap_as_rpm" -echo "oscap-ssh tool: $util_oscap_ssh" -echo "oscap-docker tool: $util_oscap_docker" -echo "oscap-vm tool: $util_oscap_vm" -echo "oscap-chroot tool: $util_oscap_chroot" -echo "python2 bindings enabled: $python2_bind" -echo "python3 bindings enabled: $python3_bind" -echo "perl bindings enabled: $perl_bind" -echo "use POSIX regex: $regex_posix" -echo "SCE enabled $sce" -echo "debugging flags enabled: $debug" -echo "CCE enabled: $cce" -echo -@@@@PROBE_TABLE@@@@ -echo " system_info: always enabled" -echo -echo " === configuration ===" -echo " probe directory set to: $probe_dir" -echo "" - -echo " === crypto === " -echo " library: $crapi_libname" -echo " libs: $crapi_LIBS" -echo " cflags: $crapi_CFLAGS" -echo "" - -echo "Valgrind checks enabled: $vgcheck" -echo "CFLAGS: $CFLAGS" -echo "CXXFLAGS: $CXXFLAGS" diff -Nru openscap-1.2.17/ac_probes/libs/acl openscap-1.3.4/ac_probes/libs/acl --- openscap-1.2.17/ac_probes/libs/acl 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/acl 1969-12-31 19:00:00.000000000 -0500 @@ -1,6 +0,0 @@ -name=acl -pkgconfig=no -functions_req=(acl_init) -functions_opt=(acl_extended_file) -probes_req= -probes_opt=(file) diff -Nru openscap-1.2.17/ac_probes/libs/apt_pkg openscap-1.3.4/ac_probes/libs/apt_pkg --- openscap-1.2.17/ac_probes/libs/apt_pkg 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/apt_pkg 1969-12-31 19:00:00.000000000 -0500 @@ -1,8 +0,0 @@ -name=apt-pkg -pkgconfig=yes -pkgconfig_name=libapt-pkg -functions_req=(pkgVersion) -functions_opt= -functions_lang=C++ -probes_req=(dpkginfo) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/blkid openscap-1.3.4/ac_probes/libs/blkid --- openscap-1.2.17/ac_probes/libs/blkid 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/blkid 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=blkid -pkgconfig=yes -pkgconfig_name=blkid -functions_req=(blkid_get_cache blkid_get_tag_value) -functions_opt= -probes_req= -probes_opt=(partition) diff -Nru openscap-1.2.17/ac_probes/libs/cap openscap-1.3.4/ac_probes/libs/cap --- openscap-1.2.17/ac_probes/libs/cap 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/cap 1969-12-31 19:00:00.000000000 -0500 @@ -1,6 +0,0 @@ -name=cap -pkgconfig=no -functions_req=(cap_init) -functions_opt=(cap_get_pid capgetp) -probes_req=(process58) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/dbus1 openscap-1.3.4/ac_probes/libs/dbus1 --- openscap-1.2.17/ac_probes/libs/dbus1 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/dbus1 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=dbus1 -pkgconfig=yes -pkgconfig_name=dbus-1 -functions_req=(dbus_bus_get) -functions_opt= -probes_req=(systemdunitproperty systemdunitproperty) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/gconf2 openscap-1.3.4/ac_probes/libs/gconf2 --- openscap-1.2.17/ac_probes/libs/gconf2 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/gconf2 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=gconf-2 -pkgconfig=yes -pkgconfig_name=gconf-2.0 -functions_req=(gconf_engine_get_default) -functions_opt= -probes_req=(gconf) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/lber openscap-1.3.4/ac_probes/libs/lber --- openscap-1.2.17/ac_probes/libs/lber 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/lber 1969-12-31 19:00:00.000000000 -0500 @@ -1,6 +0,0 @@ -name=lber -pkgconfig=no -functions_req=(ber_init) -functions_opt= -probes_req=(ldap57) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/ldap openscap-1.3.4/ac_probes/libs/ldap --- openscap-1.2.17/ac_probes/libs/ldap 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/ldap 1969-12-31 19:00:00.000000000 -0500 @@ -1,6 +0,0 @@ -name=ldap -pkgconfig=no -functions_req=(ldap_init) -functions_opt= -probes_req=(ldap57) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/opendbx openscap-1.3.4/ac_probes/libs/opendbx --- openscap-1.2.17/ac_probes/libs/opendbx 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/opendbx 1969-12-31 19:00:00.000000000 -0500 @@ -1,6 +0,0 @@ -name=opendbx -pkgconfig=no -functions_req=(odbx_init) -functions_opt= -probes_req=(sql sql57) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/pcre openscap-1.3.4/ac_probes/libs/pcre --- openscap-1.2.17/ac_probes/libs/pcre 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/pcre 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=pcre -pkgconfig=yes -pkgconfig_name=libpcre -functions_req=(pcre_exec) -functions_opt= -probes_req=(textfilecontent54 textfilecontent partition) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/procps openscap-1.3.4/ac_probes/libs/procps --- openscap-1.2.17/ac_probes/libs/procps 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/procps 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=procps-ng -pkgconfig=yes -pkgconfig_name=libprocps -functions_req=(dev_to_tty) -functions_opt= -probes_req= -probes_opt=(process58 process) diff -Nru openscap-1.2.17/ac_probes/libs/rpm openscap-1.3.4/ac_probes/libs/rpm --- openscap-1.2.17/ac_probes/libs/rpm 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/rpm 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=rpm -pkgconfig=yes -pkgconfig_name=rpm -functions_req=(rpmtsCreate rpmReadConfigFiles) -functions_opt=(headerFormat headerSprintf rpmFreeCrypto rpmFreeFilesystems) -probes_req=(rpminfo rpmverify rpmverifyfile rpmverifypackage) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/selinux openscap-1.3.4/ac_probes/libs/selinux --- openscap-1.2.17/ac_probes/libs/selinux 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/selinux 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=selinux -pkgconfig=yes -pkgconfig_name=libselinux -functions_req=(security_get_boolean_names) -functions_opt= -probes_req=(process58 selinuxboolean selinuxsecuritycontext) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/xml2 openscap-1.3.4/ac_probes/libs/xml2 --- openscap-1.2.17/ac_probes/libs/xml2 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/xml2 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=xml2 -pkgconfig=yes -pkgconfig_name=libxml-2.0 -functions_req=(xmlTextReaderRead) -functions_opt= -probes_req=(xmlfilecontent) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/libs/xslt openscap-1.3.4/ac_probes/libs/xslt --- openscap-1.2.17/ac_probes/libs/xslt 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/libs/xslt 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -name=xslt -pkgconfig=yes -pkgconfig_name=libxslt -functions_req=(xsltDocumentFunction) -functions_opt= -probes_req=(xmlfilecontent) -probes_opt= diff -Nru openscap-1.2.17/ac_probes/README openscap-1.3.4/ac_probes/README --- openscap-1.2.17/ac_probes/README 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/ac_probes/README 1969-12-31 19:00:00.000000000 -0500 @@ -1,2 +0,0 @@ -run confgen.sh to generate configure.ac from the template - diff -Nru openscap-1.2.17/appveyor.yml openscap-1.3.4/appveyor.yml --- openscap-1.2.17/appveyor.yml 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/appveyor.yml 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,26 @@ +version: master-{build} +branches: + only: + - master + - maint-1.3 +image: Visual Studio 2017 +configuration: Release +clone_folder: c:\projects\openscap +install: +- cmd: vcpkg install curl libxml2 libxslt bzip2 pcre pthreads zlib getopt-win32 +cache: c:\tools\vcpkg\installed\ +before_build: +- cmd: >- + cd build + + cmake -DENABLE_PYTHON3=FALSE -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake .. +build: + project: c:\projects\openscap\build\openscap.sln + verbosity: minimal +after_build: + - cmd: cpack +artifacts: + - path: build\OpenSCAP*.msi + name: Windows Installer + - path: build\OpenSCAP*.msi.sha512 + name: SHA512 checksum diff -Nru openscap-1.2.17/AUTHORS openscap-1.3.4/AUTHORS --- openscap-1.2.17/AUTHORS 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/AUTHORS 2021-02-01 09:53:40.000000000 -0500 @@ -1,18 +1,28 @@ +Alexander Bergmann +Alexander Scheel +Axel Nennker Brady Alleman Brandon Dixon Brent Baude Brian Kolbay Bruno Ducrot +Bryan Schneiders +Carlos Matos Charles Bushong Chris Lundquist Dan Kopeček David Niemoller +De Huo +Dmitry Teselkin +DominiqueDevinci Ed Sealing Evgeni Golov +Evgeny Kolesnikov Felix Wolfsteller Fen Labalme Francisco Slavin -Gabe +Gabe Alford +Gabriel Gaspar Becker Gary Gapinski Gautam Satish Greg Elin @@ -28,45 +38,60 @@ Jonathan Zember Josh Kayse Joshua Adams +Julian Andres Klode Katarina Jankov Lenka Horáková Lukáš Kuklínek +Malte Kraus Marcus Meissner Marek Haičman Maroš Barabas Marshall Miller Martin Preisler Matěj Týč +matsushima Matthew Keeler Matus Marhefka -Michaël Zaoui +Michaël Zaoui Michal Šrubař mildew +Milan Lysonek Miloslav Trmač Miroslav Grepl Mooli Tayer +msfuko +Nitin Ravindran Ondrej Moriš +Panu Matilainen Peter Vrabec Petr Lautrbach Pierre Chifflier +pinkgothic +Prasanth R Quey-Liang Kao Radzy Radzykewycz Raphael Sanchez Prudencio Reggie Adkins Richard W.M. Jones Riley C. Porter +Robert Frohl Ryan E Haggerty +Sam S Wang Shawn Wells Šimon Lukašík Spencer Shimko Steve Grubb +Timothy Brackett +Tom Seewald Tomas Heinrich +T.O. Radzy Radzykewycz Trey Henefield V. Vinay Vincent Batts -Watson Sato +Vojtech Polasek Watson Yuuma Sato Wesley Ceraso Prudencio Xiang Zhai Zbyněk Moravec +Yoon Jean Kim Андрей Рудаков diff -Nru openscap-1.2.17/autogen.sh openscap-1.3.4/autogen.sh --- openscap-1.2.17/autogen.sh 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/autogen.sh 1969-12-31 19:00:00.000000000 -0500 @@ -1,4 +0,0 @@ -#!/bin/sh -mkdir -p m4 -autoreconf -i -s - diff -Nru openscap-1.2.17/cmake/Copyright.txt openscap-1.3.4/cmake/Copyright.txt --- openscap-1.2.17/cmake/Copyright.txt 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/Copyright.txt 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,57 @@ +CMake - Cross Platform Makefile Generator +Copyright 2000-2016 Kitware, Inc. +Copyright 2000-2011 Insight Software Consortium +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the names of Kitware, Inc., the Insight Software Consortium, + nor the names of their contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ + +The above copyright and license notice applies to distributions of +CMake in source and binary form. Some source files contain additional +notices of original copyright by their contributors; see each source +for details. Third-party software packages supplied with CMake under +compatible licenses provide their own copyright notices documented in +corresponding subdirectories. + +------------------------------------------------------------------------------ + +CMake was initially developed by Kitware with the following sponsorship: + + * National Library of Medicine at the National Institutes of Health + as part of the Insight Segmentation and Registration Toolkit (ITK). + + * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel + Visualization Initiative. + + * National Alliance for Medical Image Computing (NAMIC) is funded by the + National Institutes of Health through the NIH Roadmap for Medical Research, + Grant U54 EB005149. + + * Kitware, Inc. diff -Nru openscap-1.2.17/cmake/FindACL.cmake openscap-1.3.4/cmake/FindACL.cmake --- openscap-1.2.17/cmake/FindACL.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindACL.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find ACL +# Once done, this will define +# +# ACL_FOUND - system has ACL +# ACL_INCLUDE_DIRS - the ACL include directories +# ACL_LIBRARIES - link these to use ACL + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(ACL_PKGCONF libacl) + +# Include dir +find_path(ACL_INCLUDE_DIR + NAMES "acl/libacl.h" "sys/libacl.h" + PATHS ${ACL_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(ACL_LIBRARY + NAMES acl + PATHS ${ACL_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(ACL_PROCESS_INCLUDES ACL_INCLUDE_DIR) +set(ACL_PROCESS_LIBS ACL_LIBRARY) +libfind_process(ACL) diff -Nru openscap-1.2.17/cmake/FindAptPkg.cmake openscap-1.3.4/cmake/FindAptPkg.cmake --- openscap-1.2.17/cmake/FindAptPkg.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindAptPkg.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,30 @@ +# - Try to find the APTPKG development libraries +# Once done this will define +# +# APTPKG_FOUND - system has libapt-pkg +# APTPKG_INCLUDE_DIR - APTPKG include directory +# APTPKG_LIBRARIES - APTPKG (if found) library + +if(APTPKG_INCLUDE_DIR AND APTPKG_LIBRARIES) + # Already in cache, be silent + set(APTPKG_FIND_QUIETLY TRUE) +endif() + +find_path(APTPKG_INCLUDE_DIR apt-pkg/init.h) +find_library(APTPKG_LIBRARIES NAMES apt-pkg) + +if(APTPKG_INCLUDE_DIR AND APTPKG_LIBRARIES) + set(APTPKG_FOUND TRUE) +endif() + +if(APTPKG_FOUND) + if(NOT APTPKG_FIND_QUIETLY) + message(STATUS "Found apt-pkg: ${APTPKG_LIBRARIES}") + endif() +else() + if(AptPkg_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find AptPkg") + endif() +endif() + +mark_as_advanced(APTPKG_INCLUDE_DIR APTPKG_LIBRARIES) diff -Nru openscap-1.2.17/cmake/FindBlkid.cmake openscap-1.3.4/cmake/FindBlkid.cmake --- openscap-1.2.17/cmake/FindBlkid.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindBlkid.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find BLKID +# Once done, this will define +# +# BLKID_FOUND - system has BLKID +# BLKID_INCLUDE_DIRS - the BLKID include directories +# BLKID_LIBRARIES - link these to use BLKID + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(BLKID_PKGCONF popt) + +# Include dir +find_path(BLKID_INCLUDE_DIR + NAMES blkid/blkid.h + PATHS ${BLKID_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(BLKID_LIBRARY + NAMES blkid + PATHS ${BLKID_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(BLKID_PROCESS_INCLUDES BLKID_INCLUDE_DIR) +set(BLKID_PROCESS_LIBS BLKID_LIBRARY) +libfind_process(BLKID) diff -Nru openscap-1.2.17/cmake/FindCap.cmake openscap-1.3.4/cmake/FindCap.cmake --- openscap-1.2.17/cmake/FindCap.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindCap.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,30 @@ +# - Try to find the Cap development libraries +# Once done this will define +# +# CAP_FOUND - system has libcap-devel +# CAP_INCLUDE_DIR - cap include directory +# CAP_LIBRARIES - cap (if found) library + +if(CAP_INCLUDE_DIR AND CAP_LIBRARIES) + # Already in cache, be silent + set(CAP_FIND_QUIETLY TRUE) +endif() + +find_path(CAP_INCLUDE_DIR sys/capability.h) +find_library(CAP_LIBRARIES NAMES cap) + +if(CAP_INCLUDE_DIR AND CAP_LIBRARIES) + set(CAP_FOUND TRUE) +endif() + +if(CAP_FOUND) + if(NOT CAP_FIND_QUIETLY) + message(STATUS "Found Cap: ${CAP_LIBRARIES}") + endif() +else() + if(Cap_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find Cap") + endif() +endif() + +mark_as_advanced(CAP_INCLUDE_DIR CAP_LIBRARIES) diff -Nru openscap-1.2.17/cmake/FindDBus.cmake openscap-1.3.4/cmake/FindDBus.cmake --- openscap-1.2.17/cmake/FindDBus.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindDBus.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,61 @@ +# - Try to find DBus +# Once done, this will define +# +# DBUS_FOUND - system has DBus +# DBUS_INCLUDE_DIRS - the DBus include directories +# DBUS_LIBRARIES - link these to use DBus +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1) + +FIND_LIBRARY(DBUS_LIBRARIES + NAMES dbus-1 + HINTS ${PC_DBUS_LIBDIR} + ${PC_DBUS_LIBRARY_DIRS} +) + +FIND_PATH(DBUS_INCLUDE_DIR + NAMES dbus/dbus.h + HINTS ${PC_DBUS_INCLUDEDIR} + ${PC_DBUS_INCLUDE_DIRS} +) + +GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH) +FIND_PATH(DBUS_ARCH_INCLUDE_DIR + NAMES dbus/dbus-arch-deps.h + HINTS ${PC_DBUS_INCLUDEDIR} + ${PC_DBUS_INCLUDE_DIRS} + ${_DBUS_LIBRARY_DIR} + ${DBUS_INCLUDE_DIR} + PATH_SUFFIXES include +) + +SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) + +mark_as_advanced(DBUS_ARCH_INCLUDE_DIR DBUS_INCLUDE_DIRS DBUS_INCLUDE_DIR DBUS_LIBRARIES) diff -Nru openscap-1.2.17/cmake/FindGConf.cmake openscap-1.3.4/cmake/FindGConf.cmake --- openscap-1.2.17/cmake/FindGConf.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindGConf.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,37 @@ +# - Try to find GConf +# Once done, this will define +# +# GCONF_FOUND - system has GCONF +# GCONF_INCLUDE_DIRS - the GCONF include directories +# GCONF_LIBRARIES - link these to use GCONF + +include(LibFindMacros) + +# Dependencies +# The current package name (GCONF) is included as first paramater in order to foward the REQUIRED or QUIET paramaters +# to the find_package for the dependent library (ie Threads) +libfind_package(GCONF GLib) +libfind_package(GCONF GObject) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(GCONF_PKGCONF gconf-2.0) + +# Include dir +find_path(GCONF_INCLUDE_DIR + NAMES gconf/gconf.h + HINTS ${GCONF_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(GCONF_LIBRARY + NAMES gconf-2 + HINTS ${GCONF_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(GCONF_PROCESS_INCLUDES GCONF_INCLUDE_DIR GLib_INCLUDE_DIRS GObject_INCLUDE_DIRS) +set(GCONF_PROCESS_LIBS GCONF_LIBRARY GLib_LIBRARIES GObject_LIBRARIES) +libfind_process(GCONF) + +mark_as_advanced(GLib_DIR GObject_DIR) diff -Nru openscap-1.2.17/cmake/FindGCrypt.cmake openscap-1.3.4/cmake/FindGCrypt.cmake --- openscap-1.2.17/cmake/FindGCrypt.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindGCrypt.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,70 @@ +# - Try to find GCrypt +# Once done this will define +# +# GCRYPT_FOUND - system has GCrypt +# GCRYPT_INCLUDE_DIRS - the GCrypt include directory +# GCRYPT_LIBRARIES - Link these to use GCrypt +# GCRYPT_DEFINITIONS - Compiler switches required for using GCrypt +# +#============================================================================= +# Copyright (c) 2009-2011 Andreas Schneider +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# + +if (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS) + # in cache already + # set(GCRYPT_FOUND TRUE) +else (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS) + + set(_GCRYPT_ROOT_PATHS + "$ENV{PROGRAMFILES}/libgcrypt" + ) + + find_path(GCRYPT_ROOT_DIR + NAMES + include/gcrypt.h + PATHS + ${_GCRYPT_ROOT_PATHS} + ) + mark_as_advanced(ZLIB_ROOT_DIR) + + find_path(GCRYPT_INCLUDE_DIR + NAMES + gcrypt.h + PATHS + /usr/local/include + /opt/local/include + /sw/include + /usr/lib/sfw/include + ${GCRYPT_ROOT_DIR}/include + ) + set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR}) + + find_library(GCRYPT_LIBRARY + NAMES + gcrypt + gcrypt11 + libgcrypt-11 + PATHS + /opt/local/lib + /sw/lib + /usr/sfw/lib/64 + /usr/sfw/lib + ${GCRYPT_ROOT_DIR}/lib + ) + set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(GCrypt DEFAULT_MSG GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS) + + # show the GCRYPT_INCLUDE_DIRS and GCRYPT_LIBRARIES variables only in the advanced view + mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR GCRYPT_LIBRARY GCRYPT_ROOT_DIR) + +endif (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS) diff -Nru openscap-1.2.17/cmake/FindGLib.cmake openscap-1.3.4/cmake/FindGLib.cmake --- openscap-1.2.17/cmake/FindGLib.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindGLib.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,38 @@ +# - Try to find +# Once done, this will define +# +# GLib_FOUND - system has GLib +# GLib_INCLUDE_DIRS - the GLib include directories +# GLib_LIBRARIES - link these to use GLib + +include(LibFindMacros) + +# Dependencies +# The current package name (GLib) is included as first paramater in order to foward the REQUIRED or QUIET paramaters +# to the find_package for the dependent library (ie Threads) +#libfind_package(GLib) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(GLib_PKGCONF glib-2.0) + +# Include dir +find_path(GLib_INCLUDE_DIR + NAMES glib.h + HINTS ${GLib_PKGCONF_INCLUDE_DIRS} +) +# glibconfig.h is located in a different directory, so include it here +find_path(GLibconfig_INCLUDE_DIR + NAMES glibconfig.h + HINTS ${GLib_PKGCONF_INCLUDE_DIRS}) + +# Finally the library itself +find_library(GLib_LIBRARY + NAMES glib-2.0 + HINTS ${GLib_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(GLib_PROCESS_INCLUDES GLib_INCLUDE_DIR GLibconfig_INCLUDE_DIR) +set(GLib_PROCESS_LIBS GLib_LIBRARY) +libfind_process(GLib) diff -Nru openscap-1.2.17/cmake/FindGObject.cmake openscap-1.3.4/cmake/FindGObject.cmake --- openscap-1.2.17/cmake/FindGObject.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindGObject.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,34 @@ +# - Try to find GObject +# Once done, this will define +# +# GObject_FOUND - system has GObject +# GObject_INCLUDE_DIRS - the GObject include directories +# GObject_LIBRARIES - link these to use GObject + +include(LibFindMacros) + +# Dependencies +# The current package name (GObject) is included as first paramater in order to foward the REQUIRED or QUIET paramaters +# to the find_package for the dependent library (ie Threads) +#libfind_package(GObject) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(GObject_PKGCONF gobject-2.0) + +# Include dir +find_path(GObject_INCLUDE_DIR + NAMES gobject/gobject.h + HINTS ${GObject_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(GObject_LIBRARY + NAMES gobject-2.0 + HINTS ${GObject_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(GObject_PROCESS_INCLUDES GObject_INCLUDE_DIR ) +set(GObject_PROCESS_LIBS GObject_LIBRARY) +libfind_process(GObject) diff -Nru openscap-1.2.17/cmake/FindLdap.cmake openscap-1.3.4/cmake/FindLdap.cmake --- openscap-1.2.17/cmake/FindLdap.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindLdap.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,35 @@ +# - Try to find the LDAP client libraries +# Once done this will define +# +# LDAP_FOUND - system has libldap +# LDAP_INCLUDE_DIRS - the ldap include directory +# LDAP_LIBRARIES - libldap + liblber (if found) library +# LBER_LIBRARIES - liblber library + +if(LDAP_INCLUDE_DIRS AND LDAP_LIBRARIES) + # Already in cache, be silent + set(Ldap_FIND_QUIETLY TRUE) +endif() + +FIND_PATH(LDAP_INCLUDE_DIRS ldap.h) +FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap) +FIND_LIBRARY(LBER_LIBRARIES NAMES lber) + +if(LDAP_INCLUDE_DIRS AND LDAP_LIBRARIES) + set(LDAP_FOUND TRUE) + if(LBER_LIBRARIES) + set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES}) + endif() +endif() + +if(LDAP_FOUND) + if(NOT Ldap_FIND_QUIETLY) + message(STATUS "Found ldap: ${LDAP_LIBRARIES}") + endif() +else() + if(Ldap_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find ldap") + endif() +endif() + +MARK_AS_ADVANCED(LDAP_INCLUDE_DIRS LDAP_LIBRARIES LBER_LIBRARIES) diff -Nru openscap-1.2.17/cmake/FindLibyaml.cmake openscap-1.3.4/cmake/FindLibyaml.cmake --- openscap-1.2.17/cmake/FindLibyaml.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindLibyaml.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find libyaml +# Once done, this will define +# +# LIBYAML_FOUND - system has libyaml +# LIBYAML_INCLUDE_DIRS - the libyaml include directories +# LIBYAML_LIBRARIES - link these to use libyaml + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(LIBYAML_PKGCONF yaml-0.1) + +# Include dir +find_path(LIBYAML_INCLUDE_DIR + NAMES yaml.h + PATHS ${LIBYAML_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(LIBYAML_LIBRARY + NAMES libyaml.so + PATHS ${LIBYAML_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(LIBYAML_PROCESS_INCLUDES LIBYAML_INCLUDE_DIR) +set(LIBYAML_PROCESS_LIBS LIBYAML_LIBRARY) +libfind_process(LIBYAML) diff -Nru openscap-1.2.17/cmake/FindNSS.cmake openscap-1.3.4/cmake/FindNSS.cmake --- openscap-1.2.17/cmake/FindNSS.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindNSS.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,57 @@ +# - Try to find the NSS library +# Once done this will define +# +# NSS_FOUND - system has the NSS library +# NSS_INCLUDE_DIRS - Include paths needed +# NSS_LIBRARY_DIRS - Linker paths needed +# NSS_LIBRARIES - Libraries needed + +# Copyright (c) 2010, Ambroz Bizjak, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +include(FindLibraryWithDebug) + +if (NSS_LIBRARIES) + set(NSS_FIND_QUIETLY TRUE) +endif () + +set(NSS_FOUND FALSE) + +if (WIN32) + find_path(NSS_FIND_INCLUDE_DIR nss.h) + + FIND_LIBRARY_WITH_DEBUG(NSS_FIND_LIBRARIES_SSL WIN32_DEBUG_POSTFIX d NAMES ssl3) + FIND_LIBRARY_WITH_DEBUG(NSS_FIND_LIBRARIES_SMIME WIN32_DEBUG_POSTFIX d NAMES smime3) + FIND_LIBRARY_WITH_DEBUG(NSS_FIND_LIBRARIES_NSS WIN32_DEBUG_POSTFIX d NAMES nss3) + + if (NSS_FIND_INCLUDE_DIR AND NSS_FIND_LIBRARIES_SSL AND NSS_FIND_LIBRARIES_SMIME AND NSS_FIND_LIBRARIES_NSS) + set(NSS_FOUND TRUE) + set(NSS_INCLUDE_DIRS "${NSS_FIND_INCLUDE_DIR}" CACHE STRING "NSS include dirs") + set(NSS_LIBRARY_DIRS "" CACHE STRING "NSS library dirs") + set(NSS_LIBRARIES "${NSS_FIND_LIBRARIES_SSL};${NSS_FIND_LIBRARIES_SMIME};${NSS_FIND_LIBRARIES_NSS}" CACHE STRING "NSS libraries") + endif () +else () + find_package(PkgConfig REQUIRED) + pkg_check_modules(NSS_PC nss) + + if (NSS_PC_FOUND) + set(NSS_FOUND TRUE) + set(NSS_INCLUDE_DIRS "${NSS_PC_INCLUDE_DIRS}" CACHE STRING "NSS include dirs") + set(NSS_LIBRARY_DIRS "${NSS_PC_LIBRARY_DIRS}" CACHE STRING "NSS library dirs") + set(NSS_LIBRARIES "${NSS_PC_LIBRARIES}" CACHE STRING "NSS libraries") + endif () +endif () + +if (NSS_FOUND) + if (NOT NSS_FIND_QUIETLY) + message(STATUS "Found NSS: ${NSS_INCLUDE_DIRS} ${NSS_LIBRARY_DIRS} ${NSS_LIBRARIES}") + endif () +else () + if (NSS_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find NSS") + endif () +endif () + +mark_as_advanced(NSS_INCLUDE_DIRS NSS_LIBRARY_DIRS NSS_LIBRARIES) diff -Nru openscap-1.2.17/cmake/FindOpenDbx.cmake openscap-1.3.4/cmake/FindOpenDbx.cmake --- openscap-1.2.17/cmake/FindOpenDbx.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindOpenDbx.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find the OpenDbx development libraries +# Once done this will define +# +# OPENDBX_FOUND - system has opendbx-devel +# OPENDBX_INCLUDE_DIR - opendbx include directory +# OPENDBX_LIBRARIES - opendbx (if found) library + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(OPENDBX_PKGCONF opendbx) + +# Include dir +find_path(OPENDBX_INCLUDE_DIR + NAMES opendbx/api.h + PATHS ${OPENDBX_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(OPENDBX_LIBRARY + NAMES opendbx + PATHS ${OPENDBX_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(OPENDBX_PROCESS_INCLUDES OPENDBX_INCLUDE_DIR) +set(OPENDBX_PROCESS_LIBS OPENDBX_LIBRARY) +libfind_process(OPENDBX) diff -Nru openscap-1.2.17/cmake/FindPCRE.cmake openscap-1.3.4/cmake/FindPCRE.cmake --- openscap-1.2.17/cmake/FindPCRE.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindPCRE.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,37 @@ +# Copyright (C) 2007-2009 LuaDist. +# Created by Peter Kapec +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the COPYRIGHT file distributed with LuaDist. +# Note: +# Searching headers and libraries is very simple and is NOT as powerful as scripts +# distributed with CMake, because LuaDist defines directories to search for. +# Everyone is encouraged to contact the author with improvements. Maybe this file +# becomes part of CMake distribution sometimes. + +# - Find pcre +# Find the native PCRE headers and libraries. +# +# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. +# PCRE_LIBRARIES - List of libraries when using pcre. +# PCRE_FOUND - True if pcre found. + +# Look for the header file. +FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h) + +# Look for the library. +FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) + +# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(PCRE_FOUND) + SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) + SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) +ELSE(PCRE_FOUND) + SET(PCRE_LIBRARIES) + SET(PCRE_INCLUDE_DIRS) +ENDIF(PCRE_FOUND) + +MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES PCRE_INCLUDE_DIR PCRE_LIBRARY) diff -Nru openscap-1.2.17/cmake/FindPopt.cmake openscap-1.3.4/cmake/FindPopt.cmake --- openscap-1.2.17/cmake/FindPopt.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindPopt.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find POPT +# Once done, this will define +# +# POPT_FOUND - system has POPT +# POPT_INCLUDE_DIRS - the POPT include directories +# POPT_LIBRARIES - link these to use POPT + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(POPT_PKGCONF popt) + +# Include dir +find_path(POPT_INCLUDE_DIR + NAMES popt.h + PATHS ${POPT_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(POPT_LIBRARY + NAMES popt + PATHS ${POPT_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(POPT_PROCESS_INCLUDES POPT_INCLUDE_DIR) +set(POPT_PROCESS_LIBS POPT_LIBRARY) +libfind_process(POPT) diff -Nru openscap-1.2.17/cmake/FindProcps.cmake openscap-1.3.4/cmake/FindProcps.cmake --- openscap-1.2.17/cmake/FindProcps.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindProcps.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find PROCPS +# Once done, this will define +# +# PROCPS_FOUND - system has PROCPS +# PROCPS_INCLUDE_DIRS - the PROCPS include directories +# PROCPS_LIBRARIES - link these to use PROCPS + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(PROCPS_PKGCONF libprocps) + +# Include dir +find_path(PROCPS_INCLUDE_DIR + NAMES proc/procps.h + PATHS ${PROCPS_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(PROCPS_LIBRARY + NAMES procps + PATHS ${PROCPS_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(PROCPS_PROCESS_INCLUDES PROCPS_INCLUDE_DIR) +set(PROCPS_PROCESS_LIBS PROCPS_LIBRARY) +libfind_process(PROCPS) diff -Nru openscap-1.2.17/cmake/FindRPM.cmake openscap-1.3.4/cmake/FindRPM.cmake --- openscap-1.2.17/cmake/FindRPM.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindRPM.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,39 @@ +# - Try to find RPM +# Once done, this will define +# +# RPM_FOUND - system has RPM +# RPM_INCLUDE_DIRS - the RPM include directories +# RPM_LIBRARIES - link these to use RPM + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(RPM_PKGCONF rpm) + +# Include dir +find_path(RPM_INCLUDE_DIR + NAMES rpm + PATHS ${RPM_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(RPM_LIBRARY + NAMES rpm + PATHS ${RPM_PKGCONF_LIBRARY_DIRS} +) +find_library(RPMIO_LIBRARY + NAMES rpmio + PATHS ${RPM_PKGCONF_LIBRARY_DIRS} +) + +set(RPM_VERSION ${RPM_PKGCONF_VERSION}) +if(RPM_VERSION) + string(COMPARE GREATER "4.6" ${RPM_VERSION} RPM46_FOUND) + string(COMPARE GREATER "4.7" ${RPM_VERSION} RPM47_FOUND) +endif() + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(RPM_PROCESS_INCLUDES RPM_INCLUDE_DIR) +set(RPM_PROCESS_LIBS RPM_LIBRARY RPMIO_LIBRARY) +libfind_process(RPM) diff -Nru openscap-1.2.17/cmake/FindSELinux.cmake openscap-1.3.4/cmake/FindSELinux.cmake --- openscap-1.2.17/cmake/FindSELinux.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/FindSELinux.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,29 @@ +# - Try to find SELinux +# Once done, this will define +# +# SELINUX_FOUND - system has SELinux +# SELINUX_INCLUDE_DIRS - the SELinux include directories +# SELINUX_LIBRARIES - link these to use SELinux + +include(LibFindMacros) + +# Use pkg-config to get hints about paths +libfind_pkg_check_modules(SELINUX_PKGCONF libselinux) + +# Include dir +find_path(SELINUX_INCLUDE_DIR + NAMES selinux/selinux.h + PATHS ${SELINUX_PKGCONF_INCLUDE_DIRS} +) + +# Finally the library itself +find_library(SELINUX_LIBRARY + NAMES selinux + PATHS ${SELINUX_PKGCONF_LIBRARY_DIRS} +) + +# Set the include dir variables and the libraries and let libfind_process do the rest. +# NOTE: Singular variables for this library, plural for libraries this this lib depends on. +set(SELINUX_PROCESS_INCLUDES SELINUX_INCLUDE_DIR) +set(SELINUX_PROCESS_LIBS SELINUX_LIBRARY) +libfind_process(SELINUX) diff -Nru openscap-1.2.17/cmake/LibFindMacros.cmake openscap-1.3.4/cmake/LibFindMacros.cmake --- openscap-1.2.17/cmake/LibFindMacros.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cmake/LibFindMacros.cmake 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,99 @@ +# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments +# used for the current package. For this to work, the first parameter must be the +# prefix of the current package, then the prefix of the new package etc, which are +# passed to find_package. +macro (libfind_package PREFIX) + set (LIBFIND_PACKAGE_ARGS ${ARGN}) + if (${PREFIX}_FIND_QUIETLY) + set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) + endif (${PREFIX}_FIND_QUIETLY) + if (${PREFIX}_FIND_REQUIRED) + set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) + endif (${PREFIX}_FIND_REQUIRED) + find_package(${LIBFIND_PACKAGE_ARGS}) +endmacro (libfind_package) + +# CMake developers made the UsePkgConfig system deprecated in the same release (2.6) +# where they added pkg_check_modules. Consequently I need to support both in my scripts +# to avoid those deprecated warnings. Here's a helper that does just that. +# Works identically to pkg_check_modules, except that no checks are needed prior to use. +macro (libfind_pkg_check_modules PREFIX PKGNAME) + if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + include(UsePkgConfig) + pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) + else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(${PREFIX} ${PKGNAME}) + endif (PKG_CONFIG_FOUND) + endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) +endmacro (libfind_pkg_check_modules) + +# Do the final processing once the paths have been detected. +# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain +# all the variables, each of which contain one include directory. +# Ditto for ${PREFIX}_PROCESS_LIBS and library files. +# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. +# Also handles errors in case library detection was required, etc. +macro (libfind_process PREFIX) + # Skip processing if already processed during this run + if (NOT ${PREFIX}_FOUND) + # Start with the assumption that the library was found + set (${PREFIX}_FOUND TRUE) + + # Process all includes and set _FOUND to false if any are missing + foreach (i ${${PREFIX}_PROCESS_INCLUDES}) + if (${i}) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) + mark_as_advanced(${i}) + else (${i}) + set (${PREFIX}_FOUND FALSE) + endif (${i}) + endforeach (i) + + # Process all libraries and set _FOUND to false if any are missing + foreach (i ${${PREFIX}_PROCESS_LIBS}) + if (${i}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) + mark_as_advanced(${i}) + else (${i}) + set (${PREFIX}_FOUND FALSE) + endif (${i}) + endforeach (i) + + # Print message and/or exit on fatal error + if (${PREFIX}_FOUND) + if (NOT ${PREFIX}_FIND_QUIETLY) + message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") + endif (NOT ${PREFIX}_FIND_QUIETLY) + else (${PREFIX}_FOUND) + if (${PREFIX}_FIND_REQUIRED) + foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) + message("${i}=${${i}}") + endforeach (i) + message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") + endif (${PREFIX}_FIND_REQUIRED) + endif (${PREFIX}_FOUND) + endif (NOT ${PREFIX}_FOUND) +endmacro (libfind_process) + +macro(libfind_library PREFIX basename) + set(TMP "") + if(MSVC80) + set(TMP -vc80) + endif(MSVC80) + if(MSVC90) + set(TMP -vc90) + endif(MSVC90) + set(${PREFIX}_LIBNAMES ${basename}${TMP}) + if(${ARGC} GREATER 2) + set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) + string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) + set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) + endif(${ARGC} GREATER 2) + find_library(${PREFIX}_LIBRARY + NAMES ${${PREFIX}_LIBNAMES} + PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} + ) +endmacro(libfind_library) + diff -Nru openscap-1.2.17/CMakeLists.txt openscap-1.3.4/CMakeLists.txt --- openscap-1.2.17/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/CMakeLists.txt 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,650 @@ +cmake_minimum_required(VERSION 2.6) + +# Inspired and referenced from https://blog.kitware.com/cmake-and-the-default-build-type +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +project("openscap") +set(OPENSCAP_VERSION_MAJOR "1") +set(OPENSCAP_VERSION_MINOR "3") +set(OPENSCAP_VERSION_PATCH "4") + +if(OPENSCAP_VERSION_SUFFIX) + set(OPENSCAP_VERSION "${OPENSCAP_VERSION_MAJOR}.${OPENSCAP_VERSION_MINOR}.${OPENSCAP_VERSION_PATCH}_${OPENSCAP_VERSION_SUFFIX}") +else() + set(OPENSCAP_VERSION "${OPENSCAP_VERSION_MAJOR}.${OPENSCAP_VERSION_MINOR}.${OPENSCAP_VERSION_PATCH}") +endif() + +# libtool versioning +# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details + +## increment if the interface has additions, changes, removals. +set(LT_CURRENT 28) + +## increment any time the source changes; set 0 to if you increment CURRENT +set(LT_REVISION 0) + +## increment if any interfaces have been added; set to 0 +## if any interfaces have been changed or removed. removal has +## precedence over adding, so set to 0 if both happened. +set(LT_AGE 3) + +math(EXPR LT_CURRENT_MINUS_AGE "${LT_CURRENT} - ${LT_AGE}") + +set(SONAME ${LT_CURRENT_MINUS_AGE}.${LT_AGE}.${LT_REVISION}) +set(SOVERSION ${LT_CURRENT_MINUS_AGE}) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") + +message(STATUS "OpenSCAP ${OPENSCAP_VERSION}") +message(STATUS "(see ${CMAKE_SOURCE_DIR}/docs/developer/developer.adoc for build instructions)") +message(STATUS " ") + +# Strictly speaking in-source will work but will be very messy, let's +# discourage our users from using them +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "In-source builds are not supported! Please use out of source builds:\n" + "$ cd openscap\n" + "$ rm CMakeCache.txt\n" + "$ cd build\n" + "$ cmake ../\n" + "$ make -j4" + ) +endif() + +# In Microsoft Visual Studio, store built binaries to a single directory. +# We need to build all the binaries in a single directory on Windows, because +# vcpkg tool fails to fetch dependent DLLs (libxml, libcurl, etc.) if +# oscap.exe is build to a different directory than openscap.dll. +# See the discussion in https://github.com/Microsoft/vcpkg/issues/1002 +if(MSVC) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +# ---------- INCLUDES CMAKE MODULES + +include(GNUInstallDirs) +include(FindPkgConfig) +include(CheckLibraryExists) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckIncludeFiles) +include(CheckCSourceCompiles) +include(CMakeDependentOption) + +# ---------- DEPENDENCIES + +find_package(ACL) +if(ACL_FOUND) + check_library_exists("${ACL_LIBRARY}" acl_extended_file "" HAVE_ACL_EXTENDED_FILE) + check_include_file(acl/libacl.h HAVE_ACL_LIBACL_H) + check_include_file(sys/acl.h HAVE_SYS_ACL_H) +endif() + +find_package(AptPkg) + +find_package(Blkid) +if(BLKID_FOUND) + check_library_exists("${BLKID_LIBRARY}" blkid_get_tag_value "" HAVE_BLKID_GET_TAG_VALUE) +endif() + +find_package(Cap) +if(CAP_FOUND) + check_library_exists("${CAP_LIBRARIES}" cap_get_pid "" HAVE_CAP_GET_PID) +endif() + +find_package(CURL) +find_package(DBus) +find_package(Doxygen) +find_package(GConf) +find_package(Ldap) +find_package(OpenDbx) +find_package(PCRE REQUIRED) +find_package(PerlLibs) +find_package(Popt) + +find_package(Procps) +if(PROCPS_FOUND) + check_library_exists("${PROCPS_LIBRARY}" dev_to_tty "" HAVE_DEV_TO_TTY) + check_include_file(proc/devname.h HAVE_PROC_DEVNAME_H) +endif() + +# According to CMake documentation: +# https://cmake.org/cmake/help/latest/module/FindPythonInterp.html +# If calling both find_package(PythonInterp) and find_package(PythonLibs), +# call find_package(PythonInterp) first to get the currently active Python +# version by default with a consistent version of PYTHON_LIBRARIES. +find_package(PythonInterp 3) +find_package(PythonLibs 3) + +set(PREFERRED_PYTHON_PATH "${PYTHON_EXECUTABLE}") +set(PYTHON3_PATH "${PYTHON_EXECUTABLE}") + +find_package(RPM) +if(RPM_FOUND) + check_library_exists("${RPM_LIBRARY}" rpmReadConfigFiles "" HAVE_RPMREADCONFIGFILES) + check_library_exists("${RPM_LIBRARY}" headerFormat "" HAVE_HEADERFORMAT) + check_library_exists("${RPMIO_LIBRARY}" rpmFreeCrypto "" HAVE_RPMFREECRYPTO) + check_library_exists("${RPM_LIBRARY}" rpmFreeFilesystems "" HAVE_RPMFREEFILESYSTEMS) + check_library_exists("${RPM_LIBRARY}" rpmVerifyFile "" HAVE_RPMVERIFYFILE) + set(HAVE_RPMVERCMP 1) +endif() + +find_package(SELinux) +find_package(SWIG) +find_package(LibXml2 REQUIRED) +find_package(LibXslt REQUIRED) +find_package(BZip2) + +# PThread +if (WIN32) + find_package(ZLIB REQUIRED) +endif() + +if (WIN32 AND NOT MINGW) + find_package(pthread CONFIG REQUIRED) + set(CMAKE_THREAD_LIBS_INIT ${PThreads4W_LIBRARY}) +else() + find_package(Threads REQUIRED) +endif() +set(CMAKE_THREAD_PREFER_PTHREAD) +set(THREADS_PREFER_PTHREAD_FLAG) +set(THREADS_USE_PTHREADS_WIN32 TRUE) +check_library_exists(pthread pthread_timedjoin_np "" HAVE_PTHREAD_TIMEDJOIN_NP) +check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP) +check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP) + +# WITH_CRYPTO +set(WITH_CRYPTO "gcrypt" CACHE STRING "gcrypt|nss3") +if(NOT (${WITH_CRYPTO} EQUAL "nss3")) + # gcrypt + find_package(GCrypt) +else() + # nss3 + find_package(NSS) +endif() +if(GCRYPT_FOUND OR NSS_FOUND) + set(CRYPTO_FOUND TRUE) +endif() + +find_package(Libyaml) +if(EXISTS ${CMAKE_SOURCE_DIR}/yaml-filter/CMakeLists.txt) + message(STATUS "yaml-filter was found") + set(YAML_FILTER_FOUND TRUE) +else() + message(STATUS "yaml-filter was not found") + set(YAML_FILTER_FOUND FALSE) +endif() + +check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) +check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) +check_function_exists(memalign HAVE_MEMALIGN) +check_function_exists(fts_open HAVE_FTS_OPEN) +check_function_exists(strsep HAVE_STRSEP) +check_function_exists(strptime HAVE_STRPTIME) + +check_include_file(syslog.h HAVE_SYSLOG_H) +check_include_file(stdio_ext.h HAVE_STDIO_EXT_H) +check_include_file(shadow.h HAVE_SHADOW_H) +check_include_file(sys/systeminfo.h HAVE_SYS_SYSTEMINFO_H) +check_include_file(getopt.h HAVE_GETOPT_H) +check_include_file(sys/mman.h HAVE_MMAN_H) +check_include_file(sys/uio.h HAVE_UIO_H) +check_include_file(sys/xattr.h HAVE_SYS_XATTR_H) +check_include_file(attr/xattr.h HAVE_ATTR_XATTR_H) +check_include_files("sys/types.h;sys/extattr.h" HAVE_SYS_EXTATTR_H) + +# HAVE_ATOMIC_BUILTINS +check_c_source_compiles("#include \nint main() {uint16_t foovar=0; uint16_t old=1; uint16_t new=2;__sync_bool_compare_and_swap(&foovar,old,new); return __sync_fetch_and_add(&foovar, 1); __sync_fetch_and_add(&foovar, 1);}" HAVE_ATOMIC_BUILTINS) +if(NOT HAVE_ATOMIC_BUILTINS) + message(WARNING "!!! Compiler does not support atomic builtins. Atomic operation will be emulated using mutex-based locking. !!!") +endif() + +mark_as_advanced(ENV_PRESENT VALGRIND_PRESENT) +find_program(ENV_PRESENT env) +find_program(VALGRIND_PRESENT valgrind) +find_program(ASCIIDOC_EXECUTABLE asciidoc) +find_program(SED_EXECUTABLE sed) +find_program(GIT_EXECUTABLE git) + +# ---------- CORE FEATURE SWITCHES +if(WIN32 OR APPLE) + option(ENABLE_SCE "enables Script Check Engine - an alternative checking engine that lets you use executables instead of OVAL for checks" OFF) +else() + option(ENABLE_SCE "enables Script Check Engine - an alternative checking engine that lets you use executables instead of OVAL for checks" ON) +endif() + +# ---------- OVAL FEATURE SWITCHES + +option(ENABLE_PROBES "build OVAL probes - each probe implements an OVAL test" TRUE) +set(SEAP_MSGID_BITS 32 CACHE STRING "Size of SEAP_msgid_t in bits [32|64]") +cmake_dependent_option(ENABLE_PROBES_INDEPENDENT "build OVAL probes for independent (cross platform) OVAL tests" ON "ENABLE_PROBES" OFF) +# On some platforms (Windows..) UNIX ends up being empty instead of "false" +set(IS_UNIX FALSE) +if (UNIX) + set(IS_UNIX TRUE) +endif() +cmake_dependent_option(ENABLE_PROBES_UNIX "build OVAL probes for the UNIX OVAL tests" ${IS_UNIX} "ENABLE_PROBES" OFF) +string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "Linux" IS_LINUX) +cmake_dependent_option(ENABLE_PROBES_LINUX "build OVAL probes for the Linux OVAL tests" ${IS_LINUX} "ENABLE_PROBES" OFF) +string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "Solaris" IS_SOLARIS) +cmake_dependent_option(ENABLE_PROBES_SOLARIS "build OVAL probes for the Solaris OVAL tests" ${IS_SOLARIS} "ENABLE_PROBES" OFF) +set(IS_WIN32 FALSE) +if (WIN32) + set(IS_WIN32 TRUE) +endif() +cmake_dependent_option(ENABLE_PROBES_WINDOWS "build OVAL probes for the Windows OVAL tests" ${IS_WIN32} "ENABLE_PROBES" OFF) + +# INDEPENDENT PROBES +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE "Independent environmentvariable probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE58 "Independent environmentvariable58 probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_FAMILY "Independent family probe" ON "ENABLE_PROBES_INDEPENDENT" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_FILEHASH "Independent filehash probe" ON "ENABLE_PROBES_INDEPENDENT; CRYPTO_FOUND; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_FILEHASH58 "Independent filehash58 probe" ON "ENABLE_PROBES_INDEPENDENT; CRYPTO_FOUND; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_SQL "Independent sql probe" ON "ENABLE_PROBES_INDEPENDENT; OPENDBX_FOUND; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_SQL57 "Independent sql57 probe" ON "ENABLE_PROBES_INDEPENDENT; OPENDBX_FOUND; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_SYSTEM_INFO "Independent system info probe" ON "ENABLE_PROBES_INDEPENDENT" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT "Independent textfilecontent probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54 "Independent textfilecontent54 probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_VARIABLE "Independent variable probe" ON "ENABLE_PROBES_INDEPENDENT" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT "Independent xmlfilecontent probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF) +cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT "Independent yamlfilecontent probe" ON "ENABLE_PROBES_INDEPENDENT; LIBYAML_FOUND; YAML_FILTER_FOUND; NOT WIN32" OFF) + +# UNIX PROBES +cmake_dependent_option(OPENSCAP_PROBE_UNIX_DNSCACHE "Unix dnscache probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_FILE "Unix file probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_FILEEXTENDEDATTRIBUTE "Unix fileextendedattribute probe" ON "ENABLE_PROBES_UNIX; HAVE_SYS_XATTR_H OR HAVE_ATTR_XATTR_H OR HAVE_SYS_EXTATTR_H" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_GCONF "Unix gconf probe" ON "ENABLE_PROBES_UNIX; GCONF_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_INTERFACE "Unix interface probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_PASSWORD "Unix password probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_PROCESS "Unix process probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_PROCESS58 "Unix process58 probe" ON "ENABLE_PROBES_UNIX; CAP_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_ROUTINGTABLE "Unix routingtable probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_RUNLEVEL "Unix runlevel probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_SHADOW "Unix shadow probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_SYMLINK "Unix symlink probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_SYSCTL "Unix sysctl probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_UNAME "Unix uname probe" ON "ENABLE_PROBES_UNIX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_UNIX_XINETD "Unix xinetd probe" ON "ENABLE_PROBES_UNIX" OFF) + +# LINUX PROBES +cmake_dependent_option(OPENSCAP_PROBE_LINUX_DPKGINFO "Linux dpkginfo probe" ON "ENABLE_PROBES_LINUX; APTPKG_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_IFLISTENERS "Linux iflisteners probe" ON "ENABLE_PROBES_LINUX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_INETLISTENINGSERVERS "Linux inetlisteningservers probe" ON "ENABLE_PROBES_LINUX" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_PARTITION "Linux partition probe" ON "ENABLE_PROBES_LINUX; BLKID_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_RPMINFO "Linux rpminfo probe" ON "ENABLE_PROBES_LINUX; RPM_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_RPMVERIFY "Linux rpmverify probe" ON "ENABLE_PROBES_LINUX; RPM_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_RPMVERIFYFILE "Linux rpmverifyfile probe" ON "ENABLE_PROBES_LINUX; RPM_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_RPMVERIFYPACKAGE "Linux rpmverifypackage probe" ON "ENABLE_PROBES_LINUX; RPM_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_SELINUXBOOLEAN "Linux selinuxboolean probe" ON "ENABLE_PROBES_LINUX; SELINUX_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_SELINUXSECURITYCONTEXT "Linux selinuxsecuritycontext probe" ON "ENABLE_PROBES_LINUX; SELINUX_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_SYSTEMDUNITDEPENDENCY "Linux systemdunitdependency probe" ON "ENABLE_PROBES_LINUX; DBUS_FOUND" OFF) +cmake_dependent_option(OPENSCAP_PROBE_LINUX_SYSTEMDUNITPROPERTY "Linux systemdunitproperty probe" ON "ENABLE_PROBES_LINUX; DBUS_FOUND" OFF) + +# SOLARIS PROBES +cmake_dependent_option(OPENSCAP_PROBE_SOLARIS_ISAINFO "Solaris isainfo probe" ON "ENABLE_PROBES_SOLARIS" OFF) + +# WINDOWS PROBES +cmake_dependent_option(OPENSCAP_PROBE_WINDOWS_ACCESSTOKEN "Windows accesstoken probe" ON "ENABLE_PROBES_WINDOWS" OFF) +cmake_dependent_option(OPENSCAP_PROBE_WINDOWS_REGISTRY "Windows registry probe" ON "ENABLE_PROBES_WINDOWS" OFF) +cmake_dependent_option(OPENSCAP_PROBE_WINDOWS_WMI57 "Windows wmi57 probe" ON "ENABLE_PROBES_WINDOWS" OFF) + + +# ---------- EXECUTABLES / UTILITIES SWITCHES + +option(ENABLE_OSCAP_UTIL "build the oscap utility, oscap is the core utility for evaluation and processing of SCAP data" TRUE) + +set(OSCAP_DOCKER_PYTHON ${PYTHON_EXECUTABLE} CACHE STRING "path to the Python interpreter for oscap-docker") +cmake_dependent_option(ENABLE_OSCAP_UTIL_DOCKER "enables the oscap-docker utility, this lets you scan containers and container images" ON "NOT WIN32" OFF) +if(ENABLE_OSCAP_UTIL_DOCKER AND NOT BZIP2_FOUND) + set(ENABLE_OSCAP_UTIL_DOCKER FALSE) + message(SEND_ERROR "oscap-docker requires bzip2! Either disable oscap-docker or install bzip2") +endif() + +cmake_dependent_option(ENABLE_OSCAP_UTIL_AS_RPM "enable the scap-as-rpm utility, this lets you package SCAP data as RPMs" ON "NOT WIN32" OFF) +cmake_dependent_option(ENABLE_OSCAP_UTIL_SSH "enables the oscap-ssh utility, this lets you scan remote machines over ssh" ON "NOT WIN32" OFF) +cmake_dependent_option(ENABLE_OSCAP_UTIL_VM "enables the oscap-vm utility, this lets you scan VMs and VM storage images" ON "NOT WIN32" OFF) +cmake_dependent_option(ENABLE_OSCAP_UTIL_PODMAN "enables the oscap-podman utility, this lets you scan Podman containers and container images" ON "NOT WIN32" OFF) +cmake_dependent_option(ENABLE_OSCAP_UTIL_CHROOT "enables the oscap-chroot utility, this lets you scan entire chroots using offline scanning" ON "NOT WIN32" OFF) +option(ENABLE_OSCAP_UTIL_AUTOTAILOR "enables the autotailor utility that is able to perform command-line tailoring" TRUE) + +# ---------- TEST-SUITE SWITCHES + +# Tests will be turned off on Windows, because the test suite uses bash +# and other Linux-specific tools. +if(WIN32) + # TODO: I hate that the doc string is duplicated but cmake doesn't support evaluating expressions :-/ + option(ENABLE_TESTS "enables the test suite, use `ctest` to run it" FALSE) +else() + option(ENABLE_TESTS "enables the test suite, use `ctest` to run it" TRUE) +endif() + +option(ENABLE_VALGRIND "enables Valgrind memory testing in the test-suite" FALSE) + +option(ENABLE_MITRE "enables MITRE tests -- requires specific environment support -- see developer documentation for more details" FALSE) + +# ---------- LANGUAGE BINDINGS +cmake_dependent_option(ENABLE_PYTHON3 "if enabled, the python3 swig bindings will be built" ON "PYTHONINTERP_FOUND;SWIG_FOUND;PYTHONLIBS_FOUND" OFF) +cmake_dependent_option(ENABLE_PERL "if enabled, the perl swig bindings will be built" ON "PERLLIBS_FOUND;SWIG_FOUND" OFF) + +# ---------- NO IDEA WHAT THIS IS FOR +set(WANT_BASE64 TRUE CACHE BOOL "wants builtin Base64") +set(WANT_XBASE64 FALSE CACHE BOOL "wants builtin XBase64") + +# ---------- Documentation + +# Due to the time it takes to build documentation on every change, +# we choose to disable documentation by default. Only when ENABLE_DOCS==TRUE +# will docs be built and added to the `make install` target. + +option(ENABLE_DOCS "enables documentation building -- suggests doxygen, asciidoc" FALSE) + +# ---------- STATUS MESSAGES + +message(STATUS " ") +message(STATUS "CMake:") +message(STATUS "generator: ${CMAKE_GENERATOR}") +message(STATUS "source directory: ${CMAKE_SOURCE_DIR}") +message(STATUS "build directory: ${CMAKE_BINARY_DIR}") +message(STATUS " ") + +message(STATUS "Core features:") +message(STATUS "SCE: ${ENABLE_SCE}") +message(STATUS " ") + +message(STATUS "OVAL:") +message(STATUS "base probe support: ${ENABLE_PROBES}") +message(STATUS "SEAP msgid bit-size: ${SEAP_MSGID_BITS}") + +message(STATUS "") +message(STATUS "Independent probes: ${ENABLE_PROBES_INDEPENDENT}") +message(STATUS " Independent family probe: ${OPENSCAP_PROBE_INDEPENDENT_FAMILY}") +message(STATUS " Independent system info probe: ${OPENSCAP_PROBE_INDEPENDENT_SYSTEM_INFO}") +message(STATUS " Independent variable probe: ${OPENSCAP_PROBE_INDEPENDENT_VARIABLE}") + +message(STATUS "") +message(STATUS "Independent probes incompatible with WIN32 (WIN32 status: ${IS_WIN32})") +message(STATUS " Independent environmentvariable probe: ${OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE}") +message(STATUS " Independent environmentvariable58 probe: ${OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE58}") +message(STATUS " Independent filehash probe: ${OPENSCAP_PROBE_INDEPENDENT_FILEHASH}") +message(STATUS " Independent filehash58 probe: ${OPENSCAP_PROBE_INDEPENDENT_FILEHASH58}") +message(STATUS " Independent sql probe (depends on opendbx): ${OPENSCAP_PROBE_INDEPENDENT_SQL}") +message(STATUS " Independent sql57 probe (depends on opendbx): ${OPENSCAP_PROBE_INDEPENDENT_SQL57}") +message(STATUS " Independent textfilecontent probe: ${OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT}") +message(STATUS " Independent textfilecontent54 probe: ${OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54}") +message(STATUS " Independent xmlfilecontent probe: ${OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT}") +message(STATUS " Independent yamlfilecontent probe (depends on libyaml, yaml-path): ${OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT}") +message(STATUS " ") + + +message(STATUS "Unix probes: ${ENABLE_PROBES_UNIX}") +message(STATUS " Unix dnscache probe: ${OPENSCAP_PROBE_UNIX_DNSCACHE}") +message(STATUS " Unix file probe: ${OPENSCAP_PROBE_UNIX_FILE}") +message(STATUS " Unix fileextendedattribute probe (depends on xattrh): ${OPENSCAP_PROBE_UNIX_FILEEXTENDEDATTRIBUTE}") +message(STATUS " Unix gconf probe (depends on gconf): ${OPENSCAP_PROBE_UNIX_GCONF}") +message(STATUS " Unix interface probe: ${OPENSCAP_PROBE_UNIX_INTERFACE}") +message(STATUS " Unix password probe: ${OPENSCAP_PROBE_UNIX_PASSWORD}") +message(STATUS " Unix process probe: ${OPENSCAP_PROBE_UNIX_PROCESS}") +message(STATUS " Unix process58 probe (depends on CAP): ${OPENSCAP_PROBE_UNIX_PROCESS58}") +message(STATUS " Unix routingtable probe: ${OPENSCAP_PROBE_UNIX_ROUTINGTABLE}") +message(STATUS " Unix runlevel probe: ${OPENSCAP_PROBE_UNIX_RUNLEVEL}") +message(STATUS " Unix shadow probe: ${OPENSCAP_PROBE_UNIX_SHADOW}") +message(STATUS " Unix symlink probe: ${OPENSCAP_PROBE_UNIX_SYMLINK}") +message(STATUS " Unix sysctl probe: ${OPENSCAP_PROBE_UNIX_SYSCTL}") +message(STATUS " Unix uname probe: ${OPENSCAP_PROBE_UNIX_UNAME}") +message(STATUS " Unix xinetd probe: ${OPENSCAP_PROBE_UNIX_XINETD}") +message(STATUS " ") + +message(STATUS "Linux probes: ${ENABLE_PROBES_LINUX}") +message(STATUS " Linux dpkginfo probe (depends on aptpkg): ${OPENSCAP_PROBE_LINUX_DPKGINFO}") +message(STATUS " Linux iflisteners probe: ${OPENSCAP_PROBE_LINUX_IFLISTENERS}") +message(STATUS " Linux inetlisteningservers probe: ${OPENSCAP_PROBE_LINUX_INETLISTENINGSERVERS}") +message(STATUS " Linux partition probe (depends on blkid): ${OPENSCAP_PROBE_LINUX_PARTITION}") +message(STATUS " Linux rpminfo probe (depends on rpm): ${OPENSCAP_PROBE_LINUX_RPMINFO}") +message(STATUS " Linux rpmverify probe (depends on rpm): ${OPENSCAP_PROBE_LINUX_RPMVERIFY}") +message(STATUS " Linux rpmverifyfile probe (depends on rpm): ${OPENSCAP_PROBE_LINUX_RPMVERIFYFILE}") +message(STATUS " Linux rpmverifypackage probe (depends on rpm): ${OPENSCAP_PROBE_LINUX_RPMVERIFYPACKAGE}") +message(STATUS " Linux selinuxboolean probe (depends on selinux): ${OPENSCAP_PROBE_LINUX_SELINUXBOOLEAN}") +message(STATUS " Linux selinuxsecuritycontext probe (depends on selinux): ${OPENSCAP_PROBE_LINUX_SELINUXSECURITYCONTEXT}") +message(STATUS " Linux systemdunitdependency probe (depends on dbus): ${OPENSCAP_PROBE_LINUX_SYSTEMDUNITDEPENDENCY}") +message(STATUS " Linux systemdunitproperty probe (depends on dbus): ${OPENSCAP_PROBE_LINUX_SYSTEMDUNITPROPERTY}") +message(STATUS " ") + +message(STATUS "Solaris probes: ${ENABLE_PROBES_SOLARIS}") +message(STATUS " Solaris isainfo probe: ${OPENSCAP_PROBE_SOLARIS_ISAINFO}") +message(STATUS " ") + + +message(STATUS "Windows probes: ${ENABLE_PROBES_WINDOWS}") +message(STATUS " Windows accesstoken probe: ${OPENSCAP_PROBE_WINDOWS_ACCESSTOKEN}") +message(STATUS " Windows registry probe: ${OPENSCAP_PROBE_WINDOWS_REGISTRY}") +message(STATUS " Windows wmi57 probe: ${OPENSCAP_PROBE_WINDOWS_WMI57}") +message(STATUS " ") + + +message(STATUS "Language bindings:") +message(STATUS "python3 bindings: ${ENABLE_PYTHON3}") +message(STATUS "perl bindings: ${ENABLE_PERL}") +message(STATUS " ") + +message(STATUS "Utilities:") +message(STATUS "oscap: ${ENABLE_OSCAP_UTIL}") +message(STATUS "oscap-docker: ${ENABLE_OSCAP_UTIL_DOCKER}") +message(STATUS "scap-as-rpm: ${ENABLE_OSCAP_UTIL_AS_RPM}") +message(STATUS "oscap-ssh: ${ENABLE_OSCAP_UTIL_SSH}") +message(STATUS "oscap-vm: ${ENABLE_OSCAP_UTIL_VM}") +message(STATUS "oscap-podman: ${ENABLE_OSCAP_UTIL_PODMAN}") +message(STATUS "oscap-chroot: ${ENABLE_OSCAP_UTIL_CHROOT}") +message(STATUS "autotailor: ${ENABLE_OSCAP_UTIL_AUTOTAILOR}") +message(STATUS " ") + +message(STATUS "Testing:") +message(STATUS "tests: ${ENABLE_TESTS}") +message(STATUS "valgrind: ${ENABLE_VALGRIND}") +message(STATUS "MITRE: ${ENABLE_MITRE}") +message(STATUS " ") + +message(STATUS "Documentation:") +message(STATUS "enabled: ${ENABLE_DOCS}") +message(STATUS "doxygen: ${DOXYGEN_EXECUTABLE}") +message(STATUS "asciidoc: ${ASCIIDOC_EXECUTABLE}") + +# ---------- PATHS + +if(WIN32) + # Windows installer does not allow full paths. + # The install path can be changed by user in Windows installer. + # We will use relative names - "schemas", "xsl" and "cpe" + # directories will be located in the same directory as oscap.exe. + set(OSCAP_DEFAULT_SCHEMA_PATH "schemas") + set(OSCAP_DEFAULT_XSLT_PATH "xsl") + set(OSCAP_DEFAULT_CPE_PATH "cpe") +else() + set(OSCAP_DEFAULT_SCHEMA_PATH "${CMAKE_INSTALL_FULL_DATADIR}/openscap/schemas") + set(OSCAP_DEFAULT_XSLT_PATH "${CMAKE_INSTALL_FULL_DATADIR}/openscap/xsl") + set(OSCAP_DEFAULT_CPE_PATH "${CMAKE_INSTALL_FULL_DATADIR}/openscap/cpe") +endif() +set(OSCAP_TEMP_DIR "/tmp" CACHE STRING "use different temporary directory to execute sce scripts (default=/tmp)") + +# ---------- RPATHS for linking + +# see https://cmake.org/Wiki/CMake_RPATH_handling + +# use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) + +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +# Turn on RPATH for OSX for policy warning +set(CMAKE_MACOSX_RPATH ON) +# ---------- CONFIGURATION + +configure_file("config.h.in" "config.h") +add_definitions(-DHAVE_CONFIG_H) +if (MSVC) + # Disable some of Microsoft Visual Studio 2017 warnings + # + # Visual Studio recommends using some non-standard functions with _s suffix + # instead of standard functions, because they considered it more secure. + # However these functions are available only in Microsoft C Runtime. + # Therefore we disable this type of warnings. + # https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + # Microsoft has renamed some POSIX functions in the CRT to conform with C99 rules for + # implementation-defined global function names. In most cases, a leading underscore was + # added to the POSIX function name to create a standard conformant name. + # If we use POSIX functions without leading underscore, a deprecation warning is shown. + # Therefore we disable this type of warnings. + # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996 + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) +endif() + +if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -W -Wall -Wnonnull -Wshadow -Wformat -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas -D_GNU_SOURCE -std=c99") +endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + add_link_options(-lkvm -lm -lprocstat) +else() + # We do not define this on FreeBSD as it causes required functionality to not be exposed, e.g. getprogname() and u_ + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_POSIX_C_SOURCE=200112L") +endif() +if(${CMAKE_SYSTEM_NAME} EQUAL "Solaris") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS__") +endif() +if(WIN32) + # expose new WinAPI function appearing on Windows 7 + # eg. inet_pton + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0600") +endif() +if(APPLE) + #full Single Unix Standard v3 (SUSv3) conformance (the Unix API) + add_definitions(-D_DARWIN_C_SOURCE) +endif() + +include_directories( + "compat/" + "src/" + "src/common/" + "src/common/public/" + "src/CPE/public/" + "src/CVE/public/" + "src/CVRF/public/" + "src/CVSS/public/" + "src/DS/public/" + "src/OVAL/public/" + "src/OVAL/probes/public/" + "src/OVAL/probes/SEAP/" + "src/OVAL/probes/SEAP/public/" + "src/OVAL/" + "src/source/public/" + "src/XCCDF/" + "src/XCCDF/public/" + "src/XCCDF_POLICY/" + "src/XCCDF_POLICY/public/" + "yaml-filter/src/" + ${CMAKE_BINARY_DIR} # config.h is generated to build directory + ${LIBXML2_INCLUDE_DIR} + ${PCRE_INCLUDE_DIRS} +) + +# Honor visibility properties for all target types +# Run "cmake --help-policy CMP0063" for policy details +if (POLICY CMP0063) + cmake_policy(SET CMP0063 NEW) +else() + message(WARNING "It is not possible to correctly set symbol visibility in object files with your version of CMake. We recommend using CMake 3.3 or newer.") +endif() + +function(set_oscap_generic_properties TARGET_OBJECT) + set_target_properties(${TARGET_OBJECT} PROPERTIES + # Make global variables and functions HIDDEN by default. + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + POSITION_INDEPENDENT_CODE ON # Compile this object code position independent. + ) + target_compile_definitions(${TARGET_OBJECT} PRIVATE OSCAP_BUILD_SHARED) +endfunction() + +if(OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT) + add_library(yamlfilter_object OBJECT yaml-filter/src/yaml-path.c yaml-filter/src/yaml-path.h) + set_oscap_generic_properties(yamlfilter_object) +endif() + +add_subdirectory("compat") +add_subdirectory("src") +add_subdirectory("utils") +add_subdirectory("docs") +add_subdirectory("dist") +add_subdirectory("schemas") +add_subdirectory("xsl") +add_subdirectory("cpe") +add_subdirectory("swig") +configure_file("run.in" ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run @ONLY) +configure_file("oscap_wrapper.in" ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/oscap_wrapper @ONLY) +file( + COPY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/oscap_wrapper" + DESTINATION ${CMAKE_BINARY_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) + +if(NOT WIN32) + # pkgconfig file + configure_file("libopenscap.pc.in" "libopenscap.pc" @ONLY) + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/libopenscap.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif() + +# changelog +if(GIT_EXECUTABLE AND SED_EXECUTABLE) + add_custom_target(changelog + COMMAND "${GIT_EXECUTABLE}" log | "${SED_EXECUTABLE}" '/^commit/d\; /^Merge/d' > "${CMAKE_BINARY_DIR}/ChangeLog" + COMMENT "Generating ChangeLog" + ) +endif() + +# Ctest +if(ENABLE_TESTS) + enable_testing() + add_subdirectory("tests") +endif() + +# CPack +set(CPACK_SOURCE_PACKAGE_FILE_NAME "openscap-${OPENSCAP_VERSION}") +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES + "\\\\.git.*" + "build/" + "build-win32/" + "~$" + "\\\\CMakeLists.txt.user" +) +if(WIN32) + set(CPACK_GENERATOR WIX) + set(CPACK_WIX_PATCH_FILE "${CMAKE_SOURCE_DIR}/wix_patch.xml") +endif() +set(CPACK_PACKAGE_NAME "OpenSCAP") +set(CPACK_PACKAGE_VENDOR "OpenSCAP Project") +set(CPACK_PACKAGE_VERSION_MAJOR "${OPENSCAP_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${OPENSCAP_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${OPENSCAP_VERSION_PATCH}") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/lgpl-2.1.rtf") +set(CPACK_PACKAGE_CHECKSUM SHA512) + +include(CPack) diff -Nru openscap-1.2.17/compat/CMakeLists.txt openscap-1.3.4/compat/CMakeLists.txt --- openscap-1.2.17/compat/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/compat/CMakeLists.txt 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,20 @@ +file(GLOB_RECURSE COMPAT_HEADERS "*.h") +list(APPEND COMPAT_SOURCES "") + +if(NOT HAVE_STRSEP) + list(APPEND COMPAT_SOURCES "strsep.c") +endif() + +if(NOT HAVE_STRPTIME) + list(APPEND COMPAT_SOURCES "strptime.c") +endif() + +# dev_to_tty is used in the process and process58 probes that are UNIX only +if(NOT HAVE_DEV_TO_TTY AND UNIX) + list(APPEND COMPAT_SOURCES "dev_to_tty.c") +endif() + +if(COMPAT_SOURCES) + add_library(compat_object OBJECT ${COMPAT_HEADERS} ${COMPAT_SOURCES}) + set_oscap_generic_properties(compat_object) +endif() diff -Nru openscap-1.2.17/compat/compat.h openscap-1.3.4/compat/compat.h --- openscap-1.2.17/compat/compat.h 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/compat/compat.h 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,70 @@ +/* + * Copyright 2017 Red Hat Inc., Durham, North Carolina. + * All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Jan Černý + */ + +#ifndef OSCAP_COMPAT_H_ +#define OSCAP_COMPAT_H_ + +#include "oscap_export.h" +#include "oscap_platforms.h" + +/* Fallback functions fixing portability issues */ + +#ifndef HAVE_STRSEP +char *strsep(char **stringp, const char *delim); +#endif + +#ifndef HAVE_STRPTIME +#include +char *strptime(const char *buf, const char *format, struct tm *tm); +#endif + +#if defined(unix) || defined(__unix__) || defined(__unix) +#define OSCAP_UNIX +#endif + +#ifdef OS_WINDOWS +#define PATH_MAX _MAX_PATH +#endif + +#ifdef _MSC_VER +#include +typedef SSIZE_T ssize_t; +#define __PRETTY_FUNCTION__ __FUNCTION__ +#define __attribute__(x) + +/* Definitions for access() */ +#define F_OK 0 +#define W_OK 2 +#define R_OK 4 + +#endif + +#if !defined(HAVE_DEV_TO_TTY) && !defined(OS_WINDOWS) +#include +#define ABBREV_DEV 1 /* remove /dev/ */ +#define ABBREV_TTY 2 /* remove tty */ +#define ABBREV_PTS 4 /* remove pts/ */ + +extern unsigned dev_to_tty(char *__restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags); +#endif + +#endif diff -Nru openscap-1.2.17/compat/dev_to_tty.c openscap-1.3.4/compat/dev_to_tty.c --- openscap-1.2.17/compat/dev_to_tty.c 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/compat/dev_to_tty.c 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,320 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + + +/* + * devname - device name functions + * Copyright 1998-2002 by Albert Cahalan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "compat.h" + +// This is the buffer size for a tty name. Any path is legal, +// which makes PAGE_SIZE appropriate (see kernel source), but +// that is only 99% portable and utmp only holds 32 anyway. +// We need at least 20 for guess_name(). +#define TTY_NAME_SIZE 128 + + +#if 0 +#include +#define MAJOR_OF(d) ((unsigned)major(d)) +#define MINOR_OF(d) ((unsigned)minor(d)) +#else +#define MAJOR_OF(d) ( ((unsigned)(d)>>8u) & 0xfffu ) +#define MINOR_OF(d) ( ((unsigned)(d)&0xffu) | (((unsigned)(d)&0xfff00000u)>>12u) ) +#undef major +#undef minor +#define major <-- do not use --> +#define minor <-- do not use --> +#endif + +typedef struct tty_map_node { + struct tty_map_node *next; + unsigned short devfs_type; // bool + unsigned short major_number; + unsigned minor_first; + unsigned minor_last; + char name[16]; +} tty_map_node; + +static tty_map_node *tty_map = NULL; + +/* Load /proc/tty/drivers for device name mapping use. */ +static void load_drivers(void){ + char buf[10000]; + char *p; + int fd; + int bytes; + fd = open("/proc/tty/drivers",O_RDONLY); + if(fd == -1) goto fail; + bytes = read(fd, buf, sizeof(buf) - 1); + if(bytes == -1) goto fail; + buf[bytes] = '\0'; + p = buf; + while(( p = strstr(p, " /dev/") )){ // " /dev/" is the second column + tty_map_node *tmn; + size_t len; + char *end; + p += 6; + end = strchr(p, ' '); + if(!end) continue; + len = end - p; + tmn = malloc(sizeof(tty_map_node)); + tmn->next = tty_map; + tty_map = tmn; + /* if we have a devfs type name such as /dev/tts/%d then strip the %d but + keep a flag. */ + if(len >= 3 && !strncmp(end - 2, "%d", 2)){ + len -= 2; + tmn->devfs_type = 1; + } + if(len >= sizeof tmn->name) + len = sizeof tmn->name - 1; // mangle it to avoid overflow + memcpy(tmn->name, p, len); + p = end; /* set p to point past the %d as well if there is one */ + while(*p == ' ') p++; + tmn->major_number = atoi(p); + p += strspn(p, "0123456789"); + while(*p == ' ') p++; + switch(sscanf(p, "%u-%u", &tmn->minor_first, &tmn->minor_last)){ + default: + /* Can't finish parsing this line so we remove it from the list */ + tty_map = tty_map->next; + free(tmn); + break; + case 1: + tmn->minor_last = tmn->minor_first; + break; + case 2: + break; + } + } +fail: + if(fd != -1) close(fd); + if(!tty_map) tty_map = (tty_map_node *)-1; +} + +/* Try to guess the device name from /proc/tty/drivers info. */ +static int driver_name(char *restrict const buf, unsigned maj, unsigned min){ + struct stat sbuf; + tty_map_node *tmn; + if(!tty_map) load_drivers(); + if(tty_map == (tty_map_node *)-1) return 0; + tmn = tty_map; + for(;;){ + if(!tmn) return 0; + if(tmn->major_number == maj && tmn->minor_first <= min && tmn->minor_last >= min) break; + tmn = tmn->next; + } + sprintf(buf, "/dev/%s%d", tmn->name, min); /* like "/dev/ttyZZ255" */ + if(stat(buf, &sbuf) < 0){ + if(tmn->devfs_type) return 0; + sprintf(buf, "/dev/%s", tmn->name); /* like "/dev/ttyZZ255" */ + if(stat(buf, &sbuf) < 0) return 0; + } + if(min != MINOR_OF(sbuf.st_rdev)) return 0; + if(maj != MAJOR_OF(sbuf.st_rdev)) return 0; + return 1; +} + +// major 204 is a mess -- "Low-density serial ports" +static const char low_density_names[][6] = { +"LU0", "LU1", "LU2", "LU3", +"FB0", +"SA0", "SA1", "SA2", +"SC0", "SC1", "SC2", "SC3", +"FW0", "FW1", "FW2", "FW3", +"AM0", "AM1", "AM2", "AM3", "AM4", "AM5", "AM6", "AM7", +"AM8", "AM9", "AM10", "AM11", "AM12", "AM13", "AM14", "AM15", +"DB0", "DB1", "DB2", "DB3", "DB4", "DB5", "DB6", "DB7", +"SG0", +"SMX0", "SMX1", "SMX2", +"MM0", "MM1", +"CPM0", "CPM1", "CPM2", "CPM3", /* "CPM4", "CPM5", */ // bad allocation? +"IOC0", "IOC1", "IOC2", "IOC3", "IOC4", "IOC5", "IOC6", "IOC7", +"IOC8", "IOC9", "IOC10", "IOC11", "IOC12", "IOC13", "IOC14", "IOC15", +"IOC16", "IOC17", "IOC18", "IOC19", "IOC20", "IOC21", "IOC22", "IOC23", +"IOC24", "IOC25", "IOC26", "IOC27", "IOC28", "IOC29", "IOC30", "IOC31", +"VR0", "VR1", +"IOC84", "IOC85", "IOC86", "IOC87", "IOC88", "IOC89", "IOC90", "IOC91", +"IOC92", "IOC93", "IOC94", "IOC95", "IOC96", "IOC97", "IOC98", "IOC99", +"IOC100", "IOC101", "IOC102", "IOC103", "IOC104", "IOC105", "IOC106", "IOC107", +"IOC108", "IOC109", "IOC110", "IOC111", "IOC112", "IOC113", "IOC114", "IOC115", +"SIOC0", "SIOC1", "SIOC2", "SIOC3", "SIOC4", "SIOC5", "SIOC6", "SIOC7", +"SIOC8", "SIOC9", "SIOC10", "SIOC11", "SIOC12", "SIOC13", "SIOC14", "SIOC15", +"SIOC16", "SIOC17", "SIOC18", "SIOC19", "SIOC20", "SIOC21", "SIOC22", "SIOC23", +"SIOC24", "SIOC25", "SIOC26", "SIOC27", "SIOC28", "SIOC29", "SIOC30", "SIOC31", +"PSC0", "PSC1", "PSC2", "PSC3", "PSC4", "PSC5", +"AT0", "AT1", "AT2", "AT3", "AT4", "AT5", "AT6", "AT7", +"AT8", "AT9", "AT10", "AT11", "AT12", "AT13", "AT14", "AT15", +"NX0", "NX1", "NX2", "NX3", "NX4", "NX5", "NX6", "NX7", +"NX8", "NX9", "NX10", "NX11", "NX12", "NX13", "NX14", "NX15", +"J0", // minor is 186 +"UL0","UL1","UL2","UL3", +"xvc0", // FAIL -- "/dev/xvc0" lacks "tty" prefix +"PZ0","PZ1","PZ2","PZ3", +"TX0","TX1","TX2","TX3","TX4","TX5","TX6","TX7", +"SC0","SC1","SC2","SC3", +"MAX0","MAX1","MAX2","MAX3", +}; + +#if 0 +// test code +#include +#define AS(x) (sizeof(x)/sizeof((x)[0])) +int main(int argc, char *argv[]){ + int i = 0; + while(i 255) return 0; // should never happen; array index protection + t0 = "pqrstuvwxyzabcde"[tmpmin>>4]; + t1 = "0123456789abcdef"[tmpmin&0x0f]; + sprintf(buf, "/dev/tty%c%c", t0, t1); + break; + case 4: + if(min<64){ + sprintf(buf, "/dev/tty%d", min); + break; + } + sprintf(buf, "/dev/ttyS%d", min-64); + break; + case 11: sprintf(buf, "/dev/ttyB%d", min); break; + case 17: sprintf(buf, "/dev/ttyH%d", min); break; + case 19: sprintf(buf, "/dev/ttyC%d", min); break; + case 22: sprintf(buf, "/dev/ttyD%d", min); break; /* devices.txt */ + case 23: sprintf(buf, "/dev/ttyD%d", min); break; /* driver code */ + case 24: sprintf(buf, "/dev/ttyE%d", min); break; + case 32: sprintf(buf, "/dev/ttyX%d", min); break; + case 43: sprintf(buf, "/dev/ttyI%d", min); break; + case 46: sprintf(buf, "/dev/ttyR%d", min); break; + case 48: sprintf(buf, "/dev/ttyL%d", min); break; + case 57: sprintf(buf, "/dev/ttyP%d", min); break; + case 71: sprintf(buf, "/dev/ttyF%d", min); break; + case 75: sprintf(buf, "/dev/ttyW%d", min); break; + case 78: sprintf(buf, "/dev/ttyM%d", min); break; /* conflict */ + case 105: sprintf(buf, "/dev/ttyV%d", min); break; + case 112: sprintf(buf, "/dev/ttyM%d", min); break; /* conflict */ + /* 136 ... 143 are /dev/pts/0, /dev/pts/1, /dev/pts/2 ... */ + case 136 ... 143: sprintf(buf, "/dev/pts/%d", min+(maj-136)*256); break; + case 148: sprintf(buf, "/dev/ttyT%d", min); break; + case 154: sprintf(buf, "/dev/ttySR%d", min); break; + case 156: sprintf(buf, "/dev/ttySR%d", min+256); break; + case 164: sprintf(buf, "/dev/ttyCH%d", min); break; + case 166: sprintf(buf, "/dev/ttyACM%d", min); break; /* bummer, 9-char */ + case 172: sprintf(buf, "/dev/ttyMX%d", min); break; + case 174: sprintf(buf, "/dev/ttySI%d", min); break; + case 188: sprintf(buf, "/dev/ttyUSB%d", min); break; /* bummer, 9-char */ + case 204: + if(min >= sizeof low_density_names / sizeof low_density_names[0]) return 0; + memcpy(buf,"/dev/tty",8); + memcpy(buf+8, low_density_names[min], sizeof low_density_names[0]); + buf[8 + sizeof low_density_names[0]] = '\0'; +// snprintf(buf, 9 + sizeof low_density_names[0], "/dev/tty%.*s", sizeof low_density_names[0], low_density_names[min]); + break; + case 208: sprintf(buf, "/dev/ttyU%d", min); break; + case 216: sprintf(buf, "/dev/ttyUB%d", min); break; // "/dev/rfcomm%d" now? + case 224: sprintf(buf, "/dev/ttyY%d", min); break; + case 227: sprintf(buf, "/dev/3270/tty%d", min); break; /* bummer, HUGE */ + case 229: sprintf(buf, "/dev/iseries/vtty%d", min); break; /* bummer, HUGE */ + case 256: sprintf(buf, "/dev/ttyEQ%d", min); break; + default: return 0; + } + if(stat(buf, &sbuf) < 0) return 0; + if(min != MINOR_OF(sbuf.st_rdev)) return 0; + if(maj != MAJOR_OF(sbuf.st_rdev)) return 0; + return 1; +} + +/* Linux 2.2 can give us filenames that might be correct. + * Useful names could be in /proc/PID/fd/2 (stderr, seldom redirected) + * and in /proc/PID/fd/255 (used by bash to remember the tty). + */ +static int link_name(char *restrict const buf, unsigned maj, unsigned min, int pid, const char *restrict name){ + struct stat sbuf; + char path[32]; + int count; + sprintf(path, "/proc/%d/%s", pid, name); /* often permission denied */ + count = readlink(path,buf,TTY_NAME_SIZE-1); + if(count == -1) return 0; + buf[count] = '\0'; + if(stat(buf, &sbuf) < 0) return 0; + if(min != MINOR_OF(sbuf.st_rdev)) return 0; + if(maj != MAJOR_OF(sbuf.st_rdev)) return 0; + return 1; +} + +/* number --> name */ +unsigned dev_to_tty(char *restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags) { + static char buf[TTY_NAME_SIZE]; + char *restrict tmp = buf; + unsigned dev = dev_t_dev; + unsigned i = 0; + int c; + if(dev == 0u) goto no_tty; + if(driver_name(tmp, MAJOR_OF(dev), MINOR_OF(dev) )) goto abbrev; + if( link_name(tmp, MAJOR_OF(dev), MINOR_OF(dev), pid, "fd/2" )) goto abbrev; + if( guess_name(tmp, MAJOR_OF(dev), MINOR_OF(dev) )) goto abbrev; + if( link_name(tmp, MAJOR_OF(dev), MINOR_OF(dev), pid, "fd/255")) goto abbrev; + // fall through if unable to find a device file +no_tty: + strcpy(ret, "?"); + return 1; +abbrev: + if((flags&ABBREV_DEV) && !strncmp(tmp,"/dev/",5) && tmp[5]) tmp += 5; + if((flags&ABBREV_TTY) && !strncmp(tmp,"tty", 3) && tmp[3]) tmp += 3; + if((flags&ABBREV_PTS) && !strncmp(tmp,"pts/", 4) && tmp[4]) tmp += 4; + /* gotta check before we chop or we may chop someone else's memory */ + if(chop + (unsigned long)(tmp-buf) <= sizeof buf) + tmp[chop] = '\0'; + /* replace non-ASCII characters with '?' and return the number of chars */ + for(;;){ + c = *tmp; + tmp++; + if(!c) break; + i++; + if(c<=' ') c = '?'; + if(c>126) c = '?'; + *ret = c; + ret++; + } + *ret = '\0'; + return i; +} diff -Nru openscap-1.2.17/compat/oscap_platforms.h openscap-1.3.4/compat/oscap_platforms.h --- openscap-1.2.17/compat/oscap_platforms.h 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/compat/oscap_platforms.h 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,61 @@ +/* + * Copyright 2018 Red Hat Inc., Durham, North Carolina. + * All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef OPENSCAP_OSCAP_PLATFORMS_H +#define OPENSCAP_OSCAP_PLATFORMS_H + +#undef OS_FREEBSD +#undef OS_LINUX +#undef OS_SOLARIS +#undef OS_SUNOS +#undef OS_WINDOWS +#undef OS_AIX +#undef OS_APPLE +#undef OS_OSX + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +# define OS_FREEBSD +#elif defined(__linux__) && defined(__GLIBC__) +# define OS_LINUX_WITH_GLIBC +#elif defined(__linux__) || defined(OS_LINUX_WITH_GLIBC) +# define OS_LINUX +#elif defined(sun) || defined(__sun) +# define OS_SUN +# if defined(__SVR4) || defined(__svr4__) +# define OS_SOLARIS +# else +# define OS_SUNOS +# endif +#elif defined(_WIN32) || defined(_WIN64) +# define OS_WINDOWS +#elif defined(_AIX) +# define OS_AIX +#elif defined(__APPLE__) +# define OS_APPLE +# if defined(Macintosh) || defined(macintosh) || defined(__MACH__) || defined(__APPLE__) +# define OS_OSX +# endif +#elif defined(_hpux) || defined(hpux) || defined(__hpux) +# define OS_HPUX +#else +# error "Sorry, your OS isn't supported." +#endif + +#endif diff -Nru openscap-1.2.17/compat/strptime.c openscap-1.3.4/compat/strptime.c --- openscap-1.2.17/compat/strptime.c 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/compat/strptime.c 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,996 @@ +/* Convert a string representation of time to a time value. + Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + see . */ + +/* XXX This version of the implementation is not really complete. + Some of the fields cannot add information alone. But if seeing + some of them in the same format (such as year, week and weekday) + this is enough information for determining the date. */ + +#include +#include +#include "compat.h" + +#ifndef __P +# if defined (__GNUC__) || (defined (__STDC__) && __STDC__) +# define __P(args) args +# else +# define __P(args) () +# endif /* GCC. */ +#endif /* Not __P. */ + +#if ! HAVE_LOCALTIME_R && ! defined localtime_r +# ifdef _LIBC +# define localtime_r __localtime_r +# else +/* Approximate localtime_r as best we can in its absence. */ +# define localtime_r my_localtime_r +static struct tm *localtime_r __P ((const time_t *, struct tm *)); +static struct tm * +localtime_r (t, tp) + const time_t *t; + struct tm *tp; +{ + struct tm *l = localtime (t); + if (! l) + return 0; + *tp = *l; + return tp; +} +# endif /* ! _LIBC */ +#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */ + + +#define match_char(ch1, ch2) if (ch1 != ch2) return NULL +#if defined __GNUC__ && __GNUC__ >= 2 +# define match_string(cs1, s2) \ + ({ size_t len = strlen (cs1); \ + int result = strncasecmp ((cs1), (s2), len) == 0; \ + if (result) (s2) += len; \ + result; }) +#elif defined _MSC_VER +# define match_string(cs1, s2) \ + (_strnicmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) +#else +/* Oh come on. Get a reasonable compiler. */ +# define match_string(cs1, s2) \ + (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) +#endif +/* We intentionally do not use isdigit() for testing because this will + lead to problems with the wide character version. */ +#define get_number(from, to, n) \ + do { \ + int __n = n; \ + val = 0; \ + while (*rp == ' ') \ + ++rp; \ + if (*rp < '0' || *rp > '9') \ + return NULL; \ + do { \ + val *= 10; \ + val += *rp++ - '0'; \ + } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \ + if (val < from || val > to) \ + return NULL; \ + } while (0) +#ifdef _NL_CURRENT +# define get_alt_number(from, to, n) \ + ({ \ + __label__ do_normal; \ + if (*decided != raw) \ + { \ + const char *alts = _NL_CURRENT (LC_TIME, ALT_DIGITS); \ + int __n = n; \ + int any = 0; \ + while (*rp == ' ') \ + ++rp; \ + val = 0; \ + do { \ + val *= 10; \ + while (*alts != '\0') \ + { \ + size_t len = strlen (alts); \ + if (strncasecmp (alts, rp, len) == 0) \ + break; \ + alts += len + 1; \ + ++val; \ + } \ + if (*alts == '\0') \ + { \ + if (*decided == not && ! any) \ + goto do_normal; \ + /* If we haven't read anything it's an error. */ \ + if (! any) \ + return NULL; \ + /* Correct the premature multiplication. */ \ + val /= 10; \ + break; \ + } \ + else \ + *decided = loc; \ + } while (--__n > 0 && val * 10 <= to); \ + if (val < from || val > to) \ + return NULL; \ + } \ + else \ + { \ + do_normal: \ + get_number (from, to, n); \ + } \ + 0; \ + }) +#else +# define get_alt_number(from, to, n) \ + /* We don't have the alternate representation. */ \ + get_number(from, to, n) +#endif +#define recursive(new_fmt) \ + (*(new_fmt) != '\0' \ + && (rp = strptime_internal (rp, (new_fmt), tm, decided, era_cnt)) != NULL) + + +#ifdef _LIBC +/* This is defined in locale/C-time.c in the GNU libc. */ +extern const struct locale_data _nl_C_LC_TIME; +extern const unsigned short int __mon_yday[2][13]; + +# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string) +# define ab_weekday_name \ + (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string) +# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string) +# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string) +# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string) +# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string) +# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string) +# define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string) +# define HERE_T_FMT_AMPM \ + (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string) +# define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string) + +# define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n) +#else +static char const weekday_name[][10] = + { + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" + }; +static char const ab_weekday_name[][4] = + { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; +static char const month_name[][10] = + { + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + }; +static char const ab_month_name[][4] = + { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; +# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y" +# define HERE_D_FMT "%m/%d/%y" +# define HERE_AM_STR "AM" +# define HERE_PM_STR "PM" +# define HERE_T_FMT_AMPM "%I:%M:%S %p" +# define HERE_T_FMT "%H:%M:%S" + +static const unsigned short int __mon_yday[2][13] = + { + /* Normal years. */ + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, + /* Leap years. */ + { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } + }; +#endif + +/* Status of lookup: do we use the locale data or the raw data? */ +enum locale_status { not, loc, raw }; + + +#ifndef __isleap +/* Nonzero if YEAR is a leap year (every 4 years, + except every 100th isn't, and every 400th is). */ +# define __isleap(year) \ + ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) +#endif + +/* Compute the day of the week. */ +static void +day_of_the_week (struct tm *tm) +{ + /* We know that January 1st 1970 was a Thursday (= 4). Compute the + the difference between this data in the one on TM and so determine + the weekday. */ + int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2); + int wday = (-473 + + (365 * (tm->tm_year - 70)) + + (corr_year / 4) + - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0) + + (((corr_year / 4) / 25) / 4) + + __mon_yday[0][tm->tm_mon] + + tm->tm_mday - 1); + tm->tm_wday = ((wday % 7) + 7) % 7; +} + +/* Compute the day of the year. */ +static void +day_of_the_year (struct tm *tm) +{ + tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon] + + (tm->tm_mday - 1)); +} + +static char * +#ifdef _LIBC +internal_function +#endif +strptime_internal __P ((const char *rp, const char *fmt, struct tm *tm, + enum locale_status *decided, int era_cnt)); + +static char * +#ifdef _LIBC +internal_function +#endif +strptime_internal (rp, fmt, tm, decided, era_cnt) + const char *rp; + const char *fmt; + struct tm *tm; + enum locale_status *decided; + int era_cnt; +{ + int cnt; + size_t val; + int have_I, is_pm; + int century, want_century; + int want_era; + int have_wday, want_xday; + int have_yday; + int have_mon, have_mday; +#ifdef _NL_CURRENT + const char *rp_backup; + size_t num_eras; + struct era_entry *era; + + era = NULL; +#endif + + have_I = is_pm = 0; + century = -1; + want_century = 0; + want_era = 0; + + have_wday = want_xday = have_yday = have_mon = have_mday = 0; + + while (*fmt != '\0') + { + /* A white space in the format string matches 0 more or white + space in the input string. */ + if (isspace (*fmt)) + { + while (isspace (*rp)) + ++rp; + ++fmt; + continue; + } + + /* Any character but `%' must be matched by the same character + in the iput string. */ + if (*fmt != '%') + { + match_char (*fmt++, *rp++); + continue; + } + + ++fmt; +#ifndef _NL_CURRENT + /* We need this for handling the `E' modifier. */ + start_over: +#endif + +#ifdef _NL_CURRENT + /* Make back up of current processing pointer. */ + rp_backup = rp; +#endif + + switch (*fmt++) + { + case '%': + /* Match the `%' character itself. */ + match_char ('%', *rp++); + break; + case 'a': + case 'A': + /* Match day of week. */ + for (cnt = 0; cnt < 7; ++cnt) + { +#ifdef _NL_CURRENT + if (*decided !=raw) + { + if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp)) + { + if (*decided == not + && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt), + weekday_name[cnt])) + *decided = loc; + break; + } + if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp)) + { + if (*decided == not + && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), + ab_weekday_name[cnt])) + *decided = loc; + break; + } + } +#endif + if (*decided != loc + && (match_string (weekday_name[cnt], rp) + || match_string (ab_weekday_name[cnt], rp))) + { + *decided = raw; + break; + } + } + if (cnt == 7) + /* Does not match a weekday name. */ + return NULL; + tm->tm_wday = cnt; + have_wday = 1; + break; + case 'b': + case 'B': + case 'h': + /* Match month name. */ + for (cnt = 0; cnt < 12; ++cnt) + { +#ifdef _NL_CURRENT + if (*decided !=raw) + { + if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp)) + { + if (*decided == not + && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt), + month_name[cnt])) + *decided = loc; + break; + } + if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp)) + { + if (*decided == not + && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), + ab_month_name[cnt])) + *decided = loc; + break; + } + } +#endif + if (match_string (month_name[cnt], rp) + || match_string (ab_month_name[cnt], rp)) + { + *decided = raw; + break; + } + } + if (cnt == 12) + /* Does not match a month name. */ + return NULL; + tm->tm_mon = cnt; + want_xday = 1; + break; + case 'c': + /* Match locale's date and time format. */ +#ifdef _NL_CURRENT + if (*decided != raw) + { + if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT))) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (*decided == not && + strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT)) + *decided = loc; + want_xday = 1; + break; + } + *decided = raw; + } +#endif + if (!recursive (HERE_D_T_FMT)) + return NULL; + want_xday = 1; + break; + case 'C': + /* Match century number. */ +#ifdef _NL_CURRENT + match_century: +#endif + get_number (0, 99, 2); + century = val; + want_xday = 1; + break; + case 'd': + case 'e': + /* Match day of month. */ + get_number (1, 31, 2); + tm->tm_mday = val; + have_mday = 1; + want_xday = 1; + break; + case 'F': + if (!recursive ("%Y-%m-%d")) + return NULL; + want_xday = 1; + break; + case 'x': +#ifdef _NL_CURRENT + if (*decided != raw) + { + if (!recursive (_NL_CURRENT (LC_TIME, D_FMT))) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (*decided == not + && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT)) + *decided = loc; + want_xday = 1; + break; + } + *decided = raw; + } +#endif + /* Fall through. */ + case 'D': + /* Match standard day format. */ + if (!recursive (HERE_D_FMT)) + return NULL; + want_xday = 1; + break; + case 'k': + case 'H': + /* Match hour in 24-hour clock. */ + get_number (0, 23, 2); + tm->tm_hour = val; + have_I = 0; + break; + case 'I': + /* Match hour in 12-hour clock. */ + get_number (1, 12, 2); + tm->tm_hour = val % 12; + have_I = 1; + break; + case 'j': + /* Match day number of year. */ + get_number (1, 366, 3); + tm->tm_yday = val - 1; + have_yday = 1; + break; + case 'm': + /* Match number of month. */ + get_number (1, 12, 2); + tm->tm_mon = val - 1; + have_mon = 1; + want_xday = 1; + break; + case 'M': + /* Match minute. */ + get_number (0, 59, 2); + tm->tm_min = val; + break; + case 'n': + case 't': + /* Match any white space. */ + while (isspace (*rp)) + ++rp; + break; + case 'p': + /* Match locale's equivalent of AM/PM. */ +#ifdef _NL_CURRENT + if (*decided != raw) + { + if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp)) + { + if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR)) + *decided = loc; + break; + } + if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp)) + { + if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR)) + *decided = loc; + is_pm = 1; + break; + } + *decided = raw; + } +#endif + if (!match_string (HERE_AM_STR, rp)) { + if (match_string (HERE_PM_STR, rp)) { + is_pm = 1; + } else { + return NULL; + } + } + break; + case 'r': +#ifdef _NL_CURRENT + if (*decided != raw) + { + if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM))) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (*decided == not && + strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM), + HERE_T_FMT_AMPM)) + *decided = loc; + break; + } + *decided = raw; + } +#endif + if (!recursive (HERE_T_FMT_AMPM)) + return NULL; + break; + case 'R': + if (!recursive ("%H:%M")) + return NULL; + break; + case 's': + { + /* The number of seconds may be very high so we cannot use + the `get_number' macro. Instead read the number + character for character and construct the result while + doing this. */ + time_t secs = 0; + if (*rp < '0' || *rp > '9') + /* We need at least one digit. */ + return NULL; + + do + { + secs *= 10; + secs += *rp++ - '0'; + } + while (*rp >= '0' && *rp <= '9'); + + if (localtime_r (&secs, tm) == NULL) + /* Error in function. */ + return NULL; + } + break; + case 'S': + get_number (0, 61, 2); + tm->tm_sec = val; + break; + case 'X': +#ifdef _NL_CURRENT + if (*decided != raw) + { + if (!recursive (_NL_CURRENT (LC_TIME, T_FMT))) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT)) + *decided = loc; + break; + } + *decided = raw; + } +#endif + /* Fall through. */ + case 'T': + if (!recursive (HERE_T_FMT)) + return NULL; + break; + case 'u': + get_number (1, 7, 1); + tm->tm_wday = val % 7; + have_wday = 1; + break; + case 'g': + get_number (0, 99, 2); + /* XXX This cannot determine any field in TM. */ + break; + case 'G': + if (*rp < '0' || *rp > '9') + return NULL; + /* XXX Ignore the number since we would need some more + information to compute a real date. */ + do + ++rp; + while (*rp >= '0' && *rp <= '9'); + break; + case 'U': + case 'V': + case 'W': + get_number (0, 53, 2); + /* XXX This cannot determine any field in TM without some + information. */ + break; + case 'w': + /* Match number of weekday. */ + get_number (0, 6, 1); + tm->tm_wday = val; + have_wday = 1; + break; + case 'y': +#ifdef _NL_CURRENT + match_year_in_century: +#endif + /* Match year within century. */ + get_number (0, 99, 2); + /* The "Year 2000: The Millennium Rollover" paper suggests that + values in the range 69-99 refer to the twentieth century. */ + tm->tm_year = val >= 69 ? val : val + 100; + /* Indicate that we want to use the century, if specified. */ + want_century = 1; + want_xday = 1; + break; + case 'Y': + /* Match year including century number. */ + get_number (0, 9999, 4); + tm->tm_year = val - 1900; + want_century = 0; + want_xday = 1; + break; + case 'Z': + /* XXX How to handle this? */ + break; + case 'E': +#ifdef _NL_CURRENT + switch (*fmt++) + { + case 'c': + /* Match locale's alternate date and time format. */ + if (*decided != raw) + { + const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT); + + if (*fmt == '\0') + fmt = _NL_CURRENT (LC_TIME, D_T_FMT); + + if (!recursive (fmt)) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (strcmp (fmt, HERE_D_T_FMT)) + *decided = loc; + want_xday = 1; + break; + } + *decided = raw; + } + /* The C locale has no era information, so use the + normal representation. */ + if (!recursive (HERE_D_T_FMT)) + return NULL; + want_xday = 1; + break; + case 'C': + if (*decided != raw) + { + if (era_cnt >= 0) + { + era = _nl_select_era_entry (era_cnt); + if (match_string (era->era_name, rp)) + { + *decided = loc; + break; + } + else + return NULL; + } + else + { + num_eras = _NL_CURRENT_WORD (LC_TIME, + _NL_TIME_ERA_NUM_ENTRIES); + for (era_cnt = 0; era_cnt < (int) num_eras; + ++era_cnt, rp = rp_backup) + { + era = _nl_select_era_entry (era_cnt); + if (match_string (era->era_name, rp)) + { + *decided = loc; + break; + } + } + if (era_cnt == (int) num_eras) + { + era_cnt = -1; + if (*decided == loc) + return NULL; + } + else + break; + } + + *decided = raw; + } + /* The C locale has no era information, so use the + normal representation. */ + goto match_century; + case 'y': + if (*decided == raw) + goto match_year_in_century; + + get_number(0, 9999, 4); + tm->tm_year = val; + want_era = 1; + want_xday = 1; + break; + case 'Y': + if (*decided != raw) + { + num_eras = _NL_CURRENT_WORD (LC_TIME, + _NL_TIME_ERA_NUM_ENTRIES); + for (era_cnt = 0; era_cnt < (int) num_eras; + ++era_cnt, rp = rp_backup) + { + era = _nl_select_era_entry (era_cnt); + if (recursive (era->era_format)) + break; + } + if (era_cnt == (int) num_eras) + { + era_cnt = -1; + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + *decided = loc; + era_cnt = -1; + break; + } + + *decided = raw; + } + get_number (0, 9999, 4); + tm->tm_year = val - 1900; + want_century = 0; + want_xday = 1; + break; + case 'x': + if (*decided != raw) + { + const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT); + + if (*fmt == '\0') + fmt = _NL_CURRENT (LC_TIME, D_FMT); + + if (!recursive (fmt)) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (strcmp (fmt, HERE_D_FMT)) + *decided = loc; + break; + } + *decided = raw; + } + if (!recursive (HERE_D_FMT)) + return NULL; + break; + case 'X': + if (*decided != raw) + { + const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT); + + if (*fmt == '\0') + fmt = _NL_CURRENT (LC_TIME, T_FMT); + + if (!recursive (fmt)) + { + if (*decided == loc) + return NULL; + else + rp = rp_backup; + } + else + { + if (strcmp (fmt, HERE_T_FMT)) + *decided = loc; + break; + } + *decided = raw; + } + if (!recursive (HERE_T_FMT)) + return NULL; + break; + default: + return NULL; + } + break; +#else + /* We have no information about the era format. Just use + the normal format. */ + if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y' + && *fmt != 'x' && *fmt != 'X') + /* This is an illegal format. */ + return NULL; + + goto start_over; +#endif + case 'O': + switch (*fmt++) + { + case 'd': + case 'e': + /* Match day of month using alternate numeric symbols. */ + get_alt_number (1, 31, 2); + tm->tm_mday = val; + have_mday = 1; + want_xday = 1; + break; + case 'H': + /* Match hour in 24-hour clock using alternate numeric + symbols. */ + get_alt_number (0, 23, 2); + tm->tm_hour = val; + have_I = 0; + break; + case 'I': + /* Match hour in 12-hour clock using alternate numeric + symbols. */ + get_alt_number (1, 12, 2); + tm->tm_hour = val - 1; + have_I = 1; + break; + case 'm': + /* Match month using alternate numeric symbols. */ + get_alt_number (1, 12, 2); + tm->tm_mon = val - 1; + have_mon = 1; + want_xday = 1; + break; + case 'M': + /* Match minutes using alternate numeric symbols. */ + get_alt_number (0, 59, 2); + tm->tm_min = val; + break; + case 'S': + /* Match seconds using alternate numeric symbols. */ + get_alt_number (0, 61, 2); + tm->tm_sec = val; + break; + case 'U': + case 'V': + case 'W': + get_alt_number (0, 53, 2); + /* XXX This cannot determine any field in TM without + further information. */ + break; + case 'w': + /* Match number of weekday using alternate numeric symbols. */ + get_alt_number (0, 6, 1); + tm->tm_wday = val; + have_wday = 1; + break; + case 'y': + /* Match year within century using alternate numeric symbols. */ + get_alt_number (0, 99, 2); + tm->tm_year = val >= 69 ? val : val + 100; + want_xday = 1; + break; + default: + return NULL; + } + break; + default: + return NULL; + } + } + + if (have_I && is_pm) + tm->tm_hour += 12; + + if (century != -1) + { + if (want_century) + tm->tm_year = tm->tm_year % 100 + (century - 19) * 100; + else + /* Only the century, but not the year. Strange, but so be it. */ + tm->tm_year = (century - 19) * 100; + } + +#ifdef _NL_CURRENT + if (era_cnt != -1) + { + era = _nl_select_era_entry(era_cnt); + if (want_era) + tm->tm_year = (era->start_date[0] + + ((tm->tm_year - era->offset) + * era->absolute_direction)); + else + /* Era start year assumed. */ + tm->tm_year = era->start_date[0]; + } + else +#endif + if (want_era) + return NULL; + + if (want_xday && !have_wday) + { + if ( !(have_mon && have_mday) && have_yday) + { + /* We don't have tm_mon and/or tm_mday, compute them. */ + int t_mon = 0; + while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday) + t_mon++; + if (!have_mon) + tm->tm_mon = t_mon - 1; + if (!have_mday) + tm->tm_mday = + (tm->tm_yday + - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1); + } + day_of_the_week (tm); + } + if (want_xday && !have_yday) + day_of_the_year (tm); + + return rp; +} + + +char *strptime(const char *buf, const char *format, struct tm *tm) +{ + enum locale_status decided; + +#ifdef _NL_CURRENT + decided = not; +#else + decided = raw; +#endif + return strptime_internal (buf, format, tm, &decided, -1); +} diff -Nru openscap-1.2.17/compat/strsep.c openscap-1.3.4/compat/strsep.c --- openscap-1.2.17/compat/strsep.c 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/compat/strsep.c 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,47 @@ +/* + * Copyright 2017 Red Hat Inc., Durham, North Carolina. + * All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Jan Černý + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +char *strsep(char **stringp, const char *delim) +{ + char *str = *stringp; + char *found = NULL; + if (str == NULL) { + return NULL; + } + const size_t delim_cnt = strlen(delim); + for (size_t i = 0; i < delim_cnt && found == NULL; i++) { + found = strchr(str, delim[i]); + } + if (found != NULL) { + *found = '\0'; + *stringp = str + 1; + } else { + *stringp = NULL; + } + return str; +} diff -Nru openscap-1.2.17/confgen.sh openscap-1.3.4/confgen.sh --- openscap-1.2.17/confgen.sh 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/confgen.sh 1969-12-31 19:00:00.000000000 -0500 @@ -1,25 +0,0 @@ -#!/bin/sh -D="$(pwd)" - -echo -n "ac_probes.sh... " -C="$(./ac_probes/ac_probes.sh "$D/ac_probes/configure.ac.tpl" "$D/ac_probes/" "$D/src/OVAL/probes/")" - -ret=$? -if [ $ret -ne 0 ]; then - echo "failed: $ret" - exit $ret -else - echo "$C" > configure.ac - echo "ok" -fi - -echo -n "autogen.sh... " -./autogen.sh - -ret=$? -if [ $ret -ne 0 ]; then - echo "failed: $ret" - exit $ret -else - echo "ok" -fi diff -Nru openscap-1.2.17/config/snippet/arg-nonnull.h openscap-1.3.4/config/snippet/arg-nonnull.h --- openscap-1.2.17/config/snippet/arg-nonnull.h 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/config/snippet/arg-nonnull.h 1969-12-31 19:00:00.000000000 -0500 @@ -1,26 +0,0 @@ -/* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2014 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools - that the values passed as arguments n, ..., m must be non-NULL pointers. - n = 1 stands for the first argument, n = 2 for the second argument etc. */ -#ifndef _GL_ARG_NONNULL -# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 -# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) -# else -# define _GL_ARG_NONNULL(params) -# endif -#endif diff -Nru openscap-1.2.17/config/snippet/c++defs.h openscap-1.3.4/config/snippet/c++defs.h --- openscap-1.2.17/config/snippet/c++defs.h 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/config/snippet/c++defs.h 1969-12-31 19:00:00.000000000 -0500 @@ -1,271 +0,0 @@ -/* C++ compatible function declaration macros. - Copyright (C) 2010-2014 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef _GL_CXXDEFS_H -#define _GL_CXXDEFS_H - -/* The three most frequent use cases of these macros are: - - * For providing a substitute for a function that is missing on some - platforms, but is declared and works fine on the platforms on which - it exists: - - #if @GNULIB_FOO@ - # if !@HAVE_FOO@ - _GL_FUNCDECL_SYS (foo, ...); - # endif - _GL_CXXALIAS_SYS (foo, ...); - _GL_CXXALIASWARN (foo); - #elif defined GNULIB_POSIXCHECK - ... - #endif - - * For providing a replacement for a function that exists on all platforms, - but is broken/insufficient and needs to be replaced on some platforms: - - #if @GNULIB_FOO@ - # if @REPLACE_FOO@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef foo - # define foo rpl_foo - # endif - _GL_FUNCDECL_RPL (foo, ...); - _GL_CXXALIAS_RPL (foo, ...); - # else - _GL_CXXALIAS_SYS (foo, ...); - # endif - _GL_CXXALIASWARN (foo); - #elif defined GNULIB_POSIXCHECK - ... - #endif - - * For providing a replacement for a function that exists on some platforms - but is broken/insufficient and needs to be replaced on some of them and - is additionally either missing or undeclared on some other platforms: - - #if @GNULIB_FOO@ - # if @REPLACE_FOO@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef foo - # define foo rpl_foo - # endif - _GL_FUNCDECL_RPL (foo, ...); - _GL_CXXALIAS_RPL (foo, ...); - # else - # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ - _GL_FUNCDECL_SYS (foo, ...); - # endif - _GL_CXXALIAS_SYS (foo, ...); - # endif - _GL_CXXALIASWARN (foo); - #elif defined GNULIB_POSIXCHECK - ... - #endif -*/ - -/* _GL_EXTERN_C declaration; - performs the declaration with C linkage. */ -#if defined __cplusplus -# define _GL_EXTERN_C extern "C" -#else -# define _GL_EXTERN_C extern -#endif - -/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); - declares a replacement function, named rpl_func, with the given prototype, - consisting of return type, parameters, and attributes. - Example: - _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) - _GL_ARG_NONNULL ((1))); - */ -#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ - _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) -#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C rettype rpl_func parameters_and_attributes - -/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); - declares the system function, named func, with the given prototype, - consisting of return type, parameters, and attributes. - Example: - _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) - _GL_ARG_NONNULL ((1))); - */ -#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C rettype func parameters_and_attributes - -/* _GL_CXXALIAS_RPL (func, rettype, parameters); - declares a C++ alias called GNULIB_NAMESPACE::func - that redirects to rpl_func, if GNULIB_NAMESPACE is defined. - Example: - _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); - */ -#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ - _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - rettype (*const func) parameters = ::rpl_func; \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); - is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); - except that the C function rpl_func may have a slightly different - declaration. A cast is used to silence the "invalid conversion" error - that would otherwise occur. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - rettype (*const func) parameters = \ - reinterpret_cast(::rpl_func); \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_SYS (func, rettype, parameters); - declares a C++ alias called GNULIB_NAMESPACE::func - that redirects to the system provided function func, if GNULIB_NAMESPACE - is defined. - Example: - _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); - */ -#if defined __cplusplus && defined GNULIB_NAMESPACE - /* If we were to write - rettype (*const func) parameters = ::func; - like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls - better (remove an indirection through a 'static' pointer variable), - but then the _GL_CXXALIASWARN macro below would cause a warning not only - for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = ::func; \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); - is like _GL_CXXALIAS_SYS (func, rettype, parameters); - except that the C function func may have a slightly different declaration. - A cast is used to silence the "invalid conversion" error that would - otherwise occur. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = \ - reinterpret_cast(::func); \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); - is like _GL_CXXALIAS_SYS (func, rettype, parameters); - except that the C function is picked among a set of overloaded functions, - namely the one with rettype2 and parameters2. Two consecutive casts - are used to silence the "cannot find a match" and "invalid conversion" - errors that would otherwise occur. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE - /* The outer cast must be a reinterpret_cast. - The inner cast: When the function is defined as a set of overloaded - functions, it works as a static_cast<>, choosing the designated variant. - When the function is defined as a single variant, it works as a - reinterpret_cast<>. The parenthesized cast syntax works both ways. */ -# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = \ - reinterpret_cast( \ - (rettype2(*)parameters2)(::func)); \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIASWARN (func); - causes a warning to be emitted when ::func is used but not when - GNULIB_NAMESPACE::func is used. func must be defined without overloaded - variants. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIASWARN(func) \ - _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) -# define _GL_CXXALIASWARN_1(func,namespace) \ - _GL_CXXALIASWARN_2 (func, namespace) -/* To work around GCC bug , - we enable the warning only when not optimizing. */ -# if !__OPTIMIZE__ -# define _GL_CXXALIASWARN_2(func,namespace) \ - _GL_WARN_ON_USE (func, \ - "The symbol ::" #func " refers to the system function. " \ - "Use " #namespace "::" #func " instead.") -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -# define _GL_CXXALIASWARN_2(func,namespace) \ - extern __typeof__ (func) func -# else -# define _GL_CXXALIASWARN_2(func,namespace) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -# endif -#else -# define _GL_CXXALIASWARN(func) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); - causes a warning to be emitted when the given overloaded variant of ::func - is used but not when GNULIB_NAMESPACE::func is used. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ - _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ - GNULIB_NAMESPACE) -# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ - _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -/* To work around GCC bug , - we enable the warning only when not optimizing. */ -# if !__OPTIMIZE__ -# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ - "The symbol ::" #func " refers to the system function. " \ - "Use " #namespace "::" #func " instead.") -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - extern __typeof__ (func) func -# else -# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -# endif -#else -# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -#endif /* _GL_CXXDEFS_H */ diff -Nru openscap-1.2.17/config/snippet/_Noreturn.h openscap-1.3.4/config/snippet/_Noreturn.h --- openscap-1.2.17/config/snippet/_Noreturn.h 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/config/snippet/_Noreturn.h 1969-12-31 19:00:00.000000000 -0500 @@ -1,10 +0,0 @@ -#if !defined _Noreturn && __STDC_VERSION__ < 201112 -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) -# define _Noreturn __attribute__ ((__noreturn__)) -# elif 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn -# endif -#endif diff -Nru openscap-1.2.17/config/snippet/warn-on-use.h openscap-1.3.4/config/snippet/warn-on-use.h --- openscap-1.2.17/config/snippet/warn-on-use.h 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/config/snippet/warn-on-use.h 1969-12-31 19:00:00.000000000 -0500 @@ -1,109 +0,0 @@ -/* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2014 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* _GL_WARN_ON_USE (function, "literal string") issues a declaration - for FUNCTION which will then trigger a compiler warning containing - the text of "literal string" anywhere that function is called, if - supported by the compiler. If the compiler does not support this - feature, the macro expands to an unused extern declaration. - - This macro is useful for marking a function as a potential - portability trap, with the intent that "literal string" include - instructions on the replacement function that should be used - instead. However, one of the reasons that a function is a - portability trap is if it has the wrong signature. Declaring - FUNCTION with a different signature in C is a compilation error, so - this macro must use the same type as any existing declaration so - that programs that avoid the problematic FUNCTION do not fail to - compile merely because they included a header that poisoned the - function. But this implies that _GL_WARN_ON_USE is only safe to - use if FUNCTION is known to already have a declaration. Use of - this macro implies that there must not be any other macro hiding - the declaration of FUNCTION; but undefining FUNCTION first is part - of the poisoning process anyway (although for symbols that are - provided only via a macro, the result is a compilation error rather - than a warning containing "literal string"). Also note that in - C++, it is only safe to use if FUNCTION has no overloads. - - For an example, it is possible to poison 'getline' by: - - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], - [getline]) in configure.ac, which potentially defines - HAVE_RAW_DECL_GETLINE - - adding this code to a header that wraps the system : - #undef getline - #if HAVE_RAW_DECL_GETLINE - _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" - "not universally present; use the gnulib module getline"); - #endif - - It is not possible to directly poison global variables. But it is - possible to write a wrapper accessor function, and poison that - (less common usage, like &environ, will cause a compilation error - rather than issue the nice warning, but the end result of informing - the developer about their portability problem is still achieved): - #if HAVE_RAW_DECL_ENVIRON - static char ***rpl_environ (void) { return &environ; } - _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); - # undef environ - # define environ (*rpl_environ ()) - #endif - */ -#ifndef _GL_WARN_ON_USE - -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -/* A compiler attribute is available in gcc versions 4.3.0 and later. */ -# define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function __attribute__ ((__warning__ (message))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -/* Verify the existence of the function. */ -# define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function -# else /* Unsupported. */ -# define _GL_WARN_ON_USE(function, message) \ -_GL_WARN_EXTERN_C int _gl_warn_on_use -# endif -#endif - -/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") - is like _GL_WARN_ON_USE (function, "string"), except that the function is - declared with the given prototype, consisting of return type, parameters, - and attributes. - This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does - not work in this case. */ -#ifndef _GL_WARN_ON_USE_CXX -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes \ - __attribute__ ((__warning__ (msg))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -/* Verify the existence of the function. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes -# else /* Unsupported. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -_GL_WARN_EXTERN_C int _gl_warn_on_use -# endif -#endif - -/* _GL_WARN_EXTERN_C declaration; - performs the declaration with C linkage. */ -#ifndef _GL_WARN_EXTERN_C -# if defined __cplusplus -# define _GL_WARN_EXTERN_C extern "C" -# else -# define _GL_WARN_EXTERN_C extern -# endif -#endif diff -Nru openscap-1.2.17/config.h.in openscap-1.3.4/config.h.in --- openscap-1.2.17/config.h.in 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/config.h.in 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,139 @@ +#ifndef _OPENSCAP_CONFIG_H_ +#define _OPENSCAP_CONFIG_H_ + +#define OPENSCAP_VERSION "@OPENSCAP_VERSION@" +#define OPENSCAP_VERSION_MAJOR @OPENSCAP_VERSION_MAJOR@ +#define OPENSCAP_VERSION_MINOR @OPENSCAP_VERSION_MINOR@ +#define OPENSCAP_VERSION_PATCH @OPENSCAP_VERSION_PATCH@ + +#cmakedefine LT_CURRENT_MINUS_AGE @LT_CURRENT_MINUS_AGE@ + +#cmakedefine CMAKE_USE_PTHREADS_INIT @CMAKE_USE_PTHREADS_INIT@ +#if defined(CMAKE_USE_PTHREADS_INIT) +#define OSCAP_THREAD_SAFE +#endif + +#cmakedefine GCRYPT_FOUND +#if defined(GCRYPT_FOUND) +#define HAVE_GCRYPT +#cmakedefine HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG +#endif + +#cmakedefine NSS3_FOUND +#if defined(NSS3_FOUND) +#define HAVE_NSS3 +#endif + +#define OSCAP_DEFAULT_SCHEMA_PATH "@OSCAP_DEFAULT_SCHEMA_PATH@" +#define OSCAP_DEFAULT_XSLT_PATH "@OSCAP_DEFAULT_XSLT_PATH@" +#define OSCAP_DEFAULT_CPE_PATH "@OSCAP_DEFAULT_CPE_PATH@" +#define OSCAP_TEMP_DIR "@OSCAP_TEMP_DIR@" + +#cmakedefine HAVE_ATOMIC_BUILTINS + +#cmakedefine HAVE_ACL_EXTENDED_FILE +#cmakedefine HAVE_BLKID_GET_TAG_VALUE +#cmakedefine HAVE_CAP_GET_PID +#cmakedefine HAVE_DEV_TO_TTY +#cmakedefine HAVE_RPMREADCONFIGFILES +#cmakedefine HAVE_HEADERFORMAT +#cmakedefine HAVE_RPMFREECRYPTO +#cmakedefine HAVE_RPMFREEFILESYSTEMS +#cmakedefine HAVE_RPMVERIFYFILE + +#cmakedefine HAVE_RPMVERCMP +#cmakedefine RPM46_FOUND +#cmakedefine RPM47_FOUND + +#cmakedefine BZIP2_FOUND + +#cmakedefine HAVE_PTHREAD_TIMEDJOIN_NP +#cmakedefine HAVE_PTHREAD_SETNAME_NP +#cmakedefine HAVE_PTHREAD_GETNAME_NP +#cmakedefine HAVE_CLOCK_GETTIME + +#cmakedefine HAVE_POSIX_MEMALIGN +#cmakedefine HAVE_MEMALIGN +#cmakedefine HAVE_FTS_OPEN + +#cmakedefine SEAP_MSGID_BITS @SEAP_MSGID_BITS@ +#cmakedefine WANT_BASE64 +#cmakedefine WANT_XBASE64 + +#cmakedefine ENABLE_PROBES +#if defined(ENABLE_PROBES) +#define OVAL_PROBES_ENABLED +#endif + +#cmakedefine HAVE_SYSLOG_H +#cmakedefine HAVE_STDIO_EXT_H +#cmakedefine CAP_FOUND +#cmakedefine SELINUX_FOUND +#cmakedefine HAVE_PROC_DEVNAME_H +#cmakedefine HAVE_SHADOW_H +#cmakedefine HAVE_SYS_SYSTEMINFO_H +#cmakedefine HAVE_ACL_LIBACL_H +#cmakedefine HAVE_SYS_ACL_H +#cmakedefine HAVE_GETOPT_H +#cmakedefine HAVE_UIO_H +#cmakedefine HAVE_ATTR_XATTR_H +#cmakedefine HAVE_SYS_XATTR_H +#cmakedefine HAVE_SYS_EXTATTR_H + +#cmakedefine HAVE_STRSEP +#cmakedefine HAVE_FLOCK +#cmakedefine HAVE_STRPTIME + +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE58 +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_FAMILY +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_FILEHASH +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_FILEHASH58 +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_SQL +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_SQL57 +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_SYSTEM_INFO +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54 +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_VARIABLE +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT +#cmakedefine OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT +#cmakedefine OPENSCAP_PROBE_LINUX_DPKGINFO +#cmakedefine OPENSCAP_PROBE_LINUX_IFLISTENERS +#cmakedefine OPENSCAP_PROBE_LINUX_INETLISTENINGSERVERS +#cmakedefine OPENSCAP_PROBE_LINUX_PARTITION +#cmakedefine OPENSCAP_PROBE_LINUX_RPMINFO +#cmakedefine OPENSCAP_PROBE_LINUX_RPMVERIFY +#cmakedefine OPENSCAP_PROBE_LINUX_RPMVERIFYFILE +#cmakedefine OPENSCAP_PROBE_LINUX_RPMVERIFYPACKAGE +#cmakedefine OPENSCAP_PROBE_LINUX_SELINUXBOOLEAN +#cmakedefine OPENSCAP_PROBE_LINUX_SELINUXSECURITYCONTEXT +#cmakedefine OPENSCAP_PROBE_LINUX_SYSTEMDUNITDEPENDENCY +#cmakedefine OPENSCAP_PROBE_LINUX_SYSTEMDUNITPROPERTY +#cmakedefine OPENSCAP_PROBE_SOLARIS_ISAINFO +#cmakedefine OPENSCAP_PROBE_UNIX_DNSCACHE +#cmakedefine OPENSCAP_PROBE_UNIX_FILE +#cmakedefine OPENSCAP_PROBE_UNIX_FILEEXTENDEDATTRIBUTE +#cmakedefine OPENSCAP_PROBE_UNIX_GCONF +#cmakedefine OPENSCAP_PROBE_UNIX_INTERFACE +#cmakedefine OPENSCAP_PROBE_UNIX_PASSWORD +#cmakedefine OPENSCAP_PROBE_UNIX_PROCESS +#cmakedefine OPENSCAP_PROBE_UNIX_PROCESS58 +#cmakedefine OPENSCAP_PROBE_UNIX_ROUTINGTABLE +#cmakedefine OPENSCAP_PROBE_UNIX_RUNLEVEL +#cmakedefine OPENSCAP_PROBE_UNIX_SHADOW +#cmakedefine OPENSCAP_PROBE_UNIX_SYMLINK +#cmakedefine OPENSCAP_PROBE_UNIX_SYSCTL +#cmakedefine OPENSCAP_PROBE_UNIX_UNAME +#cmakedefine OPENSCAP_PROBE_UNIX_XINETD +#cmakedefine OPENSCAP_PROBE_WINDOWS_ACCESSTOKEN +#cmakedefine OPENSCAP_PROBE_WINDOWS_REGISTRY +#cmakedefine OPENSCAP_PROBE_WINDOWS_WMI57 + +#cmakedefine PREFERRED_PYTHON_PATH "@PREFERRED_PYTHON_PATH@" +#cmakedefine PYTHON2_PATH "@PYTHON2_PATH@" +#cmakedefine PYTHON3_PATH "@PYTHON3_PATH@" + +#include "oscap_platforms.h" +#include "compat.h" + +#endif diff -Nru openscap-1.2.17/configure.ac openscap-1.3.4/configure.ac --- openscap-1.2.17/configure.ac 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/configure.ac 1969-12-31 19:00:00.000000000 -0500 @@ -1,1864 +0,0 @@ -# ! MAKE SURE YOU ARE EDITING THE ac_probes/configure.ac.tpl FILE, -# ! THE configure.ac FILE ITSELF IS GENERATED FROM THE TEMPLATE USING -# ! ac_probes/ac_probes.sh - -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. -AC_PREREQ(2.59) -AC_INIT([openscap], [1.2.17], [open-scap-list@redhat.com]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_AUX_DIR([config]) -AC_CONFIG_MACRO_DIR([m4]) - -AM_INIT_AUTOMAKE([foreign tar-pax]) - -# If automake supports "silent rules", enable them by default -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AC_DISABLE_STATIC -#build dll on windows(cygwin) -AC_LIBTOOL_WIN32_DLL - -# Checks for programs. -AC_PROG_CC -gl_EARLY -gl_INIT -AM_PROG_LIBTOOL -AM_PROG_CC_C_O -AC_PROG_CXX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL - -# swig -AC_PROG_SWIG([]) - -# libtool versioning -# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details - -## increment if the interface has additions, changes, removals. -LT_CURRENT=22 - -## increment any time the source changes; set 0 to if you increment CURRENT -LT_REVISION=1 - -## increment if any interfaces have been added; set to 0 -## if any interfaces have been changed or removed. removal has -## precedence over adding, so set to 0 if both happened. -LT_AGE=14 - -LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` - -AC_SUBST(LT_CURRENT) -AC_SUBST(LT_REVISION) -AC_SUBST(LT_AGE) -AC_SUBST(LT_CURRENT_MINUS_AGE) - -AC_DEFINE_UNQUOTED([LT_CURRENT_MINUS_AGE], [$LT_CURRENT_MINUS_AGE], [LT_CURRENT - LT_AGE]) - -AC_DEFUN([canonical_wrap], [AC_REQUIRE([AC_CANONICAL_HOST])]) -canonical_wrap - -# Compiler flags -CFLAGS="$CFLAGS -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas -D_GNU_SOURCE -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L" - -case $host in - *solaris*) : - CFLAGS="$CFLAGS -D__EXTENSIONS__" ;; -esac - -CFLAGS_OPTIMIZED="-O2 -finline-functions" -CFLAGS_DEBUGGING="-fno-inline-functions -O0 -g3" -CFLAGS_NODEBUG="-Wno-unused-function" - -my_save_cflags="$CFLAGS" -CFLAGS="$CFLAGS -Werror=format-security" -AC_MSG_CHECKING([whether CC supports -Werror=format-security]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [AC_MSG_RESULT([yes])] - [AM_CFLAGS="-Werror=format-security"], - [AC_MSG_RESULT([no])] -) -CFLAGS="$my_save_cflags" -AC_SUBST([AM_CFLAGS]) - - -probe_family_req_deps_ok=yes -probe_family_req_deps_missing= -probe_family_opt_deps_ok=yes -probe_family_opt_deps_missing= -probe_textfilecontent_req_deps_ok=yes -probe_textfilecontent_req_deps_missing= -probe_textfilecontent_opt_deps_ok=yes -probe_textfilecontent_opt_deps_missing= -probe_textfilecontent54_req_deps_ok=yes -probe_textfilecontent54_req_deps_missing= -probe_textfilecontent54_opt_deps_ok=yes -probe_textfilecontent54_opt_deps_missing= -probe_variable_req_deps_ok=yes -probe_variable_req_deps_missing= -probe_variable_opt_deps_ok=yes -probe_variable_opt_deps_missing= -probe_xmlfilecontent_req_deps_ok=yes -probe_xmlfilecontent_req_deps_missing= -probe_xmlfilecontent_opt_deps_ok=yes -probe_xmlfilecontent_opt_deps_missing= -probe_filehash_req_deps_ok=yes -probe_filehash_req_deps_missing= -probe_filehash_opt_deps_ok=yes -probe_filehash_opt_deps_missing= -probe_filehash58_req_deps_ok=yes -probe_filehash58_req_deps_missing= -probe_filehash58_opt_deps_ok=yes -probe_filehash58_opt_deps_missing= -probe_environmentvariable_req_deps_ok=yes -probe_environmentvariable_req_deps_missing= -probe_environmentvariable_opt_deps_ok=yes -probe_environmentvariable_opt_deps_missing= -probe_environmentvariable58_req_deps_ok=yes -probe_environmentvariable58_req_deps_missing= -probe_environmentvariable58_opt_deps_ok=yes -probe_environmentvariable58_opt_deps_missing= -probe_sql_req_deps_ok=yes -probe_sql_req_deps_missing= -probe_sql_opt_deps_ok=yes -probe_sql_opt_deps_missing= -probe_sql57_req_deps_ok=yes -probe_sql57_req_deps_missing= -probe_sql57_opt_deps_ok=yes -probe_sql57_opt_deps_missing= -probe_ldap57_req_deps_ok=yes -probe_ldap57_req_deps_missing= -probe_ldap57_opt_deps_ok=yes -probe_ldap57_opt_deps_missing= -probe_dnscache_req_deps_ok=yes -probe_dnscache_req_deps_missing= -probe_dnscache_opt_deps_ok=yes -probe_dnscache_opt_deps_missing= -probe_runlevel_req_deps_ok=yes -probe_runlevel_req_deps_missing= -probe_runlevel_opt_deps_ok=yes -probe_runlevel_opt_deps_missing= -probe_file_req_deps_ok=yes -probe_file_req_deps_missing= -probe_file_opt_deps_ok=yes -probe_file_opt_deps_missing= -probe_fileextendedattribute_req_deps_ok=yes -probe_fileextendedattribute_req_deps_missing= -probe_fileextendedattribute_opt_deps_ok=yes -probe_fileextendedattribute_opt_deps_missing= -probe_password_req_deps_ok=yes -probe_password_req_deps_missing= -probe_password_opt_deps_ok=yes -probe_password_opt_deps_missing= -probe_process_req_deps_ok=yes -probe_process_req_deps_missing= -probe_process_opt_deps_ok=yes -probe_process_opt_deps_missing= -probe_process58_req_deps_ok=yes -probe_process58_req_deps_missing= -probe_process58_opt_deps_ok=yes -probe_process58_opt_deps_missing= -probe_shadow_req_deps_ok=yes -probe_shadow_req_deps_missing= -probe_shadow_opt_deps_ok=yes -probe_shadow_opt_deps_missing= -probe_uname_req_deps_ok=yes -probe_uname_req_deps_missing= -probe_uname_opt_deps_ok=yes -probe_uname_opt_deps_missing= -probe_interface_req_deps_ok=yes -probe_interface_req_deps_missing= -probe_interface_opt_deps_ok=yes -probe_interface_opt_deps_missing= -probe_xinetd_req_deps_ok=yes -probe_xinetd_req_deps_missing= -probe_xinetd_opt_deps_ok=yes -probe_xinetd_opt_deps_missing= -probe_sysctl_req_deps_ok=yes -probe_sysctl_req_deps_missing= -probe_sysctl_opt_deps_ok=yes -probe_sysctl_opt_deps_missing= -probe_routingtable_req_deps_ok=yes -probe_routingtable_req_deps_missing= -probe_routingtable_opt_deps_ok=yes -probe_routingtable_opt_deps_missing= -probe_symlink_req_deps_ok=yes -probe_symlink_req_deps_missing= -probe_symlink_opt_deps_ok=yes -probe_symlink_opt_deps_missing= -probe_gconf_req_deps_ok=yes -probe_gconf_req_deps_missing= -probe_gconf_opt_deps_ok=yes -probe_gconf_opt_deps_missing= -probe_isainfo_req_deps_ok=yes -probe_isainfo_req_deps_missing= -probe_isainfo_opt_deps_ok=yes -probe_isainfo_opt_deps_missing= -probe_package_req_deps_ok=yes -probe_package_req_deps_missing= -probe_package_opt_deps_ok=yes -probe_package_opt_deps_missing= -probe_patch_req_deps_ok=yes -probe_patch_req_deps_missing= -probe_patch_opt_deps_ok=yes -probe_patch_opt_deps_missing= -probe_smf_req_deps_ok=yes -probe_smf_req_deps_missing= -probe_smf_opt_deps_ok=yes -probe_smf_opt_deps_missing= -probe_partition_req_deps_ok=yes -probe_partition_req_deps_missing= -probe_partition_opt_deps_ok=yes -probe_partition_opt_deps_missing= -probe_inetlisteningservers_req_deps_ok=yes -probe_inetlisteningservers_req_deps_missing= -probe_inetlisteningservers_opt_deps_ok=yes -probe_inetlisteningservers_opt_deps_missing= -probe_iflisteners_req_deps_ok=yes -probe_iflisteners_req_deps_missing= -probe_iflisteners_opt_deps_ok=yes -probe_iflisteners_opt_deps_missing= -probe_selinuxboolean_req_deps_ok=yes -probe_selinuxboolean_req_deps_missing= -probe_selinuxboolean_opt_deps_ok=yes -probe_selinuxboolean_opt_deps_missing= -probe_selinuxsecuritycontext_req_deps_ok=yes -probe_selinuxsecuritycontext_req_deps_missing= -probe_selinuxsecuritycontext_opt_deps_ok=yes -probe_selinuxsecuritycontext_opt_deps_missing= -probe_rpminfo_req_deps_ok=yes -probe_rpminfo_req_deps_missing= -probe_rpminfo_opt_deps_ok=yes -probe_rpminfo_opt_deps_missing= -probe_rpmverify_req_deps_ok=yes -probe_rpmverify_req_deps_missing= -probe_rpmverify_opt_deps_ok=yes -probe_rpmverify_opt_deps_missing= -probe_rpmverifyfile_req_deps_ok=yes -probe_rpmverifyfile_req_deps_missing= -probe_rpmverifyfile_opt_deps_ok=yes -probe_rpmverifyfile_opt_deps_missing= -probe_rpmverifypackage_req_deps_ok=yes -probe_rpmverifypackage_req_deps_missing= -probe_rpmverifypackage_opt_deps_ok=yes -probe_rpmverifypackage_opt_deps_missing= -probe_dpkginfo_req_deps_ok=yes -probe_dpkginfo_req_deps_missing= -probe_dpkginfo_opt_deps_ok=yes -probe_dpkginfo_opt_deps_missing= -probe_systemdunitproperty_req_deps_ok=yes -probe_systemdunitproperty_req_deps_missing= -probe_systemdunitproperty_opt_deps_ok=yes -probe_systemdunitproperty_opt_deps_missing= -probe_systemdunitdependency_req_deps_ok=yes -probe_systemdunitdependency_req_deps_missing= -probe_systemdunitdependency_opt_deps_ok=yes -probe_systemdunitdependency_opt_deps_missing= - -# -# env -# -AC_CHECK_PROG( - [HAVE_ENV], - [env], - [yes],,, -) - -AM_CONDITIONAL(ENV_PRESENT, [test x"${HAVE_ENV}" = xyes]) - -# -# Valgrind -# -AC_CHECK_PROG( - [HAVE_VALGRIND], - [valgrind], - [yes],,, -) - -AM_CONDITIONAL(VALGRIND_PRESENT, [test x"${HAVE_VALGRIND}" = xyes]) - -AC_HEADER_STDC -AC_HEADER_STDBOOL -AC_TYPE_SIZE_T - -AC_FUNC_MALLOC -AC_FUNC_REALLOC - -# Check for pthreads support: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_pthread.m4 -AX_PTHREAD() - -if test "x$ax_pthread_ok" != "xyes"; then - AC_MSG_FAILURE(pthread library is missing) -fi - -SAVE_LIBS=$LIBS -SAVE_CFLAGS=$CFLAGS - -CFLAGS="$CFLAGS -D_GNU_SOURCE" -LIBS="$PTHREAD_LIBS" - -AC_CHECK_FUNCS([pthread_timedjoin_np pthread_setname_np pthread_getname_np clock_gettime]) - -CFLAGS=$SAVE_CFLAGS -LIBS=$SAVE_LIBS - -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_LIBS]) - - -PKG_CHECK_MODULES([curl], [libcurl >= 7.12.0],[], - AC_MSG_FAILURE([libcurl devel support is missing])) - -PKG_CHECK_MODULES([xml2], [libxml-2.0 >= 2.0],[], - AC_MSG_FAILURE([libxml-2.0 devel support is missing])) - -PKG_CHECK_MODULES([xslt], [libxslt >= 1.1],[], - AC_MSG_FAILURE([libxslt devel support is missing])) - -PKG_CHECK_MODULES([exslt], [libexslt >= 0.8],[], - AC_MSG_FAILURE([libexslt devel support is missing])) - -AC_CHECK_HEADER(pcre.h, , [AC_MSG_ERROR([pcre.h is missing] )]) - -crapi_CFLAGS="" -crapi_LIBS="" - -if test "${with_crypto}" = ""; then - with_crypto=gcrypt -fi - -case "${with_crypto}" in - nss3) - PKG_CHECK_MODULES([nss3], [nss >= 3.0],[], - AC_MSG_FAILURE([libnss3 devel support is missing])) - - crapi_libname="NSS 3.x" - crapi_CFLAGS=$nss3_CFLAGS - crapi_LIBS=$nss3_LIBS - AC_DEFINE([HAVE_NSS3], [1], [Define to 1 if you have 'NSS' library.]) - ;; - gcrypt) - SAVE_LIBS=$LIBS - AC_CHECK_LIB([gcrypt], [gcry_check_version], - [crapi_CFLAGS=`libgcrypt-config --cflags`; - crapi_LIBS=`libgcrypt-config --libs`; - crapi_libname="GCrypt";], - [AC_MSG_ERROR([library 'gcrypt' is required for GCrypt.])], - []) - AC_DEFINE([HAVE_GCRYPT], [1], [Define to 1 if you have 'gcrypt' library.]) - AC_CACHE_CHECK([for GCRYCTL_SET_ENFORCED_FIPS_FLAG], - [ac_cv_gcryctl_set_enforced_fips_flag], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include], - [return GCRYCTL_SET_ENFORCED_FIPS_FLAG;])], - [ac_cv_gcryctl_set_enforced_fips_flag=yes], - [ac_cv_gcryctl_set_enforced_fips_flag=no])]) - - if test "${ac_cv_gcryctl_set_enforced_fips_flag}" == "yes"; then - AC_DEFINE([HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG], [1], [Define to 1 if you have 'gcrypt' library with GCRYCTL_SET_ENFORCED_FIPS_FLAG.]) - fi - LIBS=$SAVE_LIBS - ;; - *) - AC_MSG_ERROR([unknown crypto backend]) - ;; -esac - -AC_SUBST(crapi_CFLAGS) -AC_SUBST(crapi_LIBS) - -AC_CHECK_FUNCS([fts_open posix_memalign memalign]) -AC_CHECK_FUNC(sigwaitinfo, [sigwaitinfo_LIBS=""], [sigwaitinfo_LIBS="-lrt"]) -AC_SUBST(sigwaitinfo_LIBS) - -# libopenscap links against librpm if found. Otherwise we carry own implementation of rpmvercmp. -echo -echo '* Checking for rpm library (optional dependency of libopenscap) ' -PKG_CHECK_MODULES([rpm], [rpm >= 4.4],[ - SAVE_LIBS=$LIBS - AC_DEFINE([HAVE_RPMVERCMP], [1], [Define to 1 if there is rpmvercmp available.]) - AC_SUBST([rpm_CFLAGS]) - AC_SUBST([rpm_LIBS]) - LIBS=$SAVE_LIBS -],[ - AC_MSG_NOTICE([!!! librpm not found. The rpmvercmp function will be emulated. !!!]) -]) -PKG_CHECK_MODULES([rpm], [rpm >= 4.6],[ - AC_DEFINE([HAVE_RPM46], [1], [Define to 1 if rpm is newer than 4.6.]) -],[ - AC_MSG_NOTICE([librpm is older than 4.6]) -]) -PKG_CHECK_MODULES([rpm], [rpm >= 4.7],[ - AC_DEFINE([HAVE_RPM47], [1], [Define to 1 if rpm is newer than 4.7.]) -],[ - AC_MSG_NOTICE([librpm is older than 4.7]) -]) -echo -echo '* Checking for bz2 library (optional dependency of libopenscap)' -AC_CHECK_LIB([bz2], [BZ2_bzReadOpen], - [ - AC_DEFINE([HAVE_BZ2], [1], [Define to 1 if there is libbz2 available.]) - LIBS="$LIBS -lbz2" - AC_CHECK_PROG([HAVE_BZIP2],[bzip2],[yes],,,) - ],[ - AC_MSG_NOTICE([!!! libbz2 not found. Bzip2 support will be disabled !!!]) - ]) -AM_CONDITIONAL([HAVE_BZIP2], [test "x${HAVE_BZIP2}" = xyes]) - - -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $(pkg-config libapt-pkg --cflags) $(pkg-config blkid --cflags) $(pkg-config dbus-1 --cflags) $(pkg-config gconf-2.0 --cflags) $(pkg-config libpcre --cflags) $(pkg-config libprocps --cflags) $(pkg-config rpm --cflags) $(pkg-config libselinux --cflags) $(pkg-config libxml-2.0 --cflags) $(pkg-config libxslt --cflags) " - -echo -echo ' * Checking presence of required headers for the family probe' -AC_CHECK_HEADERS([string.h ],[],[probe_family_req_deps_ok=no; probe_family_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the textfilecontent probe' -AC_CHECK_HEADERS([fcntl.h limits.h stdio.h string.h sys/stat.h sys/types.h ],[],[probe_textfilecontent_req_deps_ok=no; probe_textfilecontent_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the textfilecontent54 probe' -AC_CHECK_HEADERS([errno.h fcntl.h limits.h stdio.h stdlib.h string.h sys/stat.h sys/types.h unistd.h ],[],[probe_textfilecontent54_req_deps_ok=no; probe_textfilecontent54_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the variable probe' -AC_CHECK_HEADERS([errno.h stdio.h stdlib.h string.h ],[],[probe_variable_req_deps_ok=no; probe_variable_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the xmlfilecontent probe' -AC_CHECK_HEADERS([libxml/parser.h libxml/tree.h libxml/xpath.h libxml/xpathInternals.h limits.h stdlib.h string.h ],[],[probe_xmlfilecontent_req_deps_ok=no; probe_xmlfilecontent_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the filehash probe' -AC_CHECK_HEADERS([errno.h fcntl.h limits.h pthread.h stdlib.h string.h sys/stat.h sys/types.h ],[],[probe_filehash_req_deps_ok=no; probe_filehash_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the filehash58 probe' -AC_CHECK_HEADERS([errno.h fcntl.h limits.h pthread.h stdlib.h string.h sys/stat.h sys/types.h ],[],[probe_filehash58_req_deps_ok=no; probe_filehash58_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the environmentvariable probe' -AC_CHECK_HEADERS([errno.h stdio.h stdlib.h string.h ],[],[probe_environmentvariable_req_deps_ok=no; probe_environmentvariable_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the environmentvariable58 probe' -AC_CHECK_HEADERS([dirent.h errno.h fcntl.h stdio.h stdlib.h string.h sys/stat.h sys/types.h unistd.h ],[],[probe_environmentvariable58_req_deps_ok=no; probe_environmentvariable58_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the sql probe' -AC_CHECK_HEADERS([ctype.h errno.h opendbx/api.h stdlib.h string.h time.h ],[],[probe_sql_req_deps_ok=no; probe_sql_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the sql57 probe' -AC_CHECK_HEADERS([ctype.h errno.h opendbx/api.h stdlib.h string.h time.h ],[],[probe_sql57_req_deps_ok=no; probe_sql57_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the ldap57 probe' -AC_CHECK_HEADERS([ldap.h pthread.h stdbool.h ],[],[probe_ldap57_req_deps_ok=no; probe_ldap57_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the dnscache probe' -AC_CHECK_HEADERS([string.h ],[],[probe_dnscache_req_deps_ok=no; probe_dnscache_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the runlevel probe' -AC_CHECK_HEADERS([assert.h dirent.h errno.h limits.h stdbool.h stdio.h string.h sys/stat.h sys/types.h unistd.h ],[],[probe_runlevel_req_deps_ok=no; probe_runlevel_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the file probe' -AC_CHECK_HEADERS([errno.h limits.h pthread.h stdlib.h string.h sys/stat.h ],[],[probe_file_req_deps_ok=no; probe_file_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of optional headers for the file probe' -AC_CHECK_HEADERS([acl/libacl.h sys/acl.h sys/types.h ],[],[probe_file_opt_deps_ok=no],[-]) - -echo -echo ' * Checking presence of required headers for the fileextendedattribute probe' -AC_CHECK_HEADERS([attr/xattr.h errno.h limits.h pthread.h stdlib.h string.h sys/stat.h sys/types.h ],[],[probe_fileextendedattribute_req_deps_ok=no; probe_fileextendedattribute_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the password probe' -AC_CHECK_HEADERS([errno.h lastlog.h paths.h pwd.h stdio.h stdlib.h string.h ],[],[probe_password_req_deps_ok=no; probe_password_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the process probe' -AC_CHECK_HEADERS([dirent.h errno.h sched.h time.h ],[],[probe_process_req_deps_ok=no; probe_process_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of optional headers for the process probe' -AC_CHECK_HEADERS([fcntl.h proc/devname.h stdio_ext.h stdio.h stdlib.h string.h sys/stat.h sys/sysmacros.h sys/types.h unistd.h ],[],[probe_process_opt_deps_ok=no],[-]) - -echo -echo ' * Checking presence of required headers for the process58 probe' -AC_CHECK_HEADERS([dirent.h errno.h sched.h time.h ],[],[probe_process58_req_deps_ok=no; probe_process58_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of optional headers for the process58 probe' -AC_CHECK_HEADERS([ctype.h fcntl.h proc/devname.h selinux/context.h selinux/selinux.h stdio_ext.h stdio.h stdlib.h string.h sys/capability.h sys/stat.h sys/sysmacros.h sys/types.h unistd.h ],[],[probe_process58_opt_deps_ok=no],[-]) - -echo -echo ' * Checking presence of required headers for the shadow probe' -AC_CHECK_HEADERS([errno.h shadow.h stdio.h stdlib.h string.h ],[],[probe_shadow_req_deps_ok=no; probe_shadow_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the uname probe' -AC_CHECK_HEADERS([string.h sys/utsname.h ],[],[probe_uname_req_deps_ok=no; probe_uname_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of optional headers for the uname probe' -AC_CHECK_HEADERS([stdio_ext.h sys/systeminfo.h ],[],[probe_uname_opt_deps_ok=no],[-]) - -echo -echo ' * Checking presence of required headers for the interface probe' -AC_CHECK_HEADERS([arpa/inet.h ifaddrs.h netdb.h net/if_arp.h net/if.h stdio.h string.h sys/ioctl.h sys/socket.h unistd.h ],[],[probe_interface_req_deps_ok=no; probe_interface_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the xinetd probe' -AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h fnmatch.h limits.h netdb.h stdbool.h stddef.h stdint.h stdlib.h string.h sys/stat.h sys/types.h unistd.h ],[],[probe_xinetd_req_deps_ok=no; probe_xinetd_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the sysctl probe' -AC_CHECK_HEADERS([ctype.h errno.h limits.h stdio.h string.h ],[],[probe_sysctl_req_deps_ok=no; probe_sysctl_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the routingtable probe' -AC_CHECK_HEADERS([arpa/inet.h byteswap.h endian.h errno.h netinet/in.h netinet/ip6.h netinet/ip.h net/route.h stdio.h stdlib.h string.h ],[],[probe_routingtable_req_deps_ok=no; probe_routingtable_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the symlink probe' -AC_CHECK_HEADERS([errno.h limits.h stdlib.h string.h sys/stat.h sys/types.h unistd.h ],[],[probe_symlink_req_deps_ok=no; probe_symlink_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the gconf probe' -AC_CHECK_HEADERS([gconf/gconf.h limits.h stdint.h stdlib.h string.h ],[],[probe_gconf_req_deps_ok=no; probe_gconf_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the isainfo probe' -AC_CHECK_HEADERS([arpa/inet.h dirent.h errno.h fcntl.h netdb.h stdio_ext.h stdio.h stdlib.h string.h sys/systeminfo.h ],[],[probe_isainfo_req_deps_ok=no; probe_isainfo_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the partition probe' -AC_CHECK_HEADERS([fcntl.h limits.h linux/fs.h mntent.h stdint.h stdio.h stdlib.h string.h sys/stat.h sys/statvfs.h sys/types.h sys/vfs.h ],[],[probe_partition_req_deps_ok=no; probe_partition_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of optional headers for the partition probe' -AC_CHECK_HEADERS([blkid/blkid.h linux/magic.h ],[],[probe_partition_opt_deps_ok=no],[-]) - -echo -echo ' * Checking presence of required headers for the inetlisteningservers probe' -AC_CHECK_HEADERS([arpa/inet.h dirent.h errno.h fcntl.h netdb.h stdio_ext.h stdio.h stdlib.h string.h ],[],[probe_inetlisteningservers_req_deps_ok=no; probe_inetlisteningservers_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the iflisteners probe' -AC_CHECK_HEADERS([arpa/inet.h dirent.h errno.h fcntl.h netdb.h stdio_ext.h stdio.h stdlib.h string.h ],[],[probe_iflisteners_req_deps_ok=no; probe_iflisteners_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the selinuxboolean probe' -AC_CHECK_HEADERS([errno.h fcntl.h selinux/selinux.h stdio.h stdlib.h string.h sys/stat.h ],[],[probe_selinuxboolean_req_deps_ok=no; probe_selinuxboolean_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the selinuxsecuritycontext probe' -AC_CHECK_HEADERS([dirent.h errno.h fcntl.h limits.h pthread.h selinux/context.h selinux/selinux.h stdlib.h string.h sys/stat.h sys/types.h ],[],[probe_selinuxsecuritycontext_req_deps_ok=no; probe_selinuxsecuritycontext_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the rpminfo probe' -AC_CHECK_HEADERS([assert.h errno.h fcntl.h pthread.h rpm/header.h rpm/rpmdb.h rpm/rpmfi.h rpm/rpmlib.h rpm/rpmlog.h rpm/rpmmacro.h rpm/rpmts.h stdio.h string.h sys/stat.h sys/types.h ],[],[probe_rpminfo_req_deps_ok=no; probe_rpminfo_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the rpmverify probe' -AC_CHECK_HEADERS([assert.h errno.h fcntl.h limits.h pthread.h rpm/header.h rpm/rpmcli.h rpm/rpmdb.h rpm/rpmfi.h rpm/rpmlib.h rpm/rpmlog.h rpm/rpmmacro.h rpm/rpmts.h stdio.h string.h sys/stat.h sys/types.h ],[],[probe_rpmverify_req_deps_ok=no; probe_rpmverify_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the rpmverifyfile probe' -AC_CHECK_HEADERS([assert.h errno.h fcntl.h limits.h pthread.h rpm/header.h rpm/rpmcli.h rpm/rpmdb.h rpm/rpmfi.h rpm/rpmlib.h rpm/rpmlog.h rpm/rpmmacro.h rpm/rpmts.h stdio.h string.h sys/stat.h sys/types.h ],[],[probe_rpmverifyfile_req_deps_ok=no; probe_rpmverifyfile_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the rpmverifypackage probe' -AC_CHECK_HEADERS([assert.h errno.h fcntl.h limits.h popt.h pthread.h rpm/header.h rpm/rpmcli.h rpm/rpmdb.h rpm/rpmfi.h rpm/rpmlib.h rpm/rpmlog.h rpm/rpmmacro.h rpm/rpmts.h stdio.h string.h sys/stat.h sys/types.h unistd.h ],[],[probe_rpmverifypackage_req_deps_ok=no; probe_rpmverifypackage_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the dpkginfo probe' -AC_CHECK_HEADERS([assert.h errno.h stdio.h string.h ],[],[probe_dpkginfo_req_deps_ok=no; probe_dpkginfo_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the systemdunitproperty probe' -AC_CHECK_HEADERS([dbus/dbus.h string.h ],[],[probe_systemdunitproperty_req_deps_ok=no; probe_systemdunitproperty_req_deps_missing='header files'],[-]) - -echo -echo ' * Checking presence of required headers for the systemdunitdependency probe' -AC_CHECK_HEADERS([dbus/dbus.h string.h ],[],[probe_systemdunitdependency_req_deps_ok=no; probe_systemdunitdependency_req_deps_missing='header files'],[-]) - -CPPFLAGS="$SAVE_CPPFLAGS" - -echo -echo '* Checking for acl library used by: file' -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([acl_init],[acl],[ -acl_CFLAGS=; -acl_LIBS=-lacl; -],[ -probe_file_opt_deps_ok=no; -probe_file_opt_deps_missing+=', acl lib'; -],[]) -AC_SUBST([acl_CFLAGS]) -AC_SUBST([acl_LIBS]) -LIBS=$SAVE_LIBS -SAVE_LIBS=$LIBS -LIBS=$acl_LIBS -AC_CHECK_FUNCS([acl_init], [], []) -AC_CHECK_FUNCS([acl_extended_file],[],[]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for apt_pkg library used by: dpkginfo ' -PKG_CHECK_MODULES([apt_pkg], [libapt-pkg >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([pkgVersion],[apt-pkg],[ -apt_pkg_CFLAGS=; -apt_pkg_LIBS=-lapt-pkg; -],[ -probe_dpkginfo_req_deps_ok=no; -probe_dpkginfo_req_deps_missing+=', apt_pkg'; -],[]) -AC_SUBST([apt_pkg_CFLAGS]) -AC_SUBST([apt_pkg_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$apt_pkg_LIBS -AC_LANG_PUSH([C++]) -AC_CHECK_FUNCS([pkgVersion], [], [ -probe_dpkginfo_req_deps_ok=no; -probe_dpkginfo_req_deps_missing+=", $ac_func func"; -]) -AC_LANG_POP([C++]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for blkid library used by: partition' -PKG_CHECK_MODULES([blkid], [blkid >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([blkid_get_cache],[blkid],[ -blkid_CFLAGS=; -blkid_LIBS=-lblkid; -],[ -probe_partition_opt_deps_ok=no; -probe_partition_opt_deps_missing+=', blkid'; -],[]) -AC_SUBST([blkid_CFLAGS]) -AC_SUBST([blkid_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$blkid_LIBS -AC_CHECK_FUNCS([blkid_get_cache blkid_get_tag_value], [], []) -LIBS=$SAVE_LIBS -echo -echo '* Checking for cap library used by: process58 ' -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([cap_init],[cap],[ -cap_CFLAGS=; -cap_LIBS=-lcap; -],[ -probe_process58_req_deps_ok=no; -probe_process58_req_deps_missing+=', cap lib'; -],[]) -AC_SUBST([cap_CFLAGS]) -AC_SUBST([cap_LIBS]) -LIBS=$SAVE_LIBS -SAVE_LIBS=$LIBS -LIBS=$cap_LIBS -AC_CHECK_FUNCS([cap_init], [], [ -probe_process58_req_deps_ok=no; -probe_process58_req_deps_missing+=", $ac_func func"; -]) -AC_CHECK_FUNCS([cap_get_pid capgetp],[],[]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for dbus1 library used by: systemdunitproperty systemdunitproperty ' -PKG_CHECK_MODULES([dbus1], [dbus-1 >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([dbus_bus_get],[dbus1],[ -dbus1_CFLAGS=; -dbus1_LIBS=-ldbus1; -],[ -probe_systemdunitproperty_req_deps_ok=no; -probe_systemdunitproperty_req_deps_missing+=', dbus1'; -probe_systemdunitproperty_req_deps_ok=no; -probe_systemdunitproperty_req_deps_missing+=', dbus1'; -],[]) -AC_SUBST([dbus1_CFLAGS]) -AC_SUBST([dbus1_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$dbus1_LIBS -AC_CHECK_FUNCS([dbus_bus_get], [], [ -probe_systemdunitproperty_req_deps_ok=no; -probe_systemdunitproperty_req_deps_missing+=", $ac_func func"; - -probe_systemdunitproperty_req_deps_ok=no; -probe_systemdunitproperty_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for gconf2 library used by: gconf ' -PKG_CHECK_MODULES([gconf2], [gconf-2.0 >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([gconf_engine_get_default],[gconf-2],[ -gconf2_CFLAGS=; -gconf2_LIBS=-lgconf-2; -],[ -probe_gconf_req_deps_ok=no; -probe_gconf_req_deps_missing+=', gconf2'; -],[]) -AC_SUBST([gconf2_CFLAGS]) -AC_SUBST([gconf2_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$gconf2_LIBS -AC_CHECK_FUNCS([gconf_engine_get_default], [], [ -probe_gconf_req_deps_ok=no; -probe_gconf_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for lber library used by: ldap57 ' -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([ber_init],[lber],[ -lber_CFLAGS=; -lber_LIBS=-llber; -],[ -probe_ldap57_req_deps_ok=no; -probe_ldap57_req_deps_missing+=', lber lib'; -],[]) -AC_SUBST([lber_CFLAGS]) -AC_SUBST([lber_LIBS]) -LIBS=$SAVE_LIBS -SAVE_LIBS=$LIBS -LIBS=$lber_LIBS -AC_CHECK_FUNCS([ber_init], [], [ -probe_ldap57_req_deps_ok=no; -probe_ldap57_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for ldap library used by: ldap57 ' -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([ldap_init],[ldap],[ -ldap_CFLAGS=; -ldap_LIBS=-lldap; -],[ -probe_ldap57_req_deps_ok=no; -probe_ldap57_req_deps_missing+=', ldap lib'; -],[]) -AC_SUBST([ldap_CFLAGS]) -AC_SUBST([ldap_LIBS]) -LIBS=$SAVE_LIBS -SAVE_LIBS=$LIBS -LIBS=$ldap_LIBS -AC_CHECK_FUNCS([ldap_init], [], [ -probe_ldap57_req_deps_ok=no; -probe_ldap57_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for opendbx library used by: sql sql57 ' -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([odbx_init],[opendbx],[ -opendbx_CFLAGS=; -opendbx_LIBS=-lopendbx; -],[ -probe_sql_req_deps_ok=no; -probe_sql_req_deps_missing+=', opendbx lib'; -probe_sql57_req_deps_ok=no; -probe_sql57_req_deps_missing+=', opendbx lib'; -],[]) -AC_SUBST([opendbx_CFLAGS]) -AC_SUBST([opendbx_LIBS]) -LIBS=$SAVE_LIBS -SAVE_LIBS=$LIBS -LIBS=$opendbx_LIBS -AC_CHECK_FUNCS([odbx_init], [], [ -probe_sql_req_deps_ok=no; -probe_sql_req_deps_missing+=", $ac_func func"; - -probe_sql57_req_deps_ok=no; -probe_sql57_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for pcre library used by: textfilecontent54 textfilecontent partition ' -PKG_CHECK_MODULES([pcre], [libpcre >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([pcre_exec],[pcre],[ -pcre_CFLAGS=; -pcre_LIBS=-lpcre; -],[ -probe_textfilecontent54_req_deps_ok=no; -probe_textfilecontent54_req_deps_missing+=', pcre'; -probe_textfilecontent_req_deps_ok=no; -probe_textfilecontent_req_deps_missing+=', pcre'; -probe_partition_req_deps_ok=no; -probe_partition_req_deps_missing+=', pcre'; -],[]) -AC_SUBST([pcre_CFLAGS]) -AC_SUBST([pcre_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$pcre_LIBS -AC_CHECK_FUNCS([pcre_exec], [], [ -probe_textfilecontent54_req_deps_ok=no; -probe_textfilecontent54_req_deps_missing+=", $ac_func func"; - -probe_textfilecontent_req_deps_ok=no; -probe_textfilecontent_req_deps_missing+=", $ac_func func"; - -probe_partition_req_deps_ok=no; -probe_partition_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for procps library used by: process58 process' -PKG_CHECK_MODULES([procps], [libprocps >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([dev_to_tty],[procps-ng],[ -procps_CFLAGS=; -procps_LIBS=-lprocps-ng; -],[ -probe_process58_opt_deps_ok=no; -probe_process58_opt_deps_missing+=', procps'; -probe_process_opt_deps_ok=no; -probe_process_opt_deps_missing+=', procps'; -],[]) -AC_SUBST([procps_CFLAGS]) -AC_SUBST([procps_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$procps_LIBS -AC_CHECK_FUNCS([dev_to_tty], [], []) -LIBS=$SAVE_LIBS -echo -echo '* Checking for rpm library used by: rpminfo rpmverify rpmverifyfile rpmverifypackage ' -PKG_CHECK_MODULES([rpm], [rpm >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([rpmtsCreate],[rpm],[ -rpm_CFLAGS=; -rpm_LIBS=-lrpm; -],[ -probe_rpminfo_req_deps_ok=no; -probe_rpminfo_req_deps_missing+=', rpm'; -probe_rpmverify_req_deps_ok=no; -probe_rpmverify_req_deps_missing+=', rpm'; -probe_rpmverifyfile_req_deps_ok=no; -probe_rpmverifyfile_req_deps_missing+=', rpm'; -probe_rpmverifypackage_req_deps_ok=no; -probe_rpmverifypackage_req_deps_missing+=', rpm'; -],[]) -AC_SUBST([rpm_CFLAGS]) -AC_SUBST([rpm_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$rpm_LIBS -AC_CHECK_FUNCS([rpmtsCreate rpmReadConfigFiles], [], [ -probe_rpminfo_req_deps_ok=no; -probe_rpminfo_req_deps_missing+=", $ac_func func"; - -probe_rpmverify_req_deps_ok=no; -probe_rpmverify_req_deps_missing+=", $ac_func func"; - -probe_rpmverifyfile_req_deps_ok=no; -probe_rpmverifyfile_req_deps_missing+=", $ac_func func"; - -probe_rpmverifypackage_req_deps_ok=no; -probe_rpmverifypackage_req_deps_missing+=", $ac_func func"; -]) -AC_CHECK_FUNCS([headerFormat headerSprintf rpmFreeCrypto rpmFreeFilesystems],[],[]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for selinux library used by: process58 selinuxboolean selinuxsecuritycontext ' -PKG_CHECK_MODULES([selinux], [libselinux >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([security_get_boolean_names],[selinux],[ -selinux_CFLAGS=; -selinux_LIBS=-lselinux; -],[ -probe_process58_req_deps_ok=no; -probe_process58_req_deps_missing+=', selinux'; -probe_selinuxboolean_req_deps_ok=no; -probe_selinuxboolean_req_deps_missing+=', selinux'; -probe_selinuxsecuritycontext_req_deps_ok=no; -probe_selinuxsecuritycontext_req_deps_missing+=', selinux'; -],[]) -AC_SUBST([selinux_CFLAGS]) -AC_SUBST([selinux_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$selinux_LIBS -AC_CHECK_FUNCS([security_get_boolean_names], [], [ -probe_process58_req_deps_ok=no; -probe_process58_req_deps_missing+=", $ac_func func"; - -probe_selinuxboolean_req_deps_ok=no; -probe_selinuxboolean_req_deps_missing+=", $ac_func func"; - -probe_selinuxsecuritycontext_req_deps_ok=no; -probe_selinuxsecuritycontext_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for xml2 library used by: xmlfilecontent ' -PKG_CHECK_MODULES([xml2], [libxml-2.0 >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([xmlTextReaderRead],[xml2],[ -xml2_CFLAGS=; -xml2_LIBS=-lxml2; -],[ -probe_xmlfilecontent_req_deps_ok=no; -probe_xmlfilecontent_req_deps_missing+=', xml2'; -],[]) -AC_SUBST([xml2_CFLAGS]) -AC_SUBST([xml2_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$xml2_LIBS -AC_CHECK_FUNCS([xmlTextReaderRead], [], [ -probe_xmlfilecontent_req_deps_ok=no; -probe_xmlfilecontent_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo -echo '* Checking for xslt library used by: xmlfilecontent ' -PKG_CHECK_MODULES([xslt], [libxslt >= 0.0],[],[ -SAVE_LIBS=$LIBS -AC_SEARCH_LIBS([xsltDocumentFunction],[xslt],[ -xslt_CFLAGS=; -xslt_LIBS=-lxslt; -],[ -probe_xmlfilecontent_req_deps_ok=no; -probe_xmlfilecontent_req_deps_missing+=', xslt'; -],[]) -AC_SUBST([xslt_CFLAGS]) -AC_SUBST([xslt_LIBS]) -LIBS=$SAVE_LIBS -]) -SAVE_LIBS=$LIBS -LIBS=$xslt_LIBS -AC_CHECK_FUNCS([xsltDocumentFunction], [], [ -probe_xmlfilecontent_req_deps_ok=no; -probe_xmlfilecontent_req_deps_missing+=", $ac_func func"; -]) -LIBS=$SAVE_LIBS -echo - - -#check for atomic functions -case $host_cpu in - i386 | i486 | i586 | i686) - CFLAGS="$CFLAGS -march=i686" - ;; -esac - -AC_CACHE_CHECK([for atomic builtins], [ac_cv_atomic_builtins], -[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include - uint16_t foovar=0; uint16_t old=1; uint16_t new=2;], - [__sync_bool_compare_and_swap(&foovar,old,new); return __sync_fetch_and_add(&foovar, 1);])], - [ac_cv_atomic_builtins=yes], - [ac_cv_atomic_builtins=no])]) -if test $ac_cv_atomic_builtins = yes; then - AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Define to 1 if the compiler supports atomic builtins.]) -else - AC_MSG_NOTICE([!!! Compiler does not support atomic builtins. Atomic operation will be emulated using mutex-based locking. !!!]) -fi - - -AC_ARG_ENABLE([probes-independent], - [AC_HELP_STRING([--enable-probes-independent], [enable compilation of probes independent of the base system (default=yes)])], - [case "${enableval}" in - yes) probes_independent=yes ;; - no) probes_independent=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-independent]) ;; - esac],[probes_independent=yes]) - -AC_ARG_ENABLE([probes-unix], - [AC_HELP_STRING([--enable-probes-unix], [enable compilation of probes for UNIX based systems (default=yes)])], - [case "${enableval}" in - yes) probes_unix=yes ;; - no) probes_unix=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-unix]) ;; - esac],[probes_unix=yes]) -if test "x${probes_unix}" = xyes; then - AC_DEFINE([PLATFORM_UNIX], [1], [Indicator for a Unix type OS]) -fi - - -probes_linux=no -case "${host}" in - *-*-linux*) - probes_linux=yes - ;; -esac -AC_ARG_ENABLE([probes-linux], - [AC_HELP_STRING([--enable-probes-linux], [enable compilation of probes for Linux based systems (default=autodetect)])], - [case "${enableval}" in - yes) probes_linux=yes ;; - no) probes_linux=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-linux]) ;; - esac],) - -probes_solaris=no -case "${host}" in - *-*-solaris*) - probes_solaris=yes - ;; -esac -AC_ARG_ENABLE([probes-solaris], - [AC_HELP_STRING([--enable-probes-solaris], [enable compilation of probes for Solaris based systems (default=autodetect)])], - [case "${enableval}" in - yes) probes_solaris=yes ;; - no) probes_solaris=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-solaris]) ;; - esac],) - -AC_ARG_ENABLE([cce], - [AC_HELP_STRING([--enable-cce], [include support for CCE (default=no)])], - [case "${enableval}" in - yes) cce=yes ;; - no) cce=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-cce]) ;; - esac],[cce=no]) - -AC_ARG_ENABLE([python], - [AC_HELP_STRING([--enable-python], [enable compilation of python2 bindings (default=auto)])], - [case "${enableval}" in - yes) python2_bind=yes ;; - no) python2_bind=no ;; - auto) python2_bind=auto ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; - esac],[python2_bind=auto]) - -AC_ARG_ENABLE([python3], - [AC_HELP_STRING([--enable-python3], [enable compilation of python3 bindings (default=auto)])], - [case "${enableval}" in - yes) python3_bind=yes ;; - no) python3_bind=no ;; - auto) python3_bind=auto ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python3]);; - esac],[python3_bind=auto]) - -AC_ARG_ENABLE([perl], - [AC_HELP_STRING([--enable-perl], [enable compilation of perl bindings (default=no)])], - [case "${enableval}" in - yes) perl_bind=yes ;; - no) perl_bind=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-perl]) ;; - esac],[perl_bind=no]) - -AC_ARG_ENABLE([regex-posix], - [AC_HELP_STRING([--enable-regex-posix], [compile with POSIX instead of PCRE regex (default=no)])], - [case "${enableval}" in - yes) regex_posix=yes ;; - no) regex_posix=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-regex-posix]) ;; - esac],[regex_posix=no]) - -AC_ARG_ENABLE([debug], - [AC_HELP_STRING([--enable-debug], [enable debugging flags (default=no)])], - [case "${enableval}" in - yes) debug=yes ;; - no) debug=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; - esac], [debug=no]) - -AC_ARG_ENABLE([valgrind], - [AC_HELP_STRING([--enable-valgrind], [enable valgrind checks (default=no)])], - [case "${enableval}" in - yes) vgdebug=yes ;; - no) vgdebug=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-valgrind]) ;; - esac], [vgdebug=no]) - - -AC_ARG_ENABLE([ssp], - [AC_HELP_STRING([--enable-ssp], [enable SSP (fstack-protector, default=no)])], - [case "${enableval}" in - yes) ssp=yes ;; - no) ssp=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-ssp]) ;; - esac], [ssp=no]) - -AC_ARG_WITH([crypto], - [AS_HELP_STRING([--with-crypto], - [use different crypto backend. Available options: nss3, gcrypt [default=gcrypt]])], - [], - [crypto=gcrypt]) - -if test "x${libexecdir}" = xNONE; then - probe_dir="/usr/local/libexec/openscap" -else - EXPAND_DIR(probe_dir,"${libexecdir}/openscap") -fi - -AC_SUBST(probe_dir) - -if test "x${prefix}" = xNONE; then - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_SCHEMA_PATH], ["/usr/local/share/openscap/schemas"], [Path to xml schemas]) -else - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_SCHEMA_PATH], ["${prefix}/share/openscap/schemas"], [Path to xml schemas]) -fi - -if test "x${prefix}" = xNONE; then - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_XSLT_PATH], ["/usr/local/share/openscap/xsl"], [Path to xslt files]) -else - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_XSLT_PATH], ["${prefix}/share/openscap/xsl"], [Path to xslt files]) -fi - -if test "x${prefix}" = xNONE; then - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_CPE_PATH], ["/usr/local/share/openscap/cpe"], [Path to cpe files]) -else - AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_CPE_PATH], ["${prefix}/share/openscap/cpe"], [Path to cpe files]) -fi - -if test "$regex_posix" = "yes"; then - AC_DEFINE([USE_REGEX_POSIX], [1], [Use POSIX regular expressions]) -else - AC_DEFINE([USE_REGEX_PCRE], [1], [Use PCRE]) -fi - -if test "$ssp" = "yes"; then - GCC_STACK_PROTECT_CC - GCC_STACK_PROTECT_CXX -fi - -if test "$debug" = "yes"; then - CFLAGS="$CFLAGS $CFLAGS_DEBUGGING" -else - CFLAGS="$CFLAGS $CFLAGS_NODEBUG" - AC_DEFINE([NDEBUG], [1], [No Debug defined]) -fi - -AC_ARG_ENABLE([sce], - [AC_HELP_STRING([--enable-sce], [enable script check engine (default=no)])], - [case "${enableval}" in - yes) sce=yes ;; - no) sce=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-sce]) ;; - esac],[sce=no]) - - -AC_ARG_WITH([oscap-temp-dir], - [AS_HELP_STRING([--with-oscap-temp-dir], - [use different temporary directory to execute sce scripts [default=/tmp]])], - [], - [with_oscap_temp_dir="/tmp"]) - -if test "x${sce}" = xyes; then - AC_DEFINE([ENABLE_SCE], [1], [compilation of script check engine enabled]) - CFLAGS="$CFLAGS -DOSCAP_TEMP_DIR=\\\"${with_oscap_temp_dir}\\\"" # double escape needed for compilation on some systems -fi - -AC_ARG_ENABLE([util-oscap], - [AC_HELP_STRING([--enable-util-oscap], [enable compilation of the oscap utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap=yes ;; - no) util_oscap=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap]) ;; - esac],[util_oscap=yes]) - -AC_ARG_ENABLE([util-scap-as-rpm], - [AC_HELP_STRING([--enable-util-scap-as-rpm], [enable compilation of the scap-as-rpm utility (default=yes)])], - [case "${enableval}" in - yes) util_scap_as_rpm=yes ;; - no) util_scap_as_rpm=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-scap-as-rpm]) ;; - esac],[util_scap_as_rpm=yes]) - -AC_ARG_ENABLE([util-oscap-ssh], - [AC_HELP_STRING([--enable-util-oscap-ssh], [enable compilation of the oscap-ssh utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_ssh=yes ;; - no) util_oscap_ssh=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-ssh]) ;; - esac],[util_oscap_ssh=yes]) - -AC_ARG_ENABLE([util-oscap-docker], - [AC_HELP_STRING([--enable-util-oscap-docker], [enable compilation of the oscap-docker utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_docker=yes ;; - no) util_oscap_docker=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-docker]) ;; - esac],[util_oscap_docker=yes]) - -AC_ARG_ENABLE([util-oscap-vm], - [AC_HELP_STRING([--enable-util-oscap-vm], [enable compilation of the oscap-vm utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_vm=yes ;; - no) util_oscap_vm=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-vm]) ;; - esac],[util_oscap_vm=yes]) - -AC_ARG_ENABLE([util-oscap-chroot], - [AC_HELP_STRING([--enable-util-oscap-chroot], [enable compilation of the oscap-chroot utility (default=yes)])], - [case "${enableval}" in - yes) util_oscap_chroot=yes ;; - no) util_oscap_chroot=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-chroot]) ;; - esac],[util_oscap_chroot=yes]) - -if test "$vgdebug" = "yes"; then - if test "$HAVE_VALGRIND" = "yes"; then - vgcheck="yes" - else - AC_MSG_ERROR([valgrind not installed]) - fi -else - vgcheck="no" -fi -AC_SUBST([vgcheck]) - -if test "x${util_oscap_docker}" = "xyes"; then - if test ! "x${HAVE_BZIP2}" = xyes; then - AC_MSG_FAILURE(oscap-docker requires bzip2! Either disable oscap-docker or install bzip2 development support.) - fi -fi - -if test "x${perl_bind}" = xyes; then - AC_PATH_PROG(PERL, perl) - PERL_INCLUDES="`$PERL -e 'use Config; print $Config{archlib}'`/CORE" - vendorlib="$( $PERL -e 'use Config; print $Config{vendorlib}' | sed "s|$($PERL -e 'use Config; print $Config{prefix}')||" )" - vendorarch="$( $PERL -e 'use Config; print $Config{vendorarch}' | sed "s|$($PERL -e 'use Config; print $Config{prefix}')||" )" - AC_SUBST([PERL_INCLUDES], ["-I$PERL_INCLUDES"]) - AC_SUBST([perl_vendorlibdir], ['${prefix}'$vendorlib]) - AC_SUBST([perl_vendorarchdir], ['${prefix}'$vendorarch]) - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $PERL_INCLUDES" - AC_CHECK_HEADERS([EXTERN.h],[],[AC_MSG_ERROR(Perl development librarier are needed for perl bindings)],[-]) - CPPFLAGS="$save_CPPFLAGS" -fi - - -dnl $1: Python major version -dnl $2: How to announce it -m4_define([TELL_PYTHON_NOT_PRESENT], [$2( - [python $1 bindings were requested, but the appropriate python interpreter was not found in the search path. -Please ensure that it is installed and available, or run configure with --disable-python$1 option.])]) - -dnl $1: Python major version -dnl $2: How to announce it -m4_define([TELL_PYTHON_DEVEL_NOT_PRESENT], [$2( - [python $1 bindings were requested and there is an interpreter, but the development support is missing. -Please ensure that it is installed and available, or run configure with --disable-python$1 option.])]) - -# TODO: Handle the bindings yes/no -> interpreter yes/no -> devel yes/no situation - -dnl python_bind can be set either to yes, no or auto. It will be set to yes or no after the evaluation. -dnl -dnl $1: Python major version -m4_define([EVALUATE_PYTHON_CHECK_RESULT], - [m4_if([$1], , [m4_fatal([The $0 macro needs Python major version as its first argument.])]) - AS_IF([test "x${python$1_bind}" = xyes && test "x$HAVE_PYTHON$1" = xno], - [python$1_bind=no - TELL_PYTHON_NOT_PRESENT([$1], [AC_MSG_ERROR])], - [test "x$python$1_bind" = xauto && test "x$HAVE_PYTHON$1" = xno], - [python$1_bind=no - TELL_PYTHON_NOT_PRESENT([$1], [AC_MSG_NOTICE])], - [test "x$python$1_bind" != xno && test "x$HAVE_PYTHON$1" = xyes], - [AM_CONFIGURE_PYTHON_FLAGS([PYTHON$1], - [${PYTHON$1}], - [python$1_bind=yes], - [AS_IF([test "x$python$1_bind" = xauto], - [python$1_bind=no - TELL_PYTHON_DEVEL_NOT_PRESENT([$1], [AC_MSG_NOTICE])], - [TELL_PYTHON_DEVEL_NOT_PRESENT([$1], [AC_MSG_ERROR])])])])]) - -dnl -dnl $1: The Python interpreter to check -dnl $2: The module to check -dnl $3: Action if OK -dnl $4: Action if not OK -m4_define([PYTHON_CHECK_FOR_INSTALLED_MODULE], - [AS_IF(["$1" -c 'import $2' 2> /dev/null], - [$3], [$4])]) - -dnl -dnl $1: Python major version -m4_define([_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER], - [AS_IF([test "$HAVE_PYTHON$1" = yes], - [AC_MSG_CHECKING([whether ${PYTHON$1} can import Atomic]) - PYTHON_CHECK_FOR_INSTALLED_MODULE( - [${PYTHON$1}], [Atomic], - [AC_MSG_RESULT([yes]) - preferred_python="${PYTHON$1}"], - AC_MSG_RESULT([no]))])]) - -AM_PATH_PYTHON_OF_MAJOR_VERSION([2], [2.6], [HAVE_PYTHON2=yes], [HAVE_PYTHON2=no]) -AM_PATH_PYTHON_OF_MAJOR_VERSION([3], [3.4], [HAVE_PYTHON3=yes], [HAVE_PYTHON3=no]) - -EVALUATE_PYTHON_CHECK_RESULT(3) -EVALUATE_PYTHON_CHECK_RESULT(2) - -# Just to have PYTHON defined so Automake doesn't freak out. -# Therefore, we define it to one of available interpreters in favor of Python 3 -PYTHON=: -test "x$HAVE_PYTHON2" = xyes && PYTHON="$PYTHON2" -test "x$HAVE_PYTHON3" = xyes && PYTHON="$PYTHON3" -AC_SUBST([PYTHON]) - -preferred_python=: - -AS_IF([test "x$util_oscap_docker" = xyes], - [_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER(2) - _ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER(3) - AS_IF([test "$preferred_python" = :], - [AS_IF([test "$PYTHON" != :], - [AC_MSG_NOTICE([Couldnt detect preferred python interpreter for oscap-docker. If you can, make sure one can import the 'Atomic' module and re-run the configure script.]) - AC_MSG_NOTICE([Setting the oscap-docker python to '$PYTHON'.]) - preferred_python="$PYTHON"], - [AC_MSG_ERROR([Not found a working Python interpreter and oscap-docker needs it. Aborting, as oscap-docker has been requested.])])])]) - -# oscap-docker determine python dir on default python version -OSCAPDOCKER_PYTHONDIR=`$preferred_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,prefix='$' '{prefix}'))"` -# oscap-docker uses preferred_python substitution -AC_SUBST([preferred_python]) -AC_SUBST(oscapdocker_pythondir, $OSCAPDOCKER_PYTHONDIR) - - -AM_CONDITIONAL([probe_family_enabled], test "$probe_family_req_deps_ok" = yes) -probe_family_enabled=$probe_family_req_deps_ok -AM_CONDITIONAL([probe_textfilecontent_enabled], test "$probe_textfilecontent_req_deps_ok" = yes) -probe_textfilecontent_enabled=$probe_textfilecontent_req_deps_ok -AM_CONDITIONAL([probe_textfilecontent54_enabled], test "$probe_textfilecontent54_req_deps_ok" = yes) -probe_textfilecontent54_enabled=$probe_textfilecontent54_req_deps_ok -AM_CONDITIONAL([probe_variable_enabled], test "$probe_variable_req_deps_ok" = yes) -probe_variable_enabled=$probe_variable_req_deps_ok -AM_CONDITIONAL([probe_xmlfilecontent_enabled], test "$probe_xmlfilecontent_req_deps_ok" = yes) -probe_xmlfilecontent_enabled=$probe_xmlfilecontent_req_deps_ok -AM_CONDITIONAL([probe_filehash_enabled], test "$probe_filehash_req_deps_ok" = yes) -probe_filehash_enabled=$probe_filehash_req_deps_ok -AM_CONDITIONAL([probe_filehash58_enabled], test "$probe_filehash58_req_deps_ok" = yes) -probe_filehash58_enabled=$probe_filehash58_req_deps_ok -AM_CONDITIONAL([probe_environmentvariable_enabled], test "$probe_environmentvariable_req_deps_ok" = yes) -probe_environmentvariable_enabled=$probe_environmentvariable_req_deps_ok -AM_CONDITIONAL([probe_environmentvariable58_enabled], test "$probe_environmentvariable58_req_deps_ok" = yes) -probe_environmentvariable58_enabled=$probe_environmentvariable58_req_deps_ok -AM_CONDITIONAL([probe_sql_enabled], test "$probe_sql_req_deps_ok" = yes) -probe_sql_enabled=$probe_sql_req_deps_ok -AM_CONDITIONAL([probe_sql57_enabled], test "$probe_sql57_req_deps_ok" = yes) -probe_sql57_enabled=$probe_sql57_req_deps_ok -AM_CONDITIONAL([probe_ldap57_enabled], test "$probe_ldap57_req_deps_ok" = yes) -probe_ldap57_enabled=$probe_ldap57_req_deps_ok -AM_CONDITIONAL([probe_dnscache_enabled], test "$probe_dnscache_req_deps_ok" = yes) -probe_dnscache_enabled=$probe_dnscache_req_deps_ok -AM_CONDITIONAL([probe_runlevel_enabled], test "$probe_runlevel_req_deps_ok" = yes) -probe_runlevel_enabled=$probe_runlevel_req_deps_ok -AM_CONDITIONAL([probe_file_enabled], test "$probe_file_req_deps_ok" = yes) -probe_file_enabled=$probe_file_req_deps_ok -AM_CONDITIONAL([probe_fileextendedattribute_enabled], test "$probe_fileextendedattribute_req_deps_ok" = yes) -probe_fileextendedattribute_enabled=$probe_fileextendedattribute_req_deps_ok -AM_CONDITIONAL([probe_password_enabled], test "$probe_password_req_deps_ok" = yes) -probe_password_enabled=$probe_password_req_deps_ok -AM_CONDITIONAL([probe_process_enabled], test "$probe_process_req_deps_ok" = yes) -probe_process_enabled=$probe_process_req_deps_ok -AM_CONDITIONAL([probe_process58_enabled], test "$probe_process58_req_deps_ok" = yes) -probe_process58_enabled=$probe_process58_req_deps_ok -AM_CONDITIONAL([probe_shadow_enabled], test "$probe_shadow_req_deps_ok" = yes) -probe_shadow_enabled=$probe_shadow_req_deps_ok -AM_CONDITIONAL([probe_uname_enabled], test "$probe_uname_req_deps_ok" = yes) -probe_uname_enabled=$probe_uname_req_deps_ok -AM_CONDITIONAL([probe_interface_enabled], test "$probe_interface_req_deps_ok" = yes) -probe_interface_enabled=$probe_interface_req_deps_ok -AM_CONDITIONAL([probe_xinetd_enabled], test "$probe_xinetd_req_deps_ok" = yes) -probe_xinetd_enabled=$probe_xinetd_req_deps_ok -AM_CONDITIONAL([probe_sysctl_enabled], test "$probe_sysctl_req_deps_ok" = yes) -probe_sysctl_enabled=$probe_sysctl_req_deps_ok -AM_CONDITIONAL([probe_routingtable_enabled], test "$probe_routingtable_req_deps_ok" = yes) -probe_routingtable_enabled=$probe_routingtable_req_deps_ok -AM_CONDITIONAL([probe_symlink_enabled], test "$probe_symlink_req_deps_ok" = yes) -probe_symlink_enabled=$probe_symlink_req_deps_ok -AM_CONDITIONAL([probe_gconf_enabled], test "$probe_gconf_req_deps_ok" = yes) -probe_gconf_enabled=$probe_gconf_req_deps_ok -AM_CONDITIONAL([probe_isainfo_enabled], test "$probe_isainfo_req_deps_ok" = yes) -probe_isainfo_enabled=$probe_isainfo_req_deps_ok -AM_CONDITIONAL([probe_package_enabled], test "$probe_package_req_deps_ok" = yes) -probe_package_enabled=$probe_package_req_deps_ok -AM_CONDITIONAL([probe_patch_enabled], test "$probe_patch_req_deps_ok" = yes) -probe_patch_enabled=$probe_patch_req_deps_ok -AM_CONDITIONAL([probe_smf_enabled], test "$probe_smf_req_deps_ok" = yes) -probe_smf_enabled=$probe_smf_req_deps_ok -AM_CONDITIONAL([probe_partition_enabled], test "$probe_partition_req_deps_ok" = yes) -probe_partition_enabled=$probe_partition_req_deps_ok -AM_CONDITIONAL([probe_inetlisteningservers_enabled], test "$probe_inetlisteningservers_req_deps_ok" = yes) -probe_inetlisteningservers_enabled=$probe_inetlisteningservers_req_deps_ok -AM_CONDITIONAL([probe_iflisteners_enabled], test "$probe_iflisteners_req_deps_ok" = yes) -probe_iflisteners_enabled=$probe_iflisteners_req_deps_ok -AM_CONDITIONAL([probe_selinuxboolean_enabled], test "$probe_selinuxboolean_req_deps_ok" = yes) -probe_selinuxboolean_enabled=$probe_selinuxboolean_req_deps_ok -AM_CONDITIONAL([probe_selinuxsecuritycontext_enabled], test "$probe_selinuxsecuritycontext_req_deps_ok" = yes) -probe_selinuxsecuritycontext_enabled=$probe_selinuxsecuritycontext_req_deps_ok -AM_CONDITIONAL([probe_rpminfo_enabled], test "$probe_rpminfo_req_deps_ok" = yes) -probe_rpminfo_enabled=$probe_rpminfo_req_deps_ok -AM_CONDITIONAL([probe_rpmverify_enabled], test "$probe_rpmverify_req_deps_ok" = yes) -probe_rpmverify_enabled=$probe_rpmverify_req_deps_ok -AM_CONDITIONAL([probe_rpmverifyfile_enabled], test "$probe_rpmverifyfile_req_deps_ok" = yes) -probe_rpmverifyfile_enabled=$probe_rpmverifyfile_req_deps_ok -AM_CONDITIONAL([probe_rpmverifypackage_enabled], test "$probe_rpmverifypackage_req_deps_ok" = yes) -probe_rpmverifypackage_enabled=$probe_rpmverifypackage_req_deps_ok -AM_CONDITIONAL([probe_dpkginfo_enabled], test "$probe_dpkginfo_req_deps_ok" = yes) -probe_dpkginfo_enabled=$probe_dpkginfo_req_deps_ok -AM_CONDITIONAL([probe_systemdunitproperty_enabled], test "$probe_systemdunitproperty_req_deps_ok" = yes) -probe_systemdunitproperty_enabled=$probe_systemdunitproperty_req_deps_ok -AM_CONDITIONAL([probe_systemdunitdependency_enabled], test "$probe_systemdunitdependency_req_deps_ok" = yes) -probe_systemdunitdependency_enabled=$probe_systemdunitdependency_req_deps_ok - -AM_CONDITIONAL([WANT_CCE], test "$cce" = yes) - -AM_CONDITIONAL([WANT_PROBES_INDEPENDENT], test "$probes_independent" = yes) -AM_CONDITIONAL([WANT_PROBES_UNIX], test "$probes_unix" = yes) -AM_CONDITIONAL([WANT_PROBES_LINUX], test "$probes_linux" = yes) -AM_CONDITIONAL([WANT_PROBES_SOLARIS], test "$probes_solaris" = yes) - -AM_CONDITIONAL([WANT_SCE], test "$sce" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP], test "$util_oscap" = yes) -AM_CONDITIONAL([WANT_UTIL_SCAP_AS_RPM], test "$util_scap_as_rpm" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_SSH], test "$util_oscap_ssh" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_DOCKER], test "$util_oscap_docker" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_VM], test "$util_oscap_vm" = yes) -AM_CONDITIONAL([WANT_UTIL_OSCAP_CHROOT], test "$util_oscap_chroot" = yes) -AM_CONDITIONAL([WANT_PYTHON2], test "$python2_bind" = yes) -AM_CONDITIONAL([WANT_PYTHON3], test "$python3_bind" = yes) -AM_CONDITIONAL([WANT_PERL], test "$perl_bind" = yes) -AM_CONDITIONAL([ENABLE_VALGRIND_TESTS], test "$vgcheck" = yes) - -# -# Core -# -AC_CONFIG_FILES([Makefile - lib/Makefile - src/Makefile - xsl/Makefile - schemas/Makefile - cpe/Makefile - libopenscap.pc - src/common/Makefile - src/source/Makefile - tests/Makefile - tests/API/Makefile - - swig/Makefile - swig/perl/Makefile - swig/python2/Makefile - swig/python3/Makefile - - utils/Makefile - - src/OVAL/Makefile - src/OVAL/adt/Makefile - src/OVAL/results/Makefile - tests/API/OVAL/Makefile - tests/API/OVAL/glob_to_regex/Makefile - tests/API/OVAL/schema_version/Makefile - tests/oscap_string/Makefile - tests/API/OVAL/unittests/Makefile - tests/API/OVAL/validate/Makefile - tests/API/OVAL/report_variable_values/Makefile - tests/mitre/Makefile - - src/OVAL/probes/Makefile - src/OVAL/probes/probe/Makefile - src/OVAL/probes/crapi/Makefile - src/OVAL/probes/SEAP/Makefile - src/OVAL/probes/SEAP/generic/rbt/Makefile - tests/probes/Makefile - tests/API/crypt/Makefile - tests/API/SEAP/Makefile - tests/API/probes/Makefile - tests/sources/Makefile - tests/CPE/Makefile - tests/probes/file/Makefile - tests/probes/fileextendedattribute/Makefile - tests/probes/uname/Makefile - tests/probes/shadow/Makefile - tests/probes/sql57/Makefile - tests/probes/symlink/Makefile - tests/probes/family/Makefile - tests/probes/process58/Makefile - tests/probes/sysinfo/Makefile - tests/probes/rpminfo/Makefile - tests/probes/rpmverifyfile/Makefile - tests/probes/rpmverifypackage/Makefile - tests/probes/rpmverify/Makefile - tests/probes/systemdunitproperty/Makefile - tests/probes/systemdunitdependency/Makefile - tests/probes/runlevel/Makefile - tests/probes/filehash/Makefile - tests/probes/filehash58/Makefile - tests/probes/password/Makefile - tests/probes/interface/Makefile - tests/probes/textfilecontent54/Makefile - tests/probes/environmentvariable/Makefile - tests/probes/environmentvariable58/Makefile - tests/probes/xinetd/Makefile - tests/probes/selinuxboolean/Makefile - tests/probes/isainfo/Makefile - tests/probes/iflisteners/Makefile - tests/probes/maskattr/Makefile - tests/probes/sysctl/Makefile - - src/CVSS/Makefile - tests/API/CVSS/Makefile - - src/CVE/Makefile - tests/API/CVE/Makefile - - src/CVRF/Makefile - tests/API/CVRF/Makefile - - src/CPE/Makefile - tests/API/CPE/Makefile - tests/API/CPE/name/Makefile - tests/API/CPE/lang/Makefile - tests/API/CPE/dict/Makefile - tests/API/CPE/inbuilt/Makefile - - src/CCE/Makefile - tests/API/CCE/Makefile - - src/DS/Makefile - tests/DS/Makefile - tests/DS/ds_sds_index/Makefile - tests/DS/signed/Makefile - tests/DS/validate/Makefile - - tests/bindings/Makefile - - src/XCCDF/Makefile - src/XCCDF_POLICY/Makefile - tests/API/XCCDF/Makefile - tests/API/XCCDF/applicability/Makefile - tests/API/XCCDF/default_cpe/Makefile - tests/API/XCCDF/fix/Makefile - tests/API/XCCDF/guide/Makefile - tests/API/XCCDF/unittests/Makefile - tests/API/XCCDF/parser/Makefile - tests/API/XCCDF/progress/Makefile - tests/API/XCCDF/report/Makefile - tests/API/XCCDF/result_files/Makefile - tests/API/XCCDF/tailoring/Makefile - tests/API/XCCDF/variable_instance/Makefile - - tests/schemas/Makefile - tests/bz2/Makefile - tests/codestyle/Makefile - tests/oval_details/Makefile - tests/nist/Makefile - tests/offline_mode/Makefile - - src/SCE/Makefile - tests/sce/Makefile]) - -AC_CONFIG_FILES([run], - [chmod +x,-w run]) -AC_CONFIG_FILES([tests/test_common.sh], - [chmod +x,-w tests/test_common.sh]) -AC_CONFIG_FILES([utils/oscap-docker], - [chmod +x,-w utils/oscap-docker]) - -AC_OUTPUT - -echo "******************************************************" -echo "OpenSCAP will be compiled with the following settings:" -echo -echo "oscap tool: $util_oscap" -echo "scap-as-rpm tool: $util_scap_as_rpm" -echo "oscap-ssh tool: $util_oscap_ssh" -echo "oscap-docker tool: $util_oscap_docker" -echo "oscap-vm tool: $util_oscap_vm" -echo "oscap-chroot tool: $util_oscap_chroot" -echo "python2 bindings enabled: $python2_bind" -echo "python3 bindings enabled: $python3_bind" -echo "perl bindings enabled: $perl_bind" -echo "use POSIX regex: $regex_posix" -echo "SCE enabled $sce" -echo "debugging flags enabled: $debug" -echo "CCE enabled: $cce" -echo -echo ' === probes ===' -if test "$probe_family_req_deps_ok" = "yes"; then - probe_family_table_result="yes" -else - probe_family_table_result="NO (missing: $probe_family_req_deps_missing)" -fi -printf " %-28s %s\n" "family:" "$probe_family_table_result" -if test "$probe_textfilecontent_req_deps_ok" = "yes"; then - probe_textfilecontent_table_result="yes" -else - probe_textfilecontent_table_result="NO (missing: $probe_textfilecontent_req_deps_missing)" -fi -printf " %-28s %s\n" "textfilecontent:" "$probe_textfilecontent_table_result" -if test "$probe_textfilecontent54_req_deps_ok" = "yes"; then - probe_textfilecontent54_table_result="yes" -else - probe_textfilecontent54_table_result="NO (missing: $probe_textfilecontent54_req_deps_missing)" -fi -printf " %-28s %s\n" "textfilecontent54:" "$probe_textfilecontent54_table_result" -if test "$probe_variable_req_deps_ok" = "yes"; then - probe_variable_table_result="yes" -else - probe_variable_table_result="NO (missing: $probe_variable_req_deps_missing)" -fi -printf " %-28s %s\n" "variable:" "$probe_variable_table_result" -if test "$probe_xmlfilecontent_req_deps_ok" = "yes"; then - probe_xmlfilecontent_table_result="yes" -else - probe_xmlfilecontent_table_result="NO (missing: $probe_xmlfilecontent_req_deps_missing)" -fi -printf " %-28s %s\n" "xmlfilecontent:" "$probe_xmlfilecontent_table_result" -if test "$probe_filehash_req_deps_ok" = "yes"; then - probe_filehash_table_result="yes" -else - probe_filehash_table_result="NO (missing: $probe_filehash_req_deps_missing)" -fi -printf " %-28s %s\n" "filehash:" "$probe_filehash_table_result" -if test "$probe_filehash58_req_deps_ok" = "yes"; then - probe_filehash58_table_result="yes" -else - probe_filehash58_table_result="NO (missing: $probe_filehash58_req_deps_missing)" -fi -printf " %-28s %s\n" "filehash58:" "$probe_filehash58_table_result" -if test "$probe_environmentvariable_req_deps_ok" = "yes"; then - probe_environmentvariable_table_result="yes" -else - probe_environmentvariable_table_result="NO (missing: $probe_environmentvariable_req_deps_missing)" -fi -printf " %-28s %s\n" "environmentvariable:" "$probe_environmentvariable_table_result" -if test "$probe_environmentvariable58_req_deps_ok" = "yes"; then - probe_environmentvariable58_table_result="yes" -else - probe_environmentvariable58_table_result="NO (missing: $probe_environmentvariable58_req_deps_missing)" -fi -printf " %-28s %s\n" "environmentvariable58:" "$probe_environmentvariable58_table_result" -if test "$probe_sql_req_deps_ok" = "yes"; then - probe_sql_table_result="yes" -else - probe_sql_table_result="NO (missing: $probe_sql_req_deps_missing)" -fi -printf " %-28s %s\n" "sql:" "$probe_sql_table_result" -if test "$probe_sql57_req_deps_ok" = "yes"; then - probe_sql57_table_result="yes" -else - probe_sql57_table_result="NO (missing: $probe_sql57_req_deps_missing)" -fi -printf " %-28s %s\n" "sql57:" "$probe_sql57_table_result" -if test "$probe_ldap57_req_deps_ok" = "yes"; then - probe_ldap57_table_result="yes" -else - probe_ldap57_table_result="NO (missing: $probe_ldap57_req_deps_missing)" -fi -printf " %-28s %s\n" "ldap57:" "$probe_ldap57_table_result" -if test "$probe_dnscache_req_deps_ok" = "yes"; then - probe_dnscache_table_result="yes" -else - probe_dnscache_table_result="NO (missing: $probe_dnscache_req_deps_missing)" -fi -printf " %-28s %s\n" "dnscache:" "$probe_dnscache_table_result" -if test "$probe_runlevel_req_deps_ok" = "yes"; then - probe_runlevel_table_result="yes" -else - probe_runlevel_table_result="NO (missing: $probe_runlevel_req_deps_missing)" -fi -printf " %-28s %s\n" "runlevel:" "$probe_runlevel_table_result" -if test "$probe_file_req_deps_ok" = "yes"; then - probe_file_table_result="yes" -else - probe_file_table_result="NO (missing: $probe_file_req_deps_missing)" -fi -printf " %-28s %s\n" "file:" "$probe_file_table_result" -if test "$probe_fileextendedattribute_req_deps_ok" = "yes"; then - probe_fileextendedattribute_table_result="yes" -else - probe_fileextendedattribute_table_result="NO (missing: $probe_fileextendedattribute_req_deps_missing)" -fi -printf " %-28s %s\n" "fileextendedattribute:" "$probe_fileextendedattribute_table_result" -if test "$probe_password_req_deps_ok" = "yes"; then - probe_password_table_result="yes" -else - probe_password_table_result="NO (missing: $probe_password_req_deps_missing)" -fi -printf " %-28s %s\n" "password:" "$probe_password_table_result" -if test "$probe_process_req_deps_ok" = "yes"; then - probe_process_table_result="yes" -else - probe_process_table_result="NO (missing: $probe_process_req_deps_missing)" -fi -printf " %-28s %s\n" "process:" "$probe_process_table_result" -if test "$probe_process58_req_deps_ok" = "yes"; then - probe_process58_table_result="yes" -else - probe_process58_table_result="NO (missing: $probe_process58_req_deps_missing)" -fi -printf " %-28s %s\n" "process58:" "$probe_process58_table_result" -if test "$probe_shadow_req_deps_ok" = "yes"; then - probe_shadow_table_result="yes" -else - probe_shadow_table_result="NO (missing: $probe_shadow_req_deps_missing)" -fi -printf " %-28s %s\n" "shadow:" "$probe_shadow_table_result" -if test "$probe_uname_req_deps_ok" = "yes"; then - probe_uname_table_result="yes" -else - probe_uname_table_result="NO (missing: $probe_uname_req_deps_missing)" -fi -printf " %-28s %s\n" "uname:" "$probe_uname_table_result" -if test "$probe_interface_req_deps_ok" = "yes"; then - probe_interface_table_result="yes" -else - probe_interface_table_result="NO (missing: $probe_interface_req_deps_missing)" -fi -printf " %-28s %s\n" "interface:" "$probe_interface_table_result" -if test "$probe_xinetd_req_deps_ok" = "yes"; then - probe_xinetd_table_result="yes" -else - probe_xinetd_table_result="NO (missing: $probe_xinetd_req_deps_missing)" -fi -printf " %-28s %s\n" "xinetd:" "$probe_xinetd_table_result" -if test "$probe_sysctl_req_deps_ok" = "yes"; then - probe_sysctl_table_result="yes" -else - probe_sysctl_table_result="NO (missing: $probe_sysctl_req_deps_missing)" -fi -printf " %-28s %s\n" "sysctl:" "$probe_sysctl_table_result" -if test "$probe_routingtable_req_deps_ok" = "yes"; then - probe_routingtable_table_result="yes" -else - probe_routingtable_table_result="NO (missing: $probe_routingtable_req_deps_missing)" -fi -printf " %-28s %s\n" "routingtable:" "$probe_routingtable_table_result" -if test "$probe_symlink_req_deps_ok" = "yes"; then - probe_symlink_table_result="yes" -else - probe_symlink_table_result="NO (missing: $probe_symlink_req_deps_missing)" -fi -printf " %-28s %s\n" "symlink:" "$probe_symlink_table_result" -if test "$probe_gconf_req_deps_ok" = "yes"; then - probe_gconf_table_result="yes" -else - probe_gconf_table_result="NO (missing: $probe_gconf_req_deps_missing)" -fi -printf " %-28s %s\n" "gconf:" "$probe_gconf_table_result" -if test "$probe_isainfo_req_deps_ok" = "yes"; then - probe_isainfo_table_result="yes" -else - probe_isainfo_table_result="NO (missing: $probe_isainfo_req_deps_missing)" -fi -printf " %-28s %s\n" "isainfo:" "$probe_isainfo_table_result" -if test "$probe_package_req_deps_ok" = "yes"; then - probe_package_table_result="yes" -else - probe_package_table_result="NO (missing: $probe_package_req_deps_missing)" -fi -printf " %-28s %s\n" "package:" "$probe_package_table_result" -if test "$probe_patch_req_deps_ok" = "yes"; then - probe_patch_table_result="yes" -else - probe_patch_table_result="NO (missing: $probe_patch_req_deps_missing)" -fi -printf " %-28s %s\n" "patch:" "$probe_patch_table_result" -if test "$probe_smf_req_deps_ok" = "yes"; then - probe_smf_table_result="yes" -else - probe_smf_table_result="NO (missing: $probe_smf_req_deps_missing)" -fi -printf " %-28s %s\n" "smf:" "$probe_smf_table_result" -if test "$probe_partition_req_deps_ok" = "yes"; then - probe_partition_table_result="yes" -else - probe_partition_table_result="NO (missing: $probe_partition_req_deps_missing)" -fi -printf " %-28s %s\n" "partition:" "$probe_partition_table_result" -if test "$probe_inetlisteningservers_req_deps_ok" = "yes"; then - probe_inetlisteningservers_table_result="yes" -else - probe_inetlisteningservers_table_result="NO (missing: $probe_inetlisteningservers_req_deps_missing)" -fi -printf " %-28s %s\n" "inetlisteningservers:" "$probe_inetlisteningservers_table_result" -if test "$probe_iflisteners_req_deps_ok" = "yes"; then - probe_iflisteners_table_result="yes" -else - probe_iflisteners_table_result="NO (missing: $probe_iflisteners_req_deps_missing)" -fi -printf " %-28s %s\n" "iflisteners:" "$probe_iflisteners_table_result" -if test "$probe_selinuxboolean_req_deps_ok" = "yes"; then - probe_selinuxboolean_table_result="yes" -else - probe_selinuxboolean_table_result="NO (missing: $probe_selinuxboolean_req_deps_missing)" -fi -printf " %-28s %s\n" "selinuxboolean:" "$probe_selinuxboolean_table_result" -if test "$probe_selinuxsecuritycontext_req_deps_ok" = "yes"; then - probe_selinuxsecuritycontext_table_result="yes" -else - probe_selinuxsecuritycontext_table_result="NO (missing: $probe_selinuxsecuritycontext_req_deps_missing)" -fi -printf " %-28s %s\n" "selinuxsecuritycontext:" "$probe_selinuxsecuritycontext_table_result" -if test "$probe_rpminfo_req_deps_ok" = "yes"; then - probe_rpminfo_table_result="yes" -else - probe_rpminfo_table_result="NO (missing: $probe_rpminfo_req_deps_missing)" -fi -printf " %-28s %s\n" "rpminfo:" "$probe_rpminfo_table_result" -if test "$probe_rpmverify_req_deps_ok" = "yes"; then - probe_rpmverify_table_result="yes" -else - probe_rpmverify_table_result="NO (missing: $probe_rpmverify_req_deps_missing)" -fi -printf " %-28s %s\n" "rpmverify:" "$probe_rpmverify_table_result" -if test "$probe_rpmverifyfile_req_deps_ok" = "yes"; then - probe_rpmverifyfile_table_result="yes" -else - probe_rpmverifyfile_table_result="NO (missing: $probe_rpmverifyfile_req_deps_missing)" -fi -printf " %-28s %s\n" "rpmverifyfile:" "$probe_rpmverifyfile_table_result" -if test "$probe_rpmverifypackage_req_deps_ok" = "yes"; then - probe_rpmverifypackage_table_result="yes" -else - probe_rpmverifypackage_table_result="NO (missing: $probe_rpmverifypackage_req_deps_missing)" -fi -printf " %-28s %s\n" "rpmverifypackage:" "$probe_rpmverifypackage_table_result" -if test "$probe_dpkginfo_req_deps_ok" = "yes"; then - probe_dpkginfo_table_result="yes" -else - probe_dpkginfo_table_result="NO (missing: $probe_dpkginfo_req_deps_missing)" -fi -printf " %-28s %s\n" "dpkginfo:" "$probe_dpkginfo_table_result" -if test "$probe_systemdunitproperty_req_deps_ok" = "yes"; then - probe_systemdunitproperty_table_result="yes" -else - probe_systemdunitproperty_table_result="NO (missing: $probe_systemdunitproperty_req_deps_missing)" -fi -printf " %-28s %s\n" "systemdunitproperty:" "$probe_systemdunitproperty_table_result" -if test "$probe_systemdunitdependency_req_deps_ok" = "yes"; then - probe_systemdunitdependency_table_result="yes" -else - probe_systemdunitdependency_table_result="NO (missing: $probe_systemdunitdependency_req_deps_missing)" -fi -printf " %-28s %s\n" "systemdunitdependency:" "$probe_systemdunitdependency_table_result" -echo " system_info: always enabled" -echo -echo " === configuration ===" -echo " probe directory set to: $probe_dir" -echo "" - -echo " === crypto === " -echo " library: $crapi_libname" -echo " libs: $crapi_LIBS" -echo " cflags: $crapi_CFLAGS" -echo "" - -echo "Valgrind checks enabled: $vgcheck" -echo "CFLAGS: $CFLAGS" -echo "CXXFLAGS: $CXXFLAGS" diff -Nru openscap-1.2.17/cpe/CMakeLists.txt openscap-1.3.4/cpe/CMakeLists.txt --- openscap-1.2.17/cpe/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/cpe/CMakeLists.txt 2021-02-01 09:53:40.000000000 -0500 @@ -0,0 +1,6 @@ +SET(CPE_FILES + "openscap-cpe-dict.xml" + "openscap-cpe-oval.xml" + "README" +) +install(FILES ${CPE_FILES} DESTINATION ${OSCAP_DEFAULT_CPE_PATH}) diff -Nru openscap-1.2.17/cpe/Makefile.am openscap-1.3.4/cpe/Makefile.am --- openscap-1.2.17/cpe/Makefile.am 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/cpe/Makefile.am 1969-12-31 19:00:00.000000000 -0500 @@ -1,7 +0,0 @@ -cpedir = $(pkgdatadir)/cpe/ -cpe_DATA = \ - openscap-cpe-dict.xml \ - openscap-cpe-oval.xml \ - README - -EXTRA_DIST = $(cpe_DATA) diff -Nru openscap-1.2.17/cpe/openscap-cpe-dict.xml openscap-1.3.4/cpe/openscap-cpe-dict.xml --- openscap-1.2.17/cpe/openscap-cpe-dict.xml 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/cpe/openscap-cpe-dict.xml 2021-02-01 09:53:40.000000000 -0500 @@ -17,6 +17,10 @@ Red Hat Enterprise Linux 7 oval:org.open-scap.cpe.rhel:def:7 + + Red Hat Enterprise Linux 8 + oval:org.open-scap.cpe.rhel:def:8 + Oracle Linux 5 oval:org.open-scap.cpe.ol:def:5 @@ -29,6 +33,10 @@ Oracle Linux 7 oval:org.open-scap.cpe.ol:def:7 + + Oracle Linux 8 + oval:org.open-scap.cpe.ol:def:8 + Community Enterprise Operating System 5 oval:org.open-scap.cpe.rhel:def:1005 @@ -109,6 +117,22 @@ Fedora 29 oval:org.open-scap.cpe.fedora:def:29 + + Fedora 30 + oval:org.open-scap.cpe.fedora:def:30 + + + Fedora 31 + oval:org.open-scap.cpe.fedora:def:31 + + + Fedora 32 + oval:org.open-scap.cpe.fedora:def:32 + + + Fedora 33 + oval:org.open-scap.cpe.fedora:def:33 + SUSE Linux Enterprise all versions oval:org.open-scap.cpe.sle:def:1 @@ -153,10 +177,26 @@ openSUSE 42.1 oval:org.open-scap.cpe.opensuse:def:421 + + openSUSE Leap 42.1 + oval:org.open-scap.cpe.opensuse:def:421 + openSUSE 42.2 oval:org.open-scap.cpe.opensuse:def:422 + + openSUSE Leap 42.2 + oval:org.open-scap.cpe.opensuse:def:422 + + + openSUSE Leap 42.3 + oval:org.open-scap.cpe.opensuse:def:423 + + + openSUSE Leap 15.0 + oval:org.open-scap.cpe.opensuse:def:150 + openSUSE All Versions oval:org.open-scap.cpe.opensuse:def:1 @@ -182,4 +222,36 @@ Wind River Linux 8 oval:org.open-scap.cpe.wrlinux:def:8 + + Wind River Linux 1019 + oval:org.open-scap.cpe.wrlinux:def:1019 + + + Microsoft Windows 7 + oval:org.open-scap.cpe.windows:def:7 + + + Microsoft Windows 8 + oval:org.open-scap.cpe.windows:def:8 + + + Microsoft Windows 8.1 + oval:org.open-scap.cpe.windows:def:81 + + + Microsoft Windows 10 + oval:org.open-scap.cpe.windows:def:10 + + + Microsoft Windows Server 2008 + oval:org.open-scap.cpe.windows:def:2008 + + + Microsoft Windows Server 2012 + oval:org.open-scap.cpe.windows:def:2012 + + + Microsoft Windows Server 2016 + oval:org.open-scap.cpe.windows:def:2016 + diff -Nru openscap-1.2.17/cpe/openscap-cpe-oval.xml openscap-1.3.4/cpe/openscap-cpe-oval.xml --- openscap-1.2.17/cpe/openscap-cpe-oval.xml 2018-05-29 04:44:29.000000000 -0400 +++ openscap-1.3.4/cpe/openscap-cpe-oval.xml 2021-02-01 09:53:40.000000000 -0500 @@ -68,6 +68,19 @@ + + + Red Hat Enterprise Linux 8 + + Red Hat Enterprise Linux 8 + + + The operating system installed on the system is Red Hat Enterprise Linux 8 + + + + + Oracle Linux 5 @@ -107,6 +120,19 @@ + + + Oracle Linux 8 + + Oracle Linux 8 + + + The operating system installed on the system is Oracle Linux 8 + + + + + Community Enterprise Operating System 5 @@ -367,6 +393,59 @@ + + + Fedora 30 + + Fedora 30 + + + The operating system installed on the system is Fedora 30 + + + + + + + + Fedora 31 + + Fedora 31 + + + The operating system installed on the system is Fedora 31 + + + + + + + + Fedora 32 + + Fedora 32 + + + The operating system installed on the system is Fedora 32 + + + + + + + + Fedora 33 + + Fedora 33 + + + The operating system installed on the system is Fedora 33 + + + + + + @@ -519,28 +598,56 @@ - openSUSE 42.1 + openSUSE Leap 42.1 - openSUSE 42.1 + openSUSE Leap 42.1 - The operating system installed on the system is openSUSE 42.1 + + The operating system installed on the system is openSUSE Leap 42.1 - + - openSUSE 42.2 + openSUSE Leap 42.2 - openSUSE 42.2 + openSUSE Leap 42.2 - The operating system installed on the system is openSUSE 42.2 + + The operating system installed on the system is openSUSE Leap 42.2 + + + + + + + + openSUSE Leap 42.3 + + openSUSE Leap 42.3 + + + The operating system installed on the system is openSUSE Leap 42.3 + + + + + + + + openSUSE Leap 15.0 + + openSUSE Leap 15.0 + + + The operating system installed on the system is openSUSE Leap 15.0 - + @@ -570,6 +677,110 @@ + + + Wind River Linux 1019 + + Wind River Linux 1019 + + + The operating system installed on the system is Wind River Linux 1019 + + + + + + + + Microsoft Windows 7 + + Microsoft Windows 7 + + + The operating system installed on the system is Microsoft Windows 7 + + + + + + + + Microsoft Windows 8 + + Microsoft Windows 8 + + + The operating system installed on the system is Microsoft Windows 8 + + + + + + + + Microsoft Windows 8.1 + + Microsoft Windows 8.1 + + + The operating system installed on the system is Microsoft Windows 8.1 + + + + + + + + Microsoft Windows 10 + + Microsoft Windows 10 + + + The operating system installed on the system is Microsoft Windows 10 + + + + + + + + Microsoft Windows Server 2008 + + Microsoft Windows Server 2008 + + + The operating system installed on the system is Microsoft Windows Server 2008 + + + + + + + + Microsoft Windows Server 2012 + + Microsoft Windows Server 2012 + + + The operating system installed on the system is Microsoft Windows Server 2012 + + + + + + + + Microsoft Windows Server 2016 + + Microsoft Windows Server 2016 + + + The operating system installed on the system is Microsoft Windows Server 2016 + + + + + + + + + @@ -607,6 +823,11 @@ + + + + @@ -707,6 +928,26 @@ + + + + + + + + + + + + + + + + @@ -778,6 +1019,16 @@ + + + + + + + + @@ -804,6 +1055,17 @@ + + + + @@ -811,6 +1073,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -818,7 +1108,7 @@ redhat-release - fedora-release + ^fedora-release.* @@ -853,6 +1143,17 @@ ^VERSION=.([[:digit:]]*) 1 + + /etc + os-release + ^VERSION=.(\d*.\d*) + 1 + redhat-release-virtualization-host @@ -864,6 +1165,11 @@ oraclelinux-release + + HKEY_LOCAL_MACHINE + SOFTWARE\Microsoft\Windows NT\CurrentVersion + ProductName + @@ -883,6 +1189,10 @@ ^redhat-release ^7[^\d] + + ^redhat-release + ^8[^\d] + ^centos-release ^5 @@ -919,6 +1229,10 @@ ^oraclelinux-release ^7 + + ^oraclelinux-release + ^8 + ^16$ @@ -961,6 +1275,18 @@ ^29$ + + ^30$ + + + ^31$ + + + ^32$ + + + ^33$ + ^sles-release @@ -1003,6 +1329,12 @@ ^42.2$ + + ^42.3$ + + + ^15.0$ + 8 + + 10.19 + 7 + + ^Windows 7.*$ + + + ^Windows 8.*$ + + + ^Windows 8\.1.*$ + + + ^Windows 10.*$ + + + ^.*2008.*$ + + + ^.*2012.*$ + + + ^.*2016.*$ + diff -Nru openscap-1.2.17/debian/changelog openscap-1.3.4/debian/changelog --- openscap-1.2.17/debian/changelog 2021-01-05 15:19:13.000000000 -0500 +++ openscap-1.3.4/debian/changelog 2021-06-10 12:15:55.000000000 -0400 @@ -1,3 +1,13 @@ +openscap (1.3.4-1ubuntu1) impish; urgency=medium + + * Merge from debian/1.3.4-1 sid release (LP: #1931618) + * Remaining changes: + - Import dpkg probe version comparison fix from Hirsute + * New changes: + - Add autotailor to distribution from utils/ + + -- Alexander Scheel Thu, 10 Jun 2021 12:15:55 -0400 + openscap (1.2.17-0.1ubuntu4) hirsute; urgency=medium * Add dpkg version comparison algorithm to avoid false positives. diff -Nru openscap-1.2.17/debian/compat openscap-1.3.4/debian/compat --- openscap-1.2.17/debian/compat 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/debian/compat 2021-06-10 09:16:24.000000000 -0400 @@ -0,0 +1 @@ +11 diff -Nru openscap-1.2.17/debian/control openscap-1.3.4/debian/control --- openscap-1.2.17/debian/control 2021-01-05 15:19:13.000000000 -0500 +++ openscap-1.3.4/debian/control 2021-06-10 09:16:24.000000000 -0400 @@ -1,32 +1,36 @@ Source: openscap Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Pierre Chifflier -Build-Depends: debhelper-compat (= 10), +Maintainer: Pierre Chifflier +Uploaders: Philippe Thierry +Build-Depends: debhelper (>= 13), + cmake, libpcre3-dev, libxml2-dev, libxslt1-dev, swig, - python3-dev, + python3-all-dev, libperl-dev, libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, libgcrypt-dev, libapt-pkg-dev, libselinux1-dev [linux-any], libcap-dev [linux-any], + libattr1-dev, libldap2-dev, libbz2-dev, pkg-config, dh-python, + chrpath, libdbus-1-dev -Standards-Version: 4.1.0 +X-Python3-Version: >= 3.9 +Standards-Version: 4.5.1 Section: libs Homepage: http://www.open-scap.org/ Package: libopenscap-dev Section: libdevel Architecture: linux-any -Depends: libopenscap8 (= ${binary:Version}), ${misc:Depends}, libjs-jquery +Depends: libopenscap8 (= ${binary:Version}), ${misc:Depends}, ${python3:Depends}, libjs-jquery Description: Set of libraries enabling integration of the SCAP line of standards OpenSCAP is a set of open source libraries providing an easier path for integration of the SCAP line of standards. SCAP is a line of @@ -50,7 +54,7 @@ Conflicts: libopenscap0, libopenscap1, libopenscap3 Replaces: libopenscap0, libopenscap1, libopenscap3 Pre-Depends: ${misc:Pre-Depends} -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends} Description: Set of libraries enabling integration of the SCAP line of standards OpenSCAP is a set of open source libraries providing an easier path for integration of the SCAP line of standards. SCAP is a line of @@ -70,6 +74,7 @@ Section: python Architecture: linux-any Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, libopenscap8 (= ${binary:Version}) +X-Python3-Version: ${python3:Versions} Provides: ${python3:Provides} Description: Set of libraries enabling integration of the SCAP line of standards OpenSCAP is a set of open source libraries providing an easier path @@ -86,7 +91,7 @@ * Extensible Configuration Checklist Description Format (XCCDF) * Open Vulnerability and Assessment Language (OVAL) . - This package contains the Python3 bindings for OpenSCAP. + This package contains the Python bindings for OpenSCAP. Package: libopenscap-perl Section: perl @@ -131,3 +136,4 @@ * Open Vulnerability and Assessment Language (OVAL) . This package contains debugging symbols for OpenSCAP. + diff -Nru openscap-1.2.17/debian/gbp.conf openscap-1.3.4/debian/gbp.conf --- openscap-1.2.17/debian/gbp.conf 1969-12-31 19:00:00.000000000 -0500 +++ openscap-1.3.4/debian/gbp.conf 2021-06-10 09:16:24.000000000 -0400 @@ -0,0 +1,5 @@ +[DEFAULT] +debian-branch = debian/master +debian-tag = debian/%(version)s +upstream-tag = upstream/%(version)s +submodules = True diff -Nru openscap-1.2.17/debian/libopenscap8.install openscap-1.3.4/debian/libopenscap8.install --- openscap-1.2.17/debian/libopenscap8.install 2020-06-19 00:17:54.000000000 -0400 +++ openscap-1.3.4/debian/libopenscap8.install 2021-06-10 11:28:59.000000000 -0400 @@ -1,5 +1,17 @@ +usr/bin/autotailor usr/bin/oscap +usr/bin/oscap-chroot +usr/bin/oscap-docker +usr/bin/oscap-run-sce-script +usr/bin/oscap-ssh +usr/bin/oscap-vm +usr/bin/oscap-podman +usr/share/man/man8/autotailor.8* +usr/share/man/man8/oscap.8* +usr/share/man/man8/oscap-chroot.8* +usr/share/man/man8/oscap-docker.8* +usr/share/man/man8/oscap-ssh.8* +usr/share/man/man8/oscap-vm.8* +usr/share/man/man8/oscap-podman.8* usr/lib/*/lib*.so.* -usr/lib/*/openscap/probe_* -usr/share/man/man8/oscap.8 usr/share/openscap/* diff -Nru openscap-1.2.17/debian/libopenscap8.lintian-overrides openscap-1.3.4/debian/libopenscap8.lintian-overrides --- openscap-1.2.17/debian/libopenscap8.lintian-overrides 2020-04-10 10:35:13.000000000 -0400 +++ openscap-1.3.4/debian/libopenscap8.lintian-overrides 2021-06-10 09:16:24.000000000 -0400 @@ -1,2 +1,2 @@ -# This is a long line -libopenscap8: manpage-has-errors-from-man usr/share/man/man8/oscap.8.gz 151: warning [p 3, 7.0i]: cannot adjust line +# historical package named keeped +libopenscap8: package-name-doesnt-match-sonames libopenscap25 libopenscap-sce25 diff -Nru openscap-1.2.17/debian/libopenscap-dev.install openscap-1.3.4/debian/libopenscap-dev.install --- openscap-1.2.17/debian/libopenscap-dev.install 2020-06-19 00:17:54.000000000 -0400 +++ openscap-1.3.4/debian/libopenscap-dev.install 2021-06-10 09:16:24.000000000 -0400 @@ -1,3 +1,4 @@ usr/include/* -usr/lib/*/lib*.so +usr/lib/*/libopenscap.so +usr/lib/*/libopenscap_sce.so usr/lib/*/pkgconfig/* diff -Nru openscap-1.2.17/debian/missing-sources/bootstrap.js openscap-1.3.4/debian/missing-sources/bootstrap.js --- openscap-1.2.17/debian/missing-sources/bootstrap.js 2019-11-28 07:59:49.000000000 -0500 +++ openscap-1.3.4/debian/missing-sources/bootstrap.js 1969-12-31 19:00:00.000000000 -0500 @@ -1,4521 +0,0 @@ -/*! - * Bootstrap v4.4.1 (https://getbootstrap.com/) - * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) : - typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) : - (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); -}(this, (function (exports, $, Popper) { 'use strict'; - - $ = $ && $.hasOwnProperty('default') ? $['default'] : $; - Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; - } - - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; - } - - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - - /** - * -------------------------------------------------------------------------- - * Bootstrap (v4.4.1): util.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - /** - * ------------------------------------------------------------------------ - * Private TransitionEnd Helpers - * ------------------------------------------------------------------------ - */ - - var TRANSITION_END = 'transitionend'; - var MAX_UID = 1000000; - var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) - - function toType(obj) { - return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); - } - - function getSpecialTransitionEndEvent() { - return { - bindType: TRANSITION_END, - delegateType: TRANSITION_END, - handle: function handle(event) { - if ($(event.target).is(this)) { - return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params - } - - return undefined; // eslint-disable-line no-undefined - } - }; - } - - function transitionEndEmulator(duration) { - var _this = this; - - var called = false; - $(this).one(Util.TRANSITION_END, function () { - called = true; - }); - setTimeout(function () { - if (!called) { - Util.triggerTransitionEnd(_this); - } - }, duration); - return this; - } - - function setTransitionEndSupport() { - $.fn.emulateTransitionEnd = transitionEndEmulator; - $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); - } - /** - * -------------------------------------------------------------------------- - * Public Util Api - * -------------------------------------------------------------------------- - */ - - - var Util = { - TRANSITION_END: 'bsTransitionEnd', - getUID: function getUID(prefix) { - do { - // eslint-disable-next-line no-bitwise - prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here - } while (document.getElementById(prefix)); - - return prefix; - }, - getSelectorFromElement: function getSelectorFromElement(element) { - var selector = element.getAttribute('data-target'); - - if (!selector || selector === '#') { - var hrefAttr = element.getAttribute('href'); - selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; - } - - try { - return document.querySelector(selector) ? selector : null; - } catch (err) { - return null; - } - }, - getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { - if (!element) { - return 0; - } // Get transition-duration of the element - - - var transitionDuration = $(element).css('transition-duration'); - var transitionDelay = $(element).css('transition-delay'); - var floatTransitionDuration = parseFloat(transitionDuration); - var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found - - if (!floatTransitionDuration && !floatTransitionDelay) { - return 0; - } // If multiple durations are defined, take the first - - - transitionDuration = transitionDuration.split(',')[0]; - transitionDelay = transitionDelay.split(',')[0]; - return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; - }, - reflow: function reflow(element) { - return element.offsetHeight; - }, - triggerTransitionEnd: function triggerTransitionEnd(element) { - $(element).trigger(TRANSITION_END); - }, - // TODO: Remove in v5 - supportsTransitionEnd: function supportsTransitionEnd() { - return Boolean(TRANSITION_END); - }, - isElement: function isElement(obj) { - return (obj[0] || obj).nodeType; - }, - typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { - for (var property in configTypes) { - if (Object.prototype.hasOwnProperty.call(configTypes, property)) { - var expectedTypes = configTypes[property]; - var value = config[property]; - var valueType = value && Util.isElement(value) ? 'element' : toType(value); - - if (!new RegExp(expectedTypes).test(valueType)) { - throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); - } - } - } - }, - findShadowRoot: function findShadowRoot(element) { - if (!document.documentElement.attachShadow) { - return null; - } // Can find the shadow root otherwise it'll return the document - - - if (typeof element.getRootNode === 'function') { - var root = element.getRootNode(); - return root instanceof ShadowRoot ? root : null; - } - - if (element instanceof ShadowRoot) { - return element; - } // when we don't find a shadow root - - - if (!element.parentNode) { - return null; - } - - return Util.findShadowRoot(element.parentNode); - }, - jQueryDetection: function jQueryDetection() { - if (typeof $ === 'undefined') { - throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); - } - - var version = $.fn.jquery.split(' ')[0].split('.'); - var minMajor = 1; - var ltMajor = 2; - var minMinor = 9; - var minPatch = 1; - var maxMajor = 4; - - if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { - throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); - } - } - }; - Util.jQueryDetection(); - setTransitionEndSupport(); - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME = 'alert'; - var VERSION = '4.4.1'; - var DATA_KEY = 'bs.alert'; - var EVENT_KEY = "." + DATA_KEY; - var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var Selector = { - DISMISS: '[data-dismiss="alert"]' - }; - var Event = { - CLOSE: "close" + EVENT_KEY, - CLOSED: "closed" + EVENT_KEY, - CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY - }; - var ClassName = { - ALERT: 'alert', - FADE: 'fade', - SHOW: 'show' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Alert = - /*#__PURE__*/ - function () { - function Alert(element) { - this._element = element; - } // Getters - - - var _proto = Alert.prototype; - - // Public - _proto.close = function close(element) { - var rootElement = this._element; - - if (element) { - rootElement = this._getRootElement(element); - } - - var customEvent = this._triggerCloseEvent(rootElement); - - if (customEvent.isDefaultPrevented()) { - return; - } - - this._removeElement(rootElement); - }; - - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; - } // Private - ; - - _proto._getRootElement = function _getRootElement(element) { - var selector = Util.getSelectorFromElement(element); - var parent = false; - - if (selector) { - parent = document.querySelector(selector); - } - - if (!parent) { - parent = $(element).closest("." + ClassName.ALERT)[0]; - } - - return parent; - }; - - _proto._triggerCloseEvent = function _triggerCloseEvent(element) { - var closeEvent = $.Event(Event.CLOSE); - $(element).trigger(closeEvent); - return closeEvent; - }; - - _proto._removeElement = function _removeElement(element) { - var _this = this; - - $(element).removeClass(ClassName.SHOW); - - if (!$(element).hasClass(ClassName.FADE)) { - this._destroyElement(element); - - return; - } - - var transitionDuration = Util.getTransitionDurationFromElement(element); - $(element).one(Util.TRANSITION_END, function (event) { - return _this._destroyElement(element, event); - }).emulateTransitionEnd(transitionDuration); - }; - - _proto._destroyElement = function _destroyElement(element) { - $(element).detach().trigger(Event.CLOSED).remove(); - } // Static - ; - - Alert._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var $element = $(this); - var data = $element.data(DATA_KEY); - - if (!data) { - data = new Alert(this); - $element.data(DATA_KEY, data); - } - - if (config === 'close') { - data[config](this); - } - }); - }; - - Alert._handleDismiss = function _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault(); - } - - alertInstance.close(this); - }; - }; - - _createClass(Alert, null, [{ - key: "VERSION", - get: function get() { - return VERSION; - } - }]); - - return Alert; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME] = Alert._jQueryInterface; - $.fn[NAME].Constructor = Alert; - - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Alert._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$1 = 'button'; - var VERSION$1 = '4.4.1'; - var DATA_KEY$1 = 'bs.button'; - var EVENT_KEY$1 = "." + DATA_KEY$1; - var DATA_API_KEY$1 = '.data-api'; - var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; - var ClassName$1 = { - ACTIVE: 'active', - BUTTON: 'btn', - FOCUS: 'focus' - }; - var Selector$1 = { - DATA_TOGGLE_CARROT: '[data-toggle^="button"]', - DATA_TOGGLES: '[data-toggle="buttons"]', - DATA_TOGGLE: '[data-toggle="button"]', - DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn', - INPUT: 'input:not([type="hidden"])', - ACTIVE: '.active', - BUTTON: '.btn' - }; - var Event$1 = { - CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, - FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1), - LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1 - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Button = - /*#__PURE__*/ - function () { - function Button(element) { - this._element = element; - } // Getters - - - var _proto = Button.prototype; - - // Public - _proto.toggle = function toggle() { - var triggerChangeEvent = true; - var addAriaPressed = true; - var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0]; - - if (rootElement) { - var input = this._element.querySelector(Selector$1.INPUT); - - if (input) { - if (input.type === 'radio') { - if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { - triggerChangeEvent = false; - } else { - var activeElement = rootElement.querySelector(Selector$1.ACTIVE); - - if (activeElement) { - $(activeElement).removeClass(ClassName$1.ACTIVE); - } - } - } else if (input.type === 'checkbox') { - if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) { - triggerChangeEvent = false; - } - } else { - // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input - triggerChangeEvent = false; - } - - if (triggerChangeEvent) { - input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); - $(input).trigger('change'); - } - - input.focus(); - addAriaPressed = false; - } - } - - if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { - if (addAriaPressed) { - this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); - } - - if (triggerChangeEvent) { - $(this._element).toggleClass(ClassName$1.ACTIVE); - } - } - }; - - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$1); - this._element = null; - } // Static - ; - - Button._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$1); - - if (!data) { - data = new Button(this); - $(this).data(DATA_KEY$1, data); - } - - if (config === 'toggle') { - data[config](); - } - }); - }; - - _createClass(Button, null, [{ - key: "VERSION", - get: function get() { - return VERSION$1; - } - }]); - - return Button; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { - var button = event.target; - - if (!$(button).hasClass(ClassName$1.BUTTON)) { - button = $(button).closest(Selector$1.BUTTON)[0]; - } - - if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { - event.preventDefault(); // work around Firefox bug #1540995 - } else { - var inputBtn = button.querySelector(Selector$1.INPUT); - - if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { - event.preventDefault(); // work around Firefox bug #1540995 - - return; - } - - Button._jQueryInterface.call($(button), 'toggle'); - } - }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { - var button = $(event.target).closest(Selector$1.BUTTON)[0]; - $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); - }); - $(window).on(Event$1.LOAD_DATA_API, function () { - // ensure correct active class is set to match the controls' actual values/states - // find all checkboxes/readio buttons inside data-toggle groups - var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS)); - - for (var i = 0, len = buttons.length; i < len; i++) { - var button = buttons[i]; - var input = button.querySelector(Selector$1.INPUT); - - if (input.checked || input.hasAttribute('checked')) { - button.classList.add(ClassName$1.ACTIVE); - } else { - button.classList.remove(ClassName$1.ACTIVE); - } - } // find all button toggles - - - buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE)); - - for (var _i = 0, _len = buttons.length; _i < _len; _i++) { - var _button = buttons[_i]; - - if (_button.getAttribute('aria-pressed') === 'true') { - _button.classList.add(ClassName$1.ACTIVE); - } else { - _button.classList.remove(ClassName$1.ACTIVE); - } - } - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME$1] = Button._jQueryInterface; - $.fn[NAME$1].Constructor = Button; - - $.fn[NAME$1].noConflict = function () { - $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; - return Button._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$2 = 'carousel'; - var VERSION$2 = '4.4.1'; - var DATA_KEY$2 = 'bs.carousel'; - var EVENT_KEY$2 = "." + DATA_KEY$2; - var DATA_API_KEY$2 = '.data-api'; - var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; - var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key - - var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key - - var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch - - var SWIPE_THRESHOLD = 40; - var Default = { - interval: 5000, - keyboard: true, - slide: false, - pause: 'hover', - wrap: true, - touch: true - }; - var DefaultType = { - interval: '(number|boolean)', - keyboard: 'boolean', - slide: '(boolean|string)', - pause: '(string|boolean)', - wrap: 'boolean', - touch: 'boolean' - }; - var Direction = { - NEXT: 'next', - PREV: 'prev', - LEFT: 'left', - RIGHT: 'right' - }; - var Event$2 = { - SLIDE: "slide" + EVENT_KEY$2, - SLID: "slid" + EVENT_KEY$2, - KEYDOWN: "keydown" + EVENT_KEY$2, - MOUSEENTER: "mouseenter" + EVENT_KEY$2, - MOUSELEAVE: "mouseleave" + EVENT_KEY$2, - TOUCHSTART: "touchstart" + EVENT_KEY$2, - TOUCHMOVE: "touchmove" + EVENT_KEY$2, - TOUCHEND: "touchend" + EVENT_KEY$2, - POINTERDOWN: "pointerdown" + EVENT_KEY$2, - POINTERUP: "pointerup" + EVENT_KEY$2, - DRAG_START: "dragstart" + EVENT_KEY$2, - LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, - CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 - }; - var ClassName$2 = { - CAROUSEL: 'carousel', - ACTIVE: 'active', - SLIDE: 'slide', - RIGHT: 'carousel-item-right', - LEFT: 'carousel-item-left', - NEXT: 'carousel-item-next', - PREV: 'carousel-item-prev', - ITEM: 'carousel-item', - POINTER_EVENT: 'pointer-event' - }; - var Selector$2 = { - ACTIVE: '.active', - ACTIVE_ITEM: '.active.carousel-item', - ITEM: '.carousel-item', - ITEM_IMG: '.carousel-item img', - NEXT_PREV: '.carousel-item-next, .carousel-item-prev', - INDICATORS: '.carousel-indicators', - DATA_SLIDE: '[data-slide], [data-slide-to]', - DATA_RIDE: '[data-ride="carousel"]' - }; - var PointerType = { - TOUCH: 'touch', - PEN: 'pen' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Carousel = - /*#__PURE__*/ - function () { - function Carousel(element, config) { - this._items = null; - this._interval = null; - this._activeElement = null; - this._isPaused = false; - this._isSliding = false; - this.touchTimeout = null; - this.touchStartX = 0; - this.touchDeltaX = 0; - this._config = this._getConfig(config); - this._element = element; - this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); - this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; - this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); - - this._addEventListeners(); - } // Getters - - - var _proto = Carousel.prototype; - - // Public - _proto.next = function next() { - if (!this._isSliding) { - this._slide(Direction.NEXT); - } - }; - - _proto.nextWhenVisible = function nextWhenVisible() { - // Don't call next when the page isn't visible - // or the carousel or its parent isn't visible - if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { - this.next(); - } - }; - - _proto.prev = function prev() { - if (!this._isSliding) { - this._slide(Direction.PREV); - } - }; - - _proto.pause = function pause(event) { - if (!event) { - this._isPaused = true; - } - - if (this._element.querySelector(Selector$2.NEXT_PREV)) { - Util.triggerTransitionEnd(this._element); - this.cycle(true); - } - - clearInterval(this._interval); - this._interval = null; - }; - - _proto.cycle = function cycle(event) { - if (!event) { - this._isPaused = false; - } - - if (this._interval) { - clearInterval(this._interval); - this._interval = null; - } - - if (this._config.interval && !this._isPaused) { - this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); - } - }; - - _proto.to = function to(index) { - var _this = this; - - this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); - - var activeIndex = this._getItemIndex(this._activeElement); - - if (index > this._items.length - 1 || index < 0) { - return; - } - - if (this._isSliding) { - $(this._element).one(Event$2.SLID, function () { - return _this.to(index); - }); - return; - } - - if (activeIndex === index) { - this.pause(); - this.cycle(); - return; - } - - var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; - - this._slide(direction, this._items[index]); - }; - - _proto.dispose = function dispose() { - $(this._element).off(EVENT_KEY$2); - $.removeData(this._element, DATA_KEY$2); - this._items = null; - this._config = null; - this._element = null; - this._interval = null; - this._isPaused = null; - this._isSliding = null; - this._activeElement = null; - this._indicatorsElement = null; - } // Private - ; - - _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default, {}, config); - Util.typeCheckConfig(NAME$2, config, DefaultType); - return config; - }; - - _proto._handleSwipe = function _handleSwipe() { - var absDeltax = Math.abs(this.touchDeltaX); - - if (absDeltax <= SWIPE_THRESHOLD) { - return; - } - - var direction = absDeltax / this.touchDeltaX; - this.touchDeltaX = 0; // swipe left - - if (direction > 0) { - this.prev(); - } // swipe right - - - if (direction < 0) { - this.next(); - } - }; - - _proto._addEventListeners = function _addEventListeners() { - var _this2 = this; - - if (this._config.keyboard) { - $(this._element).on(Event$2.KEYDOWN, function (event) { - return _this2._keydown(event); - }); - } - - if (this._config.pause === 'hover') { - $(this._element).on(Event$2.MOUSEENTER, function (event) { - return _this2.pause(event); - }).on(Event$2.MOUSELEAVE, function (event) { - return _this2.cycle(event); - }); - } - - if (this._config.touch) { - this._addTouchEventListeners(); - } - }; - - _proto._addTouchEventListeners = function _addTouchEventListeners() { - var _this3 = this; - - if (!this._touchSupported) { - return; - } - - var start = function start(event) { - if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { - _this3.touchStartX = event.originalEvent.clientX; - } else if (!_this3._pointerEvent) { - _this3.touchStartX = event.originalEvent.touches[0].clientX; - } - }; - - var move = function move(event) { - // ensure swiping with one touch and not pinching - if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { - _this3.touchDeltaX = 0; - } else { - _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; - } - }; - - var end = function end(event) { - if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { - _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; - } - - _this3._handleSwipe(); - - if (_this3._config.pause === 'hover') { - // If it's a touch-enabled device, mouseenter/leave are fired as - // part of the mouse compatibility events on first tap - the carousel - // would stop cycling until user tapped out of it; - // here, we listen for touchend, explicitly pause the carousel - // (as if it's the second time we tap on it, mouseenter compat event - // is NOT fired) and after a timeout (to allow for mouse compatibility - // events to fire) we explicitly restart cycling - _this3.pause(); - - if (_this3.touchTimeout) { - clearTimeout(_this3.touchTimeout); - } - - _this3.touchTimeout = setTimeout(function (event) { - return _this3.cycle(event); - }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); - } - }; - - $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { - return e.preventDefault(); - }); - - if (this._pointerEvent) { - $(this._element).on(Event$2.POINTERDOWN, function (event) { - return start(event); - }); - $(this._element).on(Event$2.POINTERUP, function (event) { - return end(event); - }); - - this._element.classList.add(ClassName$2.POINTER_EVENT); - } else { - $(this._element).on(Event$2.TOUCHSTART, function (event) { - return start(event); - }); - $(this._element).on(Event$2.TOUCHMOVE, function (event) { - return move(event); - }); - $(this._element).on(Event$2.TOUCHEND, function (event) { - return end(event); - }); - } - }; - - _proto._keydown = function _keydown(event) { - if (/input|textarea/i.test(event.target.tagName)) { - return; - } - - switch (event.which) { - case ARROW_LEFT_KEYCODE: - event.preventDefault(); - this.prev(); - break; - - case ARROW_RIGHT_KEYCODE: - event.preventDefault(); - this.next(); - break; - } - }; - - _proto._getItemIndex = function _getItemIndex(element) { - this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; - return this._items.indexOf(element); - }; - - _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { - var isNextDirection = direction === Direction.NEXT; - var isPrevDirection = direction === Direction.PREV; - - var activeIndex = this._getItemIndex(activeElement); - - var lastItemIndex = this._items.length - 1; - var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; - - if (isGoingToWrap && !this._config.wrap) { - return activeElement; - } - - var delta = direction === Direction.PREV ? -1 : 1; - var itemIndex = (activeIndex + delta) % this._items.length; - return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; - }; - - _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { - var targetIndex = this._getItemIndex(relatedTarget); - - var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); - - var slideEvent = $.Event(Event$2.SLIDE, { - relatedTarget: relatedTarget, - direction: eventDirectionName, - from: fromIndex, - to: targetIndex - }); - $(this._element).trigger(slideEvent); - return slideEvent; - }; - - _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { - if (this._indicatorsElement) { - var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); - $(indicators).removeClass(ClassName$2.ACTIVE); - - var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; - - if (nextIndicator) { - $(nextIndicator).addClass(ClassName$2.ACTIVE); - } - } - }; - - _proto._slide = function _slide(direction, element) { - var _this4 = this; - - var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); - - var activeElementIndex = this._getItemIndex(activeElement); - - var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); - - var nextElementIndex = this._getItemIndex(nextElement); - - var isCycling = Boolean(this._interval); - var directionalClassName; - var orderClassName; - var eventDirectionName; - - if (direction === Direction.NEXT) { - directionalClassName = ClassName$2.LEFT; - orderClassName = ClassName$2.NEXT; - eventDirectionName = Direction.LEFT; - } else { - directionalClassName = ClassName$2.RIGHT; - orderClassName = ClassName$2.PREV; - eventDirectionName = Direction.RIGHT; - } - - if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { - this._isSliding = false; - return; - } - - var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); - - if (slideEvent.isDefaultPrevented()) { - return; - } - - if (!activeElement || !nextElement) { - // Some weirdness is happening, so we bail - return; - } - - this._isSliding = true; - - if (isCycling) { - this.pause(); - } - - this._setActiveIndicatorElement(nextElement); - - var slidEvent = $.Event(Event$2.SLID, { - relatedTarget: nextElement, - direction: eventDirectionName, - from: activeElementIndex, - to: nextElementIndex - }); - - if ($(this._element).hasClass(ClassName$2.SLIDE)) { - $(nextElement).addClass(orderClassName); - Util.reflow(nextElement); - $(activeElement).addClass(directionalClassName); - $(nextElement).addClass(directionalClassName); - var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); - - if (nextElementInterval) { - this._config.defaultInterval = this._config.defaultInterval || this._config.interval; - this._config.interval = nextElementInterval; - } else { - this._config.interval = this._config.defaultInterval || this._config.interval; - } - - var transitionDuration = Util.getTransitionDurationFromElement(activeElement); - $(activeElement).one(Util.TRANSITION_END, function () { - $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); - $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); - _this4._isSliding = false; - setTimeout(function () { - return $(_this4._element).trigger(slidEvent); - }, 0); - }).emulateTransitionEnd(transitionDuration); - } else { - $(activeElement).removeClass(ClassName$2.ACTIVE); - $(nextElement).addClass(ClassName$2.ACTIVE); - this._isSliding = false; - $(this._element).trigger(slidEvent); - } - - if (isCycling) { - this.cycle(); - } - } // Static - ; - - Carousel._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$2); - - var _config = _objectSpread2({}, Default, {}, $(this).data()); - - if (typeof config === 'object') { - _config = _objectSpread2({}, _config, {}, config); - } - - var action = typeof config === 'string' ? config : _config.slide; - - if (!data) { - data = new Carousel(this, _config); - $(this).data(DATA_KEY$2, data); - } - - if (typeof config === 'number') { - data.to(config); - } else if (typeof action === 'string') { - if (typeof data[action] === 'undefined') { - throw new TypeError("No method named \"" + action + "\""); - } - - data[action](); - } else if (_config.interval && _config.ride) { - data.pause(); - data.cycle(); - } - }); - }; - - Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { - var selector = Util.getSelectorFromElement(this); - - if (!selector) { - return; - } - - var target = $(selector)[0]; - - if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { - return; - } - - var config = _objectSpread2({}, $(target).data(), {}, $(this).data()); - - var slideIndex = this.getAttribute('data-slide-to'); - - if (slideIndex) { - config.interval = false; - } - - Carousel._jQueryInterface.call($(target), config); - - if (slideIndex) { - $(target).data(DATA_KEY$2).to(slideIndex); - } - - event.preventDefault(); - }; - - _createClass(Carousel, null, [{ - key: "VERSION", - get: function get() { - return VERSION$2; - } - }, { - key: "Default", - get: function get() { - return Default; - } - }]); - - return Carousel; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); - $(window).on(Event$2.LOAD_DATA_API, function () { - var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); - - for (var i = 0, len = carousels.length; i < len; i++) { - var $carousel = $(carousels[i]); - - Carousel._jQueryInterface.call($carousel, $carousel.data()); - } - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME$2] = Carousel._jQueryInterface; - $.fn[NAME$2].Constructor = Carousel; - - $.fn[NAME$2].noConflict = function () { - $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; - return Carousel._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$3 = 'collapse'; - var VERSION$3 = '4.4.1'; - var DATA_KEY$3 = 'bs.collapse'; - var EVENT_KEY$3 = "." + DATA_KEY$3; - var DATA_API_KEY$3 = '.data-api'; - var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; - var Default$1 = { - toggle: true, - parent: '' - }; - var DefaultType$1 = { - toggle: 'boolean', - parent: '(string|element)' - }; - var Event$3 = { - SHOW: "show" + EVENT_KEY$3, - SHOWN: "shown" + EVENT_KEY$3, - HIDE: "hide" + EVENT_KEY$3, - HIDDEN: "hidden" + EVENT_KEY$3, - CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 - }; - var ClassName$3 = { - SHOW: 'show', - COLLAPSE: 'collapse', - COLLAPSING: 'collapsing', - COLLAPSED: 'collapsed' - }; - var Dimension = { - WIDTH: 'width', - HEIGHT: 'height' - }; - var Selector$3 = { - ACTIVES: '.show, .collapsing', - DATA_TOGGLE: '[data-toggle="collapse"]' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Collapse = - /*#__PURE__*/ - function () { - function Collapse(element, config) { - this._isTransitioning = false; - this._element = element; - this._config = this._getConfig(config); - this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); - var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); - - for (var i = 0, len = toggleList.length; i < len; i++) { - var elem = toggleList[i]; - var selector = Util.getSelectorFromElement(elem); - var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { - return foundElem === element; - }); - - if (selector !== null && filterElement.length > 0) { - this._selector = selector; - - this._triggerArray.push(elem); - } - } - - this._parent = this._config.parent ? this._getParent() : null; - - if (!this._config.parent) { - this._addAriaAndCollapsedClass(this._element, this._triggerArray); - } - - if (this._config.toggle) { - this.toggle(); - } - } // Getters - - - var _proto = Collapse.prototype; - - // Public - _proto.toggle = function toggle() { - if ($(this._element).hasClass(ClassName$3.SHOW)) { - this.hide(); - } else { - this.show(); - } - }; - - _proto.show = function show() { - var _this = this; - - if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { - return; - } - - var actives; - var activesData; - - if (this._parent) { - actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { - if (typeof _this._config.parent === 'string') { - return elem.getAttribute('data-parent') === _this._config.parent; - } - - return elem.classList.contains(ClassName$3.COLLAPSE); - }); - - if (actives.length === 0) { - actives = null; - } - } - - if (actives) { - activesData = $(actives).not(this._selector).data(DATA_KEY$3); - - if (activesData && activesData._isTransitioning) { - return; - } - } - - var startEvent = $.Event(Event$3.SHOW); - $(this._element).trigger(startEvent); - - if (startEvent.isDefaultPrevented()) { - return; - } - - if (actives) { - Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); - - if (!activesData) { - $(actives).data(DATA_KEY$3, null); - } - } - - var dimension = this._getDimension(); - - $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); - this._element.style[dimension] = 0; - - if (this._triggerArray.length) { - $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); - } - - this.setTransitioning(true); - - var complete = function complete() { - $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); - _this._element.style[dimension] = ''; - - _this.setTransitioning(false); - - $(_this._element).trigger(Event$3.SHOWN); - }; - - var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); - var scrollSize = "scroll" + capitalizedDimension; - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - this._element.style[dimension] = this._element[scrollSize] + "px"; - }; - - _proto.hide = function hide() { - var _this2 = this; - - if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { - return; - } - - var startEvent = $.Event(Event$3.HIDE); - $(this._element).trigger(startEvent); - - if (startEvent.isDefaultPrevented()) { - return; - } - - var dimension = this._getDimension(); - - this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; - Util.reflow(this._element); - $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); - var triggerArrayLength = this._triggerArray.length; - - if (triggerArrayLength > 0) { - for (var i = 0; i < triggerArrayLength; i++) { - var trigger = this._triggerArray[i]; - var selector = Util.getSelectorFromElement(trigger); - - if (selector !== null) { - var $elem = $([].slice.call(document.querySelectorAll(selector))); - - if (!$elem.hasClass(ClassName$3.SHOW)) { - $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); - } - } - } - } - - this.setTransitioning(true); - - var complete = function complete() { - _this2.setTransitioning(false); - - $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); - }; - - this._element.style[dimension] = ''; - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - }; - - _proto.setTransitioning = function setTransitioning(isTransitioning) { - this._isTransitioning = isTransitioning; - }; - - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$3); - this._config = null; - this._parent = null; - this._element = null; - this._triggerArray = null; - this._isTransitioning = null; - } // Private - ; - - _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default$1, {}, config); - config.toggle = Boolean(config.toggle); // Coerce string values - - Util.typeCheckConfig(NAME$3, config, DefaultType$1); - return config; - }; - - _proto._getDimension = function _getDimension() { - var hasWidth = $(this._element).hasClass(Dimension.WIDTH); - return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; - }; - - _proto._getParent = function _getParent() { - var _this3 = this; - - var parent; - - if (Util.isElement(this._config.parent)) { - parent = this._config.parent; // It's a jQuery object - - if (typeof this._config.parent.jquery !== 'undefined') { - parent = this._config.parent[0]; - } - } else { - parent = document.querySelector(this._config.parent); - } - - var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; - var children = [].slice.call(parent.querySelectorAll(selector)); - $(children).each(function (i, element) { - _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); - }); - return parent; - }; - - _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { - var isOpen = $(element).hasClass(ClassName$3.SHOW); - - if (triggerArray.length) { - $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); - } - } // Static - ; - - Collapse._getTargetFromElement = function _getTargetFromElement(element) { - var selector = Util.getSelectorFromElement(element); - return selector ? document.querySelector(selector) : null; - }; - - Collapse._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var $this = $(this); - var data = $this.data(DATA_KEY$3); - - var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {}); - - if (!data && _config.toggle && /show|hide/.test(config)) { - _config.toggle = false; - } - - if (!data) { - data = new Collapse(this, _config); - $this.data(DATA_KEY$3, data); - } - - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } - - data[config](); - } - }); - }; - - _createClass(Collapse, null, [{ - key: "VERSION", - get: function get() { - return VERSION$3; - } - }, { - key: "Default", - get: function get() { - return Default$1; - } - }]); - - return Collapse; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { - // preventDefault only for elements (which change the URL) not inside the collapsible element - if (event.currentTarget.tagName === 'A') { - event.preventDefault(); - } - - var $trigger = $(this); - var selector = Util.getSelectorFromElement(this); - var selectors = [].slice.call(document.querySelectorAll(selector)); - $(selectors).each(function () { - var $target = $(this); - var data = $target.data(DATA_KEY$3); - var config = data ? 'toggle' : $trigger.data(); - - Collapse._jQueryInterface.call($target, config); - }); - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME$3] = Collapse._jQueryInterface; - $.fn[NAME$3].Constructor = Collapse; - - $.fn[NAME$3].noConflict = function () { - $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; - return Collapse._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$4 = 'dropdown'; - var VERSION$4 = '4.4.1'; - var DATA_KEY$4 = 'bs.dropdown'; - var EVENT_KEY$4 = "." + DATA_KEY$4; - var DATA_API_KEY$4 = '.data-api'; - var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; - var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key - - var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key - - var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key - - var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key - - var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key - - var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) - - var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); - var Event$4 = { - HIDE: "hide" + EVENT_KEY$4, - HIDDEN: "hidden" + EVENT_KEY$4, - SHOW: "show" + EVENT_KEY$4, - SHOWN: "shown" + EVENT_KEY$4, - CLICK: "click" + EVENT_KEY$4, - CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, - KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, - KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 - }; - var ClassName$4 = { - DISABLED: 'disabled', - SHOW: 'show', - DROPUP: 'dropup', - DROPRIGHT: 'dropright', - DROPLEFT: 'dropleft', - MENURIGHT: 'dropdown-menu-right', - MENULEFT: 'dropdown-menu-left', - POSITION_STATIC: 'position-static' - }; - var Selector$4 = { - DATA_TOGGLE: '[data-toggle="dropdown"]', - FORM_CHILD: '.dropdown form', - MENU: '.dropdown-menu', - NAVBAR_NAV: '.navbar-nav', - VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' - }; - var AttachmentMap = { - TOP: 'top-start', - TOPEND: 'top-end', - BOTTOM: 'bottom-start', - BOTTOMEND: 'bottom-end', - RIGHT: 'right-start', - RIGHTEND: 'right-end', - LEFT: 'left-start', - LEFTEND: 'left-end' - }; - var Default$2 = { - offset: 0, - flip: true, - boundary: 'scrollParent', - reference: 'toggle', - display: 'dynamic', - popperConfig: null - }; - var DefaultType$2 = { - offset: '(number|string|function)', - flip: 'boolean', - boundary: '(string|element)', - reference: '(string|element)', - display: 'string', - popperConfig: '(null|object)' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Dropdown = - /*#__PURE__*/ - function () { - function Dropdown(element, config) { - this._element = element; - this._popper = null; - this._config = this._getConfig(config); - this._menu = this._getMenuElement(); - this._inNavbar = this._detectNavbar(); - - this._addEventListeners(); - } // Getters - - - var _proto = Dropdown.prototype; - - // Public - _proto.toggle = function toggle() { - if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { - return; - } - - var isActive = $(this._menu).hasClass(ClassName$4.SHOW); - - Dropdown._clearMenus(); - - if (isActive) { - return; - } - - this.show(true); - }; - - _proto.show = function show(usePopper) { - if (usePopper === void 0) { - usePopper = false; - } - - if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { - return; - } - - var relatedTarget = { - relatedTarget: this._element - }; - var showEvent = $.Event(Event$4.SHOW, relatedTarget); - - var parent = Dropdown._getParentFromElement(this._element); - - $(parent).trigger(showEvent); - - if (showEvent.isDefaultPrevented()) { - return; - } // Disable totally Popper.js for Dropdown in Navbar - - - if (!this._inNavbar && usePopper) { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ - if (typeof Popper === 'undefined') { - throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); - } - - var referenceElement = this._element; - - if (this._config.reference === 'parent') { - referenceElement = parent; - } else if (Util.isElement(this._config.reference)) { - referenceElement = this._config.reference; // Check if it's jQuery element - - if (typeof this._config.reference.jquery !== 'undefined') { - referenceElement = this._config.reference[0]; - } - } // If boundary is not `scrollParent`, then set position to `static` - // to allow the menu to "escape" the scroll parent's boundaries - // https://github.com/twbs/bootstrap/issues/24251 - - - if (this._config.boundary !== 'scrollParent') { - $(parent).addClass(ClassName$4.POSITION_STATIC); - } - - this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); - } // If this is a touch-enabled device we add extra - // empty mouseover listeners to the body's immediate children; - // only needed because of broken event delegation on iOS - // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - - - if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { - $(document.body).children().on('mouseover', null, $.noop); - } - - this._element.focus(); - - this._element.setAttribute('aria-expanded', true); - - $(this._menu).toggleClass(ClassName$4.SHOW); - $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); - }; - - _proto.hide = function hide() { - if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { - return; - } - - var relatedTarget = { - relatedTarget: this._element - }; - var hideEvent = $.Event(Event$4.HIDE, relatedTarget); - - var parent = Dropdown._getParentFromElement(this._element); - - $(parent).trigger(hideEvent); - - if (hideEvent.isDefaultPrevented()) { - return; - } - - if (this._popper) { - this._popper.destroy(); - } - - $(this._menu).toggleClass(ClassName$4.SHOW); - $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); - }; - - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$4); - $(this._element).off(EVENT_KEY$4); - this._element = null; - this._menu = null; - - if (this._popper !== null) { - this._popper.destroy(); - - this._popper = null; - } - }; - - _proto.update = function update() { - this._inNavbar = this._detectNavbar(); - - if (this._popper !== null) { - this._popper.scheduleUpdate(); - } - } // Private - ; - - _proto._addEventListeners = function _addEventListeners() { - var _this = this; - - $(this._element).on(Event$4.CLICK, function (event) { - event.preventDefault(); - event.stopPropagation(); - - _this.toggle(); - }); - }; - - _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config); - Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); - return config; - }; - - _proto._getMenuElement = function _getMenuElement() { - if (!this._menu) { - var parent = Dropdown._getParentFromElement(this._element); - - if (parent) { - this._menu = parent.querySelector(Selector$4.MENU); - } - } - - return this._menu; - }; - - _proto._getPlacement = function _getPlacement() { - var $parentDropdown = $(this._element.parentNode); - var placement = AttachmentMap.BOTTOM; // Handle dropup - - if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { - placement = AttachmentMap.TOP; - - if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { - placement = AttachmentMap.TOPEND; - } - } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { - placement = AttachmentMap.RIGHT; - } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { - placement = AttachmentMap.LEFT; - } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { - placement = AttachmentMap.BOTTOMEND; - } - - return placement; - }; - - _proto._detectNavbar = function _detectNavbar() { - return $(this._element).closest('.navbar').length > 0; - }; - - _proto._getOffset = function _getOffset() { - var _this2 = this; - - var offset = {}; - - if (typeof this._config.offset === 'function') { - offset.fn = function (data) { - data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {}); - return data; - }; - } else { - offset.offset = this._config.offset; - } - - return offset; - }; - - _proto._getPopperConfig = function _getPopperConfig() { - var popperConfig = { - placement: this._getPlacement(), - modifiers: { - offset: this._getOffset(), - flip: { - enabled: this._config.flip - }, - preventOverflow: { - boundariesElement: this._config.boundary - } - } - }; // Disable Popper.js if we have a static display - - if (this._config.display === 'static') { - popperConfig.modifiers.applyStyle = { - enabled: false - }; - } - - return _objectSpread2({}, popperConfig, {}, this._config.popperConfig); - } // Static - ; - - Dropdown._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$4); - - var _config = typeof config === 'object' ? config : null; - - if (!data) { - data = new Dropdown(this, _config); - $(this).data(DATA_KEY$4, data); - } - - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } - - data[config](); - } - }); - }; - - Dropdown._clearMenus = function _clearMenus(event) { - if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { - return; - } - - var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); - - for (var i = 0, len = toggles.length; i < len; i++) { - var parent = Dropdown._getParentFromElement(toggles[i]); - - var context = $(toggles[i]).data(DATA_KEY$4); - var relatedTarget = { - relatedTarget: toggles[i] - }; - - if (event && event.type === 'click') { - relatedTarget.clickEvent = event; - } - - if (!context) { - continue; - } - - var dropdownMenu = context._menu; - - if (!$(parent).hasClass(ClassName$4.SHOW)) { - continue; - } - - if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { - continue; - } - - var hideEvent = $.Event(Event$4.HIDE, relatedTarget); - $(parent).trigger(hideEvent); - - if (hideEvent.isDefaultPrevented()) { - continue; - } // If this is a touch-enabled device we remove the extra - // empty mouseover listeners we added for iOS support - - - if ('ontouchstart' in document.documentElement) { - $(document.body).children().off('mouseover', null, $.noop); - } - - toggles[i].setAttribute('aria-expanded', 'false'); - - if (context._popper) { - context._popper.destroy(); - } - - $(dropdownMenu).removeClass(ClassName$4.SHOW); - $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); - } - }; - - Dropdown._getParentFromElement = function _getParentFromElement(element) { - var parent; - var selector = Util.getSelectorFromElement(element); - - if (selector) { - parent = document.querySelector(selector); - } - - return parent || element.parentNode; - } // eslint-disable-next-line complexity - ; - - Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { - // If not input/textarea: - // - And not a key in REGEXP_KEYDOWN => not a dropdown command - // If input/textarea: - // - If space key => not a dropdown command - // - If key is other than escape - // - If key is not up or down => not a dropdown command - // - If trigger inside the menu => not a dropdown command - if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { - return; - } - - event.preventDefault(); - event.stopPropagation(); - - if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { - return; - } - - var parent = Dropdown._getParentFromElement(this); - - var isActive = $(parent).hasClass(ClassName$4.SHOW); - - if (!isActive && event.which === ESCAPE_KEYCODE) { - return; - } - - if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { - if (event.which === ESCAPE_KEYCODE) { - var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); - $(toggle).trigger('focus'); - } - - $(this).trigger('click'); - return; - } - - var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) { - return $(item).is(':visible'); - }); - - if (items.length === 0) { - return; - } - - var index = items.indexOf(event.target); - - if (event.which === ARROW_UP_KEYCODE && index > 0) { - // Up - index--; - } - - if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { - // Down - index++; - } - - if (index < 0) { - index = 0; - } - - items[index].focus(); - }; - - _createClass(Dropdown, null, [{ - key: "VERSION", - get: function get() { - return VERSION$4; - } - }, { - key: "Default", - get: function get() { - return Default$2; - } - }, { - key: "DefaultType", - get: function get() { - return DefaultType$2; - } - }]); - - return Dropdown; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { - event.preventDefault(); - event.stopPropagation(); - - Dropdown._jQueryInterface.call($(this), 'toggle'); - }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { - e.stopPropagation(); - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME$4] = Dropdown._jQueryInterface; - $.fn[NAME$4].Constructor = Dropdown; - - $.fn[NAME$4].noConflict = function () { - $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; - return Dropdown._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$5 = 'modal'; - var VERSION$5 = '4.4.1'; - var DATA_KEY$5 = 'bs.modal'; - var EVENT_KEY$5 = "." + DATA_KEY$5; - var DATA_API_KEY$5 = '.data-api'; - var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; - var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key - - var Default$3 = { - backdrop: true, - keyboard: true, - focus: true, - show: true - }; - var DefaultType$3 = { - backdrop: '(boolean|string)', - keyboard: 'boolean', - focus: 'boolean', - show: 'boolean' - }; - var Event$5 = { - HIDE: "hide" + EVENT_KEY$5, - HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5, - HIDDEN: "hidden" + EVENT_KEY$5, - SHOW: "show" + EVENT_KEY$5, - SHOWN: "shown" + EVENT_KEY$5, - FOCUSIN: "focusin" + EVENT_KEY$5, - RESIZE: "resize" + EVENT_KEY$5, - CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, - KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, - MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, - MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, - CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 - }; - var ClassName$5 = { - SCROLLABLE: 'modal-dialog-scrollable', - SCROLLBAR_MEASURER: 'modal-scrollbar-measure', - BACKDROP: 'modal-backdrop', - OPEN: 'modal-open', - FADE: 'fade', - SHOW: 'show', - STATIC: 'modal-static' - }; - var Selector$5 = { - DIALOG: '.modal-dialog', - MODAL_BODY: '.modal-body', - DATA_TOGGLE: '[data-toggle="modal"]', - DATA_DISMISS: '[data-dismiss="modal"]', - FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', - STICKY_CONTENT: '.sticky-top' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Modal = - /*#__PURE__*/ - function () { - function Modal(element, config) { - this._config = this._getConfig(config); - this._element = element; - this._dialog = element.querySelector(Selector$5.DIALOG); - this._backdrop = null; - this._isShown = false; - this._isBodyOverflowing = false; - this._ignoreBackdropClick = false; - this._isTransitioning = false; - this._scrollbarWidth = 0; - } // Getters - - - var _proto = Modal.prototype; - - // Public - _proto.toggle = function toggle(relatedTarget) { - return this._isShown ? this.hide() : this.show(relatedTarget); - }; - - _proto.show = function show(relatedTarget) { - var _this = this; - - if (this._isShown || this._isTransitioning) { - return; - } - - if ($(this._element).hasClass(ClassName$5.FADE)) { - this._isTransitioning = true; - } - - var showEvent = $.Event(Event$5.SHOW, { - relatedTarget: relatedTarget - }); - $(this._element).trigger(showEvent); - - if (this._isShown || showEvent.isDefaultPrevented()) { - return; - } - - this._isShown = true; - - this._checkScrollbar(); - - this._setScrollbar(); - - this._adjustDialog(); - - this._setEscapeEvent(); - - this._setResizeEvent(); - - $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { - return _this.hide(event); - }); - $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { - $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { - if ($(event.target).is(_this._element)) { - _this._ignoreBackdropClick = true; - } - }); - }); - - this._showBackdrop(function () { - return _this._showElement(relatedTarget); - }); - }; - - _proto.hide = function hide(event) { - var _this2 = this; - - if (event) { - event.preventDefault(); - } - - if (!this._isShown || this._isTransitioning) { - return; - } - - var hideEvent = $.Event(Event$5.HIDE); - $(this._element).trigger(hideEvent); - - if (!this._isShown || hideEvent.isDefaultPrevented()) { - return; - } - - this._isShown = false; - var transition = $(this._element).hasClass(ClassName$5.FADE); - - if (transition) { - this._isTransitioning = true; - } - - this._setEscapeEvent(); - - this._setResizeEvent(); - - $(document).off(Event$5.FOCUSIN); - $(this._element).removeClass(ClassName$5.SHOW); - $(this._element).off(Event$5.CLICK_DISMISS); - $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); - - if (transition) { - var transitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, function (event) { - return _this2._hideModal(event); - }).emulateTransitionEnd(transitionDuration); - } else { - this._hideModal(); - } - }; - - _proto.dispose = function dispose() { - [window, this._element, this._dialog].forEach(function (htmlElement) { - return $(htmlElement).off(EVENT_KEY$5); - }); - /** - * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` - * Do not move `document` in `htmlElements` array - * It will remove `Event.CLICK_DATA_API` event that should remain - */ - - $(document).off(Event$5.FOCUSIN); - $.removeData(this._element, DATA_KEY$5); - this._config = null; - this._element = null; - this._dialog = null; - this._backdrop = null; - this._isShown = null; - this._isBodyOverflowing = null; - this._ignoreBackdropClick = null; - this._isTransitioning = null; - this._scrollbarWidth = null; - }; - - _proto.handleUpdate = function handleUpdate() { - this._adjustDialog(); - } // Private - ; - - _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default$3, {}, config); - Util.typeCheckConfig(NAME$5, config, DefaultType$3); - return config; - }; - - _proto._triggerBackdropTransition = function _triggerBackdropTransition() { - var _this3 = this; - - if (this._config.backdrop === 'static') { - var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED); - $(this._element).trigger(hideEventPrevented); - - if (hideEventPrevented.defaultPrevented) { - return; - } - - this._element.classList.add(ClassName$5.STATIC); - - var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element); - $(this._element).one(Util.TRANSITION_END, function () { - _this3._element.classList.remove(ClassName$5.STATIC); - }).emulateTransitionEnd(modalTransitionDuration); - - this._element.focus(); - } else { - this.hide(); - } - }; - - _proto._showElement = function _showElement(relatedTarget) { - var _this4 = this; - - var transition = $(this._element).hasClass(ClassName$5.FADE); - var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null; - - if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { - // Don't move modal's DOM position - document.body.appendChild(this._element); - } - - this._element.style.display = 'block'; - - this._element.removeAttribute('aria-hidden'); - - this._element.setAttribute('aria-modal', true); - - if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) { - modalBody.scrollTop = 0; - } else { - this._element.scrollTop = 0; - } - - if (transition) { - Util.reflow(this._element); - } - - $(this._element).addClass(ClassName$5.SHOW); - - if (this._config.focus) { - this._enforceFocus(); - } - - var shownEvent = $.Event(Event$5.SHOWN, { - relatedTarget: relatedTarget - }); - - var transitionComplete = function transitionComplete() { - if (_this4._config.focus) { - _this4._element.focus(); - } - - _this4._isTransitioning = false; - $(_this4._element).trigger(shownEvent); - }; - - if (transition) { - var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); - $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); - } else { - transitionComplete(); - } - }; - - _proto._enforceFocus = function _enforceFocus() { - var _this5 = this; - - $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop - .on(Event$5.FOCUSIN, function (event) { - if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) { - _this5._element.focus(); - } - }); - }; - - _proto._setEscapeEvent = function _setEscapeEvent() { - var _this6 = this; - - if (this._isShown && this._config.keyboard) { - $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { - if (event.which === ESCAPE_KEYCODE$1) { - _this6._triggerBackdropTransition(); - } - }); - } else if (!this._isShown) { - $(this._element).off(Event$5.KEYDOWN_DISMISS); - } - }; - - _proto._setResizeEvent = function _setResizeEvent() { - var _this7 = this; - - if (this._isShown) { - $(window).on(Event$5.RESIZE, function (event) { - return _this7.handleUpdate(event); - }); - } else { - $(window).off(Event$5.RESIZE); - } - }; - - _proto._hideModal = function _hideModal() { - var _this8 = this; - - this._element.style.display = 'none'; - - this._element.setAttribute('aria-hidden', true); - - this._element.removeAttribute('aria-modal'); - - this._isTransitioning = false; - - this._showBackdrop(function () { - $(document.body).removeClass(ClassName$5.OPEN); - - _this8._resetAdjustments(); - - _this8._resetScrollbar(); - - $(_this8._element).trigger(Event$5.HIDDEN); - }); - }; - - _proto._removeBackdrop = function _removeBackdrop() { - if (this._backdrop) { - $(this._backdrop).remove(); - this._backdrop = null; - } - }; - - _proto._showBackdrop = function _showBackdrop(callback) { - var _this9 = this; - - var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; - - if (this._isShown && this._config.backdrop) { - this._backdrop = document.createElement('div'); - this._backdrop.className = ClassName$5.BACKDROP; - - if (animate) { - this._backdrop.classList.add(animate); - } - - $(this._backdrop).appendTo(document.body); - $(this._element).on(Event$5.CLICK_DISMISS, function (event) { - if (_this9._ignoreBackdropClick) { - _this9._ignoreBackdropClick = false; - return; - } - - if (event.target !== event.currentTarget) { - return; - } - - _this9._triggerBackdropTransition(); - }); - - if (animate) { - Util.reflow(this._backdrop); - } - - $(this._backdrop).addClass(ClassName$5.SHOW); - - if (!callback) { - return; - } - - if (!animate) { - callback(); - return; - } - - var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); - $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); - } else if (!this._isShown && this._backdrop) { - $(this._backdrop).removeClass(ClassName$5.SHOW); - - var callbackRemove = function callbackRemove() { - _this9._removeBackdrop(); - - if (callback) { - callback(); - } - }; - - if ($(this._element).hasClass(ClassName$5.FADE)) { - var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); - - $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); - } else { - callbackRemove(); - } - } else if (callback) { - callback(); - } - } // ---------------------------------------------------------------------- - // the following methods are used to handle overflowing modals - // todo (fat): these should probably be refactored out of modal.js - // ---------------------------------------------------------------------- - ; - - _proto._adjustDialog = function _adjustDialog() { - var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; - - if (!this._isBodyOverflowing && isModalOverflowing) { - this._element.style.paddingLeft = this._scrollbarWidth + "px"; - } - - if (this._isBodyOverflowing && !isModalOverflowing) { - this._element.style.paddingRight = this._scrollbarWidth + "px"; - } - }; - - _proto._resetAdjustments = function _resetAdjustments() { - this._element.style.paddingLeft = ''; - this._element.style.paddingRight = ''; - }; - - _proto._checkScrollbar = function _checkScrollbar() { - var rect = document.body.getBoundingClientRect(); - this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; - this._scrollbarWidth = this._getScrollbarWidth(); - }; - - _proto._setScrollbar = function _setScrollbar() { - var _this10 = this; - - if (this._isBodyOverflowing) { - // Note: DOMNode.style.paddingRight returns the actual value or '' if not set - // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set - var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); - var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding - - $(fixedContent).each(function (index, element) { - var actualPadding = element.style.paddingRight; - var calculatedPadding = $(element).css('padding-right'); - $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); - }); // Adjust sticky content margin - - $(stickyContent).each(function (index, element) { - var actualMargin = element.style.marginRight; - var calculatedMargin = $(element).css('margin-right'); - $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); - }); // Adjust body padding - - var actualPadding = document.body.style.paddingRight; - var calculatedPadding = $(document.body).css('padding-right'); - $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); - } - - $(document.body).addClass(ClassName$5.OPEN); - }; - - _proto._resetScrollbar = function _resetScrollbar() { - // Restore fixed content padding - var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); - $(fixedContent).each(function (index, element) { - var padding = $(element).data('padding-right'); - $(element).removeData('padding-right'); - element.style.paddingRight = padding ? padding : ''; - }); // Restore sticky content - - var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); - $(elements).each(function (index, element) { - var margin = $(element).data('margin-right'); - - if (typeof margin !== 'undefined') { - $(element).css('margin-right', margin).removeData('margin-right'); - } - }); // Restore body padding - - var padding = $(document.body).data('padding-right'); - $(document.body).removeData('padding-right'); - document.body.style.paddingRight = padding ? padding : ''; - }; - - _proto._getScrollbarWidth = function _getScrollbarWidth() { - // thx d.walsh - var scrollDiv = document.createElement('div'); - scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; - document.body.appendChild(scrollDiv); - var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - return scrollbarWidth; - } // Static - ; - - Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { - return this.each(function () { - var data = $(this).data(DATA_KEY$5); - - var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {}); - - if (!data) { - data = new Modal(this, _config); - $(this).data(DATA_KEY$5, data); - } - - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } - - data[config](relatedTarget); - } else if (_config.show) { - data.show(relatedTarget); - } - }); - }; - - _createClass(Modal, null, [{ - key: "VERSION", - get: function get() { - return VERSION$5; - } - }, { - key: "Default", - get: function get() { - return Default$3; - } - }]); - - return Modal; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - - - $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { - var _this11 = this; - - var target; - var selector = Util.getSelectorFromElement(this); - - if (selector) { - target = document.querySelector(selector); - } - - var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data()); - - if (this.tagName === 'A' || this.tagName === 'AREA') { - event.preventDefault(); - } - - var $target = $(target).one(Event$5.SHOW, function (showEvent) { - if (showEvent.isDefaultPrevented()) { - // Only register focus restorer if modal will actually get shown - return; - } - - $target.one(Event$5.HIDDEN, function () { - if ($(_this11).is(':visible')) { - _this11.focus(); - } - }); - }); - - Modal._jQueryInterface.call($(target), config, this); - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - $.fn[NAME$5] = Modal._jQueryInterface; - $.fn[NAME$5].Constructor = Modal; - - $.fn[NAME$5].noConflict = function () { - $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; - return Modal._jQueryInterface; - }; - - /** - * -------------------------------------------------------------------------- - * Bootstrap (v4.4.1): tools/sanitizer.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ - var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; - var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; - var DefaultWhitelist = { - // Global attributes allowed on any supplied element below. - '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], - a: ['target', 'href', 'title', 'rel'], - area: [], - b: [], - br: [], - col: [], - code: [], - div: [], - em: [], - hr: [], - h1: [], - h2: [], - h3: [], - h4: [], - h5: [], - h6: [], - i: [], - img: ['src', 'alt', 'title', 'width', 'height'], - li: [], - ol: [], - p: [], - pre: [], - s: [], - small: [], - span: [], - sub: [], - sup: [], - strong: [], - u: [], - ul: [] - }; - /** - * A pattern that recognizes a commonly useful subset of URLs that are safe. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - - var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; - /** - * A pattern that matches safe data URLs. Only matches image, video and audio types. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - - var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; - - function allowedAttribute(attr, allowedAttributeList) { - var attrName = attr.nodeName.toLowerCase(); - - if (allowedAttributeList.indexOf(attrName) !== -1) { - if (uriAttrs.indexOf(attrName) !== -1) { - return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); - } - - return true; - } - - var regExp = allowedAttributeList.filter(function (attrRegex) { - return attrRegex instanceof RegExp; - }); // Check if a regular expression validates the attribute. - - for (var i = 0, l = regExp.length; i < l; i++) { - if (attrName.match(regExp[i])) { - return true; - } - } - - return false; - } - - function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { - if (unsafeHtml.length === 0) { - return unsafeHtml; - } - - if (sanitizeFn && typeof sanitizeFn === 'function') { - return sanitizeFn(unsafeHtml); - } - - var domParser = new window.DOMParser(); - var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); - var whitelistKeys = Object.keys(whiteList); - var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); - - var _loop = function _loop(i, len) { - var el = elements[i]; - var elName = el.nodeName.toLowerCase(); - - if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { - el.parentNode.removeChild(el); - return "continue"; - } - - var attributeList = [].slice.call(el.attributes); - var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); - attributeList.forEach(function (attr) { - if (!allowedAttribute(attr, whitelistedAttributes)) { - el.removeAttribute(attr.nodeName); - } - }); - }; - - for (var i = 0, len = elements.length; i < len; i++) { - var _ret = _loop(i); - - if (_ret === "continue") continue; - } - - return createdDocument.body.innerHTML; - } - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$6 = 'tooltip'; - var VERSION$6 = '4.4.1'; - var DATA_KEY$6 = 'bs.tooltip'; - var EVENT_KEY$6 = "." + DATA_KEY$6; - var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; - var CLASS_PREFIX = 'bs-tooltip'; - var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); - var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; - var DefaultType$4 = { - animation: 'boolean', - template: 'string', - title: '(string|element|function)', - trigger: 'string', - delay: '(number|object)', - html: 'boolean', - selector: '(string|boolean)', - placement: '(string|function)', - offset: '(number|string|function)', - container: '(string|element|boolean)', - fallbackPlacement: '(string|array)', - boundary: '(string|element)', - sanitize: 'boolean', - sanitizeFn: '(null|function)', - whiteList: 'object', - popperConfig: '(null|object)' - }; - var AttachmentMap$1 = { - AUTO: 'auto', - TOP: 'top', - RIGHT: 'right', - BOTTOM: 'bottom', - LEFT: 'left' - }; - var Default$4 = { - animation: true, - template: '', - trigger: 'hover focus', - title: '', - delay: 0, - html: false, - selector: false, - placement: 'top', - offset: 0, - container: false, - fallbackPlacement: 'flip', - boundary: 'scrollParent', - sanitize: true, - sanitizeFn: null, - whiteList: DefaultWhitelist, - popperConfig: null - }; - var HoverState = { - SHOW: 'show', - OUT: 'out' - }; - var Event$6 = { - HIDE: "hide" + EVENT_KEY$6, - HIDDEN: "hidden" + EVENT_KEY$6, - SHOW: "show" + EVENT_KEY$6, - SHOWN: "shown" + EVENT_KEY$6, - INSERTED: "inserted" + EVENT_KEY$6, - CLICK: "click" + EVENT_KEY$6, - FOCUSIN: "focusin" + EVENT_KEY$6, - FOCUSOUT: "focusout" + EVENT_KEY$6, - MOUSEENTER: "mouseenter" + EVENT_KEY$6, - MOUSELEAVE: "mouseleave" + EVENT_KEY$6 - }; - var ClassName$6 = { - FADE: 'fade', - SHOW: 'show' - }; - var Selector$6 = { - TOOLTIP: '.tooltip', - TOOLTIP_INNER: '.tooltip-inner', - ARROW: '.arrow' - }; - var Trigger = { - HOVER: 'hover', - FOCUS: 'focus', - CLICK: 'click', - MANUAL: 'manual' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Tooltip = - /*#__PURE__*/ - function () { - function Tooltip(element, config) { - if (typeof Popper === 'undefined') { - throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); - } // private - - - this._isEnabled = true; - this._timeout = 0; - this._hoverState = ''; - this._activeTrigger = {}; - this._popper = null; // Protected - - this.element = element; - this.config = this._getConfig(config); - this.tip = null; - - this._setListeners(); - } // Getters - - - var _proto = Tooltip.prototype; - - // Public - _proto.enable = function enable() { - this._isEnabled = true; - }; - - _proto.disable = function disable() { - this._isEnabled = false; - }; - - _proto.toggleEnabled = function toggleEnabled() { - this._isEnabled = !this._isEnabled; - }; - - _proto.toggle = function toggle(event) { - if (!this._isEnabled) { - return; - } - - if (event) { - var dataKey = this.constructor.DATA_KEY; - var context = $(event.currentTarget).data(dataKey); - - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } - - context._activeTrigger.click = !context._activeTrigger.click; - - if (context._isWithActiveTrigger()) { - context._enter(null, context); - } else { - context._leave(null, context); - } - } else { - if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { - this._leave(null, this); - - return; - } - - this._enter(null, this); - } - }; - - _proto.dispose = function dispose() { - clearTimeout(this._timeout); - $.removeData(this.element, this.constructor.DATA_KEY); - $(this.element).off(this.constructor.EVENT_KEY); - $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); - - if (this.tip) { - $(this.tip).remove(); - } - - this._isEnabled = null; - this._timeout = null; - this._hoverState = null; - this._activeTrigger = null; - - if (this._popper) { - this._popper.destroy(); - } - - this._popper = null; - this.element = null; - this.config = null; - this.tip = null; - }; - - _proto.show = function show() { - var _this = this; - - if ($(this.element).css('display') === 'none') { - throw new Error('Please use show on visible elements'); - } - - var showEvent = $.Event(this.constructor.Event.SHOW); - - if (this.isWithContent() && this._isEnabled) { - $(this.element).trigger(showEvent); - var shadowRoot = Util.findShadowRoot(this.element); - var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); - - if (showEvent.isDefaultPrevented() || !isInTheDom) { - return; - } - - var tip = this.getTipElement(); - var tipId = Util.getUID(this.constructor.NAME); - tip.setAttribute('id', tipId); - this.element.setAttribute('aria-describedby', tipId); - this.setContent(); - - if (this.config.animation) { - $(tip).addClass(ClassName$6.FADE); - } - - var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; - - var attachment = this._getAttachment(placement); - - this.addAttachmentClass(attachment); - - var container = this._getContainer(); - - $(tip).data(this.constructor.DATA_KEY, this); - - if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { - $(tip).appendTo(container); - } - - $(this.element).trigger(this.constructor.Event.INSERTED); - this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); - $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra - // empty mouseover listeners to the body's immediate children; - // only needed because of broken event delegation on iOS - // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html - - if ('ontouchstart' in document.documentElement) { - $(document.body).children().on('mouseover', null, $.noop); - } - - var complete = function complete() { - if (_this.config.animation) { - _this._fixTransition(); - } - - var prevHoverState = _this._hoverState; - _this._hoverState = null; - $(_this.element).trigger(_this.constructor.Event.SHOWN); - - if (prevHoverState === HoverState.OUT) { - _this._leave(null, _this); - } - }; - - if ($(this.tip).hasClass(ClassName$6.FADE)) { - var transitionDuration = Util.getTransitionDurationFromElement(this.tip); - $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - } else { - complete(); - } - } - }; - - _proto.hide = function hide(callback) { - var _this2 = this; - - var tip = this.getTipElement(); - var hideEvent = $.Event(this.constructor.Event.HIDE); - - var complete = function complete() { - if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { - tip.parentNode.removeChild(tip); - } - - _this2._cleanTipClass(); - - _this2.element.removeAttribute('aria-describedby'); - - $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); - - if (_this2._popper !== null) { - _this2._popper.destroy(); - } - - if (callback) { - callback(); - } - }; - - $(this.element).trigger(hideEvent); - - if (hideEvent.isDefaultPrevented()) { - return; - } - - $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra - // empty mouseover listeners we added for iOS support - - if ('ontouchstart' in document.documentElement) { - $(document.body).children().off('mouseover', null, $.noop); - } - - this._activeTrigger[Trigger.CLICK] = false; - this._activeTrigger[Trigger.FOCUS] = false; - this._activeTrigger[Trigger.HOVER] = false; - - if ($(this.tip).hasClass(ClassName$6.FADE)) { - var transitionDuration = Util.getTransitionDurationFromElement(tip); - $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); - } else { - complete(); - } - - this._hoverState = ''; - }; - - _proto.update = function update() { - if (this._popper !== null) { - this._popper.scheduleUpdate(); - } - } // Protected - ; - - _proto.isWithContent = function isWithContent() { - return Boolean(this.getTitle()); - }; - - _proto.addAttachmentClass = function addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); - }; - - _proto.getTipElement = function getTipElement() { - this.tip = this.tip || $(this.config.template)[0]; - return this.tip; - }; - - _proto.setContent = function setContent() { - var tip = this.getTipElement(); - this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); - $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); - }; - - _proto.setElementContent = function setElementContent($element, content) { - if (typeof content === 'object' && (content.nodeType || content.jquery)) { - // Content is a DOM node or a jQuery - if (this.config.html) { - if (!$(content).parent().is($element)) { - $element.empty().append(content); - } - } else { - $element.text($(content).text()); - } - - return; - } - - if (this.config.html) { - if (this.config.sanitize) { - content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); - } - - $element.html(content); - } else { - $element.text(content); - } - }; - - _proto.getTitle = function getTitle() { - var title = this.element.getAttribute('data-original-title'); - - if (!title) { - title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; - } - - return title; - } // Private - ; - - _proto._getPopperConfig = function _getPopperConfig(attachment) { - var _this3 = this; - - var defaultBsConfig = { - placement: attachment, - modifiers: { - offset: this._getOffset(), - flip: { - behavior: this.config.fallbackPlacement - }, - arrow: { - element: Selector$6.ARROW - }, - preventOverflow: { - boundariesElement: this.config.boundary - } - }, - onCreate: function onCreate(data) { - if (data.originalPlacement !== data.placement) { - _this3._handlePopperPlacementChange(data); - } - }, - onUpdate: function onUpdate(data) { - return _this3._handlePopperPlacementChange(data); - } - }; - return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig); - }; - - _proto._getOffset = function _getOffset() { - var _this4 = this; - - var offset = {}; - - if (typeof this.config.offset === 'function') { - offset.fn = function (data) { - data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {}); - return data; - }; - } else { - offset.offset = this.config.offset; - } - - return offset; - }; - - _proto._getContainer = function _getContainer() { - if (this.config.container === false) { - return document.body; - } - - if (Util.isElement(this.config.container)) { - return $(this.config.container); - } - - return $(document).find(this.config.container); - }; - - _proto._getAttachment = function _getAttachment(placement) { - return AttachmentMap$1[placement.toUpperCase()]; - }; - - _proto._setListeners = function _setListeners() { - var _this5 = this; - - var triggers = this.config.trigger.split(' '); - triggers.forEach(function (trigger) { - if (trigger === 'click') { - $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { - return _this5.toggle(event); - }); - } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; - $(_this5.element).on(eventIn, _this5.config.selector, function (event) { - return _this5._enter(event); - }).on(eventOut, _this5.config.selector, function (event) { - return _this5._leave(event); - }); - } - }); - - this._hideModalHandler = function () { - if (_this5.element) { - _this5.hide(); - } - }; - - $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); - - if (this.config.selector) { - this.config = _objectSpread2({}, this.config, { - trigger: 'manual', - selector: '' - }); - } else { - this._fixTitle(); - } - }; - - _proto._fixTitle = function _fixTitle() { - var titleType = typeof this.element.getAttribute('data-original-title'); - - if (this.element.getAttribute('title') || titleType !== 'string') { - this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); - this.element.setAttribute('title', ''); - } - }; - - _proto._enter = function _enter(event, context) { - var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); - - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } - - if (event) { - context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; - } - - if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { - context._hoverState = HoverState.SHOW; - return; - } - - clearTimeout(context._timeout); - context._hoverState = HoverState.SHOW; - - if (!context.config.delay || !context.config.delay.show) { - context.show(); - return; - } - - context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.SHOW) { - context.show(); - } - }, context.config.delay.show); - }; - - _proto._leave = function _leave(event, context) { - var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); - - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } - - if (event) { - context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; - } - - if (context._isWithActiveTrigger()) { - return; - } - - clearTimeout(context._timeout); - context._hoverState = HoverState.OUT; - - if (!context.config.delay || !context.config.delay.hide) { - context.hide(); - return; - } - - context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.OUT) { - context.hide(); - } - }, context.config.delay.hide); - }; - - _proto._isWithActiveTrigger = function _isWithActiveTrigger() { - for (var trigger in this._activeTrigger) { - if (this._activeTrigger[trigger]) { - return true; - } - } - - return false; - }; - - _proto._getConfig = function _getConfig(config) { - var dataAttributes = $(this.element).data(); - Object.keys(dataAttributes).forEach(function (dataAttr) { - if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { - delete dataAttributes[dataAttr]; - } - }); - config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {}); - - if (typeof config.delay === 'number') { - config.delay = { - show: config.delay, - hide: config.delay - }; - } - - if (typeof config.title === 'number') { - config.title = config.title.toString(); - } - - if (typeof config.content === 'number') { - config.content = config.content.toString(); - } - - Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); - - if (config.sanitize) { - config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); - } - - return config; - }; - - _proto._getDelegateConfig = function _getDelegateConfig() { - var config = {}; - - if (this.config) { - for (var key in this.config) { - if (this.constructor.Default[key] !== this.config[key]) { - config[key] = this.config[key]; - } - } - } - - return config; - }; - - _proto._cleanTipClass = function _cleanTipClass() { - var $tip = $(this.getTipElement()); - var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); - - if (tabClass !== null && tabClass.length) { - $tip.removeClass(tabClass.join('')); - } - }; - - _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { - var popperInstance = popperData.instance; - this.tip = popperInstance.popper; - - this._cleanTipClass(); - - this.addAttachmentClass(this._getAttachment(popperData.placement)); - }; - - _proto._fixTransition = function _fixTransition() { - var tip = this.getTipElement(); - var initConfigAnimation = this.config.animation; - - if (tip.getAttribute('x-placement') !== null) { - return; - } - - $(tip).removeClass(ClassName$6.FADE); - this.config.animation = false; - this.hide(); - this.show(); - this.config.animation = initConfigAnimation; - } // Static - ; - - Tooltip._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$6); - - var _config = typeof config === 'object' && config; - - if (!data && /dispose|hide/.test(config)) { - return; - } - - if (!data) { - data = new Tooltip(this, _config); - $(this).data(DATA_KEY$6, data); - } - - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } - - data[config](); - } - }); - }; - - _createClass(Tooltip, null, [{ - key: "VERSION", - get: function get() { - return VERSION$6; - } - }, { - key: "Default", - get: function get() { - return Default$4; - } - }, { - key: "NAME", - get: function get() { - return NAME$6; - } - }, { - key: "DATA_KEY", - get: function get() { - return DATA_KEY$6; - } - }, { - key: "Event", - get: function get() { - return Event$6; - } - }, { - key: "EVENT_KEY", - get: function get() { - return EVENT_KEY$6; - } - }, { - key: "DefaultType", - get: function get() { - return DefaultType$4; - } - }]); - - return Tooltip; - }(); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - - $.fn[NAME$6] = Tooltip._jQueryInterface; - $.fn[NAME$6].Constructor = Tooltip; - - $.fn[NAME$6].noConflict = function () { - $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; - return Tooltip._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$7 = 'popover'; - var VERSION$7 = '4.4.1'; - var DATA_KEY$7 = 'bs.popover'; - var EVENT_KEY$7 = "." + DATA_KEY$7; - var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; - var CLASS_PREFIX$1 = 'bs-popover'; - var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); - - var Default$5 = _objectSpread2({}, Tooltip.Default, { - placement: 'right', - trigger: 'click', - content: '', - template: '' - }); - - var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, { - content: '(string|element|function)' - }); - - var ClassName$7 = { - FADE: 'fade', - SHOW: 'show' - }; - var Selector$7 = { - TITLE: '.popover-header', - CONTENT: '.popover-body' - }; - var Event$7 = { - HIDE: "hide" + EVENT_KEY$7, - HIDDEN: "hidden" + EVENT_KEY$7, - SHOW: "show" + EVENT_KEY$7, - SHOWN: "shown" + EVENT_KEY$7, - INSERTED: "inserted" + EVENT_KEY$7, - CLICK: "click" + EVENT_KEY$7, - FOCUSIN: "focusin" + EVENT_KEY$7, - FOCUSOUT: "focusout" + EVENT_KEY$7, - MOUSEENTER: "mouseenter" + EVENT_KEY$7, - MOUSELEAVE: "mouseleave" + EVENT_KEY$7 - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var Popover = - /*#__PURE__*/ - function (_Tooltip) { - _inheritsLoose(Popover, _Tooltip); - - function Popover() { - return _Tooltip.apply(this, arguments) || this; - } - - var _proto = Popover.prototype; - - // Overrides - _proto.isWithContent = function isWithContent() { - return this.getTitle() || this._getContent(); - }; - - _proto.addAttachmentClass = function addAttachmentClass(attachment) { - $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); - }; - - _proto.getTipElement = function getTipElement() { - this.tip = this.tip || $(this.config.template)[0]; - return this.tip; - }; - - _proto.setContent = function setContent() { - var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events - - this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); - - var content = this._getContent(); - - if (typeof content === 'function') { - content = content.call(this.element); - } - - this.setElementContent($tip.find(Selector$7.CONTENT), content); - $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); - } // Private - ; - - _proto._getContent = function _getContent() { - return this.element.getAttribute('data-content') || this.config.content; - }; - - _proto._cleanTipClass = function _cleanTipClass() { - var $tip = $(this.getTipElement()); - var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); - - if (tabClass !== null && tabClass.length > 0) { - $tip.removeClass(tabClass.join('')); - } - } // Static - ; - - Popover._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY$7); - - var _config = typeof config === 'object' ? config : null; - - if (!data && /dispose|hide/.test(config)) { - return; - } - - if (!data) { - data = new Popover(this, _config); - $(this).data(DATA_KEY$7, data); - } - - if (typeof config === 'string') { - if (typeof data[config] === 'undefined') { - throw new TypeError("No method named \"" + config + "\""); - } - - data[config](); - } - }); - }; - - _createClass(Popover, null, [{ - key: "VERSION", - // Getters - get: function get() { - return VERSION$7; - } - }, { - key: "Default", - get: function get() { - return Default$5; - } - }, { - key: "NAME", - get: function get() { - return NAME$7; - } - }, { - key: "DATA_KEY", - get: function get() { - return DATA_KEY$7; - } - }, { - key: "Event", - get: function get() { - return Event$7; - } - }, { - key: "EVENT_KEY", - get: function get() { - return EVENT_KEY$7; - } - }, { - key: "DefaultType", - get: function get() { - return DefaultType$5; - } - }]); - - return Popover; - }(Tooltip); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - - - $.fn[NAME$7] = Popover._jQueryInterface; - $.fn[NAME$7].Constructor = Popover; - - $.fn[NAME$7].noConflict = function () { - $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; - return Popover._jQueryInterface; - }; - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var NAME$8 = 'scrollspy'; - var VERSION$8 = '4.4.1'; - var DATA_KEY$8 = 'bs.scrollspy'; - var EVENT_KEY$8 = "." + DATA_KEY$8; - var DATA_API_KEY$6 = '.data-api'; - var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; - var Default$6 = { - offset: 10, - method: 'auto', - target: '' - }; - var DefaultType$6 = { - offset: 'number', - method: 'string', - target: '(string|element)' - }; - var Event$8 = { - ACTIVATE: "activate" + EVENT_KEY$8, - SCROLL: "scroll" + EVENT_KEY$8, - LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 - }; - var ClassName$8 = { - DROPDOWN_ITEM: 'dropdown-item', - DROPDOWN_MENU: 'dropdown-menu', - ACTIVE: 'active' - }; - var Selector$8 = { - DATA_SPY: '[data-spy="scroll"]', - ACTIVE: '.active', - NAV_LIST_GROUP: '.nav, .list-group', - NAV_LINKS: '.nav-link', - NAV_ITEMS: '.nav-item', - LIST_ITEMS: '.list-group-item', - DROPDOWN: '.dropdown', - DROPDOWN_ITEMS: '.dropdown-item', - DROPDOWN_TOGGLE: '.dropdown-toggle' - }; - var OffsetMethod = { - OFFSET: 'offset', - POSITION: 'position' - }; - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - - var ScrollSpy = - /*#__PURE__*/ - function () { - function ScrollSpy(element, config) { - var _this = this; - - this._element = element; - this._scrollElement = element.tagName === 'BODY' ? window : element; - this._config = this._getConfig(config); - this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); - this._offsets = []; - this._targets = []; - this._activeTarget = null; - this._scrollHeight = 0; - $(this._scrollElement).on(Event$8.SCROLL, function (event) { - return _this._process(event); - }); - this.refresh(); - - this._process(); - } // Getters - - - var _proto = ScrollSpy.prototype; - - // Public - _proto.refresh = function refresh() { - var _this2 = this; - - var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; - var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; - var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; - this._offsets = []; - this._targets = []; - this._scrollHeight = this._getScrollHeight(); - var targets = [].slice.call(document.querySelectorAll(this._selector)); - targets.map(function (element) { - var target; - var targetSelector = Util.getSelectorFromElement(element); - - if (targetSelector) { - target = document.querySelector(targetSelector); - } - - if (target) { - var targetBCR = target.getBoundingClientRect(); - - if (targetBCR.width || targetBCR.height) { - // TODO (fat): remove sketch reliance on jQuery position/offset - return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; - } - } - - return null; - }).filter(function (item) { - return item; - }).sort(function (a, b) { - return a[0] - b[0]; - }).forEach(function (item) { - _this2._offsets.push(item[0]); - - _this2._targets.push(item[1]); - }); - }; - - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY$8); - $(this._scrollElement).off(EVENT_KEY$8); - this._element = null; - this._scrollElement = null; - this._config = null; - this._selector = null; - this._offsets = null; - this._targets = null; - this._activeTarget = null; - this._scrollHeight = null; - } // Private - ; - - _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {}); - - if (typeof config.target !== 'string') { - var id = $(config.target).attr('id'); - - if (!id) { - id = Util.getUID(NAME$8); - $(config.target).attr('id', id); - } - - config.target = "#" + id; - } - - Util.typeCheckConfig(NAME$8, config, DefaultType$6); - return config; - }; - - _proto._getScrollTop = function _getScrollTop() { - return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; - }; - - _proto._getScrollHeight = function _getScrollHeight() { - return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); - }; - - _proto._getOffsetHeight = function _getOffsetHeight() { - return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; - }; - - _proto._process = function _process() { - var scrollTop = this._getScrollTop() + this._config.offset; - - var scrollHeight = this._getScrollHeight(); - - var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); - - if (this._scrollHeight !== scrollHeight) { - this.refresh(); - } - - if (scrollTop >= maxScroll) { - var target = this._targets[this._targets.length - 1]; - - if (this._activeTarget !== target) { - this._activate(target); - } - - return; - } - - if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { - this._activeTarget = null; - - this._clear(); - - return; - } - - var offsetLength = this._offsets.length; - - for (var i = offsetLength; i--;) { - var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); - - if (isActiveTarget) { - this._activate(this._targets[i]); - } - } - }; - - _proto._activate = function _activate(target) { - this._activeTarget = target; - - this._clear(); - - var queries = this._selector.split(',').map(function (selector) { - return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; - }); - - var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); - - if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { - $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); - $link.addClass(ClassName$8.ACTIVE); - } else { - // Set triggered link as active - $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active - // With both
    and