summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libnet/libnet_share.c5
-rw-r--r--source4/librpc/idl/srvsvc.idl2
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c44
-rw-r--r--source4/torture/libnet/libnet_share.c5
-rw-r--r--source4/torture/rpc/srvsvc.c22
5 files changed, 43 insertions, 35 deletions
diff --git a/source4/libnet/libnet_share.c b/source4/libnet/libnet_share.c
index e24ba8161a..5affb27ead 100644
--- a/source4/libnet/libnet_share.c
+++ b/source4/libnet/libnet_share.c
@@ -115,6 +115,7 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
NTSTATUS status;
struct libnet_RpcConnect c;
struct srvsvc_NetShareAdd s;
+ union srvsvc_NetShareInfo info;
c.level = LIBNET_RPC_CONNECT_SERVER;
c.in.name = r->in.server_name;
@@ -129,8 +130,10 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx,
return status;
}
+ info.info2 = &r->in.share;
+
s.in.level = 2;
- s.in.info.info2 = &r->in.share;
+ s.in.info = &info;
s.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", r->in.server_name);
status = dcerpc_srvsvc_NetShareAdd(c.out.dcerpc_pipe, mem_ctx, &s);
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl
index c5d1debc0a..f74bf1205a 100644
--- a/source4/librpc/idl/srvsvc.idl
+++ b/source4/librpc/idl/srvsvc.idl
@@ -565,7 +565,7 @@ import "security.idl", "svcctl.idl";
WERROR srvsvc_NetShareAdd(
[in,unique] [string,charset(UTF16)] uint16 *server_unc,
[in] uint32 level,
- [in,switch_is(level)] srvsvc_NetShareInfo info,
+ [in,ref,switch_is(level)] srvsvc_NetShareInfo *info,
[in,out,unique] uint32 *parm_error
);
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index edb48cee29..b58efbd61a 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -458,7 +458,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
info[i].name = SHARE_TYPE;
info[i].type = SHARE_INFO_STRING;
- switch (r->in.info.info2->type) {
+ switch (r->in.info->info2->type) {
case 0x00:
info[i].value = talloc_strdup(info, "DISK");
break;
@@ -474,16 +474,16 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
W_ERROR_HAVE_NO_MEMORY(info[i].value);
i++;
- if (r->in.info.info2->path && r->in.info.info2->path[0]) {
+ if (r->in.info->info2->path && r->in.info->info2->path[0]) {
info[i].name = SHARE_PATH;
info[i].type = SHARE_INFO_STRING;
/* Windows will send a path in a form of C:\example\path */
- if (r->in.info.info2->path[1] == ':') {
- info[i].value = talloc_strdup(info, &r->in.info.info2->path[2]);
+ if (r->in.info->info2->path[1] == ':') {
+ info[i].value = talloc_strdup(info, &r->in.info->info2->path[2]);
} else {
/* very strange let's try to set as is */
- info[i].value = talloc_strdup(info, r->in.info.info2->path);
+ info[i].value = talloc_strdup(info, r->in.info->info2->path);
}
W_ERROR_HAVE_NO_MEMORY(info[i].value);
all_string_sub((char *)info[i].value, "\\", "/", 0);
@@ -491,19 +491,19 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
i++;
}
- if (r->in.info.info2->comment && r->in.info.info2->comment[0]) {
+ if (r->in.info->info2->comment && r->in.info->info2->comment[0]) {
info[i].name = SHARE_COMMENT;
info[i].type = SHARE_INFO_STRING;
- info[i].value = talloc_strdup(info, r->in.info.info2->comment);
+ info[i].value = talloc_strdup(info, r->in.info->info2->comment);
W_ERROR_HAVE_NO_MEMORY(info[i].value);
i++;
}
- if (r->in.info.info2->password && r->in.info.info2->password[0]) {
+ if (r->in.info->info2->password && r->in.info->info2->password[0]) {
info[i].name = SHARE_PASSWORD;
info[i].type = SHARE_INFO_STRING;
- info[i].value = talloc_strdup(info, r->in.info.info2->password);
+ info[i].value = talloc_strdup(info, r->in.info->info2->password);
W_ERROR_HAVE_NO_MEMORY(info[i].value);
i++;
@@ -512,12 +512,12 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
info[i].name = SHARE_MAX_CONNECTIONS;
info[i].type = SHARE_INFO_INT;
info[i].value = talloc(info, int);
- *((int *)info[i].value) = r->in.info.info2->max_users;
+ *((int *)info[i].value) = r->in.info->info2->max_users;
i++;
/* TODO: security descriptor */
- nterr = share_create(sctx, r->in.info.info2->name, info, i);
+ nterr = share_create(sctx, r->in.info->info2->name, info, i);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -556,7 +556,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
info[i].name = SHARE_TYPE;
info[i].type = SHARE_INFO_STRING;
- switch (r->in.info.info502->type) {
+ switch (r->in.info->info502->type) {
case 0x00:
info[i].value = talloc_strdup(info, "DISK");
break;
@@ -572,16 +572,16 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
W_ERROR_HAVE_NO_MEMORY(info[i].value);
i++;
- if (r->in.info.info502->path && r->in.info.info502->path[0]) {
+ if (r->in.info->info502->path && r->in.info->info502->path[0]) {
info[i].name = SHARE_PATH;
info[i].type = SHARE_INFO_STRING;
/* Windows will send a path in a form of C:\example\path */
- if (r->in.info.info502->path[1] == ':') {
- info[i].value = talloc_strdup(info, &r->in.info.info502->path[2]);
+ if (r->in.info->info502->path[1] == ':') {
+ info[i].value = talloc_strdup(info, &r->in.info->info502->path[2]);
} else {
/* very strange let's try to set as is */
- info[i].value = talloc_strdup(info, r->in.info.info502->path);
+ info[i].value = talloc_strdup(info, r->in.info->info502->path);
}
W_ERROR_HAVE_NO_MEMORY(info[i].value);
all_string_sub((char *)info[i].value, "\\", "/", 0);
@@ -589,19 +589,19 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
i++;
}
- if (r->in.info.info502->comment && r->in.info.info502->comment[0]) {
+ if (r->in.info->info502->comment && r->in.info->info502->comment[0]) {
info[i].name = SHARE_COMMENT;
info[i].type = SHARE_INFO_STRING;
- info[i].value = talloc_strdup(info, r->in.info.info502->comment);
+ info[i].value = talloc_strdup(info, r->in.info->info502->comment);
W_ERROR_HAVE_NO_MEMORY(info[i].value);
i++;
}
- if (r->in.info.info502->password && r->in.info.info502->password[0]) {
+ if (r->in.info->info502->password && r->in.info->info502->password[0]) {
info[i].name = SHARE_PASSWORD;
info[i].type = SHARE_INFO_STRING;
- info[i].value = talloc_strdup(info, r->in.info.info502->password);
+ info[i].value = talloc_strdup(info, r->in.info->info502->password);
W_ERROR_HAVE_NO_MEMORY(info[i].value);
i++;
@@ -610,12 +610,12 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
info[i].name = SHARE_MAX_CONNECTIONS;
info[i].type = SHARE_INFO_INT;
info[i].value = talloc(info, int);
- *((int *)info[i].value) = r->in.info.info502->max_users;
+ *((int *)info[i].value) = r->in.info->info502->max_users;
i++;
/* TODO: security descriptor */
- nterr = share_create(sctx, r->in.info.info502->name, info, i);
+ nterr = share_create(sctx, r->in.info->info502->name, info, i);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c
index 76a29851e1..e49461357a 100644
--- a/source4/torture/libnet/libnet_share.c
+++ b/source4/torture/libnet/libnet_share.c
@@ -170,6 +170,7 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con
{
NTSTATUS status;
struct srvsvc_NetShareAdd add;
+ union srvsvc_NetShareInfo info;
struct srvsvc_NetShareInfo2 i;
i.name = share;
@@ -180,9 +181,11 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con
i.password = NULL;
i.permissions = 0x0;
+ info.info2 = &i;
+
add.in.server_unc = host;
add.in.level = 2;
- add.in.info.info2 = &i;
+ add.in.info = &info;
add.in.parm_error = NULL;
status = dcerpc_srvsvc_NetShareAdd(svc_pipe, mem_ctx, &add);
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index 55352278e7..b890f11ab8 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -447,6 +447,7 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx,
struct srvsvc_NetShareGetInfo q;
struct srvsvc_NetShareDel d;
struct sec_desc_buf sd_buf;
+ union srvsvc_NetShareInfo info;
struct {
uint32_t level;
WERROR expected;
@@ -468,17 +469,18 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx,
talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.share_name = talloc_strdup(tctx, "testshare");
+ info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2);
+ info.info2->name = r.in.share_name;
+ info.info2->type = STYPE_DISKTREE;
+ info.info2->comment = talloc_strdup(tctx, "test comment");
+ info.info2->permissions = 123434566;
+ info.info2->max_users = -1;
+ info.info2->current_users = 0;
+ info.info2->path = talloc_strdup(tctx, "C:\\");
+ info.info2->password = NULL;
+
+ a.in.info = &info;
a.in.level = 2;
- a.in.info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2);
- a.in.info.info2->name = r.in.share_name;
- a.in.info.info2->type = STYPE_DISKTREE;
- a.in.info.info2->comment = talloc_strdup(tctx, "test comment");
- a.in.info.info2->permissions = 123434566;
- a.in.info.info2->max_users = -1;
- a.in.info.info2->current_users = 0;
- a.in.info.info2->path = talloc_strdup(tctx, "C:\\");
- a.in.info.info2->password = NULL;
-
a.in.parm_error = NULL;
status = dcerpc_srvsvc_NetShareAdd(p, tctx, &a);