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

gd at samba.org gd at samba.org
Wed Sep 20 20:40:45 GMT 2006


Author: gd
Date: 2006-09-20 20:40:45 +0000 (Wed, 20 Sep 2006)
New Revision: 18741

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

Log:
test dfs_Enum and dfs_EnumEx in the torture test.

Guenther

Modified:
   branches/SAMBA_4_0/source/torture/rpc/dfs.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/dfs.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/dfs.c	2006-09-20 20:32:36 UTC (rev 18740)
+++ branches/SAMBA_4_0/source/torture/rpc/dfs.c	2006-09-20 20:40:45 UTC (rev 18741)
@@ -40,41 +40,106 @@
 	return True;
 }
 
-static BOOL test_InfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level,
-			   const char *root)
+static BOOL test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level,
+			      const char *root)
 {
 	NTSTATUS status;
 	struct dfs_GetInfo r;
-	
-	r.in.path = root;
+
+	printf("Testing GetInfo level %u on '%s'\n", level, root);
+
+	r.in.path = talloc_strdup(mem_ctx, root);
 	r.in.server = NULL;
 	r.in.share = NULL;
 	r.in.level = level;
 
-	printf("Testing GetInfo level %u on '%s'\n", level, root);
-
 	status = dcerpc_dfs_GetInfo(p, mem_ctx, &r);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Info failed - %s\n", nt_errstr(status));
 		return False;
+	} else if (!W_ERROR_IS_OK(r.out.result)) {
+		printf("GetInfo failed - %s\n", win_errstr(r.out.result));
+		return False;
 	}
 
 	return True;
 }
 
-static BOOL test_Info(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *root)
+static BOOL test_GetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *root)
 {
 	BOOL ret = True;
-	uint16_t levels[] = {1, 2, 3, 4, 100, 101, 102, 200, 300};
+	/* 103, 104, 105, 106 is only available on Set */
+	uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 100, 101, 102, 103, 104, 105, 106, 200, 300};
 	int i;
+
 	for (i=0;i<ARRAY_SIZE(levels);i++) {
-		if (!test_InfoLevel(p, mem_ctx, levels[i], root)) {
+		if (!test_GetInfoLevel(p, mem_ctx, levels[i], root)) {
 			ret = False;
 		}
 	}
 	return ret;
 }
 
+static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, const char *dfs_name)
+{
+	NTSTATUS status;
+	struct dfs_EnumEx rex;
+	uint32_t total=0;
+	struct dfs_EnumStruct e;
+	struct dfs_Info1 s;
+	struct dfs_EnumArray1 e1;
+	BOOL ret = True;
+	
+	rex.in.level = level;
+	rex.in.bufsize = (uint32_t)-1;
+	rex.in.total = &total;
+	rex.in.info = &e;
+	rex.in.dfs_name = dfs_name;
+
+	e.level = rex.in.level;
+	e.e.info1 = &e1;
+	e.e.info1->count = 0;
+	e.e.info1->s = &s;
+	s.path = NULL;
+
+	printf("Testing EnumEx level %u on '%s'\n", level, dfs_name);
+
+	status = dcerpc_dfs_EnumEx(p, mem_ctx, &rex);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("EnumEx failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	if (level == 1 && rex.out.total) {
+		int i;
+		for (i=0;i<*rex.out.total;i++) {
+			const char *root = talloc_strdup(mem_ctx, rex.out.info->e.info1->s[i].path);
+			if (!test_GetInfo(p, mem_ctx, root)) {
+				ret = False;
+			}
+		}
+	}
+
+	if (level == 300 && rex.out.total) {
+		int i,k;
+		for (i=0;i<*rex.out.total;i++) {
+			uint16_t levels[] = {1, 2, 3, 4, 200}; /* 300 */
+			const char *root = talloc_strdup(mem_ctx, rex.out.info->e.info300->s[i].dom_root);
+			for (k=0;k<ARRAY_SIZE(levels);k++) {
+				if (!test_EnumLevelEx(p, mem_ctx, levels[k], root)) {
+					ret = False;
+				}
+			}
+			if (!test_GetInfo(p, mem_ctx, root)) {
+				ret = False;
+			}
+		}
+	}
+
+	return ret;
+}
+
+
 static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level)
 {
 	NTSTATUS status;
@@ -96,17 +161,22 @@
 	e.e.info1->s = &s;
 	s.path = NULL;
 	
+	printf("Testing Enum level %u\n", level);
+
 	status = dcerpc_dfs_Enum(p, mem_ctx, &r);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Enum failed - %s\n", nt_errstr(status));
 		return False;
+	} else if (!W_ERROR_IS_OK(r.out.result)) {
+		printf("dfs_Enum failed - %s\n", win_errstr(r.out.result));
+		return False;
 	}
 
 	if (level == 1 && r.out.total) {
 		int i;
 		for (i=0;i<*r.out.total;i++) {
 			const char *root = r.out.info->e.info1->s[i].path;
-			if (!test_Info(p, mem_ctx, root)) {
+			if (!test_GetInfo(p, mem_ctx, root)) {
 				ret = False;
 			}
 		}
@@ -122,14 +192,31 @@
 	BOOL ret = True;
 	uint16_t levels[] = {1, 2, 3, 4, 200, 300};
 	int i;
+
 	for (i=0;i<ARRAY_SIZE(levels);i++) {
 		if (!test_EnumLevel(p, mem_ctx, levels[i])) {
 			ret = False;
 		}
 	}
+
 	return ret;
 }
 
+static BOOL test_EnumEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host)
+{
+	BOOL ret = True;
+	uint16_t levels[] = {1, 2, 3, 4, 200, 300};
+	int i;
+
+	for (i=0;i<ARRAY_SIZE(levels);i++) {
+		if (!test_EnumLevelEx(p, mem_ctx, levels[i], host)) {
+			ret = False;
+		}
+	}
+
+	return ret;
+}
+
 #if 0
 static BOOL test_Add(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
@@ -165,11 +252,12 @@
 
 BOOL torture_rpc_dfs(struct torture_context *torture)
 {
-        NTSTATUS status;
-        struct dcerpc_pipe *p;
+	NTSTATUS status;
+	struct dcerpc_pipe *p;
 	TALLOC_CTX *mem_ctx;
 	BOOL ret = True;
 	enum dfs_ManagerVersion version;
+	const char *host = lp_parm_string(-1, "torture", "host");
 
 	mem_ctx = talloc_init("torture_rpc_dfs");
 
@@ -180,20 +268,13 @@
 		return False;
 	}
 
-	if (!test_GetManagerVersion(p, mem_ctx, &version)) {
-		ret = False;
-	}
-
+	ret &= test_GetManagerVersion(p, mem_ctx, &version);
 #if 0
-	if (!test_Add(p, mem_ctx)) {
-		ret = False;
-	}
+	ret &= test_Add(p, mem_ctx);
 #endif
+	ret &= test_Enum(p, mem_ctx);
+	ret &= test_EnumEx(p, mem_ctx, host);
 
-	if (!test_Enum(p, mem_ctx)) {
-		ret = False;
-	}
-
 	talloc_free(mem_ctx);
 
 	return ret;



More information about the samba-cvs mailing list