svn commit: samba r9351 - in branches/SOC/SAMBA_4_0: . source/libnet source/torture/rpc

brad at samba.org brad at samba.org
Wed Aug 17 05:15:32 GMT 2005


Author: brad
Date: 2005-08-17 05:15:31 +0000 (Wed, 17 Aug 2005)
New Revision: 9351

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

Log:
 r5438 at buttercup:  j0j0 | 2005-08-16 23:23:58 -0600
 Removed LIBNET_JOIN_TORTURE level, as it became unnecessary once libnet_Join_primary_domain() handled netbios names better.
 Corrected libnet_JoinDomain() and libnet_JoinADSDomain().
 

Modified:
   branches/SOC/SAMBA_4_0/
   branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
   branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h
   branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
   branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c


Changeset:

Property changes on: branches/SOC/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9311
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5436
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5433
   + 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9311
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5438
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5433

Modified: branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-17 05:09:32 UTC (rev 9350)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-17 05:15:31 UTC (rev 9351)
@@ -420,9 +420,9 @@
 			return status;
 		}
 	}
-	r->out.samr_pipe = samr_pipe;
-	r->out.samr_binding = samr_binding;
-
+	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;
 	/* Now, if it was AD, then we want to start looking changing a
 	 * few more things.  Otherwise, we are done. */
 	if (realm) {
@@ -432,10 +432,7 @@
 	r->out.realm = NULL;
 	r->out.kvno = 0;
 
-	if (r->in.level != LIBNET_JOIN_TORTURE) {
-		/* This is probably not the best way to keep the connection from closing */
-		talloc_free(tmp_ctx); 
-	}
+	talloc_free(tmp_ctx); 
 	return NT_STATUS_OK;
 }
 
@@ -641,11 +638,9 @@
 			return NT_STATUS_INTERNAL_DB_CORRUPTION;
 		}
 	}
+	
+	talloc_free(tmp_ctx); 
 
-	if (r->in.level != LIBNET_JOIN_TORTURE) {
-		/* This is probably not the best way to keep the connection from closing */
-		talloc_free(tmp_ctx); 
-	}
 	return NT_STATUS_OK;
 }
 
@@ -677,12 +672,12 @@
 	}
 	r2.in.domain_name  = r->in.domain_name;
 	
-	if ((r->in.level == LIBNET_JOIN_SPECIFIED) 
-		|| (r->in.level == LIBNET_JOIN_TORTURE)) {
-	 	r2.in.netbios_name = r->in.netbios_name;
+	if ((r2.in.netbios_name != NULL) && (r2.in.level != LIBNET_JOIN_AUTOMATIC)) {
+		r2.in.netbios_name = r->in.netbios_name;
 	} else {
 		r2.in.netbios_name = talloc_asprintf(mem_ctx, "%s", lp_netbios_name());
 	}
+	
 	r2.in.account_name = talloc_asprintf(mem_ctx, "%s$", r2.in.netbios_name);
 	
 	/* Local secrets are stored in secrets.ldb */
@@ -703,10 +698,10 @@
 		return status;
 	}
 	
-	if (r->in.level == LIBNET_JOIN_TORTURE) {
-		/* get the SAMR pipe we left open in libnet_JoinDomain() */
-		r->out.samr_pipe = r2.out.samr_pipe;
-	}
+	r->out.samr_pipe = r2.out.samr_pipe;
+	r->out.user_handle = r2.out.user_handle;
+	r->out.domain_sid = r2.out.domain_sid;
+	r->out.join_password = r2.out.join_password;
 	
 	sct = talloc_asprintf(mem_ctx, "%d", r->in.secure_channel_type);
 	msg = ldb_msg_new(mem_ctx);
@@ -776,8 +771,8 @@
 					  msg->dn);
 		return NT_STATUS_INTERNAL_DB_CORRUPTION;
 	}
+	
 	return NT_STATUS_OK;
-
 }
 
 NTSTATUS libnet_Join(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_Join *r)
@@ -800,7 +795,13 @@
 					 r->in.secure_channel_type, r->in.domain_name);
 		return NT_STATUS_INVALID_PARAMETER;
 	}
+	
 	r->out.error_string = r2.out.error_string;
+	r->out.join_password = r2.out.join_password;
+	r->out.domain_sid = r2.out.domain_sid;
+	r->out.samr_pipe = r2.out.samr_pipe;
+	r->out.user_handle = r2.out.user_handle;
+	
 	return nt_status;
 }
 

