[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1703-gf6397fb

Günther Deschner gd at samba.org
Tue Jan 29 14:19:23 GMT 2008


The branch, v3-2-test has been updated
       via  f6397fbeae6668c6d0470f968cb1506b3ce34e4a (commit)
      from  3a3c1aed9bfc681457aa06f706fc6fe2d9b2e903 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit f6397fbeae6668c6d0470f968cb1506b3ce34e4a
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 29 14:59:20 2008 +0100

    Use another pidl generated call to enumerate ds trusted domains in winbindd.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/winbindd/winbindd_ads.c |   49 ++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/winbindd/winbindd_ads.c b/source/winbindd/winbindd_ads.c
index f963669..9bc3104 100644
--- a/source/winbindd/winbindd_ads.c
+++ b/source/winbindd/winbindd_ads.c
@@ -1157,8 +1157,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 				DOM_SID **dom_sids)
 {
 	NTSTATUS 		result = NT_STATUS_UNSUCCESSFUL;
-	struct ds_domain_trust	*domains = NULL;
-	int			count = 0;
+	struct netr_DomainTrustList trusts;
 	int			i;
 	uint32			flags;	
 	struct rpc_pipe_client *cli;
@@ -1194,29 +1193,27 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 			  domain->name, nt_errstr(result)));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
-	
-	if ( NT_STATUS_IS_OK(result) ) {
-		result = rpccli_ds_enum_domain_trusts(cli, mem_ctx,
-						      cli->cli->desthost, 
-						      flags, &domains,
-						      (unsigned int *)&count);
-	}
-	
-	if ( NT_STATUS_IS_OK(result) && count) {
+
+	result = rpccli_netr_DsrEnumerateDomainTrusts(cli, mem_ctx,
+						      cli->cli->desthost,
+						      flags,
+						      &trusts,
+						      NULL);
+	if ( NT_STATUS_IS_OK(result) && trusts.count) {
 
 		/* Allocate memory for trusted domain names and sids */
 
-		if ( !(*names = TALLOC_ARRAY(mem_ctx, char *, count)) ) {
+		if ( !(*names = TALLOC_ARRAY(mem_ctx, char *, trusts.count)) ) {
 			DEBUG(0, ("trusted_domains: out of memory\n"));
 			return NT_STATUS_NO_MEMORY;
 		}
 
-		if ( !(*alt_names = TALLOC_ARRAY(mem_ctx, char *, count)) ) {
+		if ( !(*alt_names = TALLOC_ARRAY(mem_ctx, char *, trusts.count)) ) {
 			DEBUG(0, ("trusted_domains: out of memory\n"));
 			return NT_STATUS_NO_MEMORY;
 		}
 
-		if ( !(*dom_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, count)) ) {
+		if ( !(*dom_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, trusts.count)) ) {
 			DEBUG(0, ("trusted_domains: out of memory\n"));
 			return NT_STATUS_NO_MEMORY;
 		}
@@ -1225,7 +1222,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 
 
 		ret_count = 0;		
-		for (i = 0; i < count; i++) {
+		for (i = 0; i < trusts.count; i++) {
 			struct winbindd_domain d;
 			
 			/* drop external trusts if this is not our primary 
@@ -1233,24 +1230,24 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 			   domains may be less that the ones actually trusted
 			   by the DC. */
 
-			if ( (domains[i].trust_attributes == DS_DOMAIN_TRUST_ATTRIB_QUARANTINED_DOMAIN) && 
+			if ( (trusts.array[i].trust_attributes == DS_DOMAIN_TRUST_ATTRIB_QUARANTINED_DOMAIN) &&
 			     !domain->primary ) 
 			{
 				DEBUG(10,("trusted_domains: Skipping external trusted domain "
 					  "%s because it is outside of our primary domain\n",
-					  domains[i].netbios_domain));				
+					  trusts.array[i].netbios_name));
 				continue;				
 			}
 			
-			(*names)[ret_count] = domains[i].netbios_domain;
-			(*alt_names)[ret_count] = domains[i].dns_domain;
-			sid_copy(&(*dom_sids)[ret_count], &domains[i].sid);
+			(*names)[ret_count] = CONST_DISCARD(char *, trusts.array[i].netbios_name);
+			(*alt_names)[ret_count] = CONST_DISCARD(char *, trusts.array[i].dns_name);
+			sid_copy(&(*dom_sids)[ret_count], trusts.array[i].sid);
 
 			/* add to the trusted domain cache */
 
-			fstrcpy( d.name,  domains[i].netbios_domain );
-			fstrcpy( d.alt_name, domains[i].dns_domain );			
-			sid_copy( &d.sid, &domains[i].sid );
+			fstrcpy( d.name,  trusts.array[i].netbios_name);
+			fstrcpy( d.alt_name, trusts.array[i].dns_name);
+			sid_copy( &d.sid, trusts.array[i].sid);
 
 			/* This gets a little tricky.  If we are
 			   following a transitive forest trust, then
@@ -1269,9 +1266,9 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 				   we have the current trust flags and
 				   attributes */
 
-				d.domain_flags = domains[i].flags;
-				d.domain_type = domains[i].trust_type;
-				d.domain_trust_attribs = domains[i].trust_attributes;
+				d.domain_flags = trusts.array[i].trust_flags;
+				d.domain_type = trusts.array[i].trust_type;
+				d.domain_trust_attribs = trusts.array[i].trust_attributes;
 			} else {
 				/* Look up the record in the cache */
 				struct winbindd_tdc_domain *parent;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list