From: Aaron Haslett Date: Tue, 1 May 2018 03:51:10 +0000 (+1200) Subject: samdb rid: clear cache to prevent old ntds_guid X-Git-Tag: ldb-1.4.0~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b72d4c7bbb8462232d685e17612b06b4cca57f2;p=thirdparty%2Fsamba.git samdb rid: clear cache to prevent old ntds_guid During the new samba-tool domain backup restore the NTDS GUID changes as the server is taken over by the new DC record. Signed-off-by: Aaron Haslett Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c b/source4/dsdb/samdb/ldb_modules/ridalloc.c index abfe14a5a80..b436b9b5435 100644 --- a/source4/dsdb/samdb/ldb_modules/ridalloc.c +++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c @@ -443,6 +443,12 @@ int ridalloc_create_own_rid_set(struct ldb_module *module, TALLOC_CTX *mem_ctx, return ldb_operr(ldb_module_get_ctx(module)); } + /* clear the cache so we don't get an old ntds_guid */ + if (ldb_set_opaque(ldb, "cache.ntds_guid", NULL) != LDB_SUCCESS) { + talloc_free(tmp_ctx); + return ldb_operr(ldb_module_get_ctx(module)); + } + our_ntds_guid = samdb_ntds_objectGUID(ldb_module_get_ctx(module)); if (!our_ntds_guid) { talloc_free(tmp_ctx);