Skip to content

Commit 066a9f8

Browse files
committed
oval: add verifyfiles_object types
Signed-off-by: Hank Donnay <[email protected]>
1 parent 1caaaa0 commit 066a9f8

File tree

3 files changed

+56
-11
lines changed

3 files changed

+56
-11
lines changed

oval/objects.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
func (o *Objects) init() {
99
var wg sync.WaitGroup
10-
wg.Add(4)
10+
wg.Add(5)
1111

1212
go func() {
1313
defer wg.Done()
@@ -33,6 +33,14 @@ func (o *Objects) init() {
3333
}
3434
}()
3535

36+
go func() {
37+
defer wg.Done()
38+
o.rpmverifyfileMemo = make(map[string]int, len(o.RPMVerifyFileObjects))
39+
for i, v := range o.RPMVerifyFileObjects {
40+
o.rpmverifyfileMemo[v.ID] = i
41+
}
42+
}()
43+
3644
go func() {
3745
defer wg.Done()
3846
o.dpkginfoMemo = make(map[string]int, len(o.DpkgInfoObjects))
@@ -60,6 +68,9 @@ func (o *Objects) Lookup(ref string) (kind string, index int, err error) {
6068
if i, ok := o.dpkginfoMemo[ref]; ok {
6169
return o.DpkgInfoObjects[i].XMLName.Local, i, nil
6270
}
71+
if i, ok := o.rpmverifyfileMemo[ref]; ok {
72+
return o.RPMVerifyFileObjects[i].XMLName.Local, i, nil
73+
}
6374

6475
// We didn't find it, maybe we can say why.
6576
id, err := ParseID(ref)

oval/rpminfo.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,38 @@ type RPMInfoObject struct {
3636
Name string `xml:"name"`
3737
}
3838

39+
type RPMVerifyFileObject struct {
40+
XMLName xml.Name `xml:"rpmverifyfile_object"`
41+
ID string `xml:"id,attr"`
42+
Version int `xml:"version,attr"`
43+
Behaviors VerifyFileBehaviors `xml:"behaviors"`
44+
Name VerifyFileOp `xml:"name"`
45+
Epoch VerifyFileOp `xml:"epoch"`
46+
Release VerifyFileOp `xml:"release"`
47+
RPMVersion VerifyFileOp `xml:"version"`
48+
Arch VerifyFileOp `xml:"arch"`
49+
Filepath string `xml:"filepath"`
50+
}
51+
52+
type VerifyFileBehaviors struct {
53+
XMLName xml.Name `xml:"behaviors"`
54+
NoConfigFiles bool `xml:"noconfigfiles"`
55+
NoGhostFiles bool `xml:"noghostfiles"`
56+
NoGroup bool `xml:"nogroup"`
57+
NoLinkTo bool `xml:"nolinkto"`
58+
NoMD5 bool `xml:"nomd5"`
59+
NoMode bool `xml:"nomode"`
60+
NoMTime bool `xml:"nomtime"`
61+
NoRDev bool `xml:"nordev"`
62+
NoSize bool `xml:"nosize"`
63+
NoUser bool `xml:"nouser"`
64+
}
65+
66+
type VerifyFileOp struct {
67+
XMLName xml.Name
68+
Op string `xml:"operation,attr"`
69+
}
70+
3971
// RPMInfoState : >states>rpminfo_state
4072
type RPMInfoState struct {
4173
XMLName xml.Name `xml:"rpminfo_state"`

oval/types.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,18 @@ type StateRef struct {
260260

261261
// Objects : >objects
262262
type Objects struct {
263-
once sync.Once
264-
XMLName xml.Name `xml:"objects"`
265-
LineObjects []LineObject `xml:"line_object"`
266-
Version55Objects []Version55Object `xml:"version55_object"`
267-
RPMInfoObjects []RPMInfoObject `xml:"rpminfo_object"`
268-
DpkgInfoObjects []DpkgInfoObject `xml:"dpkginfo_object"`
269-
lineMemo map[string]int
270-
version55Memo map[string]int
271-
rpminfoMemo map[string]int
272-
dpkginfoMemo map[string]int
263+
once sync.Once
264+
XMLName xml.Name `xml:"objects"`
265+
LineObjects []LineObject `xml:"line_object"`
266+
Version55Objects []Version55Object `xml:"version55_object"`
267+
RPMInfoObjects []RPMInfoObject `xml:"rpminfo_object"`
268+
RPMVerifyFileObjects []RPMVerifyFileObject `xml:"rpmverifyfile_object"`
269+
DpkgInfoObjects []DpkgInfoObject `xml:"dpkginfo_object"`
270+
lineMemo map[string]int
271+
version55Memo map[string]int
272+
rpminfoMemo map[string]int
273+
rpmverifyfileMemo map[string]int
274+
dpkginfoMemo map[string]int
273275
}
274276

275277
// States : >states

0 commit comments

Comments
 (0)