summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema
diff options
context:
space:
mode:
authorNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-09-21 17:29:28 -0700
committerNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-09-21 17:29:28 -0700
commit9e85192e6415fbaacf394330f6e61759190485ad (patch)
tree9e9a8c9d7fdd4dbcc471e69c4c4708eb6ae11dc3 /source4/dsdb/schema
parent10c6f3f71a4fe3e36e2a0476dc0077187371fafb (diff)
parentb850d7fb08b97fff8ce5ec2cbff2256aa390e440 (diff)
downloadsamba-9e85192e6415fbaacf394330f6e61759190485ad.tar.gz
samba-9e85192e6415fbaacf394330f6e61759190485ad.tar.bz2
samba-9e85192e6415fbaacf394330f6e61759190485ad.zip
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r--source4/dsdb/schema/schema_init.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 9f7d967158..fa1953a14f 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -1028,6 +1028,7 @@ int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
"fSMORoleOwner",
NULL
};
+ unsigned flags;
tmp_ctx = talloc_new(mem_ctx);
if (!tmp_ctx) {
@@ -1035,27 +1036,28 @@ int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
return LDB_ERR_OPERATIONS_ERROR;
}
+ /* we don't want to trace the schema load */
+ flags = ldb_get_flags(ldb);
+ ldb_set_flags(ldb, flags & ~LDB_FLG_ENABLE_TRACING);
+
/*
* setup the prefix mappings and schema info
*/
ret = ldb_search(ldb, tmp_ctx, &schema_res,
schema_dn, LDB_SCOPE_BASE, schema_attrs, NULL);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
- talloc_free(tmp_ctx);
- return ret;
+ goto failed;
} else if (ret != LDB_SUCCESS) {
*error_string_out = talloc_asprintf(mem_ctx,
"dsdb_schema: failed to search the schema head: %s",
ldb_errstring(ldb));
- talloc_free(tmp_ctx);
- return ret;
+ goto failed;
}
if (schema_res->count != 1) {
*error_string_out = talloc_asprintf(mem_ctx,
"dsdb_schema: [%u] schema heads found on a base search",
schema_res->count);
- talloc_free(tmp_ctx);
- return LDB_ERR_CONSTRAINT_VIOLATION;
+ goto failed;
}
/*
@@ -1068,8 +1070,7 @@ int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
*error_string_out = talloc_asprintf(mem_ctx,
"dsdb_schema: failed to search attributeSchema objects: %s",
ldb_errstring(ldb));
- talloc_free(tmp_ctx);
- return ret;
+ goto failed;
}
/*
@@ -1082,8 +1083,7 @@ int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
*error_string_out = talloc_asprintf(mem_ctx,
"dsdb_schema: failed to search attributeSchema objects: %s",
ldb_errstring(ldb));
- talloc_free(tmp_ctx);
- return ret;
+ goto failed;
}
ret = dsdb_schema_from_ldb_results(tmp_ctx, ldb,
@@ -1093,13 +1093,25 @@ int dsdb_schema_from_schema_dn(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
*error_string_out = talloc_asprintf(mem_ctx,
"dsdb_schema load failed: %s",
error_string);
- talloc_free(tmp_ctx);
- return ret;
+ goto failed;
}
talloc_steal(mem_ctx, *schema);
talloc_free(tmp_ctx);
+ if (flags & LDB_FLG_ENABLE_TRACING) {
+ flags = ldb_get_flags(ldb);
+ ldb_set_flags(ldb, flags | LDB_FLG_ENABLE_TRACING);
+ }
+
return LDB_SUCCESS;
+
+failed:
+ if (flags & LDB_FLG_ENABLE_TRACING) {
+ flags = ldb_get_flags(ldb);
+ ldb_set_flags(ldb, flags | LDB_FLG_ENABLE_TRACING);
+ }
+ talloc_free(tmp_ctx);
+ return ret;
}