summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-04 16:28:03 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-04 18:16:24 +0100
commit8297302e989c62092b50a275207046e83cd52800 (patch)
tree2c7415f47c417d1b21f84ee98ac0eaa8f136b264 /source4/dsdb
parentffa03820f1352779988f7cf19190ef6ec2eae33d (diff)
downloadsamba-8297302e989c62092b50a275207046e83cd52800.tar.gz
samba-8297302e989c62092b50a275207046e83cd52800.tar.bz2
samba-8297302e989c62092b50a275207046e83cd52800.zip
s4:operational LDB - don't accidentally "ate" search helper attributes if we need them for more constructed attributes
With this patch we delete the helper attributes at the end where all constructed attributes have already been computed.
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/operational.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c
index 886bacb6b6..1d0269854f 100644
--- a/source4/dsdb/samdb/ldb_modules/operational.c
+++ b/source4/dsdb/samdb/ldb_modules/operational.c
@@ -345,6 +345,7 @@ static int operational_search_post_process(struct ldb_module *module,
{
struct ldb_context *ldb;
unsigned int i, a = 0;
+ bool constructed_attributes = false;
ldb = ldb_module_get_ctx(module);
@@ -376,6 +377,7 @@ static int operational_search_post_process(struct ldb_module *module,
/* construct the new attribute, using either a supplied
constructor or a simple copy */
+ constructed_attributes = true;
if (search_sub[i].constructor != NULL) {
if (search_sub[i].constructor(module, msg) != LDB_SUCCESS) {
goto failed;
@@ -385,17 +387,23 @@ static int operational_search_post_process(struct ldb_module *module,
search_sub[i].attr) != LDB_SUCCESS) {
goto failed;
}
+ }
+ }
- /* remove the added search attribute, unless it was
- asked for by the user */
+ /* Deletion of the search helper attributes are needed if:
+ * - we generated constructed attributes and
+ * - we aren't requesting all attributes
+ */
+ if ((constructed_attributes) && (!ldb_attr_in_list(attrs, "*"))) {
+ for (i=0;i<ARRAY_SIZE(search_sub);i++) {
+ /* remove the added search helper attributes, unless
+ * they were asked for by the user */
if (search_sub[i].replace != NULL &&
- !ldb_attr_in_list(attrs, search_sub[i].replace) &&
- !ldb_attr_in_list(attrs, "*")) {
+ !ldb_attr_in_list(attrs, search_sub[i].replace)) {
ldb_msg_remove_attr(msg, search_sub[i].replace);
}
if (search_sub[i].extra_attr != NULL &&
- !ldb_attr_in_list(attrs, search_sub[i].extra_attr) &&
- !ldb_attr_in_list(attrs, "*")) {
+ !ldb_attr_in_list(attrs, search_sub[i].extra_attr)) {
ldb_msg_remove_attr(msg, search_sub[i].extra_attr);
}
}