diff --git a/src/OVAL/probes/unix/linux/partition_probe.c b/src/OVAL/probes/unix/linux/partition_probe.c index cd0e104132..eea7bc3480 100644 --- a/src/OVAL/probes/unix/linux/partition_probe.c +++ b/src/OVAL/probes/unix/linux/partition_probe.c @@ -402,7 +402,7 @@ int partition_probe_main(probe_ctx *ctx, void *probe_arg) rc = oscap_pcre_exec(re, mnt_entp->mnt_dir, strlen(mnt_entp->mnt_dir), 0, 0, NULL, 0); - if (rc == 0) { + if (rc >= 0) { if ( #if defined(HAVE_BLKID_GET_TAG_VALUE) collect_item(ctx, obj_over, mnt_entp, blkcache) diff --git a/tests/probes/partition/test_probes_partition.sh b/tests/probes/partition/test_probes_partition.sh index 4214612607..2e31fec0bd 100755 --- a/tests/probes/partition/test_probes_partition.sh +++ b/tests/probes/partition/test_probes_partition.sh @@ -10,22 +10,30 @@ function test_probes_partition { local ret_val=0; local DF="${srcdir}/test_probes_partition.xml" - local RF="test_probes_partition.results.xml" - echo "result file: $RF" + local result="test_probes_partition.results.xml" + echo "result file: $result" local stderr=$(mktemp $1.err.XXXXXX) echo "stderr file: $stderr" - [ -f $RF ] && rm -f $RF + [ -f $result ] && rm -f $result - $OSCAP oval eval --results $RF $DF 2>$stderr + $OSCAP oval eval --results $result $DF 2>$stderr - if [ -f $RF ]; then - verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF 1 + if [ -f $result ]; then + verify_results "def" $DF $result 3 && verify_results "tst" $DF $result 3 ret_val=$? else ret_val=1 fi + CO='/oval_results/results/system/oval_system_characteristics/collected_objects' + assert_exists 1 $CO'/object[@id="oval:1:obj:1" and @flag="complete"]' + assert_exists 1 $CO'/object[@id="oval:1:obj:2" and @flag="complete"]' + assert_exists 1 $CO'/object[@id="oval:1:obj:3" and @flag="does not exist"]' + SD='/oval_results/results/system/oval_system_characteristics/system_data' + assert_exists 1 $SD'/lin-sys:partition_item' + assert_exists 1 $SD'/lin-sys:partition_item/lin-sys:mount_point[text()="/proc"]' + grep -Ei "(W: |E: )" $stderr && ret_val=1 && echo "There is an error and/or a warning in the output!" rm $stderr diff --git a/tests/probes/partition/test_probes_partition.xml b/tests/probes/partition/test_probes_partition.xml index 9bb2237f50..711f68986e 100644 --- a/tests/probes/partition/test_probes_partition.xml +++ b/tests/probes/partition/test_probes_partition.xml @@ -21,6 +21,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -29,18 +51,34 @@ + + + + + + + /proc + + ^\/proc$ + + + ^something.*without.*leading.*slash$ + proc + + proc + - \ No newline at end of file +