svn commit: samba r9467 - in branches/SOC/SAMBA_4_0: . source/libnet source/torture/rpc source/utils/net

brad at samba.org brad at samba.org
Mon Aug 22 02:00:49 GMT 2005


Author: brad
Date: 2005-08-22 02:00:48 +0000 (Mon, 22 Aug 2005)
New Revision: 9467

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

Log:
 r5510 at buttercup:  j0j0 | 2005-08-21 20:06:55 -0600
 Another round of bugfixing.
 

Modified:
   branches/SOC/SAMBA_4_0/
   branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
   branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c
   branches/SOC/SAMBA_4_0/source/utils/net/net_join.c


Changeset:

Property changes on: branches/SOC/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9397
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5508
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5497
   + 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9397
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5510
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5497

Modified: branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-22 01:53:06 UTC (rev 9466)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-22 02:00:48 UTC (rev 9467)
@@ -66,7 +66,7 @@
 	struct samr_LookupNames ln;
 	struct samr_OpenUser ou;
 	struct samr_CreateUser2 cu;
-	struct policy_handle u_handle;
+	struct policy_handle *u_handle;
 	struct samr_QueryUserInfo qui;
 	struct samr_SetUserInfo sui;
 	union samr_UserInfo u_info;
@@ -88,7 +88,8 @@
 		return NT_STATUS_NO_MEMORY;
 	}
 
-
+	u_handle = talloc(tmp_ctx, struct policy_handle);
+		
 	/* prepare connect to the LSA pipe of PDC */
 	c.level                     = LIBNET_RPC_CONNECT_PDC;
 	c.in.domain_name            = r->in.domain_name;
@@ -270,13 +271,15 @@
 	}
 
 	/* prepare samr_CreateUser2 */
-	ZERO_STRUCT(u_handle);
+	ZERO_STRUCT(*u_handle);
+/*	ZERO_STRUCT(r->out.user_handle);*/
 	cu.in.domain_handle  = &d_handle;
 	cu.in.access_mask     = SEC_FLAG_MAXIMUM_ALLOWED;
 	samr_account_name.string = r->in.account_name;
 	cu.in.account_name    = &samr_account_name;
 	cu.in.acct_flags      = r->in.acct_type;
-	cu.out.user_handle    = &u_handle;
+	cu.out.user_handle    = u_handle;
+/*	cu.out.user_handle    = r->out.user_handle;*/
 	cu.out.rid            = &rid;
 	cu.out.access_granted = &access_granted;
 
@@ -323,11 +326,13 @@
 		}
 		
 		/* prepare samr_OpenUser */
-		ZERO_STRUCT(u_handle);
+		ZERO_STRUCT(*u_handle);
+/*		ZERO_STRUCT(r->out.user_handle);*/
 		ou.in.domain_handle = &d_handle;
 		ou.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
 		ou.in.rid = ln.out.rids.ids[0];
-		ou.out.user_handle = &u_handle;
+		ou.out.user_handle = u_handle;
+/*		ou.out.user_handle = r->out.user_handle;*/
 		
 		/* 6. do a samr_OpenUser to get a user handle */
 		status = dcerpc_samr_OpenUser(samr_pipe, tmp_ctx, &ou);
@@ -341,7 +346,8 @@
 	}
 
 	/* Find out what password policy this user has */
-	pwp.in.user_handle = &u_handle;
+	pwp.in.user_handle = u_handle;
+/*	pwp.in.user_handle = r->out.user_handle;*/
 
 	status = dcerpc_samr_GetUserPwInfo(samr_pipe, tmp_ctx, &pwp);
 	if (NT_STATUS_IS_OK(status)) {
@@ -354,7 +360,8 @@
 	r2.samr_handle.level		= LIBNET_SET_PASSWORD_SAMR_HANDLE;
 	r2.samr_handle.in.account_name	= r->in.account_name;
 	r2.samr_handle.in.newpassword	= r->out.join_password;
-	r2.samr_handle.in.user_handle   = &u_handle;
+	r2.samr_handle.in.user_handle   = u_handle;
+/*	r2.samr_handle.in.user_handle	= r->out.user_handle;*/
 	r2.samr_handle.in.dcerpc_pipe   = samr_pipe;
 
 	status = libnet_SetPassword(ctx, tmp_ctx, &r2);
@@ -367,7 +374,8 @@
 	}
 
 	/* prepare samr_QueryUserInfo (get flags) */
-	qui.in.user_handle = &u_handle;
+	qui.in.user_handle = u_handle;
+/*	qui.in.user_handle = r->out.user_handle;*/
 	qui.in.level = 16;
 	
 	status = dcerpc_samr_QueryUserInfo(samr_pipe, tmp_ctx, &qui);
@@ -405,7 +413,8 @@
 		ZERO_STRUCT(u_info);
 		u_info.info16.acct_flags = acct_flags;
 
-		sui.in.user_handle = &u_handle;
+		sui.in.user_handle = u_handle;
+/*		sui.in.user_handle = r->out.user_handle;*/
 		sui.in.info = &u_info;
 		sui.in.level = 16;
 		
@@ -421,7 +430,8 @@
 	}
 	r->out.samr_pipe = talloc_steal(mem_ctx, samr_pipe);
 	r->out.samr_binding = talloc_steal(mem_ctx, samr_binding);
-	r->out.user_handle = &u_handle;
+	r->out.user_handle = talloc_steal(mem_ctx, u_handle);
+
 	/* Now, if it was AD, then we want to start looking changing a
 	 * few more things.  Otherwise, we are done. */
 	if (realm) {
@@ -469,7 +479,12 @@
 		"dNSHostName",
 		NULL,
 	};
