]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ldap: ldap-settings - Read ssl settings from ssl_setting_parser_info
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 20 Sep 2024 16:55:29 +0000 (16:55 +0000)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:01 +0000 (10:40 +0200)
src/lib-ldap/ldap-settings.c
src/lib-ldap/ldap-settings.h

index f02126fe28d8affec0fc8af84316bd3a82a424d9..2618c09ee40f49c26bd4435a1c9a013449a8a6b7 100644 (file)
@@ -4,6 +4,8 @@
 #include "str.h"
 #include "settings.h"
 #include "ldap-settings.h"
+#include "ssl-settings.h"
+#include "iostream-ssl.h"
 
 #undef DEF
 #undef DEFN
@@ -65,6 +67,13 @@ ldap_client_settings_postcheck(struct ldap_client_settings *set, const char **er
        return 0;
 }
 
+static void bind_pool(pool_t to, pool_t from)
+{
+       pool_add_external_ref(to, from);
+       pool_t tmp = from;
+       pool_unref(&tmp);
+}
+
 int ldap_client_settings_get(struct event *event,
                             const struct ldap_client_settings **set_r,
                             const char **error_r)
@@ -76,6 +85,15 @@ int ldap_client_settings_get(struct event *event,
                return -1;
        }
 
+       if (settings_get(event, &ssl_setting_parser_info, 0, &set->ssl_set, error_r) < 0) {
+               settings_free(set);
+               return -1;
+       }
+
+       ssl_client_settings_to_iostream_set(set->ssl_set, &set->ssl_ioset);
+       bind_pool(set->pool, set->ssl_set->pool);
+       bind_pool(set->pool, set->ssl_ioset->pool);
+
        *set_r = set;
        *error_r = NULL;
        return 0;
index 502ef769e8200f7b384dc44f1c704f58fe070968..d4d66915d170722a988f9ef6f88c8782420647f1 100644 (file)
@@ -15,6 +15,7 @@ struct ldap_client_settings {
        bool starttls;
 
        struct event *event_parent;
+       const struct ssl_settings *ssl_set;
        const struct ssl_iostream_settings *ssl_ioset;
 };