diff options
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_cache.c | 71 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 64 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.h | 2 |
3 files changed, 0 insertions, 137 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c index a7f72dd6d0..de489e3d8b 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_cache.c +++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c @@ -38,7 +38,6 @@ #define LTDB_FLAG_CASE_INSENSITIVE (1<<0) #define LTDB_FLAG_INTEGER (1<<1) #define LTDB_FLAG_HIDDEN (1<<2) -#define LTDB_FLAG_OBJECTCLASS (1<<3) /* valid attribute flags */ static const struct { @@ -168,66 +167,6 @@ failed: /* - register any subclasses from @SUBCLASSES -*/ -static int ltdb_subclasses_load(struct ldb_module *module) -{ - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; - struct ldb_message *msg = ltdb->cache->subclasses; - struct ldb_dn *dn; - int i, j, r; - - dn = ldb_dn_new(module, module->ldb, LTDB_SUBCLASSES); - if (dn == NULL) goto failed; - - r = ltdb_search_dn1(module, dn, msg); - if (r != LDB_SUCCESS && r != LDB_ERR_NO_SUCH_OBJECT) { - talloc_free(dn); - goto failed; - } - talloc_free(dn); - - for (i=0;i<msg->num_elements;i++) { - struct ldb_message_element *el = &msg->elements[i]; - for (j=0;j<el->num_values;j++) { - if (ldb_subclass_add(module->ldb, el->name, - (char *)el->values[j].data) != 0) { - goto failed; - } - } - } - - return 0; -failed: - return -1; -} - - -/* - de-register any @SUBCLASSES -*/ -static void ltdb_subclasses_unload(struct ldb_module *module) -{ - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; - struct ldb_message *msg; - int i; - - if (ltdb->cache->subclasses == NULL) { - /* no previously loaded subclasses */ - return; - } - - msg = ltdb->cache->subclasses; - for (i=0;i<msg->num_elements;i++) { - ldb_subclass_remove(module->ldb, msg->elements[i].name); - } - - talloc_free(ltdb->cache->subclasses); - ltdb->cache->subclasses = NULL; -} - - -/* initialise the baseinfo record */ static int ltdb_baseinfo_init(struct ldb_module *module) @@ -298,7 +237,6 @@ static void ltdb_cache_free(struct ldb_module *module) int ltdb_cache_reload(struct ldb_module *module) { ltdb_attributes_unload(module); - ltdb_subclasses_unload(module); ltdb_cache_free(module); return ltdb_cache_load(module); } @@ -325,10 +263,8 @@ int ltdb_cache_load(struct ldb_module *module) ltdb->cache = talloc_zero(ltdb, struct ltdb_cache); if (ltdb->cache == NULL) goto failed; ltdb->cache->indexlist = talloc_zero(ltdb->cache, struct ldb_message); - ltdb->cache->subclasses = talloc_zero(ltdb->cache, struct ldb_message); ltdb->cache->attributes = talloc_zero(ltdb->cache, struct ldb_message); if (ltdb->cache->indexlist == NULL || - ltdb->cache->subclasses == NULL || ltdb->cache->attributes == NULL) { goto failed; } @@ -369,16 +305,12 @@ int ltdb_cache_load(struct ldb_module *module) memset(<db->cache->last_attribute, 0, sizeof(ltdb->cache->last_attribute)); ltdb_attributes_unload(module); - ltdb_subclasses_unload(module); talloc_free(ltdb->cache->indexlist); - talloc_free(ltdb->cache->subclasses); ltdb->cache->indexlist = talloc_zero(ltdb->cache, struct ldb_message); - ltdb->cache->subclasses = talloc_zero(ltdb->cache, struct ldb_message); ltdb->cache->attributes = talloc_zero(ltdb->cache, struct ldb_message); if (ltdb->cache->indexlist == NULL || - ltdb->cache->subclasses == NULL || ltdb->cache->attributes == NULL) { goto failed; } @@ -394,9 +326,6 @@ int ltdb_cache_load(struct ldb_module *module) if (ltdb_attributes_load(module) == -1) { goto failed; } - if (ltdb_subclasses_load(module) == -1) { - goto failed; - } done: talloc_free(baseinfo); diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index bcab3acafe..cf9380f8c0 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -258,67 +258,6 @@ static int ltdb_index_dn_simple(struct ldb_module *module, static int list_union(struct ldb_context *, struct dn_list *, const struct dn_list *); /* - return a list of dn's that might match a simple indexed search on - the special objectclass attribute - */ -static int ltdb_index_dn_objectclass(struct ldb_module *module, - const struct ldb_parse_tree *tree, - const struct ldb_message *index_list, - struct dn_list *list) -{ - struct ldb_context *ldb = module->ldb; - unsigned int i; - int ret; - const char *target = (const char *)tree->u.equality.value.data; - const char **subclasses; - - list->count = 0; - list->dn = NULL; - - ret = ltdb_index_dn_simple(module, tree, index_list, list); - - subclasses = ldb_subclass_list(module->ldb, target); - - if (subclasses == NULL) { - return ret; - } - - for (i=0;subclasses[i];i++) { - struct ldb_parse_tree tree2; - struct dn_list *list2; - tree2.operation = LDB_OP_EQUALITY; - tree2.u.equality.attr = LTDB_OBJECTCLASS; - if (!tree2.u.equality.attr) { - return LDB_ERR_OPERATIONS_ERROR; - } - tree2.u.equality.value.data = - (uint8_t *)talloc_strdup(list, subclasses[i]); - if (tree2.u.equality.value.data == NULL) { - return LDB_ERR_OPERATIONS_ERROR; - } - tree2.u.equality.value.length = strlen(subclasses[i]); - list2 = talloc(list, struct dn_list); - if (list2 == NULL) { - talloc_free(tree2.u.equality.value.data); - return LDB_ERR_OPERATIONS_ERROR; - } - if (ltdb_index_dn_objectclass(module, &tree2, - index_list, list2) == LDB_SUCCESS) { - if (list->count == 0) { - *list = *list2; - ret = LDB_SUCCESS; - } else { - list_union(ldb, list, list2); - talloc_free(list2); - } - } - talloc_free(tree2.u.equality.value.data); - } - - return ret; -} - -/* return a list of dn's that might match a leaf indexed search */ static int ltdb_index_dn_leaf(struct ldb_module *module, @@ -326,9 +265,6 @@ static int ltdb_index_dn_leaf(struct ldb_module *module, const struct ldb_message *index_list, struct dn_list *list) { - if (ldb_attr_cmp(tree->u.equality.attr, LTDB_OBJECTCLASS) == 0) { - return ltdb_index_dn_objectclass(module, tree, index_list, list); - } if (ldb_attr_dn(tree->u.equality.attr) == 0) { list->dn = talloc_array(list, char *, 1); if (list->dn == NULL) { diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index 61b5f789d7..d4a8ff2fb1 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -21,7 +21,6 @@ struct ltdb_private { struct ltdb_cache { struct ldb_message *indexlist; struct ldb_message *attributes; - struct ldb_message *subclasses; struct { char *name; @@ -56,7 +55,6 @@ struct ltdb_context { #define LTDB_IDXONE "@IDXONE" #define LTDB_BASEINFO "@BASEINFO" #define LTDB_ATTRIBUTES "@ATTRIBUTES" -#define LTDB_SUBCLASSES "@SUBCLASSES" /* special attribute types */ #define LTDB_SEQUENCE_NUMBER "sequenceNumber" |