summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules/schema.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-02-27 11:35:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:55 -0500
commitb1b14817eaa6e6579596d54166e17bc8d5605c01 (patch)
treeb1af59838a0337dd52b510374b048255397dfe24 /source4/lib/ldb/modules/schema.c
parentd2dc86994e7075490f95faa1cc85008feb38f04a (diff)
downloadsamba-b1b14817eaa6e6579596d54166e17bc8d5605c01.tar.gz
samba-b1b14817eaa6e6579596d54166e17bc8d5605c01.tar.bz2
samba-b1b14817eaa6e6579596d54166e17bc8d5605c01.zip
r5585: LDB interfaces change:
changes: - ldb_wrap disappears from code and become a private structure of db_wrap.c thanks to our move to talloc in ldb code, we do not need to expose it anymore - removal of ldb_close() function form the code thanks to our move to talloc in ldb code, we do not need it anymore use talloc_free() to close and free an ldb database - some minor updates to ldb modules code to cope with the change and fix some bugs I found out during the process (This used to be commit d58be9e74b786a11a57e89df36081d55730dfe0a)
Diffstat (limited to 'source4/lib/ldb/modules/schema.c')
-rw-r--r--source4/lib/ldb/modules/schema.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c
index 2921bdc68b..ef766b55ee 100644
--- a/source4/lib/ldb/modules/schema.c
+++ b/source4/lib/ldb/modules/schema.c
@@ -297,12 +297,6 @@ static int get_attr_list_recursive(struct ldb_module *module, struct schema_stru
return 0;
}
-/* close */
-static int schema_close(struct ldb_module *module)
-{
- return ldb_next_close(module);
-}
-
/* search */
static int schema_search(struct ldb_module *module, const char *base,
enum ldb_scope scope, const char *expression,
@@ -371,18 +365,6 @@ static int schema_add_record(struct ldb_module *module, const struct ldb_message
return -1;
}
- /* check we are not trying to delete a required attribute */
- /* TODO: consider multivalued attrs */
- if ((attr->flags & SCHEMA_FLAG_MOD_DELETE) != 0) {
- ldb_debug(module->ldb, LDB_DEBUG_ERROR,
- "Trying to delete the required attribute %s.\n",
- attr->name);
-
- data->error_string = "Objectclass violation, a required attribute cannot be removed";
- talloc_free(entry_structs);
- return -1;
- }
-
/* mark the attribute as checked */
attr->flags = SCHEMA_FLAG_CHECKED;
}
@@ -477,6 +459,18 @@ static int schema_modify_record(struct ldb_module *module, const struct ldb_mess
return -1;
}
+ /* check we are not trying to delete a required attribute */
+ /* TODO: consider multivalued attrs */
+ if ((attr->flags & SCHEMA_FLAG_MOD_DELETE) != 0) {
+ ldb_debug(module->ldb, LDB_DEBUG_ERROR,
+ "Trying to delete the required attribute %s.\n",
+ attr->name);
+
+ data->error_string = "Objectclass violation, a required attribute cannot be removed";
+ talloc_free(entry_structs);
+ return -1;
+ }
+
/* mark the attribute as checked */
attr->flags = SCHEMA_FLAG_CHECKED;
}
@@ -544,9 +538,15 @@ static const char *schema_errstring(struct ldb_module *module)
return ldb_next_errstring(module);
}
+static int schema_destructor(void *module_ctx)
+{
+ struct ldb_module *ctx = module_ctx;
+ /* put your clean-up functions here */
+ return 0;
+}
+
static const struct ldb_module_ops schema_ops = {
"schema",
- schema_close,
schema_search,
schema_search_free,
schema_add_record,
@@ -584,5 +584,7 @@ struct ldb_module *schema_module_init(struct ldb_context *ldb, const char *optio
ctx->prev = ctx->next = NULL;
ctx->ops = &schema_ops;
+ talloc_set_destructor (ctx, schema_destructor);
+
return ctx;
}