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