github.com/quay/claircore@v1.5.28/oracle/releases.go (about)

     1  package oracle
     2  
     3  import "github.com/quay/claircore"
     4  
     5  // Oracle Linux has minor releases such as 7.7 and 6.10
     6  // however their elsa OVAL xml sec db always references the major release
     7  // for example: <platform>Oracle Linux 5</platform>
     8  // for this reason the oracle distribution scanner will detect and normalize
     9  // minor releases to major releases to match vulnerabilities correctly
    10  
    11  type Release string
    12  
    13  const (
    14  	Nine  Release = "9"
    15  	Eight Release = "8"
    16  	Seven Release = "7"
    17  	Six   Release = "6"
    18  	Five  Release = "5"
    19  )
    20  
    21  var nineDist = &claircore.Distribution{
    22  	Name:            "Oracle Linux Server",
    23  	Version:         "9",
    24  	DID:             "ol",
    25  	PrettyName:      "Oracle Linux Server 9",
    26  	VersionID:       "9",
    27  	VersionCodeName: "Oracle Linux 9",
    28  }
    29  
    30  var eightDist = &claircore.Distribution{
    31  	Name:            "Oracle Linux Server",
    32  	Version:         "8",
    33  	DID:             "ol",
    34  	PrettyName:      "Oracle Linux Server 8",
    35  	VersionID:       "8",
    36  	VersionCodeName: "Oracle Linux 8",
    37  }
    38  
    39  var sevenDist = &claircore.Distribution{
    40  	Name:            "Oracle Linux Server",
    41  	Version:         "7",
    42  	DID:             "ol",
    43  	PrettyName:      "Oracle Linux Server 7",
    44  	VersionID:       "7",
    45  	VersionCodeName: "Oracle Linux 7",
    46  }
    47  
    48  var sixDist = &claircore.Distribution{
    49  	Name:            "Oracle Linux Server",
    50  	Version:         "6",
    51  	DID:             "ol",
    52  	PrettyName:      "Oracle Linux Server 6",
    53  	VersionID:       "6",
    54  	VersionCodeName: "Oracle Linux 6",
    55  }
    56  
    57  var fiveDist = &claircore.Distribution{
    58  	Name:            "Oracle Linux Server",
    59  	Version:         "5",
    60  	DID:             "ol",
    61  	PrettyName:      "Oracle Linux Server 5",
    62  	VersionID:       "5",
    63  	VersionCodeName: "Oracle Linux 5",
    64  }
    65  
    66  func releaseToDist(r Release) *claircore.Distribution {
    67  	switch r {
    68  	case Nine:
    69  		return nineDist
    70  	case Eight:
    71  		return eightDist
    72  	case Seven:
    73  		return sevenDist
    74  	case Six:
    75  		return sixDist
    76  	case Five:
    77  		return fiveDist
    78  	default:
    79  		// return empty dist
    80  		return &claircore.Distribution{}
    81  	}
    82  }