Fixed CN regression in ACMEv2. (#515)

This commit is contained in:
mikepulaski 2018-04-09 02:15:11 +02:00 committed by xenolf
parent 0b6d953434
commit 5d4f14bc6a
2 changed files with 5 additions and 8 deletions

View file

@ -482,6 +482,7 @@ func (c *Client) createOrderForIdentifiers(domains []string) (orderResource, err
orderRes := orderResource{ orderRes := orderResource{
URL: hdr.Get("Location"), URL: hdr.Get("Location"),
Domains: domains,
orderMessage: response, orderMessage: response,
} }
return orderRes, nil return orderRes, nil
@ -590,7 +591,7 @@ func (c *Client) requestCertificateForOrder(order orderResource, bundle bool, pr
} }
// determine certificate name(s) based on the authorization resources // determine certificate name(s) based on the authorization resources
commonName := order.Identifiers[0].Value commonName := order.Domains[0]
var san []string var san []string
for _, auth := range order.Identifiers { for _, auth := range order.Identifiers {
san = append(san, auth.Value) san = append(san, auth.Value)
@ -606,12 +607,7 @@ func (c *Client) requestCertificateForOrder(order orderResource, bundle bool, pr
} }
func (c *Client) requestCertificateForCsr(order orderResource, bundle bool, csr []byte, privateKeyPem []byte) (CertificateResource, error) { func (c *Client) requestCertificateForCsr(order orderResource, bundle bool, csr []byte, privateKeyPem []byte) (CertificateResource, error) {
commonName := order.Identifiers[0].Value commonName := order.Domains[0]
var authURLs []string
for _, auth := range order.Identifiers[1:] {
authURLs = append(authURLs, auth.Value)
}
csrString := base64.RawURLEncoding.EncodeToString(csr) csrString := base64.RawURLEncoding.EncodeToString(csr)
var retOrder orderMessage var retOrder orderMessage

View file

@ -35,6 +35,7 @@ type accountMessage struct {
type orderResource struct { type orderResource struct {
URL string `json:"url,omitempty"` URL string `json:"url,omitempty"`
Domains []string `json:"domains,omitempty"`
orderMessage `json:"body,omitempty"` orderMessage `json:"body,omitempty"`
} }