summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-09-18 22:43:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:06:56 -0500
commitc64116e158080c7cd7304cdd3b80c8666f78c7c6 (patch)
tree085c09bd111eb1277e2d054b71042f7460fa44c5 /source4/lib/ldb/common
parent425cb6733cf25a79fae79744ddffe06ac1b11f6b (diff)
downloadsamba-c64116e158080c7cd7304cdd3b80c8666f78c7c6.tar.gz
samba-c64116e158080c7cd7304cdd3b80c8666f78c7c6.tar.bz2
samba-c64116e158080c7cd7304cdd3b80c8666f78c7c6.zip
r25218: After discussion with Simo, remove the subclass support from LDB.
Subclass support was designed to avoid needing to spell out the full list of objectClasses that an entry was in. However, Samba4 now enforces this restriction in the objectClass module, and the way subclass matching was handled was complex and counter-intuitive in my opinion (and did not match LDAP). Andrew Bartlett (This used to be commit f5ce04b904e14445a2a7e7f92e7e1f64b645c6f2)
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c29
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c111
2 files changed, 1 insertions, 139 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index b8747c3b95..8ed2763d4d 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -278,33 +278,6 @@ int ldb_comparison_dn(struct ldb_context *ldb, void *mem_ctx,
}
/*
- compare two objectclasses, looking at subclasses
-*/
-int ldb_comparison_objectclass(struct ldb_context *ldb, void *mem_ctx,
- const struct ldb_val *v1, const struct ldb_val *v2)
-{
- int ret, i;
- const char **subclasses;
- ret = ldb_comparison_fold(ldb, mem_ctx, v1, v2);
- if (ret == 0) {
- return 0;
- }
- subclasses = ldb_subclass_list(ldb, (char *)v1->data);
- if (subclasses == NULL) {
- return ret;
- }
- for (i=0;subclasses[i];i++) {
- struct ldb_val vs;
- vs.data = discard_const(subclasses[i]);
- vs.length = strlen(subclasses[i]);
- if (ldb_comparison_objectclass(ldb, mem_ctx, &vs, v2) == 0) {
- return 0;
- }
- }
- return ret;
-}
-
-/*
compare two utc time values. 1 second resolution
*/
int ldb_comparison_utctime(struct ldb_context *ldb, void *mem_ctx,
@@ -368,7 +341,7 @@ static const struct ldb_schema_syntax ldb_standard_syntaxes[] = {
.ldif_read_fn = ldb_handler_copy,
.ldif_write_fn = ldb_handler_copy,
.canonicalise_fn = ldb_handler_fold,
- .comparison_fn = ldb_comparison_objectclass
+ .comparison_fn = ldb_comparison_fold
},
{
.name = LDB_SYNTAX_UTC_TIME,
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index 358d2f18bd..effd93ae26 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -204,114 +204,3 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb)
return LDB_SUCCESS;
}
-/*
- return the list of subclasses for a class
-*/
-const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname)
-{
- int i;
- for (i=0;i<ldb->schema.num_classes;i++) {
- if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) {
- return (const char **)ldb->schema.classes[i].subclasses;
- }
- }
- return NULL;
-}
-
-
-/*
- add a new subclass
-*/
-static int ldb_subclass_new(struct ldb_context *ldb, const char *classname, const char *subclass)
-{
- struct ldb_subclass *s, *c;
- s = talloc_realloc(ldb, ldb->schema.classes, struct ldb_subclass, ldb->schema.num_classes+1);
- if (s == NULL) goto failed;
-
- ldb->schema.classes = s;
- c = &s[ldb->schema.num_classes];
- c->name = talloc_strdup(s, classname);
- if (c->name == NULL) goto failed;
-
- c->subclasses = talloc_array(s, char *, 2);
- if (c->subclasses == NULL) goto failed;
-
- c->subclasses[0] = talloc_strdup(c->subclasses, subclass);
- if (c->subclasses[0] == NULL) goto failed;
- c->subclasses[1] = NULL;
-
- ldb->schema.num_classes++;
-
- return 0;
-failed:
- ldb_oom(ldb);
- return -1;
-}
-
-/*
- add a subclass
-*/
-int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass)
-{
- int i, n;
- struct ldb_subclass *c;
- char **s;
-
- for (i=0;i<ldb->schema.num_classes;i++) {
- if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) {
- break;
- }
- }
- if (i == ldb->schema.num_classes) {
- return ldb_subclass_new(ldb, classname, subclass);
- }
- c = &ldb->schema.classes[i];
-
- for (n=0;c->subclasses[n];n++) /* noop */;
-
- s = talloc_realloc(ldb->schema.classes, c->subclasses, char *, n+2);
- if (s == NULL) {
- ldb_oom(ldb);
- return -1;
- }
-
- c->subclasses = s;
- s[n] = talloc_strdup(s, subclass);
- if (s[n] == NULL) {
- ldb_oom(ldb);
- return -1;
- }
- s[n+1] = NULL;
-
- return 0;
-}
-
-/*
- remove a set of subclasses for a class
-*/
-void ldb_subclass_remove(struct ldb_context *ldb, const char *classname)
-{
- int i;
- struct ldb_subclass *c;
-
- for (i=0;i<ldb->schema.num_classes;i++) {
- if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) {
- break;
- }
- }
- if (i == ldb->schema.num_classes) {
- return;
- }
-
- c = &ldb->schema.classes[i];
- talloc_free(c->name);
- talloc_free(c->subclasses);
- if (ldb->schema.num_classes-(i+1) > 0) {
- memmove(c, c+1, sizeof(*c) * (ldb->schema.num_classes-(i+1)));
- }
- ldb->schema.num_classes--;
- if (ldb->schema.num_classes == 0) {
- talloc_free(ldb->schema.classes);
- ldb->schema.classes = NULL;
- }
-}