Lines 204-210
static void univention_policy_cleanup(univention_policy_handle_t* handle)
|
Link Here
|
---|
|
204 |
} |
204 |
} |
205 |
|
205 |
|
206 |
/* Retrieve policy 'dn' */ |
206 |
/* Retrieve policy 'dn' */ |
207 |
static void univention_policy_merge(LDAP *ld, const char *dn, univention_policy_handle_t *handle, char **object_classes) |
207 |
static void univention_policy_merge(LDAP *ld, const char *dn, univention_policy_handle_t *handle, char **object_classes, const char *objectdn) |
208 |
{ |
208 |
{ |
209 |
int rc; |
209 |
int rc; |
210 |
LDAPMessage *res; |
210 |
LDAPMessage *res; |
Lines 266-271
static void univention_policy_merge(LDAP *ld, const char *dn, univention_policy_
|
Link Here
|
---|
|
266 |
} |
266 |
} |
267 |
ldap_value_free_len(vals); |
267 |
ldap_value_free_len(vals); |
268 |
} |
268 |
} |
|
|
269 |
|
270 |
if (apply && (vals = ldap_get_values_len(ld, entry, "ldapFilter")) != NULL) { |
271 |
int ldap_filter_rc; |
272 |
for (i = 0; (vals[i] != NULL && vals[i]->bv_val != NULL); i++) { |
273 |
LDAPMessage *ldap_filter_res; |
274 |
char *search_attrs[] = { LDAP_NO_ATTRS, NULL }; |
275 |
ldap_filter_rc = ldap_search_ext_s(ld, objectdn, LDAP_SCOPE_BASE, vals[i]->bv_val, search_attrs, 0, NULL, NULL, &timeout, 0, &ldap_filter_res); |
276 |
if (ldap_filter_rc != LDAP_SUCCESS) { |
277 |
univention_debug(UV_DEBUG_LDAP, UV_DEBUG_ERROR, "search filter '%s' caused error: %s: %s", vals[i]->bv_val, objectdn, ldap_err2string(ldap_filter_rc)); |
278 |
} else { |
279 |
if (!ldap_count_entries(ld, ldap_filter_res)) |
280 |
apply = false; |
281 |
} |
282 |
ldap_msgfree(ldap_filter_res); |
283 |
break; // single-value |
284 |
} |
285 |
ldap_value_free_len(vals); |
286 |
} |
287 |
|
269 |
if (fixed_attributes == NULL && (vals = ldap_get_values_len(ld, entry, "fixedAttributes")) != NULL) { |
288 |
if (fixed_attributes == NULL && (vals = ldap_get_values_len(ld, entry, "fixedAttributes")) != NULL) { |
270 |
i = ldap_count_values_len(vals); |
289 |
i = ldap_count_values_len(vals); |
271 |
if ((fixed_attributes = calloc(i + 1, sizeof(char *))) == NULL) |
290 |
if ((fixed_attributes = calloc(i + 1, sizeof(char *))) == NULL) |
Lines 327-332
static void univention_policy_merge(LDAP *ld, const char *dn, univention_policy_
|
Link Here
|
---|
|
327 |
strcmp(attr, "emptyAttributes") && |
346 |
strcmp(attr, "emptyAttributes") && |
328 |
strcmp(attr, "requiredObjectClasses") && |
347 |
strcmp(attr, "requiredObjectClasses") && |
329 |
strcmp(attr, "prohibitedObjectClasses") && |
348 |
strcmp(attr, "prohibitedObjectClasses") && |
|
|
349 |
strcmp(attr, "ldapFilter") && |
330 |
strcmp(attr, "univentionObjectType") && |
350 |
strcmp(attr, "univentionObjectType") && |
331 |
(vals = ldap_get_values_len(ld, entry, attr)) != NULL) { |
351 |
(vals = ldap_get_values_len(ld, entry, attr)) != NULL) { |
332 |
|
352 |
|
Lines 431-437
univention_policy_handle_t* univention_policy_open(LDAP* ld, const char *base, c
|
Link Here
|
---|
|
431 |
univention_debug(UV_DEBUG_POLICY, UV_DEBUG_INFO, "found policies for %s", pdn); |
451 |
univention_debug(UV_DEBUG_POLICY, UV_DEBUG_INFO, "found policies for %s", pdn); |
432 |
for (i = 0; (vals[i] != NULL && vals[i]->bv_val != NULL); i++) { |
452 |
for (i = 0; (vals[i] != NULL && vals[i]->bv_val != NULL); i++) { |
433 |
univention_debug(UV_DEBUG_POLICY, UV_DEBUG_INFO, " policy: %s", vals[i]->bv_val); |
453 |
univention_debug(UV_DEBUG_POLICY, UV_DEBUG_INFO, " policy: %s", vals[i]->bv_val); |
434 |
univention_policy_merge(ld, vals[i]->bv_val, handle, object_classes); |
454 |
univention_policy_merge(ld, vals[i]->bv_val, handle, object_classes, dn); |
435 |
} |
455 |
} |
436 |
ldap_value_free_len(vals); |
456 |
ldap_value_free_len(vals); |
437 |
} |
457 |
} |