diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-06-30 17:17:24 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-07-01 17:58:47 +0200 |
commit | 2a918a353f3d0e5dc64ac89ad3e32a564aa094c9 (patch) | |
tree | cfbf2b30be864ebcf2bbd200e79a375ac1b74db0 /source4/dsdb/samdb/ldb_modules | |
parent | db0a105aae2ba32be4aa5658fc8963ba28933a6b (diff) | |
download | samba-2a918a353f3d0e5dc64ac89ad3e32a564aa094c9.tar.gz samba-2a918a353f3d0e5dc64ac89ad3e32a564aa094c9.tar.bz2 samba-2a918a353f3d0e5dc64ac89ad3e32a564aa094c9.zip |
schema_fsmo: prepare auto allocation of schema oid prefixes
This implements the logic in the schema_fsmo_add() function,
but it only calls a dummy dsdb_create_prefix_mapping() yet.
metze
(This used to be commit 9018b85e834de6714a78304ba1c7018838e30a61)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/schema_fsmo.c | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c index 0fcda0a430..01108605ec 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c +++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c @@ -241,7 +241,65 @@ static int schema_fsmo_init(struct ldb_module *module) return ldb_next_init(module); } +static int schema_fsmo_add(struct ldb_module *module, struct ldb_request *req) +{ + struct dsdb_schema *schema; + const char *attributeID = NULL; + const char *governsID = NULL; + const char *oid_attr = NULL; + const char *oid = NULL; + uint32_t id32; + WERROR status; + + schema = dsdb_get_schema(module->ldb); + if (!schema) { + return ldb_next_request(module, req); + } + + if (!schema->fsmo.we_are_master) { + ldb_debug_set(module->ldb, LDB_DEBUG_ERROR, + "schema_fsmo_add: we are not master: reject request\n"); + return LDB_ERR_UNWILLING_TO_PERFORM; + } + + attributeID = samdb_result_string(req->op.add.message, "attributeID", NULL); + governsID = samdb_result_string(req->op.add.message, "governsID", NULL); + + if (attributeID) { + oid_attr = "attributeID"; + oid = attributeID; + } else if (governsID) { + oid_attr = "governsID"; + oid = governsID; + } + + if (!oid) { + return ldb_next_request(module, req); + } + + status = dsdb_map_oid2int(schema, oid, &id32); + if (W_ERROR_IS_OK(status)) { + return ldb_next_request(module, req); + } else if (!W_ERROR_EQUAL(WERR_DS_NO_MSDS_INTID, status)) { + ldb_debug_set(module->ldb, LDB_DEBUG_ERROR, + "schema_fsmo_add: failed to map %s[%s]: %s\n", + oid_attr, oid, win_errstr(status)); + return LDB_ERR_UNWILLING_TO_PERFORM; + } + + status = dsdb_create_prefix_mapping(module->ldb, schema, oid); + if (!W_ERROR_IS_OK(status)) { + ldb_debug_set(module->ldb, LDB_DEBUG_ERROR, + "schema_fsmo_add: failed to create prefix mapping for %s[%s]: %s\n", + oid_attr, oid, win_errstr(status)); + return LDB_ERR_UNWILLING_TO_PERFORM; + } + + return ldb_next_request(module, req); +} + _PUBLIC_ const struct ldb_module_ops ldb_schema_fsmo_module_ops = { .name = "schema_fsmo", - .init_context = schema_fsmo_init + .init_context = schema_fsmo_init, + .add = schema_fsmo_add }; |