summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/samba3rpc.c18
-rw-r--r--source4/torture/rpc/srvsvc.c30
2 files changed, 27 insertions, 21 deletions
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index e04400ef05..bd23327e70 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1866,6 +1866,7 @@ static bool test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
{
NTSTATUS status;
struct srvsvc_NetShareGetInfo r;
+ union srvsvc_NetShareInfo info;
uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007, 1501 };
int i;
bool ret = true;
@@ -1873,12 +1874,11 @@ static bool test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s",
dcerpc_server_name(p));
r.in.share_name = sharename;
+ r.out.info = &info;
for (i=0;i<ARRAY_SIZE(levels);i++) {
r.in.level = levels[i];
- ZERO_STRUCT(r.out);
-
printf("testing NetShareGetInfo level %u on share '%s'\n",
r.in.level, r.in.share_name);
@@ -2114,6 +2114,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p;
NTSTATUS status;
struct srvsvc_NetShareGetInfo r;
+ union srvsvc_NetShareInfo info;
struct security_descriptor *result;
if (!(tmp_ctx = talloc_new(mem_ctx))) {
@@ -2144,6 +2145,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
dcerpc_server_name(p));
r.in.share_name = sharename;
r.in.level = 502;
+ r.out.info = &info;
status = dcerpc_srvsvc_NetShareGetInfo(p, tmp_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -2153,7 +2155,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
return NULL;
}
- result = talloc_steal(mem_ctx, r.out.info.info502->sd_buf.sd);
+ result = talloc_steal(mem_ctx, info.info502->sd_buf.sd);
talloc_free(tmp_ctx);
return result;
}
@@ -2208,7 +2210,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
status = dcerpc_srvsvc_NetShareSetInfo(p, tmp_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("srvsvc_NetShareGetInfo failed: %s\n",
+ d_printf("srvsvc_NetShareSetInfo failed: %s\n",
nt_errstr(status));
}
@@ -3105,11 +3107,12 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
struct smbcli_state *cli,
const char *share,
- struct srvsvc_NetShareInfo502 **info)
+ struct srvsvc_NetShareInfo502 **info502)
{
struct smbcli_tree *ipc;
struct dcerpc_pipe *p;
struct srvsvc_NetShareGetInfo r;
+ union srvsvc_NetShareInfo info;
NTSTATUS status;
if (!(p = dcerpc_pipe_init(cli,
@@ -3142,15 +3145,16 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
dcerpc_server_name(p));
r.in.share_name = share;
r.in.level = 502;
+ r.out.info = &info;
status = dcerpc_srvsvc_NetShareGetInfo(p, p, &r);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- d_printf("(%s) OpenHKLM failed: %s, %s\n", __location__,
+ d_printf("(%s) srvsvc_NetShareGetInfo failed: %s, %s\n", __location__,
nt_errstr(status), win_errstr(r.out.result));
goto fail;
}
- *info = talloc_move(mem_ctx, &r.out.info.info502);
+ *info502 = talloc_move(mem_ctx, &info.info502);
return NT_STATUS_OK;
fail:
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index 4a61ba5acd..3e584aaba5 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -384,6 +384,7 @@ static bool test_NetShareGetInfo(struct torture_context *tctx,
{
NTSTATUS status;
struct srvsvc_NetShareGetInfo r;
+ union srvsvc_NetShareInfo info;
struct {
uint32_t level;
WERROR anon_status;
@@ -400,6 +401,7 @@ static bool test_NetShareGetInfo(struct torture_context *tctx,
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.share_name = sharename;
+ r.out.info = &info;
for (i=0;i<ARRAY_SIZE(levels);i++) {
WERROR expected;
@@ -407,7 +409,6 @@ static bool test_NetShareGetInfo(struct torture_context *tctx,
r.in.level = levels[i].level;
expected = levels[i].anon_status;
if (admin) expected = levels[i].admin_status;
- ZERO_STRUCT(r.out);
torture_comment(tctx, "testing NetShareGetInfo level %u on share '%s'\n",
r.in.level, r.in.share_name);
@@ -417,8 +418,8 @@ static bool test_NetShareGetInfo(struct torture_context *tctx,
torture_assert_werr_equal(tctx, r.out.result, expected, "NetShareGetInfo failed");
if (r.in.level != 2) continue;
- if (!r.out.info.info2 || !r.out.info.info2->path) continue;
- if (!test_NetShareCheck(p, tctx, r.out.info.info2->path)) {
+ if (!r.out.info->info2 || !r.out.info->info2->path) continue;
+ if (!test_NetShareCheck(p, tctx, r.out.info->info2->path)) {
return false;
}
}
@@ -571,41 +572,42 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx,
torture_assert_werr_equal(tctx, r.out.result, levels[i].expected, "NetShareSetInfo failed");
q.in.share_name = r.in.share_name;
+ q.out.info = &info;
status = dcerpc_srvsvc_NetShareGetInfo(p, tctx, &q);
torture_assert_ntstatus_ok(tctx, status, "NetShareGetInfo failed");
torture_assert_werr_ok(tctx, q.out.result, "NetShareGetInfo failed");
- torture_assert_str_equal(tctx, q.out.info.info502->name, r.in.share_name,
+ torture_assert_str_equal(tctx, q.out.info->info502->name, r.in.share_name,
"share name invalid");
switch (levels[i].level) {
case 0:
break;
case 1:
- torture_assert_str_equal(tctx, q.out.info.info502->comment, "test comment 1", "comment");
+ torture_assert_str_equal(tctx, q.out.info->info502->comment, "test comment 1", "comment");
break;
case 2:
- torture_assert_str_equal(tctx, q.out.info.info2->comment, "test comment 2", "comment");
- torture_assert_int_equal(tctx, q.out.info.info2->max_users, 2, "max users");
- torture_assert_str_equal(tctx, q.out.info.info2->path, "C:\\", "path");
+ torture_assert_str_equal(tctx, q.out.info->info2->comment, "test comment 2", "comment");
+ torture_assert_int_equal(tctx, q.out.info->info2->max_users, 2, "max users");
+ torture_assert_str_equal(tctx, q.out.info->info2->path, "C:\\", "path");
break;
case 501:
- torture_assert_str_equal(tctx, q.out.info.info501->comment, "test comment 501", "comment");
+ torture_assert_str_equal(tctx, q.out.info->info501->comment, "test comment 501", "comment");
break;
case 502:
- torture_assert_str_equal(tctx, q.out.info.info502->comment, "test comment 502", "comment");
- torture_assert_int_equal(tctx, q.out.info.info502->max_users, 502, "max users");
- torture_assert_str_equal(tctx, q.out.info.info502->path, "C:\\", "path");
+ torture_assert_str_equal(tctx, q.out.info->info502->comment, "test comment 502", "comment");
+ torture_assert_int_equal(tctx, q.out.info->info502->max_users, 502, "max users");
+ torture_assert_str_equal(tctx, q.out.info->info502->path, "C:\\", "path");
break;
case 1004:
- torture_assert_str_equal(tctx, q.out.info.info1004->comment, "test comment 1004",
+ torture_assert_str_equal(tctx, q.out.info->info1004->comment, "test comment 1004",
"comment");
break;
case 1005:
break;
case 1006:
- torture_assert_int_equal(tctx, q.out.info.info1006->max_users, 1006, "Max users");
+ torture_assert_int_equal(tctx, q.out.info->info1006->max_users, 1006, "Max users");
break;
/* case 1007:
break;