mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
rpc_client/cli_lsarpc.c:
rpc_parse/parse_lsa.c: nsswitch/winbindd_rpc.c: nsswitch/winbindd.h: - Add const libads/ads_ldap.c: - Cleanup function for use nsswitch/winbindd_ads.c: - Use new utility function ads_sid_to_dn - Don't search for 'dn=', rather call the ads_search_retry_dn() nsswitch/winbindd_ads.c: include/rpc_ds.h: rpc_client/cli_ds.c: - Fixup braindamage in cli_ds_enum_domain_trusts(): - This function was returning a UNISTR2 up to the caller, and was doing nasty (invalid, per valgrind) things with memcpy() - Create a new structure that represents this informaiton in a useful way and use talloc. Andrew Bartlett
This commit is contained in:
@ -82,7 +82,7 @@ done:
|
||||
|
||||
NTSTATUS cli_ds_enum_domain_trusts(struct cli_state *cli, TALLOC_CTX *mem_ctx,
|
||||
const char *server, uint32 flags,
|
||||
DS_DOMAIN_TRUSTS **trusts, uint32 *num_domains)
|
||||
struct ds_domain_trust **trusts, uint32 *num_domains)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
DS_Q_ENUM_DOM_TRUSTS q;
|
||||
@ -118,12 +118,32 @@ NTSTATUS cli_ds_enum_domain_trusts(struct cli_state *cli, TALLOC_CTX *mem_ctx,
|
||||
int i;
|
||||
|
||||
*num_domains = r.num_domains;
|
||||
*trusts = (DS_DOMAIN_TRUSTS*)smb_xmalloc(r.num_domains*sizeof(DS_DOMAIN_TRUSTS));
|
||||
|
||||
memcpy( *trusts, r.domains.trusts, r.num_domains*sizeof(DS_DOMAIN_TRUSTS) );
|
||||
for ( i=0; i<r.num_domains; i++ ) {
|
||||
copy_unistr2( &(*trusts)[i].netbios_domain, &r.domains.trusts[i].netbios_domain );
|
||||
copy_unistr2( &(*trusts)[i].dns_domain, &r.domains.trusts[i].dns_domain );
|
||||
*trusts = (struct ds_domain_trust*)talloc(mem_ctx, r.num_domains*sizeof(**trusts));
|
||||
|
||||
for ( i=0; i< *num_domains; i++ ) {
|
||||
(*trusts)[i].flags = r.domains.trusts[i].flags;
|
||||
(*trusts)[i].parent_index = r.domains.trusts[i].parent_index;
|
||||
(*trusts)[i].trust_type = r.domains.trusts[i].trust_type;
|
||||
(*trusts)[i].trust_attributes = r.domains.trusts[i].trust_attributes;
|
||||
(*trusts)[i].guid = r.domains.trusts[i].guid;
|
||||
|
||||
if (&r.domains.trusts[i].sid_ptr) {
|
||||
sid_copy(&(*trusts)[i].sid, &r.domains.trusts[i].sid.sid);
|
||||
} else {
|
||||
ZERO_STRUCT((*trusts)[i].sid);
|
||||
}
|
||||
|
||||
if (&r.domains.trusts[i].netbios_ptr) {
|
||||
(*trusts)[i].netbios_domain = unistr2_tdup( mem_ctx, &r.domains.trusts[i].netbios_domain );
|
||||
} else {
|
||||
(*trusts)[i].netbios_domain = NULL;
|
||||
}
|
||||
|
||||
if (&r.domains.trusts[i].dns_ptr) {
|
||||
(*trusts)[i].dns_domain = unistr2_tdup( mem_ctx, &r.domains.trusts[i].dns_domain );
|
||||
} else {
|
||||
(*trusts)[i].dns_domain = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user