Skip to content

Commit f65f3a6

Browse files
committed
Merge branch 'maint-1.2' into maint-1.3
Conflicts: ac_probes/configure.ac.tpl configure.ac schemas/Makefile.am schemas/common/xlink.xsd src/DS/sds_priv.h src/source/Makefile.am tests/API/probes/Makefile.am tests/DS/Makefile.am tests/DS/sds_detect_version/scap-1.3-ds.xml tests/DS/validate/Makefile.am
2 parents aaa9918 + 4593a00 commit f65f3a6

File tree

10 files changed

+75
-19
lines changed

10 files changed

+75
-19
lines changed

schemas/oval/5.11.2/oval-definitions-schema.xsd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@
14501450
<xsd:simpleContent>
14511451
<xsd:restriction base="oval-def:EntitySimpleBaseType">
14521452
<xsd:simpleType>
1453-
<xsd:union memberTypes="xsd:hexBinary oval:EmptyStringType"/>
1453+
<xsd:restriction base="xsd:string"/>
14541454
</xsd:simpleType>
14551455
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="binary"/>
14561456
</xsd:restriction>
@@ -1463,7 +1463,7 @@
14631463
<xsd:simpleContent>
14641464
<xsd:restriction base="oval-def:EntitySimpleBaseType">
14651465
<xsd:simpleType>
1466-
<xsd:union memberTypes="xsd:boolean oval:EmptyStringType"/>
1466+
<xsd:restriction base="xsd:string"/>
14671467
</xsd:simpleType>
14681468
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="boolean"/>
14691469
</xsd:restriction>
@@ -1476,7 +1476,7 @@
14761476
<xsd:simpleContent>
14771477
<xsd:restriction base="oval-def:EntitySimpleBaseType">
14781478
<xsd:simpleType>
1479-
<xsd:union memberTypes="xsd:float oval:EmptyStringType"/>
1479+
<xsd:restriction base="xsd:string"/>
14801480
</xsd:simpleType>
14811481
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="float"/>
14821482
</xsd:restriction>
@@ -1489,7 +1489,7 @@
14891489
<xsd:simpleContent>
14901490
<xsd:restriction base="oval-def:EntitySimpleBaseType">
14911491
<xsd:simpleType>
1492-
<xsd:union memberTypes="xsd:integer oval:EmptyStringType"/>
1492+
<xsd:restriction base="xsd:string"/>
14931493
</xsd:simpleType>
14941494
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="int"/>
14951495
</xsd:restriction>
@@ -1656,7 +1656,7 @@
16561656
<xsd:simpleContent>
16571657
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
16581658
<xsd:simpleType>
1659-
<xsd:union memberTypes="xsd:hexBinary oval:EmptyStringType"/>
1659+
<xsd:restriction base="xsd:string"/>
16601660
</xsd:simpleType>
16611661
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="binary"/>
16621662
</xsd:restriction>
@@ -1669,7 +1669,7 @@
16691669
<xsd:simpleContent>
16701670
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
16711671
<xsd:simpleType>
1672-
<xsd:union memberTypes="xsd:boolean oval:EmptyStringType"/>
1672+
<xsd:restriction base="xsd:string"/>
16731673
</xsd:simpleType>
16741674
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="boolean"/>
16751675
</xsd:restriction>
@@ -1682,7 +1682,7 @@
16821682
<xsd:simpleContent>
16831683
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
16841684
<xsd:simpleType>
1685-
<xsd:union memberTypes="xsd:float oval:EmptyStringType"/>
1685+
<xsd:restriction base="xsd:string"/>
16861686
</xsd:simpleType>
16871687
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="float"/>
16881688
</xsd:restriction>
@@ -1695,7 +1695,7 @@
16951695
<xsd:simpleContent>
16961696
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
16971697
<xsd:simpleType>
1698-
<xsd:union memberTypes="xsd:integer oval:EmptyStringType"/>
1698+
<xsd:restriction base="xsd:string"/>
16991699
</xsd:simpleType>
17001700
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="int"/>
17011701
</xsd:restriction>

schemas/oval/5.11.2/oval-system-characteristics-schema.xsd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@
493493
<xsd:simpleContent>
494494
<xsd:restriction base="oval-sc:EntityItemSimpleBaseType">
495495
<xsd:simpleType>
496-
<xsd:union memberTypes="xsd:hexBinary oval:EmptyStringType"/>
496+
<xsd:restriction base="xsd:string"/>
497497
</xsd:simpleType>
498498
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="binary"/>
499499
</xsd:restriction>
@@ -506,7 +506,7 @@
506506
<xsd:simpleContent>
507507
<xsd:restriction base="oval-sc:EntityItemSimpleBaseType">
508508
<xsd:simpleType>
509-
<xsd:union memberTypes="xsd:boolean oval:EmptyStringType"/>
509+
<xsd:restriction base="xsd:string"/>
510510
</xsd:simpleType>
511511
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="boolean"/>
512512
</xsd:restriction>
@@ -519,7 +519,7 @@
519519
<xsd:simpleContent>
520520
<xsd:restriction base="oval-sc:EntityItemSimpleBaseType">
521521
<xsd:simpleType>
522-
<xsd:union memberTypes="xsd:float oval:EmptyStringType"/>
522+
<xsd:restriction base="xsd:string"/>
523523
</xsd:simpleType>
524524
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="float"/>
525525
</xsd:restriction>
@@ -532,7 +532,7 @@
532532
<xsd:simpleContent>
533533
<xsd:restriction base="oval-sc:EntityItemSimpleBaseType">
534534
<xsd:simpleType>
535-
<xsd:union memberTypes="xsd:integer oval:EmptyStringType"/>
535+
<xsd:restriction base="xsd:string"/>
536536
</xsd:simpleType>
537537
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="int"/>
538538
</xsd:restriction>

