MCPcopy Create free account
hub / github.com/apache/httpd / ssl_hook_Fixup

Function ssl_hook_Fixup

modules/ssl/ssl_engine_kernel.c:1352–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350};
1351
1352int ssl_hook_Fixup(request_rec *r)
1353{
1354 SSLDirConfigRec *dc = myDirConfig(r);
1355 apr_table_t *env = r->subprocess_env;
1356 char *var, *val = "";
1357#ifdef HAVE_TLSEXT
1358 const char *servername;
1359#endif
1360 STACK_OF(X509) *peer_certs;
1361 SSLConnRec *sslconn;
1362 SSL *ssl;
1363 int i;
1364
1365 if (!modssl_request_is_tls(r, &sslconn)) {
1366 return DECLINED;
1367 }
1368 ssl = sslconn->ssl;
1369
1370 /*
1371 * Annotate the SSI/CGI environment with standard SSL information
1372 */
1373 /* the always present HTTPS (=HTTP over SSL) flag! */
1374 apr_table_setn(env, "HTTPS", "on");
1375
1376#ifdef HAVE_TLSEXT
1377 /* add content of SNI TLS extension (if supplied with ClientHello) */
1378 if ((servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name))) {
1379 apr_table_set(env, "SSL_TLS_SNI", servername);
1380 }
1381#endif
1382
1383 /* standard SSL environment variables */
1384 if (dc->nOptions & SSL_OPT_STDENVVARS) {
1385 modssl_var_extract_dns(env, ssl, r->pool);
1386 modssl_var_extract_san_entries(env, ssl, r->pool);
1387
1388 for (i = 0; ssl_hook_Fixup_vars[i]; i++) {
1389 var = (char *)ssl_hook_Fixup_vars[i];
1390 val = ssl_var_lookup(r->pool, r->server, r->connection, r, var);
1391 if (!strIsEmpty(val)) {
1392 apr_table_setn(env, var, val);
1393 }
1394 }
1395 }
1396
1397 /*
1398 * On-demand bloat up the SSI/CGI environment with certificate data
1399 */
1400 if (dc->nOptions & SSL_OPT_EXPORTCERTDATA) {
1401 val = ssl_var_lookup(r->pool, r->server, r->connection,
1402 r, "SSL_SERVER_CERT");
1403
1404 apr_table_setn(env, "SSL_SERVER_CERT", val);
1405
1406 val = ssl_var_lookup(r->pool, r->server, r->connection,
1407 r, "SSL_CLIENT_CERT");
1408
1409 apr_table_setn(env, "SSL_CLIENT_CERT", val);

Callers

nothing calls this directly

Calls 4

modssl_request_is_tlsFunction · 0.85
modssl_var_extract_dnsFunction · 0.85
ssl_var_lookupFunction · 0.70

Tested by

no test coverage detected