-
+	
+	/*
+	Valgrind complains about uninitialized values unless we set this.
+	*/
+	r->out.error_string = NULL;
+	
 	/* We need to convert between a samAccountName and domain to a
 	 * DN in the directory.  The correct way to do this is with
 	 * DRSUAPI CrackNames */
@@ -645,8 +660,10 @@
 		}
 	}
 	
-/*	testing*/
-	r->out.error_string = NULL;
+/*	testing - if this talloc_free() executes, we segfault if we try and use the 
+	talloc_steal()'ed open pipe and handle (like we do in testjoin.c).
+.*/
+	
 	talloc_free(tmp_ctx); 
 
 
@@ -708,16 +725,11 @@
 	}
 	
 	r->out.samr_pipe = talloc_steal(mem_ctx, r2.out.samr_pipe);
+	/*r->out.user_handle = talloc_steal(mem_ctx, r2.out.user_handle);*/
 	r->out.user_handle = talloc_steal(mem_ctx, r2.out.user_handle);
 	r->out.domain_sid = talloc_steal(mem_ctx, r2.out.domain_sid);
 	r->out.join_password = talloc_steal(mem_ctx, r2.out.join_password);
 	
-	/*
-	r2.out.samr_pipe = talloc_steal(mem_ctx, r->out.samr_pipe);
-	r2.out.user_handle = talloc_steal(mem_ctx, r->out.user_handle);
-	r2.out.domain_sid = talloc_steal(mem_ctx, r->out.domain_sid);
-	r2.out.join_password = talloc_steal(mem_ctx, r->out.join_password);
-	*/
 	sct = talloc_asprintf(mem_ctx, "%d", r->in.secure_channel_type);
 	msg = ldb_msg_new(mem_ctx);
 
@@ -816,7 +828,9 @@
 	r->out.join_password = talloc_steal(mem_ctx, r2->out.join_password);
 	r->out.domain_sid = talloc_steal(mem_ctx, r2->out.domain_sid);
 	r->out.samr_pipe = talloc_steal(mem_ctx, r2->out.samr_pipe);
+	/*r->out.user_handle = talloc_steal(mem_ctx, r2->out.user_handle);*/
 	r->out.user_handle = talloc_steal(mem_ctx, r2->out.user_handle);
+	/*r->out.user_handle = ctx->user_handle;*/
 	
 	return nt_status;
 }

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c	2005-08-22 01:53:06 UTC (rev 9466)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c	2005-08-22 02:00:48 UTC (rev 9467)
@@ -288,7 +288,7 @@
 	struct libnet_context *libnet_ctx;
 	struct libnet_JoinDomain libnet_r;
 	struct test_join *tj;
-		
+	
 	NTSTATUS status;
 	
 	libnet_ctx = libnet_context_init(NULL);
@@ -306,6 +306,8 @@
 	 Call libnet_JoinDomain() rather than libnet_Join() -- it calls libnet_Join_primary_domain(), which puts 
 	 the machine acct info in secrets.tdb. We don't want that for a torture_join.
 	 */	
+	printf("joining domain.\n");
+	
 	status = libnet_JoinDomain(libnet_ctx, mem_ctx, &libnet_r);
 	if (!NT_STATUS_IS_OK(status)) {
 		return NULL;
@@ -313,7 +315,7 @@
 	
 	tj = talloc(mem_ctx, struct test_join);
 	
-	tj->p = libnet_r.out.samr_pipe;
+	tj->p = talloc_steal(mem_ctx, libnet_r.out.samr_pipe);
 	tj->user_handle = *libnet_r.out.user_handle;
 	tj->dom_sid = dom_sid_string(mem_ctx, libnet_r.out.domain_sid);
 	*machine_password = libnet_r.out.join_password;
@@ -322,8 +324,12 @@
 	  Leave domain. This will ensure that the info for the torture machine
 	  acct is what we are expecting when we rejoin again.
 	*/
+	printf("leaving domain.\n");
+	
 	torture_leave_domain(tj);
 	
+	printf("joining domain.\n");
+	
 	status = libnet_JoinDomain(libnet_ctx, mem_ctx, &libnet_r);
 	if (!NT_STATUS_IS_OK(status)) {
 		return NULL;
@@ -331,10 +337,10 @@
 	
 	tj = talloc(mem_ctx, struct test_join);
 	
-	tj->p = libnet_r.out.samr_pipe;
+	tj->p = talloc_steal(mem_ctx, libnet_r.out.samr_pipe);
 	tj->user_handle = *libnet_r.out.user_handle;
 	tj->dom_sid = dom_sid_string(mem_ctx, libnet_r.out.domain_sid);
-	*machine_password = libnet_r.out.join_password;
+	*machine_password = talloc_steal(mem_ctx, libnet_r.out.join_password);
 			
 	printf("torture_join_domain() complete.\n");
 	return tj;

Modified: branches/SOC/SAMBA_4_0/source/utils/net/net_join.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/utils/net/net_join.c	2005-08-22 01:53:06 UTC (rev 9466)
+++ branches/SOC/SAMBA_4_0/source/utils/net/net_join.c	2005-08-22 02:00:48 UTC (rev 9467)
@@ -69,7 +69,8 @@
 	r.out.error_string       = NULL;
 	r.in.level		 = LIBNET_JOIN_AUTOMATIC;
 	/*
-	 Valgrind complains if we don't set netbios_name to null here.
+	 Valgrind complains about an uninitialized value
+	 if we don't set netbios_name to null here.
 	*/
 	r.in.netbios_name	 = NULL;
 	



More information about the samba-cvs mailing list