database: Add parent feature pointer to Feature struct

Feature now has a pointer to parent feature. If a vulnerability affects
a parent feature, this child feature will be affected.
master
Sida Chen 6 years ago
parent 3c72fa29a6
commit 3fe894c5ad

@ -165,6 +165,12 @@ type Feature struct {
Name string Name string
Version string Version string
VersionFormat string VersionFormat string
// Parent feature indicates that the vulnerability affects parent feature
// will also affect this feature.
//
// e.g. A source package is the parent feature of a binary package.
Parent *Feature
} }
// NamespacedFeature is a feature with determined namespace and can be affected // NamespacedFeature is a feature with determined namespace and can be affected

@ -26,10 +26,10 @@ import (
// int keys must be the consistent with the database ID. // int keys must be the consistent with the database ID.
var ( var (
realFeatures = map[int]database.Feature{ realFeatures = map[int]database.Feature{
1: {"ourchat", "0.5", "dpkg"}, 1: {"ourchat", "0.5", "dpkg", nil},
2: {"openssl", "1.0", "dpkg"}, 2: {"openssl", "1.0", "dpkg", nil},
3: {"openssl", "2.0", "dpkg"}, 3: {"openssl", "2.0", "dpkg", nil},
4: {"fake", "2.0", "rpm"}, 4: {"fake", "2.0", "rpm", nil},
} }
realNamespaces = map[int]database.Namespace{ realNamespaces = map[int]database.Namespace{

Loading…
Cancel
Save