Skip to content

Commit

Permalink
refactor: split ksplice1 and ksplice2
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Nov 2, 2024
1 parent cd98708 commit ed3cdbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/vulnsrc/oracle-oval/oracle-oval.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,17 @@ func resolveVersions(vers []string) (string, []string) {
type PkgFlavor string

const (
NormalPackageFlavor PkgFlavor = "normal"
FipsPackageFlavor PkgFlavor = "fips"
KsplicePackageFlavor PkgFlavor = "ksplice"
NormalPackageFlavor PkgFlavor = "normal"
FipsPackageFlavor PkgFlavor = "fips"
Ksplice1PackageFlavor PkgFlavor = "ksplice1"
Ksplice2PackageFlavor PkgFlavor = "ksplice2"
)

// PackageFlavor determinants the package "flavor" based on its version string
// - normal
// - FIPS validated
// - ksplice userspace
// - ksplice1 userspace
// - ksplice2 userspace
func PackageFlavor(version string) PkgFlavor {
version = strings.ToLower(version)
if strings.HasSuffix(version, "_fips") {
Expand All @@ -267,8 +269,12 @@ func PackageFlavor(version string) PkgFlavor {

subs := strings.Split(version, ".")
for _, s := range subs {
if strings.HasPrefix(s, "ksplice") {
return KsplicePackageFlavor
if strings.HasPrefix(s, "ksplice1") {
return Ksplice1PackageFlavor
}

if strings.HasPrefix(s, "ksplice2") {
return Ksplice2PackageFlavor
}
}
return NormalPackageFlavor
Expand Down
3 changes: 3 additions & 0 deletions pkg/vulnsrc/oracle-oval/oracle-oval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ func TestVulnSrc_Update(t *testing.T) {
Key: []string{"advisory-detail", "CVE-2016-10228", "Oracle Linux 8", "glibc"},
Value: types.Advisories{
Entries: []types.Advisory{
{
FixedVersion: "2:2.28-151.0.1.ksplice1.el8",
},
{
FixedVersion: "2:2.28-151.0.1.ksplice2.el8",
},
Expand Down

0 comments on commit ed3cdbf

Please sign in to comment.