Fix getSSLClietnDN returns DN instead CN

This commit is contained in:
Héctor Hurtado
2020-09-11 11:18:11 +02:00
parent a17cc4838d
commit c7567fb4cc
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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()))
}
}
+2 -2
View File
@@ -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))
}
}