summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-07-21 11:18:21 +1000
committerAndrew Bartlett <abartlet@samba.org>2008-07-21 11:18:21 +1000
commitca46ad25b8ee43d50383cefb804694fe27595d33 (patch)
tree7c4cd88c1a7a13ce05c1bbae372468fac6e24a45 /source4/lib/ldb
parent706140a1dcc5220739bde0f17afcb32ebc0c130a (diff)
downloadsamba-ca46ad25b8ee43d50383cefb804694fe27595d33.tar.gz
samba-ca46ad25b8ee43d50383cefb804694fe27595d33.tar.bz2
samba-ca46ad25b8ee43d50383cefb804694fe27595d33.zip
Fix ldb_map to add/remove the same 'extra' objectclass
The code previously added data->add_objectClass, but only removed the fixed objectclass of extensibleObject. Found by the ldap.py test. Andrew Bartlett (This used to be commit 4fa15c3173a997fa0b9041161d81e742e1fdb41c)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c
index 9c189feb11..b3f639dc67 100644
--- a/source4/lib/ldb/ldb_map/ldb_map.c
+++ b/source4/lib/ldb/ldb_map/ldb_map.c
@@ -810,6 +810,7 @@ static struct ldb_val map_objectclass_convert_remote(struct ldb_module *module,
/* Generate a local message with a mapped objectClass. */
static struct ldb_message_element *map_objectclass_generate_local(struct ldb_module *module, void *mem_ctx, const char *local_attr, const struct ldb_message *remote)
{
+ const struct ldb_map_context *data = map_get_context(module);
struct ldb_message_element *el, *oc;
struct ldb_val val;
int i;
@@ -844,10 +845,10 @@ static struct ldb_message_element *map_objectclass_generate_local(struct ldb_mod
el->values[i] = map_objectclass_convert_remote(module, el->values, &oc->values[i]);
}
- val.data = (uint8_t *)talloc_strdup(el->values, "extensibleObject");
+ val.data = (uint8_t *)talloc_strdup(el->values, data->add_objectclass);
val.length = strlen((char *)val.data);
- /* Remove last value if it was "extensibleObject" */
+ /* Remove last value if it was the string in data->add_objectclass (eg samba4top, extensibleObject) */
if (ldb_val_equal_exact(&val, &el->values[i-1])) {
el->num_values--;
el->values = talloc_realloc(el, el->values, struct ldb_val, el->num_values);