diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-04-06 15:17:05 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-04-09 12:21:30 +0300 |
commit | 6d439afbf77b15d34310144c473f6600148f7d84 (patch) | |
tree | 687a2d9c0b60872d4076c7151d8315ba46c44826 /source4/dsdb/samdb | |
parent | 7f0da64a4990f21f67afde192322a53bcb4438ce (diff) | |
download | samba-6d439afbf77b15d34310144c473f6600148f7d84.tar.gz samba-6d439afbf77b15d34310144c473f6600148f7d84.tar.bz2 samba-6d439afbf77b15d34310144c473f6600148f7d84.zip |
s4/samldb: schemaInfo attribute must be updated when adding new Schema object
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 24d1450d9c..3b2d283006 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -1054,6 +1054,44 @@ static int samldb_check_rdn(struct ldb_module *module, struct ldb_dn *dn) return LDB_SUCCESS; } +static int samldb_schema_info_update(struct samldb_ctx *ac) +{ + WERROR werr; + struct ldb_context *ldb; + struct dsdb_schema *schema; + + /* replicated update should always go through */ + if (ldb_request_get_control(ac->req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) { + return LDB_SUCCESS; + } + + /* do not update schemaInfo during provisioning */ + if (ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID)) { + return LDB_SUCCESS; + } + + ldb = ldb_module_get_ctx(ac->module); + schema = dsdb_get_schema(ldb, NULL); + if (!schema) { + ldb_debug_set(ldb, LDB_DEBUG_FATAL, + "samldb_schema_info_update: no dsdb_schema loaded"); + DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb))); + return LDB_ERR_OPERATIONS_ERROR; + } + + werr = dsdb_module_schema_info_update(ac->module, schema, 0); + if (!W_ERROR_IS_OK(werr)) { + ldb_debug_set(ldb, LDB_DEBUG_FATAL, + "samldb_schema_info_update: " + "dsdb_module_schema_info_update failed with %s", + win_errstr(werr)); + DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb))); + return LDB_ERR_OPERATIONS_ERROR; + } + + return LDB_SUCCESS; +} + /* * samldb_sid_from_dn (async) */ @@ -1800,6 +1838,12 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req) return ret; } + ret = samldb_schema_info_update(ac); + if (ret != LDB_SUCCESS) { + talloc_free(ac); + return ret; + } + return samldb_fill_object(ac, "classSchema"); } @@ -1812,6 +1856,12 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req) return ret; } + ret = samldb_schema_info_update(ac); + if (ret != LDB_SUCCESS) { + talloc_free(ac); + return ret; + } + return samldb_fill_object(ac, "attributeSchema"); } |