From: Andrew Bartlett Date: Tue, 27 Jun 2023 02:59:49 +0000 (+1200) Subject: s4-dsdb: Improve logging for drs_ObjectIdentifier_to_dn_and_nc_root() X-Git-Tag: samba-4.17.11~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=957c794891b31741ca2aef21f7fcba655a1c0040;p=thirdparty%2Fsamba.git s4-dsdb: Improve logging for drs_ObjectIdentifier_to_dn_and_nc_root() At this layer we can make a reasonable assumption about being able to read ldb_errstring() to print that for extra useful debugging. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15401 Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher (cherry picked from commit 63843a22c8db73d459bee61e73bb1f0d31e3d427) --- diff --git a/source4/dsdb/common/dsdb_dn.c b/source4/dsdb/common/dsdb_dn.c index c86848fd697..b34d1e6052a 100644 --- a/source4/dsdb/common/dsdb_dn.c +++ b/source4/dsdb/common/dsdb_dn.c @@ -554,6 +554,18 @@ int drs_ObjectIdentifier_to_dn_and_nc_root(TALLOC_CTX *mem_ctx, new_dn, normalised_dn, nc_root); + if (ret != LDB_SUCCESS) { + /* + * dsdb_normalise_dn_and_find_nc_root() sets LDB error + * strings, and the functions it calls do also + */ + DBG_NOTICE("Failed to find DN \"%s\" -> \"%s\" for normalisation: %s (%s)\n", + drs_ObjectIdentifier_to_debug_string(mem_ctx, nc), + ldb_dn_get_extended_linearized(mem_ctx, new_dn, 1), + ldb_errstring(ldb), + ldb_strerror(ret)); + } + TALLOC_FREE(new_dn); return ret; }