summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-06-23 07:26:25 -0500
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-24 10:04:51 +0200
commite228b67e56ab63414055e64455a97ea0643803e2 (patch)
treec1210bd3d3937605461234391a5e920296378fea
parente88f37daa068f7effe6f11b8ff8aeb79316e6632 (diff)
downloadsamba-e228b67e56ab63414055e64455a97ea0643803e2.tar.gz
samba-e228b67e56ab63414055e64455a97ea0643803e2.tar.bz2
samba-e228b67e56ab63414055e64455a97ea0643803e2.zip
s4/ldb: ldb_msg_el_map_remote() should rename the remote attribute names into local names as defined in simple_ldap_map.c.
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map_outbound.c16
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 836aec9b1b..17d77d7d62 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);