From 8297302e989c62092b50a275207046e83cd52800 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Thu, 4 Mar 2010 16:28:03 +0100 Subject: [PATCH] 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. --- source4/dsdb/samdb/ldb_modules/operational.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c index 886bacb6b63..1d0269854f4 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