From 07953142a4755354a8e76fa217c6cbf1b5dbcf30 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 Nov 2009 18:46:28 +1100 Subject: s4:dsdb Rework samdb code to use 'storage format' DNs for defaultObjectCategory It is important to always ensure that this attribute has an extended DN if the rest of the database stores things that way. The knowlege of what format the DN is stored on disk with is passed around in an LDB opaque. Andrew Bartlett --- source4/dsdb/samdb/ldb_modules/extended_dn_out.c | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'source4/dsdb/samdb/ldb_modules/extended_dn_out.c') diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c index bf70c3e80f..a3e4f57f4b 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c @@ -665,6 +665,7 @@ static int extended_dn_out_ldb_init(struct ldb_module *module) int ret; struct extended_dn_out_private *p = talloc(module, struct extended_dn_out_private); + struct dsdb_extended_dn_store_format *dn_format; ldb_module_set_private(module, p); @@ -673,6 +674,20 @@ static int extended_dn_out_ldb_init(struct ldb_module *module) return LDB_ERR_OPERATIONS_ERROR; } + dn_format = talloc(p, struct dsdb_extended_dn_store_format); + if (!dn_format) { + talloc_free(p); + ldb_oom(ldb_module_get_ctx(module)); + return LDB_ERR_OPERATIONS_ERROR; + } + + dn_format->store_extended_dn_in_ldb = true; + ret = ldb_set_opaque(ldb_module_get_ctx(module), DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME, dn_format); + if (ret != LDB_SUCCESS) { + talloc_free(p); + return ret; + } + p->dereference = false; p->normalise = false; @@ -690,6 +705,7 @@ static int extended_dn_out_dereference_init(struct ldb_module *module, const cha { int ret, i = 0; struct extended_dn_out_private *p = talloc_zero(module, struct extended_dn_out_private); + struct dsdb_extended_dn_store_format *dn_format; struct dsdb_openldap_dereference_control *dereference_control; struct dsdb_attribute *cur; struct ldb_context *ldb = ldb_module_get_ctx(module); @@ -702,6 +718,21 @@ static int extended_dn_out_dereference_init(struct ldb_module *module, const cha return LDB_ERR_OPERATIONS_ERROR; } + dn_format = talloc(p, struct dsdb_extended_dn_store_format); + if (!dn_format) { + talloc_free(p); + ldb_oom(ldb_module_get_ctx(module)); + return LDB_ERR_OPERATIONS_ERROR; + } + + dn_format->store_extended_dn_in_ldb = false; + + ret = ldb_set_opaque(ldb_module_get_ctx(module), DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME, dn_format); + if (ret != LDB_SUCCESS) { + talloc_free(p); + return ret; + } + p->dereference = true; /* At the moment, servers that need dereference also need the -- cgit