diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-08-25 11:39:03 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-09-05 11:19:25 +0200 |
commit | 1afeb4e391c99fa3513d460d3a8f08d9609f5a7e (patch) | |
tree | 1eeb696df242ed4168daca04d4721900d31ecae1 /source4/dsdb/samdb | |
parent | ad3734194991f55492b92a6330f055c10e6fd1e1 (diff) | |
download | samba-1afeb4e391c99fa3513d460d3a8f08d9609f5a7e.tar.gz samba-1afeb4e391c99fa3513d460d3a8f08d9609f5a7e.tar.bz2 samba-1afeb4e391c99fa3513d460d3a8f08d9609f5a7e.zip |
s4-schema consolidate schema handling
It also creates a single routine dsdb_load_ldb_results_into_schema()
to handle cases where the schema is in the form of an ldb_result.
Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/schema_load.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c index b7b5f6bae7..ec574b33e3 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_load.c +++ b/source4/dsdb/samdb/ldb_modules/schema_load.c @@ -150,8 +150,7 @@ static int dsdb_schema_from_db(struct ldb_module *module, struct ldb_dn *schema_ char *error_string; int ret; struct ldb_result *schema_res; - struct ldb_result *a_res; - struct ldb_result *c_res; + struct ldb_result *res; static const char *schema_attrs[] = { "prefixMap", "schemaInfo", @@ -190,36 +189,21 @@ static int dsdb_schema_from_db(struct ldb_module *module, struct ldb_dn *schema_ /* * load the attribute definitions */ - ret = dsdb_module_search(module, tmp_ctx, &a_res, - schema_dn, LDB_SCOPE_ONELEVEL, NULL, - DSDB_FLAG_NEXT_MODULE, - NULL, - "(objectClass=attributeSchema)"); - if (ret != LDB_SUCCESS) { - ldb_asprintf_errstring(ldb, - "dsdb_schema: failed to search attributeSchema objects: %s", - ldb_errstring(ldb)); - goto failed; - } - - /* - * load the objectClass definitions - */ - ret = dsdb_module_search(module, tmp_ctx, &c_res, + ret = dsdb_module_search(module, tmp_ctx, &res, schema_dn, LDB_SCOPE_ONELEVEL, NULL, DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT, NULL, - "(objectClass=classSchema)"); + "(|(objectClass=attributeSchema)(objectClass=classSchema))"); if (ret != LDB_SUCCESS) { ldb_asprintf_errstring(ldb, - "dsdb_schema: failed to search classSchema objects: %s", + "dsdb_schema: failed to search attributeSchema and classSchema objects: %s", ldb_errstring(ldb)); goto failed; } ret = dsdb_schema_from_ldb_results(tmp_ctx, ldb, - schema_res, a_res, c_res, schema, &error_string); + schema_res, res, schema, &error_string); if (ret != LDB_SUCCESS) { ldb_asprintf_errstring(ldb, "dsdb_schema load failed: %s", |