svn commit: samba r9564 - in branches/SOC/SAMBA_4_0: . source/libnet

brad at samba.org brad at samba.org
Wed Aug 24 03:43:11 GMT 2005


Author: brad
Date: 2005-08-24 03:43:11 +0000 (Wed, 24 Aug 2005)
New Revision: 9564

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9564

Log:
 r5614 at buttercup:  j0j0 | 2005-08-23 21:50:38 -0600
 Gave libnet_JoinADSDomain() its own tmp_ctx rather than passing it from libnet_JoinDomain() as a parameter (yuk).
  
 As a side effect, it proves that my bug lies in libnet_JoinDomain(), not libnet_JoinADSDomain().
 

Modified:
   branches/SOC/SAMBA_4_0/
   branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c


Changeset:

Property changes on: branches/SOC/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9550
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5612
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5609
   + 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9550
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5614
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5609

Modified: branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-24 03:39:25 UTC (rev 9563)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-24 03:43:11 UTC (rev 9564)
@@ -89,6 +89,7 @@
 	}
 
 	u_handle = talloc(tmp_ctx, struct policy_handle);
+		
 	r2 = talloc(tmp_ctx, union libnet_SetPassword);	
 
 	/* prepare connect to the LSA pipe of PDC */
@@ -101,7 +102,7 @@
 	/* connect to the LSA pipe of the PDC */
 	status = libnet_RpcConnect(ctx, tmp_ctx, &c);
 	if (!NT_STATUS_IS_OK(status)) {
-		r->out.error_string = talloc_asprintf(mem_ctx,
+		r->out.error_string = talloc_asprintf(r,
 						"Connection to LSA pipe of PDC of domain '%s' failed: %s",
 						r->in.domain_name, nt_errstr(status));
 		talloc_free(tmp_ctx);
@@ -184,7 +185,7 @@
 	status = dcerpc_parse_binding(tmp_ctx, c.out.dcerpc_pipe->conn->binding_string, &samr_binding);
 	if (!NT_STATUS_IS_OK(status)) {
 		r->out.error_string
-			= talloc_asprintf(mem_ctx,
+			= talloc_asprintf(r,
 					  "Failed to parse dcerpc binding '%s'", 
 					  c.out.dcerpc_pipe->conn->binding_string);
 		talloc_free(tmp_ctx);
@@ -421,17 +422,17 @@
 	r->out.samr_pipe = talloc_steal(r, samr_pipe);
 	r->out.samr_binding = talloc_steal(r, samr_binding);
 	r->out.user_handle = talloc_steal(r, u_handle);
-
+	r->out.error_string = NULL;
 	/* r->out.error_string = talloc_steal(r, r2->samr_handle.out.error_string); */
-	/* The line above segfaults torture_join_domain() on the second join. 
+	/* Uncommenting the line above segfaults torture_join_domain() on the second join. 
 	   have not yet investigated why.
 	*/
 
 	/* Now, if it was AD, then we want to start looking changing a
 	 * few more things.  Otherwise, we are done. */
 	if (realm) {
-		status = libnet_JoinADSDomain(ctx, mem_ctx, tmp_ctx, r);
 		talloc_free(tmp_ctx);	/* comment this line to stop segfaults */
+		status = libnet_JoinADSDomain(ctx, mem_ctx, r);
 		return status;
 	}
 
@@ -444,12 +445,14 @@
 	return NT_STATUS_OK;
 }
 
-NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, TALLOC_CTX *tmp_ctx, struct libnet_JoinDomain *r)
+NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_JoinDomain *r)
 {
 
 
 	NTSTATUS status;
 	
+	TALLOC_CTX *tmp_ctx;
+	
 	const char *realm = r->out.realm;
 	
 	struct dcerpc_binding *samr_binding = r->out.samr_binding;
@@ -489,6 +492,8 @@
 
 	/* Fiddle with the bindings, so get to DRSUAPI on
 	 * NCACN_IP_TCP, sealed */
+	tmp_ctx = talloc_named(mem_ctx, 0, "libnet_JoinADSDomain temp context");  
+	 
 	drsuapi_binding = talloc(tmp_ctx, struct dcerpc_binding);
 	drsuapi_binding = samr_binding;
 	drsuapi_binding->transport = NCACN_IP_TCP;
@@ -658,6 +663,7 @@
 		}
 	}
 	r->out.kvno = kvno;
+	talloc_free(tmp_ctx);
 	return NT_STATUS_OK;
 }
 



More information about the samba-cvs mailing list