diff options
author | Matthieu Patou <mat@matws.net> | 2012-05-14 20:16:11 -0700 |
---|---|---|
committer | Matthieu Patou <mat@matws.net> | 2012-06-22 23:22:02 -0700 |
commit | d7aa7e8ef0db7da07785994e3be7c3cf00289f4d (patch) | |
tree | bd94331a2229347bfeef355184dde89fde20affb /source4 | |
parent | 6edd940135d97e80d70e2b48d8019be5d3557f64 (diff) | |
download | samba-d7aa7e8ef0db7da07785994e3be7c3cf00289f4d.tar.gz samba-d7aa7e8ef0db7da07785994e3be7c3cf00289f4d.tar.bz2 samba-d7aa7e8ef0db7da07785994e3be7c3cf00289f4d.zip |
s4-dsdb: support otherWellKnownObjects
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/extended_dn_in.c | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_in.c b/source4/dsdb/samdb/ldb_modules/extended_dn_in.c index 541a2593f1..72acf07192 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_in.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_in.c @@ -51,6 +51,11 @@ struct extended_search_context { int extended_type; }; +static const char *wkattr[] = { + "wellKnownObjects", + "otherWellKnownObjects", + NULL +}; /* An extra layer of indirection because LDB does not allow the original request to be altered */ static int extended_final_callback(struct ldb_request *req, struct ldb_reply *ares) @@ -88,7 +93,7 @@ static int extended_base_callback(struct ldb_request *req, struct ldb_reply *are struct ldb_request *down_req; struct ldb_message_element *el; int ret; - unsigned int i; + unsigned int i, j; size_t wkn_len = 0; char *valstr = NULL; const char *found = NULL; @@ -125,29 +130,35 @@ static int extended_base_callback(struct ldb_request *req, struct ldb_reply *are wkn_len = strlen(ac->wellknown_object); - el = ldb_msg_find_element(ares->message, "wellKnownObjects"); - if (!el) { - ac->basedn = NULL; - break; - } + for (j=0; wkattr[j]; j++) { - for (i=0; i < el->num_values; i++) { - valstr = talloc_strndup(ac, - (const char *)el->values[i].data, - el->values[i].length); - if (!valstr) { - ldb_oom(ldb_module_get_ctx(ac->module)); - return ldb_module_done(ac->req, NULL, NULL, - LDB_ERR_OPERATIONS_ERROR); - } - - if (strncasecmp(valstr, ac->wellknown_object, wkn_len) != 0) { - talloc_free(valstr); + el = ldb_msg_find_element(ares->message, wkattr[j]); + if (!el) { + ac->basedn = NULL; continue; } - found = &valstr[wkn_len]; - break; + for (i=0; i < el->num_values; i++) { + valstr = talloc_strndup(ac, + (const char *)el->values[i].data, + el->values[i].length); + if (!valstr) { + ldb_oom(ldb_module_get_ctx(ac->module)); + return ldb_module_done(ac->req, NULL, NULL, + LDB_ERR_OPERATIONS_ERROR); + } + + if (strncasecmp(valstr, ac->wellknown_object, wkn_len) != 0) { + talloc_free(valstr); + continue; + } + + found = &valstr[wkn_len]; + break; + } + if (found) { + break; + } } if (!found) { @@ -525,10 +536,6 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req static const char *no_attr[] = { NULL }; - static const char *wkattr[] = { - "wellKnownObjects", - NULL - }; bool all_partitions = false; if (req->operation == LDB_SEARCH) { |