From fb490d88c1b43ae95ef8be7c32be4f3562eba4e2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 11 Aug 2011 16:29:24 +1000 Subject: 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 --- source4/dsdb/common/util.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source4') 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); -- cgit