Skip to content

Commit

Permalink
Test SCE load (remove)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyz committed Sep 1, 2023
1 parent 9f1a21b commit ac8100a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SCE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ add_library(openscap_sce SHARED
"${CMAKE_SOURCE_DIR}/src/common/list.c"
"${CMAKE_SOURCE_DIR}/src/common/oscap_string.c"
"${CMAKE_SOURCE_DIR}/src/common/oscap_buffer.c"
"${CMAKE_SOURCE_DIR}/src/common/oscap_pcre.c"
# "${CMAKE_SOURCE_DIR}/src/common/oscap_pcre.c"
"${CMAKE_SOURCE_DIR}/src/common/util.c"
)
target_include_directories(openscap_sce PUBLIC public)
Expand Down
6 changes: 5 additions & 1 deletion src/XCCDF_POLICY/check_engine_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "oscap_helpers.h"
#include "common/_error.h"

#include "debug_priv.h"

#ifndef OS_WINDOWS
#include <dlfcn.h>
#endif
Expand Down Expand Up @@ -56,14 +58,15 @@ struct check_engine_plugin_def *check_engine_plugin_load2(const char* path, bool

const char *path_prefix = getenv("OSCAP_CHECK_ENGINE_PLUGIN_DIR");
char *full_path = path_prefix ? oscap_sprintf("%s/%s", path_prefix, path) : oscap_strdup(path);
dD("SCE plugin path: %s", full_path);
// NB: valgrind reports a leak on the next line, I have confirmed this to be a false positive
ret->module_handle = dlopen(full_path, RTLD_LAZY);
free(full_path);

char *error = NULL;
if (!ret->module_handle) {
error = dlerror();

dD("SCE plugin load error (dlopen): %s", error);
if (!quiet)
oscap_seterr(OSCAP_EFAMILY_GLIBC,
"Failed to load extra check engine from '%s'. Details: '%s'.",
Expand All @@ -77,6 +80,7 @@ struct check_engine_plugin_def *check_engine_plugin_load2(const char* path, bool
*(void **)(&entry_fn) = dlsym(ret->module_handle, STRINGIZE(OPENSCAP_CHECK_ENGINE_PLUGIN_ENTRY));

if ((error = dlerror()) != NULL) {
dD("SCE plugin load error (dlsym): %s", error);
if (!quiet)
oscap_seterr(OSCAP_EFAMILY_GLIBC,
"Failed to retrieve module entry '%s' from loaded extra check engine '%s'. Details: '%s'.",
Expand Down
2 changes: 1 addition & 1 deletion tests/sce/test_sce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
. $builddir/tests/test_common.sh

set -x
$OSCAP --version
LD_DEBUG=bindings $OSCAP --verbose=DEVEL --version

set -e -o pipefail

Expand Down

0 comments on commit ac8100a

Please sign in to comment.