summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/srvsvc.idl2
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c14
-rw-r--r--source4/torture/rpc/samba3rpc.c18
-rw-r--r--source4/torture/rpc/srvsvc.c30
4 files changed, 35 insertions, 29 deletions
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl
index 77224ee188..e40cc205f9 100644
--- a/source4/librpc/idl/srvsvc.idl
+++ b/source4/librpc/idl/srvsvc.idl
@@ -586,7 +586,7 @@ import "security.idl", "svcctl.idl";
[in,unique] [string,charset(UTF16)] uint16 *server_unc,
[in] [string,charset(UTF16)] uint16 share_name[],
[in] uint32 level,
- [out,switch_is(level)] srvsvc_NetShareInfo info
+ [out,ref,switch_is(level)] srvsvc_NetShareInfo *info
);
/******************/
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index ced2fb5137..19051c9c3e 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -974,7 +974,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
struct share_context *sctx = NULL;
struct share_config *scfg = NULL;
- ZERO_STRUCT(r->out);
+ ZERO_STRUCTP(r->out.info);
/* TODO: - access check
*/
@@ -1007,7 +1007,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return status;
}
- r->out.info.info0 = info.info0;
+ r->out.info->info0 = info.info0;
return WERR_OK;
}
case 1:
@@ -1023,7 +1023,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return status;
}
- r->out.info.info1 = info.info1;
+ r->out.info->info1 = info.info1;
return WERR_OK;
}
case 2:
@@ -1041,7 +1041,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return status;
}
- r->out.info.info2 = info.info2;
+ r->out.info->info2 = info.info2;
return WERR_OK;
}
case 501:
@@ -1057,7 +1057,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return status;
}
- r->out.info.info501 = info.info501;
+ r->out.info->info501 = info.info501;
return WERR_OK;
}
case 502:
@@ -1075,7 +1075,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return status;
}
- r->out.info.info502 = info.info502;
+ r->out.info->info502 = info.info502;
return WERR_OK;
}
case 1005:
@@ -1091,7 +1091,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return status;
}
- r->out.info.info1005 = info.info1005;
+ r->out.info->info1005 = info.info1005;
return WERR_OK;
}
default:
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;