From 28a6881d4f4aac814cb01ca87e113caf4b1c8026 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 Sep 2011 09:03:39 +1000 Subject: [PATCH] s4-lsa: fixed set of trust password with old password the calculation of add_incoming and add_outgoing was not correct when a trust was already in place Pair-Programmed-With: Andrew Bartlett --- source4/rpc_server/lsa/dcesrv_lsa.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index d5c1b61f584..5acdfe80460 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -1736,7 +1736,6 @@ static NTSTATUS setInfoTrustedDomain_base(struct dcesrv_call_state *dce_call, if (info_ex) { uint32_t origattrs; uint32_t origdir; - uint32_t tmp; int origtype; nt_status = update_uint32_t_value(mem_ctx, p_state->sam_ldb, @@ -1748,20 +1747,20 @@ static NTSTATUS setInfoTrustedDomain_base(struct dcesrv_call_state *dce_call, return nt_status; } - tmp = info_ex->trust_direction ^ origdir; - if (tmp & LSA_TRUST_DIRECTION_INBOUND) { - if (origdir & LSA_TRUST_DIRECTION_INBOUND) { - del_incoming = true; - } else { - add_incoming = true; - } + if (info_ex->trust_direction & LSA_TRUST_DIRECTION_INBOUND) { + add_incoming = true; } - if (tmp & LSA_TRUST_DIRECTION_OUTBOUND) { - if (origdir & LSA_TRUST_DIRECTION_OUTBOUND) { - del_outgoing = true; - } else { - add_outgoing = true; - } + if (info_ex->trust_direction & LSA_TRUST_DIRECTION_OUTBOUND) { + add_outgoing = true; + } + + if ((origdir & LSA_TRUST_DIRECTION_INBOUND) && + !(info_ex->trust_direction & LSA_TRUST_DIRECTION_INBOUND)) { + del_incoming = true; + } + if ((origdir & LSA_TRUST_DIRECTION_OUTBOUND) && + !(info_ex->trust_direction & LSA_TRUST_DIRECTION_OUTBOUND)) { + del_outgoing = true; } origtype = ldb_msg_find_attr_as_int(dom_msg, "trustType", -1); -- 2.34.1