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

Function modssl_var_extract_dns

modules/ssl/ssl_engine_vars.c:951–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949}
950
951void modssl_var_extract_dns(apr_table_t *t, SSL *ssl, apr_pool_t *p)
952{
953 apr_hash_t *nids;
954 unsigned n;
955 X509 *xs;
956
957 /* Build up a hash table of (int *)NID->(char *)short-name for all
958 * the tags which are to be extracted: */
959 nids = apr_hash_make(p);
960 for (n = 0; ssl_var_lookup_ssl_cert_dn_rec[n].name; n++) {
961 if (ssl_var_lookup_ssl_cert_dn_rec[n].extract) {
962 apr_hash_set(nids, &ssl_var_lookup_ssl_cert_dn_rec[n].nid,
963 sizeof(ssl_var_lookup_ssl_cert_dn_rec[0].nid),
964 ssl_var_lookup_ssl_cert_dn_rec[n].name);
965 }
966 }
967
968 /* Extract the server cert DNS -- note that the refcount does NOT
969 * increase: */
970 xs = SSL_get_certificate(ssl);
971 if (xs) {
972 extract_dn(t, nids, "SSL_SERVER_S_DN_", X509_get_subject_name(xs), p);
973 extract_dn(t, nids, "SSL_SERVER_I_DN_", X509_get_issuer_name(xs), p);
974 }
975
976 /* Extract the client cert DNs -- note that the refcount DOES
977 * increase: */
978 xs = SSL_get_peer_certificate(ssl);
979 if (xs) {
980 extract_dn(t, nids, "SSL_CLIENT_S_DN_", X509_get_subject_name(xs), p);
981 extract_dn(t, nids, "SSL_CLIENT_I_DN_", X509_get_issuer_name(xs), p);
982 X509_free(xs);
983 }
984}
985
986static void extract_san_array(apr_table_t *t, const char *pfx,
987 apr_array_header_t *entries, apr_pool_t *p)

Callers 1

ssl_hook_FixupFunction · 0.85

Calls 1

extract_dnFunction · 0.85

Tested by

no test coverage detected