mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Allow empty values when parsing distinguished name (#26627)
This commit is contained in:
parent
b2bf148b65
commit
e02ad241ea
2 changed files with 6 additions and 5 deletions
|
|
@ -203,10 +203,6 @@ func ExtractDetailsFromOsqueryDistinguishedName(str string) (*HostCertificateNam
|
|||
return nil, errors.New("invalid distinguished name, wrong key value pair format")
|
||||
}
|
||||
|
||||
if len(kv[1]) == 0 {
|
||||
return nil, errors.New("invalid distinguished name, missing value")
|
||||
}
|
||||
|
||||
switch strings.ToUpper(kv[0]) {
|
||||
case "C":
|
||||
details.Country = strings.Trim(kv[1], " ")
|
||||
|
|
|
|||
|
|
@ -73,7 +73,12 @@ func TestExtractHostCertificateNameDetails(t *testing.T) {
|
|||
{
|
||||
name: "missing value",
|
||||
input: "/C=US/O=Fleet Device Management Inc./OU=Fleet Device Management Inc./CN=",
|
||||
err: true,
|
||||
expected: &HostCertificateNameDetails{
|
||||
Country: "US",
|
||||
Organization: "Fleet Device Management Inc.",
|
||||
OrganizationalUnit: "Fleet Device Management Inc.",
|
||||
CommonName: "",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "missing first slash",
|
||||
|
|
|
|||
Loading…
Reference in a new issue