summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-03-06 15:33:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:58 -0500
commit0b4c61a05a9a070db489986fda5c57697cfd092a (patch)
tree0dfb09021e3f3e2e38fbb2df4a8302c4ac9a74e4 /source4/lib/ldb/modules
parent348fa3f9f663fc83ee8d9442366a3b36a82a2724 (diff)
downloadsamba-0b4c61a05a9a070db489986fda5c57697cfd092a.tar.gz
samba-0b4c61a05a9a070db489986fda5c57697cfd092a.tar.bz2
samba-0b4c61a05a9a070db489986fda5c57697cfd092a.zip
r5670: simplify and clarify ldb_modules.c code
rectify the test schema correct a glitch in schema module (This used to be commit 0579b5f7adfe160be8ecf124934b6593a02ed06f)
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r--source4/lib/ldb/modules/schema.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c
index ef766b55ee..1b08db6170 100644
--- a/source4/lib/ldb/modules/schema.c
+++ b/source4/lib/ldb/modules/schema.c
@@ -108,7 +108,7 @@ static struct schema_attribute *schema_find_attribute(struct schema_attribute_li
/* get all the attributes and objectclasses found in msg and put them in schema_structure
attributes go in the entry_attrs structure for later checking
objectclasses go in the objectclasses structure */
-static int get_msg_attributes(struct schema_structures *ss, const struct ldb_message *msg)
+static int get_msg_attributes(struct schema_structures *ss, const struct ldb_message *msg, int flag_mask)
{
int i, j, k, l;
@@ -132,13 +132,13 @@ static int get_msg_attributes(struct schema_structures *ss, const struct ldb_mes
for (k = 0, l = ss->objectclasses.num; k < msg->elements[i].num_values; k++) {
ss->objectclasses.attr[l].name = msg->elements[i].values[k].data;
- ss->objectclasses.attr[l].flags = msg->elements[i].flags;
+ ss->objectclasses.attr[l].flags = msg->elements[i].flags & flag_mask;
l++;
}
ss->objectclasses.num += msg->elements[i].num_values;
}
- ss->entry_attrs.attr[j].flags = msg->elements[i].flags;
+ ss->entry_attrs.attr[j].flags = msg->elements[i].flags & flag_mask;
ss->entry_attrs.attr[j].name = talloc_reference(ss->entry_attrs.attr,
msg->elements[i].name);
if (ss->entry_attrs.attr[j].name == NULL) {
@@ -163,7 +163,8 @@ static int get_entry_attributes(struct ldb_context *ldb, const char *dn, struct
}
talloc_steal(ss, srch);
- ret = get_msg_attributes(ss, *srch);
+ /* set flags to 0 as flags on search have undefined values */
+ ret = get_msg_attributes(ss, *srch, 0);
if (ret != 0) {
ldb_search_free(ldb, srch);
return ret;
@@ -336,7 +337,7 @@ static int schema_add_record(struct ldb_module *module, const struct ldb_message
return -1;
}
- ret = get_msg_attributes(entry_structs, msg);
+ ret = get_msg_attributes(entry_structs, msg, SCHEMA_FLAG_MOD_MASK);
if (ret != 0) {
talloc_free(entry_structs);
return ret;
@@ -430,7 +431,7 @@ static int schema_modify_record(struct ldb_module *module, const struct ldb_mess
}
/* get list of values to modify */
- ret = get_msg_attributes(entry_structs, msg);
+ ret = get_msg_attributes(entry_structs, msg, SCHEMA_FLAG_MOD_MASK);
if (ret != 0) {
talloc_free(entry_structs);
return ret;