Klaus Demo nginx / 58d3821
fix memory leak when ssl_verify_client is on Igor Sysoev 14 years ago
1 changed file(s) with 14 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
287287 char *subject, *issuer;
288288 int err, depth;
289289 X509 *cert;
290 X509_NAME *name;
290 X509_NAME *sname, *iname;
291291 ngx_connection_t *c;
292292 ngx_ssl_conn_t *ssl_conn;
293293
300300 err = X509_STORE_CTX_get_error(x509_store);
301301 depth = X509_STORE_CTX_get_error_depth(x509_store);
302302
303 name = X509_get_subject_name(cert);
304 subject = name ? X509_NAME_oneline(name, NULL, 0) : "(none)";
305
306 name = X509_get_issuer_name(cert);
307 issuer = name ? X509_NAME_oneline(name, NULL, 0) : "(none)";
303 sname = X509_get_subject_name(cert);
304 subject = sname ? X509_NAME_oneline(sname, NULL, 0) : "(none)";
305
306 iname = X509_get_issuer_name(cert);
307 issuer = iname ? X509_NAME_oneline(iname, NULL, 0) : "(none)";
308308
309309 ngx_log_debug5(NGX_LOG_DEBUG_EVENT, c->log, 0,
310310 "verify:%d, error:%d, depth:%d, "
311311 "subject:\"%s\",issuer: \"%s\"",
312312 ok, err, depth, subject, issuer);
313
314 if (sname) {
315 OPENSSL_free(subject);
316 }
317
318 if (iname) {
319 OPENSSL_free(issuer);
320 }
313321
314322 return 1;
315323 }