diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-02-27 16:46:22 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-02-27 07:36:05 +0100 |
commit | e7397eeaa2631cde263ff324fda8fafa290bff8c (patch) | |
tree | 8f1462102dfc953b633a7b1f784477df2f1e4195 /source4 | |
parent | 90c03ccf4c7bb33ac8b6c1338ec97642bcf8251b (diff) | |
download | samba-e7397eeaa2631cde263ff324fda8fafa290bff8c.tar.gz samba-e7397eeaa2631cde263ff324fda8fafa290bff8c.tar.bz2 samba-e7397eeaa2631cde263ff324fda8fafa290bff8c.zip |
s4-netlogond: Fix use of uninitialised value dns_name
The GET_CHECK_STR macro (now unrolled) did not initialise the trusts->array[n].dns_name
when the value was not set. New tests for our trusted domains code create
domain trusts without a DNS domain name. Found by the autobuild flakey build detector.
Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/netlogon/dcerpc_netlogon.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 6d6cfe031a..1cbd9583c7 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -2088,21 +2088,6 @@ static WERROR dcesrv_netr_DsrGetDcSiteCoverageW(struct dcesrv_call_state *dce_ca } -#define GET_CHECK_STR(dest, mem, msg, attr) \ -do {\ - const char *s; \ - s = ldb_msg_find_attr_as_string(msg, attr, NULL); \ - if (!s) { \ - DEBUG(0, ("DB Error, TustedDomain entry (%s) " \ - "without flatname\n", \ - ldb_dn_get_linearized(msg->dn))); \ - continue; \ - } \ - dest = talloc_strdup(mem, s); \ - W_ERROR_HAVE_NO_MEMORY(dest); \ -} while(0) - - static WERROR fill_trusted_domains_array(TALLOC_CTX *mem_ctx, struct ldb_context *sam_ctx, struct netr_DomainTrustList *trusts, @@ -2158,10 +2143,14 @@ static WERROR fill_trusted_domains_array(TALLOC_CTX *mem_ctx, n + 1); W_ERROR_HAVE_NO_MEMORY(trusts->array); - GET_CHECK_STR(trusts->array[n].netbios_name, trusts, - dom_res[i], "flatname"); - GET_CHECK_STR(trusts->array[n].dns_name, trusts, - dom_res[i], "trustPartner"); + trusts->array[n].netbios_name = talloc_steal(trusts->array, ldb_msg_find_attr_as_string(dom_res[i], "flatname", NULL)); + if (!trusts->array[n].netbios_name) { + DEBUG(0, ("DB Error, TrustedDomain entry (%s) " + "without flatname\n", + ldb_dn_get_linearized(dom_res[i]->dn))); + } + + trusts->array[n].dns_name = talloc_steal(trusts->array, ldb_msg_find_attr_as_string(dom_res[i], "trustPartner", NULL)); trusts->array[n].trust_flags = flags; if ((trust_flags & NETR_TRUST_FLAG_IN_FOREST) && |