Skip to content

Commit

Permalink
Fix getSSLClietnDN returns DN instead CN
Browse files Browse the repository at this point in the history
  • Loading branch information
Héctor Hurtado committed Sep 11, 2020
1 parent a17cc48 commit c7567fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/server/data/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func getSSLClietnDN(w http.ResponseWriter, r *http.Request, h *model.Handler) {
httperror.ErrorJSON(w, ResourceItemNotFound, http.StatusNotFound)
} else {
w.Header().Add("Content-Type", "application/octet-stream")
_, _ = w.Write([]byte(h.Request.TLS.VerifiedChains[0][0].Subject.CommonName))
_, _ = w.Write([]byte(h.Request.TLS.VerifiedChains[0][0].Subject.String()))
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/server/data/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,8 @@ func TestGetSSLClientDNReturnsCorrectDN(t *testing.T) {

res := w.Result()

if body, _ := ioutil.ReadAll(res.Body); string(body) != h.Request.TLS.VerifiedChains[0][0].Subject.CommonName {
t.Errorf("Body mismatch. Expected: %q, got: %q", h.Request.TLS.VerifiedChains[0][0].Subject.CommonName, string(body))
if body, _ := ioutil.ReadAll(res.Body); string(body) != h.Request.TLS.VerifiedChains[0][0].Subject.String() {
t.Errorf("Body mismatch. Expected: %q, got: %q", h.Request.TLS.VerifiedChains[0][0].Subject.String(), string(body))
}
}

Expand Down

0 comments on commit c7567fb

Please sign in to comment.