src/server/daemon/ldap_auth.c

changeset 473
102322b6f4ee
parent 472
d6bc67906c8c
child 490
d218607f5a7e
equal deleted inserted replaced
472:d6bc67906c8c 473:102322b6f4ee
35 #include <string.h> 35 #include <string.h>
36 #include <sys/time.h> 36 #include <sys/time.h>
37 37
38 #include <cx/utils.h> 38 #include <cx/utils.h>
39 #include <cx/hash_map.h> 39 #include <cx/hash_map.h>
40 #include <cx/printf.h>
40 41
41 #include "../util/util.h" 42 #include "../util/util.h"
42 43
43 #include "ldap_auth.h" 44 #include "ldap_auth.h"
44 #include "ldap_resource.h" 45 #include "ldap_resource.h"
158 cxstring memberType = serverconfig_object_directive_value(node, cx_str("MemberType")); 159 cxstring memberType = serverconfig_object_directive_value(node, cx_str("MemberType"));
159 cxstring enableGroups = serverconfig_object_directive_value(node, cx_str("EnableGroups")); 160 cxstring enableGroups = serverconfig_object_directive_value(node, cx_str("EnableGroups"));
160 cxstring userNameIsDn = serverconfig_object_directive_value(node, cx_str("UserNameIsDn")); 161 cxstring userNameIsDn = serverconfig_object_directive_value(node, cx_str("UserNameIsDn"));
161 162
162 if(!resource.ptr) { 163 if(!resource.ptr) {
163 // TODO: create resource pool 164 // implicitly create a resource pool for this authdb
165 cxmutstr respool_name = cx_asprintf_a(cfg->a, "_authdb_%s", name);
166 if(!respool_name.ptr) {
167 return NULL;
168 }
169 log_ereport(
170 LOG_INFORM,
171 "ldap authdb %s: no resource specified: create resource pool %s",
172 name,
173 respool_name.ptr);
174 if(resourcepool_new(cfg, cx_str("ldap"), cx_strcast(respool_name), node)) {
175 log_ereport(
176 LOG_FAILURE,
177 "ldap authdb %s: cannot create ldap resource pool",
178 name);
179 return NULL;
180 }
181 authdb->config.resource = respool_name.ptr;
164 } else { 182 } else {
165 authdb->config.resource = cx_strdup_a(cfg->a, resource).ptr; 183 authdb->config.resource = cx_strdup_a(cfg->a, resource).ptr;
166 if(!authdb->config.resource) return NULL; 184 if(!authdb->config.resource) return NULL;
167 } 185 }
168 186

mercurial