From c846d461fa1edb97219be87c4ba37e97e85dd488 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Aug 2006 23:25:04 +0000 Subject: r17542: In using ldb_map, I ran across some very odd behaviours when we search for objectClass=xyz. The code has been warning at me 'no covert_operator set', and indeed this is the case. (It then proceeds to strip this as a search expression) In this commit, I have implemented a convert_operator for objectClass, by pretending it is a simple MAP_CONVERT operator for the search requests. I also have changed the logic for when we should bail out. I can only see reason to bail out on the search if we have both local and remote trees. How can a remote-only search be un-splittable? Andrew Bartlett (This used to be commit 656e58672c357121647a080400fcab4e5d30b46b) --- source4/lib/ldb/modules/ldb_map.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source4/lib/ldb/modules/ldb_map.c') diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c index cdb9f5b4a9..8eff612d1b 100644 --- a/source4/lib/ldb/modules/ldb_map.c +++ b/source4/lib/ldb/modules/ldb_map.c @@ -798,7 +798,27 @@ static struct ldb_message_element *map_objectclass_generate_local(struct ldb_mod return el; } +/* Mappings for searches on objectClass= assuming a one-to-one + * mapping. Needed because this is a generate operator for the + * add/modify code */ +static int map_objectclass_convert_operator(struct ldb_module *module, void *mem_ctx, + struct ldb_parse_tree **new, const struct ldb_parse_tree *tree) +{ + + static const struct ldb_map_attribute objectclass_map = { + .local_name = "objectclass", + .type = MAP_CONVERT, + .u = { + .convert = { + .remote_name = "objectclass", + .convert_local = map_objectclass_convert_local, + .convert_remote = map_objectclass_convert_remote, + }, + }, + }; + return map_subtree_collect_remote_simple(module, mem_ctx, new, tree, &objectclass_map); +} /* Auxiliary request construction * ============================== */ @@ -1142,6 +1162,7 @@ static const struct ldb_map_attribute builtin_attribute_maps[] = { { .local_name = "objectclass", .type = MAP_GENERATE, + .convert_operator = map_objectclass_convert_operator, .u = { .generate = { .remote_names = { "objectclass", NULL }, -- cgit