Skip to content

Commit ab08318

Browse files
committed
Merge branch 'maint-1.3'
2 parents a807dca + 1d1baf5 commit ab08318

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1420
-377
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "yaml-filter"]
2+
path = yaml-filter
3+
url = https://github.com/OpenSCAP/yaml-filter.git

CMakeLists.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ find_package(LibXslt REQUIRED)
143143
find_package(BZip2)
144144

145145
# PThread
146+
if (WIN32)
147+
find_package(ZLIB REQUIRED)
148+
find_package(pthread CONFIG REQUIRED)
149+
set(CMAKE_THREAD_LIBS_INIT ${PThreads4W_LIBRARY})
150+
else()
151+
find_package(Threads REQUIRED)
152+
endif()
146153
set(CMAKE_THREAD_PREFER_PTHREAD)
147154
set(THREADS_PREFER_PTHREAD_FLAG)
148-
set(THREADS_USE_PTHREADS_WIN32 true)
149-
find_package(Threads REQUIRED)
155+
set(THREADS_USE_PTHREADS_WIN32 TRUE)
150156
check_library_exists(pthread pthread_timedjoin_np "" HAVE_PTHREAD_TIMEDJOIN_NP)
151157
check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP)
152158
check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP)
@@ -164,6 +170,15 @@ if(GCRYPT_FOUND OR NSS_FOUND)
164170
set(CRYPTO_FOUND TRUE)
165171
endif()
166172

173+
find_package(Libyaml)
174+
if(EXISTS ${CMAKE_SOURCE_DIR}/yaml-filter/CMakeLists.txt)
175+
message(STATUS "yaml-filter was found")
176+
set(YAML_FILTER_FOUND TRUE)
177+
else()
178+
message(STATUS "yaml-filter was not found")
179+
set(YAML_FILTER_FOUND FALSE)
180+
endif()
181+
167182
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
168183
check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
169184
check_function_exists(memalign HAVE_MEMALIGN)
@@ -235,6 +250,7 @@ cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT "Independent t
235250
cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54 "Independent textfilecontent54 probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF)
236251
cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_VARIABLE "Independent variable probe" ON "ENABLE_PROBES_INDEPENDENT" OFF)
237252
cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT "Independent xmlfilecontent probe" ON "ENABLE_PROBES_INDEPENDENT; NOT WIN32" OFF)
253+
cmake_dependent_option(OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT "Independent yamlfilecontent probe" ON "ENABLE_PROBES_INDEPENDENT; LIBYAML_FOUND; YAML_FILTER_FOUND; NOT WIN32" OFF)
238254

239255
# UNIX PROBES
240256
cmake_dependent_option(OPENSCAP_PROBE_UNIX_DNSCACHE "Unix dnscache probe" ON "ENABLE_PROBES_UNIX" OFF)
@@ -358,6 +374,7 @@ message(STATUS " Independent sql57 probe (depends on opendbx): ${OPENSCAP_PROBE
358374
message(STATUS " Independent textfilecontent probe: ${OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT}")
359375
message(STATUS " Independent textfilecontent54 probe: ${OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54}")
360376
message(STATUS " Independent xmlfilecontent probe: ${OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT}")
377+
message(STATUS " Independent yamlfilecontent probe (depends on libyaml, yaml-path): ${OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT}")
361378
message(STATUS " ")
362379

363380

@@ -526,6 +543,7 @@ include_directories(
526543
"src/XCCDF/public/"
527544
"src/XCCDF_POLICY/"
528545
"src/XCCDF_POLICY/public/"
546+
"yaml-filter"
529547
${CMAKE_BINARY_DIR} # config.h is generated to build directory
530548
${LIBXML2_INCLUDE_DIR}
531549
)
@@ -548,6 +566,11 @@ function(set_oscap_generic_properties TARGET_OBJECT)
548566
target_compile_definitions(${TARGET_OBJECT} PRIVATE OSCAP_BUILD_SHARED)
549567
endfunction()
550568

569+
if(OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT)
570+
add_library(yamlfilter_object OBJECT yaml-filter/yaml-path.c yaml-filter/yaml-path.h)
571+
set_oscap_generic_properties(yamlfilter_object)
572+
endif()
573+
551574
add_subdirectory("compat")
552575
add_subdirectory("src")
553576
add_subdirectory("utils")

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ image: Visual Studio 2017
77
configuration: Release
88
clone_folder: c:\projects\openscap
99
install:
10-
- cmd: vcpkg install curl libxml2 libxslt bzip2 pcre pthreads
10+
- cmd: vcpkg install curl libxml2 libxslt bzip2 pcre pthreads zlib getopt-win32
1111
cache: c:\tools\vcpkg\installed\
1212
before_build:
1313
- cmd: >-

cmake/FindLibyaml.cmake

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# - Try to find libyaml
2+
# Once done, this will define
3+
#
4+
# LIBYAML_FOUND - system has libyaml
5+
# LIBYAML_INCLUDE_DIRS - the libyaml include directories
6+
# LIBYAML_LIBRARIES - link these to use libyaml
7+
8+
include(LibFindMacros)
9+
10+
# Use pkg-config to get hints about paths
11+
libfind_pkg_check_modules(LIBYAML_PKGCONF yaml-0.1)
12+
13+
# Include dir
14+
find_path(LIBYAML_INCLUDE_DIR
15+
NAMES yaml.h
16+
PATHS ${LIBYAML_PKGCONF_INCLUDE_DIRS}
17+
)
18+
19+
# Finally the library itself
20+
find_library(LIBYAML_LIBRARY
21+
NAMES libyaml.so
22+
PATHS ${LIBYAML_PKGCONF_LIBRARY_DIRS}
23+
)
24+
25+
# Set the include dir variables and the libraries and let libfind_process do the rest.
26+
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
27+
set(LIBYAML_PROCESS_INCLUDES LIBYAML_INCLUDE_DIR)
28+
set(LIBYAML_PROCESS_LIBS LIBYAML_LIBRARY)
29+
libfind_process(LIBYAML)

cmake/FindThreads.cmake

Lines changed: 0 additions & 236 deletions
This file was deleted.

config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
#cmakedefine OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54
9696
#cmakedefine OPENSCAP_PROBE_INDEPENDENT_VARIABLE
9797
#cmakedefine OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT
98+
#cmakedefine OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT
9899
#cmakedefine OPENSCAP_PROBE_LINUX_DPKGINFO
99100
#cmakedefine OPENSCAP_PROBE_LINUX_IFLISTENERS
100101
#cmakedefine OPENSCAP_PROBE_LINUX_INETLISTENINGSERVERS

cpe/openscap-cpe-dict.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@
129129
<title xml:lang="en-us">Fedora 32</title>
130130
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.fedora:def:32</check>
131131
</cpe-item>
132+
<cpe-item name="cpe:/o:fedoraproject:fedora:33">
133+
<title xml:lang="en-us">Fedora 33</title>
134+
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.fedora:def:33</check>
135+
</cpe-item>
132136
<cpe-item name="cpe:/o:suse:sle">
133137
<title xml:lang="en-us">SUSE Linux Enterprise all versions</title>
134138
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.sle:def:1</check>

0 commit comments

Comments
 (0)