From: Matthias Dieter Wallnöfer Date: Thu, 4 Mar 2010 15:28:03 +0000 (+0100) Subject: s4:operational LDB - don't accidentally "ate" search helper attributes if we need... X-Git-Tag: samba-3.6.0pre1~4791 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8297302e989c62092b50a275207046e83cd52800;p=thirdparty%2Fsamba.git 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. --- 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