|
|
906948 |
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
|
|
|
906948 |
index 4e2e80d..10a2c86 100644
|
|
|
906948 |
--- a/modules/ssl/ssl_engine_init.c
|
|
|
906948 |
+++ b/modules/ssl/ssl_engine_init.c
|
|
|
906948 |
@@ -2256,51 +2256,6 @@ int ssl_proxy_section_post_config(apr_pool_t *p, apr_pool_t *plog,
|
|
|
906948 |
return OK;
|
|
|
906948 |
}
|
|
|
906948 |
|
|
|
906948 |
-static int ssl_init_FindCAList_X509NameCmp(const X509_NAME * const *a,
|
|
|
906948 |
- const X509_NAME * const *b)
|
|
|
906948 |
-{
|
|
|
906948 |
- return(X509_NAME_cmp(*a, *b));
|
|
|
906948 |
-}
|
|
|
906948 |
-
|
|
|
906948 |
-static void ssl_init_PushCAList(STACK_OF(X509_NAME) *ca_list,
|
|
|
906948 |
- server_rec *s, apr_pool_t *ptemp,
|
|
|
906948 |
- const char *file)
|
|
|
906948 |
-{
|
|
|
906948 |
- int n;
|
|
|
906948 |
- STACK_OF(X509_NAME) *sk;
|
|
|
906948 |
-
|
|
|
906948 |
- sk = (STACK_OF(X509_NAME) *)
|
|
|
906948 |
- SSL_load_client_CA_file(file);
|
|
|
906948 |
-
|
|
|
906948 |
- if (!sk) {
|
|
|
906948 |
- return;
|
|
|
906948 |
- }
|
|
|
906948 |
-
|
|
|
906948 |
- for (n = 0; n < sk_X509_NAME_num(sk); n++) {
|
|
|
906948 |
- X509_NAME *name = sk_X509_NAME_value(sk, n);
|
|
|
906948 |
-
|
|
|
906948 |
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02209)
|
|
|
906948 |
- "CA certificate: %s",
|
|
|
906948 |
- modssl_X509_NAME_to_string(ptemp, name, 0));
|
|
|
906948 |
-
|
|
|
906948 |
- /*
|
|
|
906948 |
- * note that SSL_load_client_CA_file() checks for duplicates,
|
|
|
906948 |
- * but since we call it multiple times when reading a directory
|
|
|
906948 |
- * we must also check for duplicates ourselves.
|
|
|
906948 |
- */
|
|
|
906948 |
-
|
|
|
906948 |
- if (sk_X509_NAME_find(ca_list, name) < 0) {
|
|
|
906948 |
- /* this will be freed when ca_list is */
|
|
|
906948 |
- sk_X509_NAME_push(ca_list, name);
|
|
|
906948 |
- }
|
|
|
906948 |
- else {
|
|
|
906948 |
- /* need to free this ourselves, else it will leak */
|
|
|
906948 |
- X509_NAME_free(name);
|
|
|
906948 |
- }
|
|
|
906948 |
- }
|
|
|
906948 |
-
|
|
|
906948 |
- sk_X509_NAME_free(sk);
|
|
|
906948 |
-}
|
|
|
906948 |
|
|
|
906948 |
static apr_status_t ssl_init_ca_cert_path(server_rec *s,
|
|
|
906948 |
apr_pool_t *ptemp,
|
|
|
906948 |
@@ -2324,7 +2279,7 @@ static apr_status_t ssl_init_ca_cert_path(server_rec *s,
|
|
|
906948 |
}
|
|
|
906948 |
file = apr_pstrcat(ptemp, path, "/", direntry.name, NULL);
|
|
|
906948 |
if (ca_list) {
|
|
|
906948 |
- ssl_init_PushCAList(ca_list, s, ptemp, file);
|
|
|
906948 |
+ SSL_add_file_cert_subjects_to_stack(ca_list, file);
|
|
|
906948 |
}
|
|
|
906948 |
if (xi_list) {
|
|
|
906948 |
load_x509_info(ptemp, xi_list, file);
|
|
|
906948 |
@@ -2341,19 +2296,13 @@ STACK_OF(X509_NAME) *ssl_init_FindCAList(server_rec *s,
|
|
|
906948 |
const char *ca_file,
|
|
|
906948 |
const char *ca_path)
|
|
|
906948 |
{
|
|
|
906948 |
- STACK_OF(X509_NAME) *ca_list;
|
|
|
906948 |
-
|
|
|
906948 |
- /*
|
|
|
906948 |
- * Start with a empty stack/list where new
|
|
|
906948 |
- * entries get added in sorted order.
|
|
|
906948 |
- */
|
|
|
906948 |
- ca_list = sk_X509_NAME_new(ssl_init_FindCAList_X509NameCmp);
|
|
|
906948 |
+ STACK_OF(X509_NAME) *ca_list = sk_X509_NAME_new_null();;
|
|
|
906948 |
|
|
|
906948 |
/*
|
|
|
906948 |
* Process CA certificate bundle file
|
|
|
906948 |
*/
|
|
|
906948 |
if (ca_file) {
|
|
|
906948 |
- ssl_init_PushCAList(ca_list, s, ptemp, ca_file);
|
|
|
906948 |
+ SSL_add_file_cert_subjects_to_stack(ca_list, ca_file);
|
|
|
906948 |
/*
|
|
|
906948 |
* If ca_list is still empty after trying to load ca_file
|
|
|
906948 |
* then the file failed to load, and users should hear about that.
|
|
|
906948 |
@@ -2377,11 +2326,6 @@ STACK_OF(X509_NAME) *ssl_init_FindCAList(server_rec *s,
|
|
|
906948 |
return NULL;
|
|
|
906948 |
}
|
|
|
906948 |
|
|
|
906948 |
- /*
|
|
|
906948 |
- * Cleanup
|
|
|
906948 |
- */
|
|
|
906948 |
- (void) sk_X509_NAME_set_cmp_func(ca_list, NULL);
|
|
|
906948 |
-
|
|
|
906948 |
return ca_list;
|
|
|
906948 |
}
|
|
|
906948 |
|