Skip to content

Commit

Permalink
Make Scep a pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
fdurand committed Dec 15, 2021
1 parent b7067b0 commit 63ce1b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions go/caddy/pfpki/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.")
}

Expand Down

0 comments on commit 63ce1b3

Please sign in to comment.