From 5915254bdf0858095b68a763209d083b102fb9d3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 20 Sep 2006 20:40:45 +0000 Subject: r18741: test dfs_Enum and dfs_EnumEx in the torture test. Guenther (This used to be commit de5fe8350d7c5812d4197ad2712275f338e43243) --- source4/torture/rpc/dfs.c | 127 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 104 insertions(+), 23 deletions(-) (limited to 'source4/torture/rpc') diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 51bf346a96..3c6548881b 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -40,41 +40,106 @@ static BOOL test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, e 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;icount = 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;ks = &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,11 +192,28 @@ static BOOL test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) BOOL ret = True; uint16_t levels[] = {1, 2, 3, 4, 200, 300}; int i; + for (i=0;i