summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c14
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c6
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c6
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c6
4 files changed, 13 insertions, 19 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index d64340b5d0..dbd5222ce5 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -71,7 +71,7 @@ static void ltdb_attributes_unload(struct ldb_module *module)
msg = ltdb->cache->attributes;
for (i=0;i<msg->num_elements;i++) {
- ldb_remove_attrib_handler(module->ldb, msg->elements[i].name);
+ ldb_schema_attribute_remove(module->ldb, msg->elements[i].name);
}
talloc_free(ltdb->cache->attributes);
@@ -126,7 +126,6 @@ static int ltdb_attributes_load(struct ldb_module *module)
unsigned flags;
const char *syntax;
const struct ldb_schema_syntax *s;
- struct ldb_attrib_handler h;
if (ltdb_attributes_flags(&msg->elements[i], &flags) != 0) {
ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Invalid @ATTRIBUTES element for '%s'\n", msg->elements[i].name);
@@ -156,14 +155,9 @@ static int ltdb_attributes_load(struct ldb_module *module)
syntax, msg->elements[i].name);
goto failed;
}
- h.attr = msg->elements[i].name;
- h.flags |= LDB_ATTR_FLAG_ALLOCATED;
- h.ldif_read_fn = s->ldif_read_fn;
- h.ldif_write_fn = s->ldif_write_fn;
- h.canonicalise_fn = s->canonicalise_fn;
- h.comparison_fn = s->comparison_fn;
-
- if (ldb_set_attrib_handlers(module->ldb, &h, 1) != 0) {
+
+ flags |= LDB_ATTR_FLAG_ALLOCATED;
+ if (ldb_schema_attribute_add_with_syntax(module->ldb, msg->elements[i].name, flags, s) != 0) {
goto failed;
}
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index 19385f5504..fd61d41037 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -108,7 +108,7 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb,
{
struct ldb_dn *ret;
struct ldb_val v;
- const struct ldb_attrib_handler *h;
+ const struct ldb_schema_attribute *a;
char *attr_folded;
int r;
@@ -117,8 +117,8 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb,
return NULL;
}
- h = ldb_attrib_handler(ldb, attr);
- r = h->canonicalise_fn(ldb, ldb, value, &v);
+ a = ldb_schema_attribute_by_name(ldb, attr);
+ r = a->syntax->canonicalise_fn(ldb, ldb, value, &v);
if (r != LDB_SUCCESS) {
const char *errstr = ldb_errstring(ldb);
/* canonicalisation can be refused. For example,
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 5736b7684b..6890378185 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -123,9 +123,9 @@ static int msg_add_all_elements(struct ldb_module *module, struct ldb_message *r
}
for (i=0;i<msg->num_elements;i++) {
- const struct ldb_attrib_handler *h;
- h = ldb_attrib_handler(ldb, msg->elements[i].name);
- if (h->flags & LDB_ATTR_FLAG_HIDDEN) {
+ const struct ldb_schema_attribute *a;
+ a = ldb_schema_attribute_by_name(ldb, msg->elements[i].name);
+ if (a->flags & LDB_ATTR_FLAG_HIDDEN) {
continue;
}
if (msg_add_element(ret, &msg->elements[i],
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 09ddca5034..6adf6f48ca 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -558,7 +558,7 @@ static int msg_delete_element(struct ldb_module *module,
unsigned int i;
int found;
struct ldb_message_element *el;
- const struct ldb_attrib_handler *h;
+ const struct ldb_schema_attribute *a;
found = find_element(msg, name);
if (found == -1) {
@@ -567,10 +567,10 @@ static int msg_delete_element(struct ldb_module *module,
el = &msg->elements[found];
- h = ldb_attrib_handler(ldb, el->name);
+ a = ldb_schema_attribute_by_name(ldb, el->name);
for (i=0;i<el->num_values;i++) {
- if (h->comparison_fn(ldb, ldb, &el->values[i], val) == 0) {
+ if (a->syntax->comparison_fn(ldb, ldb, &el->values[i], val) == 0) {
if (i<el->num_values-1) {
memmove(&el->values[i], &el->values[i+1],
sizeof(el->values[i])*(el->num_values-(i+1)));