Should be returning nil from applyIdentity if cert expired.

This commit is contained in:
max furman 2019-12-17 15:53:37 -08:00
parent ed7ef7229f
commit 9aafe265d0

View file

@ -135,7 +135,7 @@ func (o *clientOptions) applyDefaultIdentity() error {
} }
crt, err := i.TLSCertificate() crt, err := i.TLSCertificate()
if err != nil { if err != nil {
return err return nil
} }
o.certificate = crt o.certificate = crt
return nil return nil
@ -954,8 +954,8 @@ func (c *Client) SSHCheckHost(principal string, token string) (*api.SSHCheckPrin
Token: token, Token: token,
}) })
if err != nil { if err != nil {
return nil, errs.Wrap(http.StatusInternalServerError, err, return nil, errs.Wrap(http.StatusInternalServerError, err, "error marshaling request",
"error marshaling check-host request") errs.WithMessage("Failed to marshal the check-host request"))
} }
u := c.endpoint.ResolveReference(&url.URL{Path: "/ssh/check-host"}) u := c.endpoint.ResolveReference(&url.URL{Path: "/ssh/check-host"})
retry: retry:
@ -974,7 +974,8 @@ retry:
} }
var check api.SSHCheckPrincipalResponse var check api.SSHCheckPrincipalResponse
if err := readJSON(resp.Body, &check); err != nil { if err := readJSON(resp.Body, &check); err != nil {
return nil, errs.Wrapf(http.StatusInternalServerError, err, "error reading %s response", u) return nil, errs.Wrapf(http.StatusInternalServerError, err, "error reading %s response", u,
errs.WithMessage("Failed to parse response from /ssh/check-host endpoint"))
} }
return &check, nil return &check, nil
} }