|
|
59234c |
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
|
|
|
59234c |
index 19cb611..79d5219 100644
|
|
|
59234c |
--- a/modules/ssl/ssl_engine_init.c
|
|
|
59234c |
+++ b/modules/ssl/ssl_engine_init.c
|
|
|
59234c |
@@ -2070,70 +2070,18 @@ int ssl_proxy_section_post_config(apr_pool_t *p, apr_pool_t *plog,
|
|
|
59234c |
return OK;
|
|
|
59234c |
}
|
|
|
59234c |
|
|
|
59234c |
-static int ssl_init_FindCAList_X509NameCmp(const X509_NAME * const *a,
|
|
|
59234c |
- const X509_NAME * const *b)
|
|
|
59234c |
-{
|
|
|
59234c |
- return(X509_NAME_cmp(*a, *b));
|
|
|
59234c |
-}
|
|
|
59234c |
-
|
|
|
59234c |
-static void ssl_init_PushCAList(STACK_OF(X509_NAME) *ca_list,
|
|
|
59234c |
- server_rec *s, apr_pool_t *ptemp,
|
|
|
59234c |
- const char *file)
|
|
|
59234c |
-{
|
|
|
59234c |
- int n;
|
|
|
59234c |
- STACK_OF(X509_NAME) *sk;
|
|
|
59234c |
-
|
|
|
59234c |
- sk = (STACK_OF(X509_NAME) *)
|
|
|
59234c |
- SSL_load_client_CA_file(file);
|
|
|
59234c |
-
|
|
|
59234c |
- if (!sk) {
|
|
|
59234c |
- return;
|
|
|
59234c |
- }
|
|
|
59234c |
-
|
|
|
59234c |
- for (n = 0; n < sk_X509_NAME_num(sk); n++) {
|
|
|
59234c |
- X509_NAME *name = sk_X509_NAME_value(sk, n);
|
|
|
59234c |
-
|
|
|
59234c |
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02209)
|
|
|
59234c |
- "CA certificate: %s",
|
|
|
59234c |
- modssl_X509_NAME_to_string(ptemp, name, 0));
|
|
|
59234c |
-
|
|
|
59234c |
- /*
|
|
|
59234c |
- * note that SSL_load_client_CA_file() checks for duplicates,
|
|
|
59234c |
- * but since we call it multiple times when reading a directory
|
|
|
59234c |
- * we must also check for duplicates ourselves.
|
|
|
59234c |
- */
|
|
|
59234c |
-
|
|
|
59234c |
- if (sk_X509_NAME_find(ca_list, name) < 0) {
|
|
|
59234c |
- /* this will be freed when ca_list is */
|
|
|
59234c |
- sk_X509_NAME_push(ca_list, name);
|
|
|
59234c |
- }
|
|
|
59234c |
- else {
|
|
|
59234c |
- /* need to free this ourselves, else it will leak */
|
|
|
59234c |
- X509_NAME_free(name);
|
|
|
59234c |
- }
|
|
|
59234c |
- }
|
|
|
59234c |
-
|
|
|
59234c |
- sk_X509_NAME_free(sk);
|
|
|
59234c |
-}
|
|
|
59234c |
-
|
|
|
59234c |
STACK_OF(X509_NAME) *ssl_init_FindCAList(server_rec *s,
|
|
|
59234c |
apr_pool_t *ptemp,
|
|
|
59234c |
const char *ca_file,
|
|
|
59234c |
const char *ca_path)
|
|
|
59234c |
{
|
|
|
59234c |
- STACK_OF(X509_NAME) *ca_list;
|
|
|
59234c |
-
|
|
|
59234c |
- /*
|
|
|
59234c |
- * Start with a empty stack/list where new
|
|
|
59234c |
- * entries get added in sorted order.
|
|
|
59234c |
- */
|
|
|
59234c |
- ca_list = sk_X509_NAME_new(ssl_init_FindCAList_X509NameCmp);
|
|
|
59234c |
+ STACK_OF(X509_NAME) *ca_list = sk_X509_NAME_new_null();;
|
|
|
59234c |
|
|
|
59234c |
/*
|
|
|
59234c |
* Process CA certificate bundle file
|
|
|
59234c |
*/
|
|
|
59234c |
if (ca_file) {
|
|
|
59234c |
- ssl_init_PushCAList(ca_list, s, ptemp, ca_file);
|
|
|
59234c |
+ SSL_add_file_cert_subjects_to_stack(ca_list, ca_file);
|
|
|
59234c |
/*
|
|
|
59234c |
* If ca_list is still empty after trying to load ca_file
|
|
|
59234c |
* then the file failed to load, and users should hear about that.
|
|
|
59234c |
@@ -2168,17 +2116,12 @@ STACK_OF(X509_NAME) *ssl_init_FindCAList(server_rec *s,
|
|
|
59234c |
continue; /* don't try to load directories */
|
|
|
59234c |
}
|
|
|
59234c |
file = apr_pstrcat(ptemp, ca_path, "/", direntry.name, NULL);
|
|
|
59234c |
- ssl_init_PushCAList(ca_list, s, ptemp, file);
|
|
|
59234c |
+ SSL_add_file_cert_subjects_to_stack(ca_list, file);
|
|
|
59234c |
}
|
|
|
59234c |
|
|
|
59234c |
apr_dir_close(dir);
|
|
|
59234c |
}
|
|
|
59234c |
|
|
|
59234c |
- /*
|
|
|
59234c |
- * Cleanup
|
|
|
59234c |
- */
|
|
|
59234c |
- (void) sk_X509_NAME_set_cmp_func(ca_list, NULL);
|
|
|
59234c |
-
|
|
|
59234c |
return ca_list;
|
|
|
59234c |
}
|
|
|
59234c |
|