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

Function getIDs

modules/ssl/ssl_util_ssl.c:363–383  ·  view source on GitHub ↗

return an array of (RFC 6125 coined) DNS-IDs and CN-IDs in a certificate */

Source from the content-addressed store, hash-verified

361
362/* return an array of (RFC 6125 coined) DNS-IDs and CN-IDs in a certificate */
363static BOOL getIDs(apr_pool_t *p, X509 *x509, apr_array_header_t **ids)
364{
365 const X509_NAME *subj;
366 int i = -1;
367
368 /* First, the DNS-IDs (dNSName entries in the subjectAltName extension) */
369 if (!x509 ||
370 (modssl_X509_getSAN(p, x509, GEN_DNS, NULL, -1, ids) == FALSE && !*ids)) {
371 *ids = NULL;
372 return FALSE;
373 }
374
375 /* Second, the CN-IDs (commonName attributes in the subject DN) */
376 subj = X509_get_subject_name(x509);
377 while ((i = X509_NAME_get_index_by_NID(subj, NID_commonName, i)) != -1) {
378 APR_ARRAY_PUSH(*ids, const char *) =
379 modssl_X509_NAME_ENTRY_to_string(p, X509_NAME_get_entry(subj, i), 0);
380 }
381
382 return apr_is_empty_array(*ids) ? FALSE : TRUE;
383}
384
385/*
386 * Check if a certificate matches for a particular name, by iterating over its

Callers 1

modssl_X509_match_nameFunction · 0.85

Calls 2

modssl_X509_getSANFunction · 0.85

Tested by

no test coverage detected