summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-01-05 02:04:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2004-01-05 02:04:37 +0000
commit614c18d24bc1bb19c884138c8c16099d1b8484d2 (patch)
treee4133565818bb5fba4e679be42d953fcdd1302b8 /source3/rpc_client
parent685e0cbeb846cfbd09bb0f497968c5354f13de00 (diff)
downloadsamba-614c18d24bc1bb19c884138c8c16099d1b8484d2.tar.gz
samba-614c18d24bc1bb19c884138c8c16099d1b8484d2.tar.bz2
samba-614c18d24bc1bb19c884138c8c16099d1b8484d2.zip
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 used to be commit 06c3f15aa166bb567d8be0a8bc4b095b167ab371)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_ds.c34
-rw-r--r--source3/rpc_client/cli_lsarpc.c2
2 files changed, 28 insertions, 8 deletions
diff --git a/source3/rpc_client/cli_ds.c b/source3/rpc_client/cli_ds.c
index a7a093328c..f8455edcd9 100644
--- a/source3/rpc_client/cli_ds.c
+++ b/source3/rpc_client/cli_ds.c
@@ -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;
+ }
}
}
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index ab4fbad613..3b1f5478c6 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -217,7 +217,7 @@ NTSTATUS cli_lsa_close(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/** Lookup a list of sids */
NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol, int num_sids, DOM_SID *sids,
+ POLICY_HND *pol, int num_sids, const DOM_SID *sids,
char ***domains, char ***names, uint32 **types)
{
prs_struct qbuf, rbuf;