From 63ce1b3c4f8d2c42d145f753c5e429bf297d1d94 Mon Sep 17 00:00:00 2001 From: Durand Fabrice Date: Wed, 15 Dec 2021 14:13:07 -0500 Subject: [PATCH] Make Scep a pointer --- go/caddy/pfpki/models/models.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/caddy/pfpki/models/models.go b/go/caddy/pfpki/models/models.go index 9fd51e2efff1..2f41187d6257 100644 --- a/go/caddy/pfpki/models/models.go +++ b/go/caddy/pfpki/models/models.go @@ -139,7 +139,7 @@ type ( SerialNumber string `json:"serial_number,omitempty"` DNSNames string `json:"dns_names,omitempty"` IPAddresses string `json:"ip_addresses,omitempty"` - Scep bool `json:"scep,omitempty" gorm:"default:false"` + Scep *bool `json:"scep,omitempty" gorm:"default:false"` } // RevokedCert struct @@ -518,8 +518,8 @@ func (c CA) Put(cn string, crt *x509.Certificate, options ...string) error { if CaDB := c.DB.First(&ca, profiledb[0].CaID).Find(&ca); CaDB.Error != nil { c.DB.First(&ca) } - - if err := c.DB.Create(&Cert{Cn: cn, Ca: ca, CaName: ca.Cn, ProfileName: profiledb[0].Name, SerialNumber: crt.SerialNumber.String(), Mail: attributeMap["emailAddress"], StreetAddress: attributeMap["streetAddress"], Organisation: attributeMap["O"], OrganisationalUnit: attributeMap["OU"], Country: attributeMap["C"], State: attributeMap["ST"], Locality: attributeMap["L"], PostalCode: attributeMap["emailAddress"], Profile: profiledb[0], Key: "", Cert: publicKey.String(), ValidUntil: crt.NotAfter, Scep: true}).Error; err != nil { + vrai := true + if err := c.DB.Create(&Cert{Cn: cn, Ca: ca, CaName: ca.Cn, ProfileName: profiledb[0].Name, SerialNumber: crt.SerialNumber.String(), Mail: attributeMap["emailAddress"], StreetAddress: attributeMap["streetAddress"], Organisation: attributeMap["O"], OrganisationalUnit: attributeMap["OU"], Country: attributeMap["C"], State: attributeMap["ST"], Locality: attributeMap["L"], PostalCode: attributeMap["emailAddress"], Profile: profiledb[0], Key: "", Cert: publicKey.String(), ValidUntil: crt.NotAfter, Scep: &vrai}).Error; err != nil { return errors.New("A database error occured. See log for details.") }