Modified: branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h
===================================================================
--- branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h	2005-08-17 05:09:32 UTC (rev 9350)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h	2005-08-17 05:15:31 UTC (rev 9351)
@@ -24,7 +24,6 @@
 enum libnet_Join_level {
 	LIBNET_JOIN_AUTOMATIC,
 	LIBNET_JOIN_SPECIFIED,
-	LIBNET_JOIN_TORTURE,
 };
 
 struct libnet_JoinDomain {

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c	2005-08-17 05:09:32 UTC (rev 9350)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c	2005-08-17 05:15:31 UTC (rev 9351)
@@ -76,7 +76,6 @@
 static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
 {
 	NTSTATUS status;
-	BOOL ret = True;
 	struct DsSyncTest *ctx;
 	struct drsuapi_DsBindInfoCtr *our_bind_info;
 	const char *binding = lp_parm_string(-1, "torture", "binding");
@@ -114,9 +113,10 @@
 	/* ctx->new_dc ...*/
 #define TEST_MACHINE_NAME "smbtorturedssync"
 	/*create machine account*/
-	ctx->new_dc.join = torture_join_domain(TEST_MACHINE_NAME, lp_workgroup(), ACB_SVRTRUST, &new_dc_pass);  
+	ctx->new_dc.join = torture_join_domain(mem_ctx, TEST_MACHINE_NAME, lp_workgroup(), ACB_SVRTRUST, &new_dc_pass);  
 
-	/*ctx->libnet_ctx = libnet_context_init(NULL);
+	/*
+	ctx->libnet_ctx = libnet_context_init(NULL);
 	if (ctx->libnet_ctx == NULL) {
 	 printf("libnet_context_init() failed, ctx->libnet_ctx not initialized.\n");
 	}
@@ -148,17 +148,8 @@
 	cli_credentials_set_domain(ctx->new_dc.credentials, lp_workgroup(), CRED_SPECIFIED);
 	cli_credentials_set_username(ctx->new_dc.credentials, TEST_MACHINE_NAME"$", CRED_SPECIFIED);
 
-
-	/*here we need to tell determine the new_dc_pass out of the libnet_Join stuff*/
 	cli_credentials_set_password(ctx->new_dc.credentials, new_dc_pass, CRED_SPECIFIED);
 
-	/*
-	new_dc_pass = ctx->libnet_r.out.join_password;
-	printf("new_dc_pass: %s.\n",new_dc_pass);
-
-	cli_credentials_set_password(ctx->new_dc.credentials, new_dc_pass, CRED_SPECIFIED);
-	*/	
-
 	cli_credentials_set_secure_channel_type(ctx->new_dc.credentials, SEC_CHAN_BDC);
 
 	ctx->new_dc.invocation_id = GUID_random();
@@ -228,8 +219,8 @@
 	if (ctx->new_dc.join) {
 		torture_leave_domain(ctx->new_dc.join);
 	}
-	*/
 	talloc_free(ctx);
+	*/
 }
 
 static BOOL test_DsBind(struct DsSyncTest *ctx,	struct cli_credentials *credentials, struct DsSyncBindInfo *b)

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c	2005-08-17 05:09:32 UTC (rev 9350)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c	2005-08-17 05:15:31 UTC (rev 9351)
@@ -273,7 +273,8 @@
 }
 
 
-struct test_join *torture_join_domain(const char *machine_name, 
+struct test_join *torture_join_domain(TALLOC_CTX *mem_ctx, 
+				      const char *machine_name, 
 				      const char *domain,
 				      uint16_t acct_flags,
 				      const char **machine_password)
@@ -288,9 +289,7 @@
 	struct libnet_Join libnet_r;
 	struct test_join *tj;
 	NTSTATUS status;
-	TALLOC_CTX *mem_ctx;
 	
-	mem_ctx = talloc_init("torture_join_domain");
 	libnet_ctx = libnet_context_init(NULL);
 	if (libnet_ctx == NULL) {
 		talloc_free(mem_ctx);
@@ -298,8 +297,7 @@
 	}
 	libnet_ctx->cred = cmdline_credentials;
 	libnet_r.in.domain_name = domain;
-	libnet_r.in.level = LIBNET_JOIN_TORTURE; /*LIBNET_JOIN_TORTURE indicates LIBNET_JOIN_SPECIFIED, and return from libnet_Join()
-						   with an open SAMR pipe.*/
+	libnet_r.in.level = LIBNET_JOIN_SPECIFIED; 
 	libnet_r.in.netbios_name = machine_name;
 	
 	if (acct_flags == ACB_SVRTRUST) {
@@ -318,7 +316,6 @@
 	tj->dom_sid = dom_sid_string(mem_ctx, libnet_r.out.domain_sid);
 	*machine_password = libnet_r.out.join_password;
 	printf("torture_join_domain() complete.\n");
-	talloc_free(mem_ctx); 
 	return tj;
 }
 
@@ -366,7 +363,7 @@
 	struct test_join *join;
 };
 
-struct test_join_ads_dc *torture_join_domain_ads_dc(const char *machine_name, 
+struct test_join_ads_dc *torture_join_domain_ads_dc(TALLOC_CTX *mem_ctx, const char *machine_name, 
 						    const char *domain,
 						    const char **machine_password)
 {
@@ -377,7 +374,7 @@
 		return NULL;
 	}
 
-	join->join = torture_join_domain(machine_name, domain,
+	join->join = torture_join_domain(mem_ctx, machine_name, domain,
 					ACB_SVRTRUST,
 					machine_password);
 



More information about the samba-cvs mailing list