diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-11-16 18:46:28 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-11-17 10:38:02 +1100 |
commit | 07953142a4755354a8e76fa217c6cbf1b5dbcf30 (patch) | |
tree | ba9ce648b532d84b856782d2a29c7e97c4a565be /source4/dsdb/samdb/ldb_modules/extended_dn_out.c | |
parent | 0238147a855c65ea0a81b0a945ae8ffd9b260c75 (diff) | |
download | samba-07953142a4755354a8e76fa217c6cbf1b5dbcf30.tar.gz samba-07953142a4755354a8e76fa217c6cbf1b5dbcf30.tar.bz2 samba-07953142a4755354a8e76fa217c6cbf1b5dbcf30.zip |
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
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/extended_dn_out.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/extended_dn_out.c | 31 |
1 files changed, 31 insertions, 0 deletions
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 |