From: Andrew Bartlett Date: Thu, 27 Jul 2023 05:14:30 +0000 (+1200) Subject: dsdb: Use samdb_system_container_dn() in dsdb_trust_*() X-Git-Tag: samba-4.17.11~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc74e3e94704ce4a28a0adb8102f71abb723fae1;p=thirdparty%2Fsamba.git dsdb: Use samdb_system_container_dn() in dsdb_trust_*() This is now exactly the same actions, but just uses common code to do it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=9959 Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher (cherry picked from commit 4250d07e4dcd43bf7450b1ae603ff46fdc892d02) --- diff --git a/source4/dsdb/common/util_trusts.c b/source4/dsdb/common/util_trusts.c index 0f4d5584192..fd1aa2be4d4 100644 --- a/source4/dsdb/common/util_trusts.c +++ b/source4/dsdb/common/util_trusts.c @@ -2459,17 +2459,12 @@ NTSTATUS dsdb_trust_search_tdo(struct ldb_context *sam_ctx, return NT_STATUS_INVALID_PARAMETER_MIX; } - system_dn = ldb_dn_copy(frame, ldb_get_default_basedn(sam_ctx)); + system_dn = samdb_system_container_dn(sam_ctx, frame); if (system_dn == NULL) { TALLOC_FREE(frame); return NT_STATUS_NO_MEMORY; } - if (!ldb_dn_add_child_fmt(system_dn, "CN=System")) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; - } - if (netbios != NULL) { netbios_encoded = ldb_binary_encode_string(frame, netbios); if (netbios_encoded == NULL) { @@ -2617,17 +2612,12 @@ NTSTATUS dsdb_trust_search_tdo_by_sid(struct ldb_context *sam_ctx, return NT_STATUS_NO_MEMORY; } - system_dn = ldb_dn_copy(frame, ldb_get_default_basedn(sam_ctx)); + system_dn = samdb_system_container_dn(sam_ctx, frame); if (system_dn == NULL) { TALLOC_FREE(frame); return NT_STATUS_NO_MEMORY; } - if (!ldb_dn_add_child_fmt(system_dn, "CN=System")) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; - } - filter = talloc_asprintf(frame, "(&" "(objectClass=trustedDomain)" @@ -2794,17 +2784,12 @@ NTSTATUS dsdb_trust_search_tdos(struct ldb_context *sam_ctx, *res = NULL; - system_dn = ldb_dn_copy(frame, ldb_get_default_basedn(sam_ctx)); + system_dn = samdb_system_container_dn(sam_ctx, frame); if (system_dn == NULL) { TALLOC_FREE(frame); return NT_STATUS_NO_MEMORY; } - if (!ldb_dn_add_child_fmt(system_dn, "CN=System")) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; - } - if (exclude != NULL) { exclude_encoded = ldb_binary_encode_string(frame, exclude); if (exclude_encoded == NULL) {