summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-01-05 23:54:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2004-01-05 23:54:37 +0000
commit81e028f4ace8eddab33ab2d76de1055b7dacc92e (patch)
treea94443dadeaf14afae6bcaee76a53df44175f310 /source3/rpc_client
parent716d933a858265a664bc5dc862d24bda9473e816 (diff)
downloadsamba-81e028f4ace8eddab33ab2d76de1055b7dacc92e.tar.gz
samba-81e028f4ace8eddab33ab2d76de1055b7dacc92e.tar.bz2
samba-81e028f4ace8eddab33ab2d76de1055b7dacc92e.zip
rpc_client/cli_lsarpc.c:
rpc_parse/parse_lsa.c: nsswitch/winbindd_rpc.c: nsswitch/winbindd.h: - Add const libads/ads_ldap.c: - Add ads_sid_to_dn utility function 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 627d33d1667f0d4b1070f988494885b74c4c04dd)
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 163e847922..0ec9beb1a4 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;