add option to automatically bind new ldap sessions

Sat, 11 Mar 2023 13:57:30 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 11 Mar 2023 13:57:30 +0100
changeset 463
4fd523fff13b
parent 462
72848970541a
child 464
0a29110b94ec

add option to automatically bind new ldap sessions

src/server/daemon/ldap_resource.c file | annotate | diff | comparison | revisions
src/server/daemon/resourcepool.c file | annotate | diff | comparison | revisions
--- a/src/server/daemon/ldap_resource.c	Sat Mar 11 12:37:48 2023 +0100
+++ b/src/server/daemon/ldap_resource.c	Sat Mar 11 13:57:30 2023 +0100
@@ -124,7 +124,17 @@
     char *bindpw = pblock_findval("Bindpw", pb);
     char *bind = pblock_findval("Bind", pb);
     
-    if(!ldap_uri || !host) {
+    log_ereport(
+            LOG_INFORM,
+            "create ldap resource pool: name=%s : %s%s%s%s : binddn=%s",
+            rpname,
+            ldap_uri ? "uri=" : "host=",
+            ldap_uri ? ldap_uri : host,
+            ldap_uri || !port ? "" : ":",
+            !port ? "" : port,
+            binddn ? binddn : "''");
+    
+    if(!ldap_uri && !host) {
         log_ereport(LOG_MISCONFIG, "Resource pool %s: No host or ldap uri specified", rpname);
         return NULL;
     }
@@ -160,7 +170,8 @@
     ldap_pool->port = (int)port_i;
     ldap_pool->binddn = binddn;
     ldap_pool->bindpw = bindpw;
-    ldap_pool->bind = util_getboolean(bind, ldap_pool->binddn != NULL);
+    WSBool bind_def = binddn != NULL;
+    ldap_pool->bind = bind ? util_getboolean(bind, bind_def) : bind_def;
     
     return ldap_pool;
 }
--- a/src/server/daemon/resourcepool.c	Sat Mar 11 12:37:48 2023 +0100
+++ b/src/server/daemon/resourcepool.c	Sat Mar 11 13:57:30 2023 +0100
@@ -146,6 +146,8 @@
     
     if(createResource) {
         // create a new resource and store it in the resourcepool
+        log_ereport(LOG_DEBUG, "resourcepool %s: create resource", name);
+        
         void *resourceData = respool->type->createresource(respool->data);
         if(resourceData) {
             respool->numcreated++;

mercurial