You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2026/06/03 17:09:40 UTC

svn commit: r1934935 - in httpd/httpd/branches/2.4.x: . modules/ldap

Author: jorton
Date: Wed Jun  3 17:09:40 2026
New Revision: 1934935

Log:
Merge r1934932 from trunk:

* modules/ldap/util_ldap.c (uldap_connection_find): Fix inheritance in
  per-dir context.

Reviewed by: jorton, covener, jfclere

Modified:
   httpd/httpd/branches/2.4.x/   (props changed)
   httpd/httpd/branches/2.4.x/modules/ldap/util_ldap.c

Modified: httpd/httpd/branches/2.4.x/modules/ldap/util_ldap.c
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/ldap/util_ldap.c	Wed Jun  3 16:47:03 2026	(r1934934)
+++ httpd/httpd/branches/2.4.x/modules/ldap/util_ldap.c	Wed Jun  3 17:09:40 2026	(r1934935)
@@ -897,8 +897,23 @@ static util_ldap_connection_t *
          */
         l->secure = secureflag;
 
-        /* save away a copy of the client cert list that is presently valid */
-        l->client_certs = apr_array_copy_hdr(l->pool, dc->client_certs);
+        /* Deep-copy the client cert list into the connection pool so that
+         * the cached connection does not retain pointers into the
+         * (potentially short-lived) per-directory config pool.
+         */
+        l->client_certs = apr_array_copy(l->pool, dc->client_certs);
+        if (!apr_is_empty_array(l->client_certs)) {
+            int i;
+            apr_ldap_opt_tls_cert_t *certs;
+
+            certs = (apr_ldap_opt_tls_cert_t *)l->client_certs->elts;
+            for (i = 0; i < l->client_certs->nelts; i++) {
+                if (certs[i].path)
+                    certs[i].path = apr_pstrdup(l->pool, certs[i].path);
+                if (certs[i].password)
+                    certs[i].password = apr_pstrdup(l->pool, certs[i].password);
+            }
+        }
 
         /* whether or not to keep this connection in the pool when it's returned */
         l->keep = (st->connection_pool_ttl == 0) ? 0 : 1;