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

brad at samba.org brad at samba.org
Sat Aug 20 16:38:30 GMT 2005


Author: brad
Date: 2005-08-20 16:38:29 +0000 (Sat, 20 Aug 2005)
New Revision: 9427

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

Log:
 r5504 at buttercup:  j0j0 | 2005-08-20 10:44:52 -0600
 Some bugfixes.
 Removed a bunch of debugging code.
 torture_leave_domain() works again! not 100% perfect yet though...
 

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:9397
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5502
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:5504
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-20 14:31:12 UTC (rev 9426)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c	2005-08-20 16:38:29 UTC (rev 9427)
@@ -422,7 +422,7 @@
 	}
 	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 = &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,7 +432,9 @@
 	r->out.realm = NULL;
 	r->out.kvno = 0;
 
+
 	talloc_free(tmp_ctx); 
+
 	return NT_STATUS_OK;
 }
 
@@ -644,7 +646,9 @@
 		}
 	}
 	
+/*	testing
 	talloc_free(tmp_ctx); 
+*/
 
 	return NT_STATUS_OK;
 }
@@ -703,10 +707,17 @@
 		return status;
 	}
 	
+	
+	/*
 	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;
+	*/
+	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);

Modified: branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h
===================================================================
--- branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h	2005-08-20 14:31:12 UTC (rev 9426)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.h	2005-08-20 16:38:29 UTC (rev 9427)
@@ -44,10 +44,11 @@
 		unsigned int kvno; /* msDS-KeyVersionNumber */
 		struct dcerpc_pipe *samr_pipe;
 		struct dcerpc_binding *samr_binding;
-		struct policy_handle user_handle;
+		struct policy_handle *user_handle;
 	} out;
 };
 
+/*I think this struct can be cleaned up.*/
 struct libnet_Join {
 	struct {
 		const char *domain_name;
@@ -61,7 +62,7 @@
 		const char *join_password;
 		struct dom_sid *domain_sid;
 		struct dcerpc_pipe *samr_pipe;
-		struct policy_handle user_handle;
+		struct policy_handle *user_handle;
 	} out;
 };
 

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c	2005-08-20 14:31:12 UTC (rev 9426)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c	2005-08-20 16:38:29 UTC (rev 9427)
@@ -80,7 +80,6 @@
 	struct drsuapi_DsBindInfoCtr *our_bind_info;
 	const char *binding = lp_parm_string(-1, "torture", "binding");
 	const char *new_dc_pass;
-	
 	ctx = talloc_zero(mem_ctx, struct DsSyncTest);
 	if (!ctx) return NULL;
 
@@ -115,54 +114,12 @@
 	/*create machine account*/
 	ctx->new_dc.join = torture_join_domain(mem_ctx, TEST_MACHINE_NAME, lp_workgroup(), ACB_SVRTRUST, &new_dc_pass);  
 
-	/* debugging printf()'s*/
-	if (torture_join_samr_pipe(ctx->new_dc.join) != NULL) {
-		 printf("test_create_context(): tj->p isn't null\n");
-	} else {
-		printf("test_create_context(): tj->p is null.\n");
-	}
-	
-	if (torture_join_samr_user_policy(ctx->new_dc.join) != NULL) {
-		printf("test_create_context(): tj->user_handle isn't null\n");	
-	} else {
-		printf("test_create_context(): tj->user_handle is null.\n");
-	}
-
-	/*
-	ctx->libnet_ctx = libnet_context_init(NULL);
-	if (ctx->libnet_ctx == NULL) {
-	 printf("libnet_context_init() failed, ctx->libnet_ctx not initialized.\n");
-	}
-	ctx->libnet_ctx->cred = cmdline_credentials;
-
-	ctx->libnet_r.in.domain_name = ctx->admin.credentials->domain;
-	ctx->libnet_r.in.secure_channel_type = SEC_CHAN_BDC;
-	ctx->libnet_r.in.level = LIBNET_JOIN_SPECIFIED; 
-	ctx->libnet_r.in.netbios_name = TEST_MACHINE_NAME;
-	
-	status = libnet_Join(ctx->libnet_ctx, ctx, &ctx->libnet_r);
-	if (!NT_STATUS_IS_OK(status)) {
-		const char *errstr = nt_errstr(status);
-		if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
-			errstr = dcerpc_errstr(ctx, ctx->admin.drsuapi.pipe->last_fault_code);
-		}
-		printf("libnet_Join() failed - %s\n", errstr);
-		printf("libnet_r.out.error_string returned: %s\n",ctx->libnet_r.out.error_string);
-		ret = False;
-	} else {
-	 	printf("Joined domain %s as %s.\n",ctx->libnet_r.in.domain_name,ctx->libnet_r.in.netbios_name);
-	}
-	*/
-
-	
 	ctx->new_dc.credentials = cli_credentials_init(ctx);
 	
 	cli_credentials_set_workstation(ctx->new_dc.credentials, TEST_MACHINE_NAME, CRED_SPECIFIED);
 	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);
-
 	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();
@@ -229,11 +186,6 @@
 		}
 	}
 
-	/*
-	This will need to be replaced with a libnet leave domain call.
-	It will remove the computer dn: CN=smbtorturedssync,OU=Domain Controllers,DC=smb,DC=test
-	entry, and maybe the server dn also.
-	*/
 	printf("test_destroy_context(): Removing machine account %s$.\n",TEST_MACHINE_NAME);
 	if (ctx->new_dc.join) {
 		torture_leave_domain(ctx->new_dc.join);

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c	2005-08-20 14:31:12 UTC (rev 9426)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c	2005-08-20 16:38:29 UTC (rev 9427)
@@ -288,6 +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,36 +307,16 @@
 	 the machine acct info in secrets.tdb. We don't want that for a torture_join.
 	 */	
 	status = libnet_JoinDomain(libnet_ctx, mem_ctx, &libnet_r);
-
 	if (!NT_STATUS_IS_OK(status)) {
 		return NULL;
 	}
+	
 	tj = talloc(mem_ctx, struct test_join);
 	
-	/* this bit makes torture_leave_domain() segfault...
-	   libnet_ctx seems to be a better place to fetch most of this from anyway.
-	   
 	tj->p = libnet_r.out.samr_pipe;
-	tj->user_handle = libnet_r.out.user_handle; 
+	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;
-	*/
-	if (libnet_ctx->pipe != NULL) {
-		 printf("torture_join_domain(): libnet_ctx->pipe isn't null\n");
-	} else {
-		printf("torture_join_domain(): libnet_ctx->pipe is null.\n");
-	}
-	
-	if (&libnet_ctx->user_handle != NULL) {
-		printf("torture_join_domain(): libnet_ctx->user_handle isn't null\n");	
-	} else {
-		printf("torture_join_domain(): libnet_ctx->user_handle is null.\n");
-	}
-	
-	tj->p = libnet_ctx->pipe;
-	tj->user_handle = libnet_ctx->user_handle;
-	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");
 	return tj;



More information about the samba-cvs mailing list