1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-06 13:18:07 +03:00

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 <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4250d07e4d)
This commit is contained in:
Andrew Bartlett 2023-07-27 17:14:30 +12:00 committed by Jule Anger
parent ecbba6aec2
commit dc74e3e947

View File

@ -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) {