summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-14 00:24:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:44 -0500
commit44c107e3a3349bcc13d489ba8731980aefc09ccc (patch)
treec7cedd01f614edd2593e3453a301b78b74e67d3c /source4/torture
parentff55bda1481ed369e39b9d7d70f04e941b0b341e (diff)
downloadsamba-44c107e3a3349bcc13d489ba8731980aefc09ccc.tar.gz
samba-44c107e3a3349bcc13d489ba8731980aefc09ccc.tar.bz2
samba-44c107e3a3349bcc13d489ba8731980aefc09ccc.zip
r713: added a NetShareGetInfo torture test (thanks to abartlet for pointing
out that this was missing) (This used to be commit 00916f236d3437a9080614d20a3ab589be6f9196)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/srvsvc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index d7f9a7004b..8985956f5c 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -117,6 +117,36 @@ static BOOL test_NetSessEnum(struct dcerpc_pipe *p,
return True;
}
+
+static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ const char *sharename)
+{
+ NTSTATUS status;
+ struct srvsvc_NetShareGetInfo r;
+ int levels[] = {0, 1, 2, 501, 502, 1005};
+ int i;
+ BOOL ret = True;
+
+ r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.share_name = "";
+
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ r.in.level = levels[i];
+
+ printf("testing NetShareGetInfo level %u on share '%s'\n",
+ r.in.level, r.in.share_name);
+
+ status = dcerpc_srvsvc_NetShareGetInfo(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("NetShareGetInfo level %u failed - %s\n",
+ r.in.level, nt_errstr(status));
+ ret = False;
+ }
+ }
+
+ return ret;
+}
+
static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx)
{
@@ -137,6 +167,8 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p,
r.out.resume_handle = &resume_handle;
for (i=0;i<ARRAY_SIZE(levels);i++) {
+ int j;
+
resume_handle = 0;
r.in.level = levels[i];
printf("testing NetShareEnumAll level %u\n", r.in.level);
@@ -144,7 +176,20 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p,
if (!NT_STATUS_IS_OK(status)) {
printf("NetShareEnumAll level %u failed - %s\n", r.in.level, nt_errstr(status));
ret = False;
+ continue;
+ }
+
+ /* call srvsvc_NetShareGetInfo for each returned share */
+ if (r.in.level == 1) {
+ for (j=0;j<r.out.ctr.ctr1->count;j++) {
+ const char *name;
+ name = r.out.ctr.ctr1->array[j].name;
+ if (!test_NetShareGetInfo(p, mem_ctx, name)) {
+ ret = False;
+ }
+ }
}
+
}
return True;