From 75ae19422b2b405cabe269c29afb61a1b50636d1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 11 Nov 2011 16:35:59 +0100 Subject: s4:dsdb/schema: pass and remember the schema_dn in dsdb_set_schema_from_ldif() metze --- source4/dsdb/pydsdb.c | 2 +- source4/dsdb/schema/schema_set.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 62b5c8db83..3c7c8bfaa1 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -838,7 +838,7 @@ static PyObject *py_dsdb_set_schema_from_ldif(PyObject *self, PyObject *args) PyErr_LDB_OR_RAISE(py_ldb, ldb); - result = dsdb_set_schema_from_ldif(ldb, pf, df); + result = dsdb_set_schema_from_ldif(ldb, pf, df, dn); PyErr_WERROR_IS_ERR_RAISE(result); Py_RETURN_NONE; diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index 18f3ab7b7c..6f735db486 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -683,7 +683,9 @@ WERROR dsdb_schema_set_el_from_ldb_msg(struct ldb_context *ldb, struct dsdb_sche * schema itself to the directory. */ -WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const char *df) +WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, + const char *pf, const char *df, + const char *dn) { struct ldb_ldif *ldif; struct ldb_message *msg; @@ -702,9 +704,15 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const } schema = dsdb_new_schema(mem_ctx); - + if (!schema) { + goto nomem; + } + schema->base_dn = ldb_dn_new(schema, ldb, dn); + if (!schema->base_dn) { + goto nomem; + } schema->fsmo.we_are_master = true; - schema->fsmo.master_dn = ldb_dn_new_fmt(schema, ldb, "@PROVISION_SCHEMA_MASTER"); + schema->fsmo.master_dn = ldb_dn_new(schema, ldb, "@PROVISION_SCHEMA_MASTER"); if (!schema->fsmo.master_dn) { goto nomem; } -- cgit