src/source/oscap_source.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "source/validate_priv.h"
5555
#include "XCCDF/elements.h"
5656
#include "XCCDF/public/xccdf_benchmark.h"
57+
#include "DS/sds_priv.h"
5758

5859
typedef enum oscap_source_type {
5960
OSCAP_SRC_FROM_USER_XML_FILE = 1, ///< The source originated from XML file supplied by user

tests/API/probes/all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test_init "test_api_probes.log"
77
if [ -z ${CUSTOM_OSCAP+x} ] ; then
88
test_run "fts test" $srcdir/fts.sh
99
test_run "probe api smoke test" ./test_api_probes_smoke
10-
test_run "fsdev is_local_fs unit test" ./test_fsdev_is_local_fs
10+
test_run "fsdev is_local_fs unit test" ./test_fsdev_is_local_fs $srcdir/fake_mtab
1111
fi
1212

1313
test_exit

tests/API/probes/fake_mtab

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/dev/mapper/fedora-root / ext4 rw,seclabel,relatime 0 0
2+
tmpfs /tmp tmpfs rw,seclabel,nosuid,nodev 0 0
3+
/etc/mount.map /nfs/test autofs rw,relatime,fd=17,pgrp=11111,timeout=5,minproto=5,maxproto=5,direct,pipe_ino=1246883 0 0
4+
192.168.122.231:/test /nfs/test nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.1,local_lock=none,addr=192.168.122.231 0 0
5+
/dev/mapper/fedora-home /home ext4 rw,seclabel,relatime 0 0
6+
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
7+
//192.168.0.5/storage /media/movies cifs guest,uid=myuser,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm 0 0

tests/API/probes/test_fsdev_is_local_fs.c

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,46 @@
2929
#include <mntent.h>
3030
#include "fsdev.h"
3131

32-
int main(int argc, char *argv[])
32+
static int test_single_call()
3333
{
3434
struct mntent ment;
3535
ment.mnt_type = "autofs";
3636
int ret = is_local_fs(&ment);
37-
if (ret != 0) {
37+
/* autofs entry is never considered local */
38+
return (ret == 0);
39+
}
40+
41+
static int test_multiple_calls(const char *fake_mtab)
42+
{
43+
/*
44+
* fake mtab contains only 4 local filesystems:
45+
* /, /tmp, /home and /proc
46+
*/
47+
FILE *f = setmntent(fake_mtab, "r");
48+
if (f == NULL) {
49+
fprintf(stderr, "fake_mtab could not be open\n");
50+
return 0;
51+
}
52+
struct mntent *ment;
53+
unsigned int locals = 0;
54+
while ((ment = getmntent(f)) != NULL) {
55+
if (is_local_fs(ment)) {
56+
locals++;
57+
}
58+
}
59+
endmntent(f);
60+
return (locals == 4);
61+
}
62+
63+
int main(int argc, char *argv[])
64+
{
65+
if (!test_single_call()) {
66+
fprintf(stderr, "test_single_call has failed\n");
67+
return 1;
68+
}
69+
if (!test_multiple_calls(argv[1])) {
70+
fprintf(stderr, "test_multiple_calls has failed\n");
3871
return 1;
3972
}
4073
return 0;
41-
}
74+
}

tests/DS/ds_continue_without_remote_resources/remote_content_1.2.ds.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
<var_ref>oval:x:var:1</var_ref>
4444
</variable_object>
4545
</objects>
46+
47+
<variables>
48+
<constant_variable id="oval:x:var:1" version="1" comment="x" datatype="int">
49+
<value>100</value>
50+
</constant_variable>
51+
</variables>
52+
4653
</oval_definitions>
4754
</ds:component>
4855

tests/DS/ds_continue_without_remote_resources/remote_content_1.3.ds.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
<var_ref>oval:x:var:1</var_ref>
4646
</variable_object>
4747
</objects>
48+
49+
<variables>
50+
<constant_variable id="oval:x:var:1" version="1" comment="x" datatype="int">
51+
<value>100</value>
52+
</constant_variable>
53+
</variables>
54+
4855
</oval_definitions>
4956
</ds:component>
5057

tests/DS/sds_detect_version/scap-1.3-ds.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ns4:generator>
1111
<ns6:product_name>combine_ovals.py from SCAP Security Guide</ns6:product_name>
1212
<ns6:product_version>ssg: [0, 1, 44], python: 3.7.3</ns6:product_version>
13-
<ns6:schema_version>5.11</ns6:schema_version>
13+
<ns6:schema_version>5.11.2</ns6:schema_version>
1414
<ns6:timestamp>2019-05-10T06:18:18</ns6:timestamp>
1515
</ns4:generator>
1616
<ns4:definitions>

tests/DS/test_ds_misc.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,15 @@ function test_ds_continue_without_remote_resources() {
222222
local DS="${srcdir}/$1"
223223
local PROFILE="$2"
224224
local result=$(mktemp)
225+
local oval_result="test_single_rule.oval.xml.result.xml"
225226

226-
$OSCAP xccdf eval --profile "$PROFILE" --results "$result" "$DS"
227+
$OSCAP xccdf eval --oval-results --profile "$PROFILE" --results "$result" "$DS"
227228

228229
assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_test-pass"]/result[text()="pass"]'
229230
assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_test-remote_res"]/result[text()="notchecked"]'
230231
assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_test-pass2"]/result[text()="pass"]'
231232

232-
rm -f "$result"
233+
rm -f "$result" "$oval_result"
233234
}
234235

235236

0 commit comments

Comments
 (0)