summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-08-11 16:29:24 +1000
committerAndrew Tridgell <tridge@samba.org>2011-08-12 04:00:07 +0200
commitfb490d88c1b43ae95ef8be7c32be4f3562eba4e2 (patch)
tree89f4da9e314340b98ec18389d64b1c54ab6e76f2 /source4/dsdb/common
parentbb6214d63440d52227ea94d1788b6875b4d4742c (diff)
downloadsamba-fb490d88c1b43ae95ef8be7c32be4f3562eba4e2.tar.gz
samba-fb490d88c1b43ae95ef8be7c32be4f3562eba4e2.tar.bz2
samba-fb490d88c1b43ae95ef8be7c32be4f3562eba4e2.zip
s4-dsdb: don't cache the NTDS settings DN
this DN can change due to a server rename, so we cannot cache it. It is set by provision, but not anywhere else. This seems to not have a large performance impact Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index f306748d08..3b287e3635 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1252,9 +1252,9 @@ bool samdb_set_ntds_settings_dn(struct ldb_context *ldb, struct ldb_dn *ntds_set
struct ldb_dn *ntds_settings_dn_new;
struct ldb_dn *ntds_settings_dn_old;
- /* see if we have a cached copy */
+ /* see if we have a forced copy from provision */
ntds_settings_dn_old = talloc_get_type(ldb_get_opaque(ldb,
- "cache.ntds_settings_dn"), struct ldb_dn);
+ "forced.ntds_settings_dn"), struct ldb_dn);
tmp_ctx = talloc_new(ldb);
if (tmp_ctx == NULL) {
@@ -1266,8 +1266,8 @@ bool samdb_set_ntds_settings_dn(struct ldb_context *ldb, struct ldb_dn *ntds_set
goto failed;
}
- /* cache the domain_sid in the ldb */
- if (ldb_set_opaque(ldb, "cache.ntds_settings_dn", ntds_settings_dn_new) != LDB_SUCCESS) {
+ /* set the DN in the ldb to avoid lookups during provision */
+ if (ldb_set_opaque(ldb, "forced.ntds_settings_dn", ntds_settings_dn_new) != LDB_SUCCESS) {
goto failed;
}
@@ -1295,7 +1295,7 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb)
struct ldb_dn *settings_dn;
/* see if we have a cached copy */
- settings_dn = (struct ldb_dn *)ldb_get_opaque(ldb, "cache.ntds_settings_dn");
+ settings_dn = (struct ldb_dn *)ldb_get_opaque(ldb, "forced.ntds_settings_dn");
if (settings_dn) {
return settings_dn;
}
@@ -1318,10 +1318,9 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb)
settings_dn = ldb_msg_find_attr_as_dn(ldb, tmp_ctx, root_res->msgs[0], "dsServiceName");
- /* cache the domain_sid in the ldb */
- if (ldb_set_opaque(ldb, "cache.ntds_settings_dn", settings_dn) != LDB_SUCCESS) {
- goto failed;
- }
+ /* note that we do not cache the DN here, as that would mean
+ * we could not handle server renames at runtime. Only
+ * provision sets up forced.ntds_settings_dn */
talloc_steal(ldb, settings_dn);
talloc_free(tmp_ctx);