From a04e43212715860bc36d90c5a1f5a5c4b6bcecdd Mon Sep 17 00:00:00 2001 From: Endi S. Dewata Date: Wed, 23 Jun 2010 07:26:25 -0500 Subject: [PATCH] s4/ldb: ldb_msg_el_map_remote() should rename the remote attribute names into local names as defined in simple_ldap_map.c. --- source4/lib/ldb/ldb_map/ldb_map_outbound.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/source4/lib/ldb/ldb_map/ldb_map_outbound.c b/source4/lib/ldb/ldb_map/ldb_map_outbound.c index 836aec9..afcd38d 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_outbound.c @@ -219,6 +219,8 @@ static struct ldb_message_element *ldb_msg_el_map_remote(struct ldb_module *modu const char *attr_name, const struct ldb_message_element *old) { + const struct ldb_map_context *data = map_get_context(module); + const char *local_attr_name = attr_name; struct ldb_message_element *el; unsigned int i; @@ -235,7 +237,19 @@ static struct ldb_message_element *ldb_msg_el_map_remote(struct ldb_module *modu return NULL; } - el->name = talloc_strdup(el, attr_name); + for (i = 0; data->attribute_maps[i].local_name; i++) { + struct ldb_map_attribute *am = &data->attribute_maps[i]; + if (am->type == LDB_MAP_RENAME && + !strcmp(am->u.rename.remote_name, attr_name) + || am->type == LDB_MAP_CONVERT && + !strcmp(am->u.convert.remote_name, attr_name)) { + + local_attr_name = am->local_name; + break; + } + } + + el->name = talloc_strdup(el, local_attr_name); if (el->name == NULL) { talloc_free(el); map_oom(module); -- 1.6.6.1