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

brad at samba.org brad at samba.org
Fri Aug 26 04:42:50 GMT 2005


Author: brad
Date: 2005-08-26 04:42:50 +0000 (Fri, 26 Aug 2005)
New Revision: 9630

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

Log:
Commented out the parts of the dssync test which perform the dc join and create/remove associated ldap entries.

Commented out the test for the 'german' dssync option, because now we detect the Site-Name using CLDAP. If cldap_netlogon() does not return ok, the code defaults to 'Default-First-Site-Name'.
Modified:
   branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c


Changeset:
Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c	2005-08-26 04:23:41 UTC (rev 9629)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c	2005-08-26 04:42:50 UTC (rev 9630)
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/ndr_drsuapi.h"
 #include "librpc/gen_ndr/ndr_samr.h"
 #include "libcli/ldap/ldap.h"
+#include "libcli/cldap/cldap.h"
 #include "ads.h"
 
 struct DsSyncBindInfo {
@@ -44,10 +45,11 @@
 	struct dcerpc_binding *drsuapi_binding;
 	struct ldb_context *ldb_ctx;
 	struct ldb_message *ldb_msg;
-	struct libnet_context *libnet_ctx;
+/*	struct libnet_context *libnet_ctx;
 	struct libnet_Join libnet_r;
+*/
 	const char *ldap_url;
-
+	const char *site_name;
 	const char *domain_dn;
 	const char *config_dn;
 	const char *schema_dn;
@@ -66,7 +68,8 @@
 		struct drsuapi_DsGetDCInfo2 dc_info2;
 		struct GUID invocation_id;
 		struct GUID object_guid;
-		struct test_join *join;
+/*		struct test_join *join;
+*/
 	} new_dc;
 
 	/* info about the old dc */
@@ -81,7 +84,8 @@
 	struct DsSyncTest *ctx;
 	struct drsuapi_DsBindInfoCtr *our_bind_info;
 	const char *binding = lp_parm_string(-1, "torture", "binding");
-	const char *new_dc_pass;
+/*	const char *new_dc_pass;
+*/
 	ctx = talloc_zero(mem_ctx, struct DsSyncTest);
 	if (!ctx) return NULL;
 
@@ -114,14 +118,14 @@
 	/* ctx->new_dc ...*/
 #define TEST_MACHINE_NAME "smbtorturedssync"
 	/*create machine account*/
-	ctx->new_dc.join = torture_join_domain(mem_ctx, 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->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_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();
@@ -206,10 +210,10 @@
 	}
 
 	printf("test_destroy_context(): Removing machine account %s$.\n",TEST_MACHINE_NAME);
-	if (ctx->new_dc.join) {
+/*	if (ctx->new_dc.join) {
 		torture_leave_domain(ctx->new_dc.join);
 	}
-	
+*/	
 	talloc_free(ctx);
 	
 }
@@ -277,6 +281,9 @@
 	struct drsuapi_DsNameString names[1];
 	BOOL ret = True;
 
+	struct cldap_socket *cldap = cldap_socket_init(ctx, NULL);
+	struct cldap_netlogon search;
+	
 	r.in.bind_handle		= &ctx->admin.drsuapi.bind_handle;
 	r.in.level			= 1;
 	r.in.req.req1.unknown1		= 0x000004e4;
@@ -327,6 +334,24 @@
 	ctx->config_dn = talloc_asprintf(ctx, "CN=Configuration,%s", ctx->domain_dn);
 	ctx->schema_dn = talloc_asprintf(ctx, "CN=Schema,%s", ctx->config_dn);
 
+	ZERO_STRUCT(search);
+	search.in.dest_address = ctx->drsuapi_binding->host;
+	search.in.acct_control = -1;
+	search.in.version = 6;
+	status = cldap_netlogon(cldap, ctx, &search);
+	if (!NT_STATUS_IS_OK(status)) {
+		const char *errstr = nt_errstr(status);
+		ctx->site_name = talloc_asprintf(ctx, "%s", "Default-First-Site-Name");
+		printf("cldap_netlogon() returned %s. Defaulting to Site-Name: %s\n", errstr, ctx->site_name);		
+	} else {
+		ctx->site_name = talloc_steal(ctx, search.out.netlogon.logon5.site_name);
+		printf("cldap_netlogon() returned Site-Name: %s.\n",ctx->site_name);
+	}
+	ctx->new_dc.dc_info2.server_dn = talloc_asprintf(ctx,
+		"CN=%s,CN=Servers,CN=%s,CN=Sites,CN=Configuration,%s",
+		TEST_MACHINE_NAME, ctx->site_name, ctx->domain_dn);
+	
+	/*
 	if (lp_parm_bool(-1, "dssync","german", False)) {
 		ctx->new_dc.dc_info2.server_dn = talloc_asprintf(ctx,
 			"CN=%s,CN=Servers,CN=Standardname-des-ersten-Standorts,CN=Sites,CN=Configuration,%s",
@@ -336,7 +361,7 @@
 			"CN=%s,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,%s",
 			TEST_MACHINE_NAME, ctx->domain_dn);
 	}
-
+	*/
 	ctx->new_dc.dc_info2.ntds_dn = talloc_asprintf(ctx,
 		"CN=NTDS Settings,%s",ctx->new_dc.dc_info2.server_dn);
 
@@ -801,8 +826,9 @@
 
 			break;
 		}
-
+		
 		status = dcerpc_drsuapi_DsGetNCChanges(ctx->new_dc.drsuapi.pipe, ctx, &r);
+				
 		if (!NT_STATUS_IS_OK(status)) {
 			const char *errstr = nt_errstr(status);
 			if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
@@ -834,10 +860,10 @@
 	ret &= test_DsBind(ctx, ctx->admin.credentials, &ctx->admin.drsuapi);
 	ret &= test_LDAPBind(ctx, ctx->admin.credentials, &ctx->admin.ldap);
 	ret &= test_GetInfo(ctx);
-	ret &= test_CompleteJoin(ctx, mem_ctx);
+	/*ret &= test_CompleteJoin(ctx, mem_ctx);*/
 	ret &= test_DsBind(ctx, ctx->admin.credentials, &ctx->new_dc.drsuapi);
 	ret &= test_FetchData(ctx);
-	test_destroy_context(ctx);
+	/*test_destroy_context(ctx);*/
 
 	return ret;
 }



More information about the samba-cvs mailing list