summaryrefslogtreecommitdiff
path: root/src/gmrequest.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-08 14:38:32 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-08 14:38:32 +0300
commit66d425de8597cd9f88a2657505b7098d02cc9617 (patch)
tree8c25c1daa8d7a73c72a69ca0775a8be6d4d921c7 /src/gmrequest.c
parentfe3810593788183dd70992d30fc46c4e6e6b8d94 (diff)
Showing the server certificate subject name
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r--src/gmrequest.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c
index d2683135..9591885a 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -17,6 +17,7 @@ void init_GmResponse(iGmResponse *d) {
17 init_Block(&d->body, 0); 17 init_Block(&d->body, 0);
18 d->certFlags = 0; 18 d->certFlags = 0;
19 iZap(d->certValidUntil); 19 iZap(d->certValidUntil);
20 init_String(&d->certSubject);
20} 21}
21 22
22void initCopy_GmResponse(iGmResponse *d, const iGmResponse *other) { 23void initCopy_GmResponse(iGmResponse *d, const iGmResponse *other) {
@@ -25,9 +26,11 @@ void initCopy_GmResponse(iGmResponse *d, const iGmResponse *other) {
25 initCopy_Block(&d->body, &other->body); 26 initCopy_Block(&d->body, &other->body);
26 d->certFlags = other->certFlags; 27 d->certFlags = other->certFlags;
27 d->certValidUntil = other->certValidUntil; 28 d->certValidUntil = other->certValidUntil;
29 initCopy_String(&d->certSubject, &other->certSubject);
28} 30}
29 31
30void deinit_GmResponse(iGmResponse *d) { 32void deinit_GmResponse(iGmResponse *d) {
33 deinit_String(&d->certSubject);
31 deinit_Block(&d->body); 34 deinit_Block(&d->body);
32 deinit_String(&d->meta); 35 deinit_String(&d->meta);
33} 36}
@@ -38,6 +41,7 @@ void clear_GmResponse(iGmResponse *d) {
38 clear_Block(&d->body); 41 clear_Block(&d->body);
39 d->certFlags = 0; 42 d->certFlags = 0;
40 iZap(d->certValidUntil); 43 iZap(d->certValidUntil);
44 clear_String(&d->certSubject);
41} 45}
42 46
43iGmResponse *copy_GmResponse(const iGmResponse *d) { 47iGmResponse *copy_GmResponse(const iGmResponse *d) {
@@ -117,7 +121,7 @@ void setUrl_GmRequest(iGmRequest *d, const iString *url) {
117 121
118static uint32_t timedOutWhileReceivingBody_GmRequest_(uint32_t interval, void *obj) { 122static uint32_t timedOutWhileReceivingBody_GmRequest_(uint32_t interval, void *obj) {
119 iGmRequest *d = obj; 123 iGmRequest *d = obj;
120 iGuardMutex(&d->mutex, cancel_TlsRequest(d->req)); 124 cancel_TlsRequest(d->req);
121 iUnused(interval); 125 iUnused(interval);
122 return 0; 126 return 0;
123} 127}
@@ -146,7 +150,8 @@ static void checkServerCertificate_GmRequest_(iGmRequest *d) {
146 if (checkTrust_GmCerts(certDb, domain, cert)) { 150 if (checkTrust_GmCerts(certDb, domain, cert)) {
147 d->resp.certFlags |= trusted_GmCertFlag; 151 d->resp.certFlags |= trusted_GmCertFlag;
148 } 152 }
149 validUntil_TlsCertificate(serverCertificate_TlsRequest(d->req), &d->resp.certValidUntil); 153 validUntil_TlsCertificate(cert, &d->resp.certValidUntil);
154 set_String(&d->resp.certSubject, collect_String(subject_TlsCertificate(cert)));
150 } 155 }
151} 156}
152 157