From: Andrew Bartlett Date: Tue, 14 Aug 2012 07:49:12 +0000 (+1000) Subject: s4-dsdb: Use ldb_dn_copy() rather than talloc_reference() X-Git-Tag: tevent-0.9.17~75 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c8d8f206b79280604cb79f263e74aa2b681726e;p=thirdparty%2Fsamba.git s4-dsdb: Use ldb_dn_copy() rather than talloc_reference() As the normal case (outside provision) uses a copy, this avoids a case where a caller might modify a global variable accidentily. As suggested by metze. Andrew Bartlett --- diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index fd54e4adb94..565dc363063 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -1252,7 +1252,7 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb, TALLOC_CTX *mem_c /* see if we have a cached copy */ settings_dn = (struct ldb_dn *)ldb_get_opaque(ldb, "forced.ntds_settings_dn"); if (settings_dn) { - return talloc_reference(mem_ctx, settings_dn); + return ldb_dn_copy(mem_ctx, settings_dn); } tmp_ctx = talloc_new(mem_ctx);