svn commit: samba r15626 - in branches/SAMBA_4_0/source/torture/libnet: .

mimir at samba.org mimir at samba.org
Mon May 15 21:50:53 GMT 2006


Author: mimir
Date: 2006-05-15 21:50:53 +0000 (Mon, 15 May 2006)
New Revision: 15626

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

Log:
Modify the tests to fit them in current changes in libnet
functions.


rafal


Modified:
   branches/SAMBA_4_0/source/torture/libnet/domain.c
   branches/SAMBA_4_0/source/torture/libnet/libnet_rpc.c
   branches/SAMBA_4_0/source/torture/libnet/libnet_user.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/libnet/domain.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/domain.c	2006-05-15 21:49:27 UTC (rev 15625)
+++ branches/SAMBA_4_0/source/torture/libnet/domain.c	2006-05-15 21:50:53 UTC (rev 15626)
@@ -21,22 +21,23 @@
 
 #include "includes.h"
 #include "torture/rpc/rpc.h"
+#include "lib/events/events.h"
 #include "libnet/libnet.h"
 #include "librpc/gen_ndr/ndr_samr_c.h"
 
-static BOOL test_domainopen(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static BOOL test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx,
 			    struct lsa_String *domname,
 			    struct policy_handle *domain_handle)
 {
 	NTSTATUS status;
-	struct libnet_rpc_domain_open io;
+	struct libnet_DomainOpen io;
 	
 	printf("opening domain\n");
 	
 	io.in.domain_name  = talloc_strdup(mem_ctx, domname->string);
 	io.in.access_mask  = SEC_FLAG_MAXIMUM_ALLOWED;
 
-	status = libnet_rpc_domain_open(p, mem_ctx, &io);
+	status = libnet_DomainOpen(net_ctx, mem_ctx, &io);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Composite domain open failed - %s\n", nt_errstr(status));
 		return False;
@@ -73,7 +74,8 @@
 {
 	NTSTATUS status;
 	const char *binding;
-	struct dcerpc_pipe *p;
+	struct libnet_context *net_ctx;
+	struct event_context *evt_ctx;
 	TALLOC_CTX *mem_ctx;
 	BOOL ret = True;
 	struct policy_handle h;
@@ -82,8 +84,11 @@
 	mem_ctx = talloc_init("test_domain_open");
 	binding = lp_parm_string(-1, "torture", "binding");
 
+	evt_ctx = event_context_find(torture);
+	net_ctx = libnet_context_init(evt_ctx);
+
 	status = torture_rpc_connection(mem_ctx, 
-					&p,
+					&net_ctx->samr_pipe,
 					&dcerpc_table_samr);
 	
 	if (!NT_STATUS_IS_OK(status)) {
@@ -95,12 +100,12 @@
 	/*
 	 * Testing synchronous version
 	 */
-	if (!test_domainopen(p, mem_ctx, &name, &h)) {
+	if (!test_domainopen(net_ctx, mem_ctx, &name, &h)) {
 		ret = False;
 		goto done;
 	}
 
-	if (!test_cleanup(p, mem_ctx, &h)) {
+	if (!test_cleanup(net_ctx->samr_pipe, mem_ctx, &h)) {
 		ret = False;
 		goto done;
 	}

Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/libnet_rpc.c	2006-05-15 21:49:27 UTC (rev 15625)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_rpc.c	2006-05-15 21:50:53 UTC (rev 15626)
@@ -101,6 +101,36 @@
 	return True;
 }
 
+
+static BOOL test_samr_dcinfo_connect(struct libnet_context *ctx)
+{
+	NTSTATUS status;
+	struct libnet_RpcConnect connect;
+	connect.level           = LIBNET_RPC_CONNECT_DC_INFO;
+	connect.in.binding      = lp_parm_string(-1, "torture", "binding");
+	connect.in.dcerpc_iface = &dcerpc_table_samr;
+	
+	status = libnet_RpcConnect(ctx, ctx, &connect);
+	
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("Couldn't connect to rpc service %s on %s: %s\n",
+		       connect.in.dcerpc_iface->name, connect.in.binding,
+		       nt_errstr(status));
+
+		return False;
+	}
+
+	printf("Domain Controller Info:\n");
+	printf("\tDomain Name:\t %s\n", connect.out.domain_name);
+	printf("\tDomain SID:\t %s\n", dom_sid_string(ctx, connect.out.domain_sid));
+	printf("\tRealm:\t\t %s\n", connect.out.realm);
+	printf("\tGUID:\t\t %s\n", GUID_string(ctx, connect.out.guid));
+
+	return True;
+}
+
+
+
 BOOL torture_rpc_connect(struct torture_context *torture)
 {
 	struct libnet_context *ctx;
@@ -108,23 +138,29 @@
 	ctx = libnet_context_init(NULL);
 	ctx->cred = cmdline_credentials;
 
-	printf("Testing connection to lsarpc interface\n");
+	printf("Testing connection to LSA interface\n");
 	if (!test_lsa_connect(ctx)) {
-		printf("failed to connect lsarpc interface\n");
+		printf("failed to connect LSA interface\n");
 		return False;
 	}
 
-	printf("Testing connection with domain info to lsarpc interface\n");
+	printf("Testing connection with domain info to LSA interface\n");
 	if (!test_lsa_dcinfo_connect(ctx)) {
-		printf("failed to connect lsarpc interface\n");
+		printf("failed to connect LSA interface\n");
 		return False;
 	}
 
 	printf("Testing connection to SAMR service\n");
 	if (!test_samr_connect(ctx)) {
-		printf("failed to connect samr interface\n");
+		printf("failed to connect SAMR interface\n");
 		return False;
 	}
 
+	printf("Testing connection with domain info to SAMR interface\n");
+	if (!test_samr_dcinfo_connect(ctx)) {
+		printf("failed to connect SAMR interface\n");
+		return False;
+	}
+
 	return True;
 }

Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_user.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/libnet_user.c	2006-05-15 21:49:27 UTC (rev 15625)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_user.c	2006-05-15 21:50:53 UTC (rev 15626)
@@ -117,7 +117,7 @@
 		return False;
 	}
 
-	if (!test_cleanup(ctx->pipe, mem_ctx, &ctx->domain_handle, TEST_USERNAME)) {
+	if (!test_cleanup(ctx->samr_pipe, mem_ctx, &ctx->domain.handle, TEST_USERNAME)) {
 		printf("cleanup failed\n");
 		return False;
 	}



More information about the samba-cvs mailing list