From 523732ed2d33f61d35774aa3f771a890cb663035 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 29 Oct 2008 15:11:27 +0100 Subject: s4-srvsvc: merge srvsvc_NetShareSetInfo from s3 idl. Guenther --- source4/librpc/idl/srvsvc.idl | 2 +- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 44 +++++++-------- source4/torture/rpc/samba3rpc.c | 4 +- source4/torture/rpc/srvsvc.c | 94 ++++++++++++++++--------------- 4 files changed, 74 insertions(+), 70 deletions(-) diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index f74bf1205a..77224ee188 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -595,7 +595,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 share_name[], [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 b58efbd61a..ced2fb5137 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1247,7 +1247,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info0->name, + r->in.info->info0->name, NULL, NULL, NULL, @@ -1264,11 +1264,11 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info1->name, + r->in.info->info1->name, NULL, - r->in.info.info1->comment, + r->in.info->info1->comment, NULL, - r->in.info.info1->type, + r->in.info->info1->type, 0, 0, NULL); @@ -1281,12 +1281,12 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info2->name, - r->in.info.info2->path, - r->in.info.info2->comment, - r->in.info.info2->password, - r->in.info.info2->type, - r->in.info.info2->max_users, + r->in.info->info2->name, + r->in.info->info2->path, + r->in.info->info2->comment, + r->in.info->info2->password, + r->in.info->info2->type, + r->in.info->info2->max_users, 0, NULL); if (W_ERROR_EQUAL(status, WERR_OK)) { @@ -1298,13 +1298,13 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info501->name, + r->in.info->info501->name, NULL, - r->in.info.info501->comment, + r->in.info->info501->comment, NULL, - r->in.info.info501->type, + r->in.info->info501->type, 0, - r->in.info.info501->csc_policy, + r->in.info->info501->csc_policy, NULL); if (W_ERROR_EQUAL(status, WERR_OK)) { return status; @@ -1315,14 +1315,14 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info502->name, - r->in.info.info502->path, - r->in.info.info502->comment, - r->in.info.info502->password, - r->in.info.info502->type, - r->in.info.info502->max_users, + r->in.info->info502->name, + r->in.info->info502->path, + r->in.info->info502->comment, + r->in.info->info502->password, + r->in.info->info502->type, + r->in.info->info502->max_users, 0, - r->in.info.info502->sd_buf.sd); + r->in.info->info502->sd_buf.sd); if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } @@ -1334,7 +1334,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, r->in.share_name, r->in.level, NULL, NULL, - r->in.info.info1004->comment, + r->in.info->info1004->comment, NULL, 0, 0, diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 5aff213533..e04400ef05 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -2170,6 +2170,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx, NTSTATUS status; struct sec_desc_buf i; struct srvsvc_NetShareSetInfo r; + union srvsvc_NetShareInfo info; uint32_t error = 0; if (!(tmp_ctx = talloc_new(mem_ctx))) { @@ -2201,7 +2202,8 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx, r.in.share_name = sharename; r.in.level = 1501; i.sd = sd; - r.in.info.info1501 = &i; + info.info1501 = &i; + r.in.info = &info; r.in.parm_error = &error; status = dcerpc_srvsvc_NetShareSetInfo(p, tmp_ctx, &r); diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index b890f11ab8..4a61ba5acd 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -501,69 +501,71 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx, switch (levels[i].level) { case 0: - r.in.info.info0 = talloc(tctx, struct srvsvc_NetShareInfo0); - r.in.info.info0->name = r.in.share_name; + info.info0 = talloc(tctx, struct srvsvc_NetShareInfo0); + info.info0->name = r.in.share_name; break; case 1: - r.in.info.info1 = talloc(tctx, struct srvsvc_NetShareInfo1); - r.in.info.info1->name = r.in.share_name; - r.in.info.info1->type = STYPE_DISKTREE; - r.in.info.info1->comment = talloc_strdup(tctx, "test comment 1"); + info.info1 = talloc(tctx, struct srvsvc_NetShareInfo1); + info.info1->name = r.in.share_name; + info.info1->type = STYPE_DISKTREE; + info.info1->comment = talloc_strdup(tctx, "test comment 1"); break; case 2: - r.in.info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2); - r.in.info.info2->name = r.in.share_name; - r.in.info.info2->type = STYPE_DISKTREE; - r.in.info.info2->comment = talloc_strdup(tctx, "test comment 2"); - r.in.info.info2->permissions = 0; - r.in.info.info2->max_users = 2; - r.in.info.info2->current_users = 1; - r.in.info.info2->path = talloc_strdup(tctx, "::BLaH::"); /* "C:\\"); */ - r.in.info.info2->password = NULL; + 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 2"); + info.info2->permissions = 0; + info.info2->max_users = 2; + info.info2->current_users = 1; + info.info2->path = talloc_strdup(tctx, "::BLaH::"); /* "C:\\"); */ + info.info2->password = NULL; break; case 501: - r.in.info.info501 = talloc(tctx, struct srvsvc_NetShareInfo501); - r.in.info.info501->name = r.in.share_name; - r.in.info.info501->type = STYPE_DISKTREE; - r.in.info.info501->comment = talloc_strdup(tctx, "test comment 501"); - r.in.info.info501->csc_policy = 0; + info.info501 = talloc(tctx, struct srvsvc_NetShareInfo501); + info.info501->name = r.in.share_name; + info.info501->type = STYPE_DISKTREE; + info.info501->comment = talloc_strdup(tctx, "test comment 501"); + info.info501->csc_policy = 0; break; case 502: ZERO_STRUCT(sd_buf); - r.in.info.info502 = talloc(tctx, struct srvsvc_NetShareInfo502); - r.in.info.info502->name = r.in.share_name; - r.in.info.info502->type = STYPE_DISKTREE; - r.in.info.info502->comment = talloc_strdup(tctx, "test comment 502"); - r.in.info.info502->permissions = 0; - r.in.info.info502->max_users = 502; - r.in.info.info502->current_users = 1; - r.in.info.info502->path = talloc_strdup(tctx, "C:\\"); - r.in.info.info502->password = NULL; - r.in.info.info502->sd_buf = sd_buf; + info.info502 = talloc(tctx, struct srvsvc_NetShareInfo502); + info.info502->name = r.in.share_name; + info.info502->type = STYPE_DISKTREE; + info.info502->comment = talloc_strdup(tctx, "test comment 502"); + info.info502->permissions = 0; + info.info502->max_users = 502; + info.info502->current_users = 1; + info.info502->path = talloc_strdup(tctx, "C:\\"); + info.info502->password = NULL; + info.info502->sd_buf = sd_buf; break; case 1004: - r.in.info.info1004 = talloc(tctx, struct srvsvc_NetShareInfo1004); - r.in.info.info1004->comment = talloc_strdup(tctx, "test comment 1004"); + info.info1004 = talloc(tctx, struct srvsvc_NetShareInfo1004); + info.info1004->comment = talloc_strdup(tctx, "test comment 1004"); break; case 1005: - r.in.info.info1005 = talloc(tctx, struct srvsvc_NetShareInfo1005); - r.in.info.info1005->dfs_flags = 0; + info.info1005 = talloc(tctx, struct srvsvc_NetShareInfo1005); + info.info1005->dfs_flags = 0; break; case 1006: - r.in.info.info1006 = talloc(tctx, struct srvsvc_NetShareInfo1006); - r.in.info.info1006->max_users = 1006; + info.info1006 = talloc(tctx, struct srvsvc_NetShareInfo1006); + info.info1006->max_users = 1006; break; /* case 1007: - r.in.info.info1007 = talloc(tctx, struct srvsvc_NetShareInfo1007); - r.in.info.info1007->flags = 0; - r.in.info.info1007->alternate_directory_name = talloc_strdup(tctx, "test"); + info.info1007 = talloc(tctx, struct srvsvc_NetShareInfo1007); + info.info1007->flags = 0; + info.info1007->alternate_directory_name = talloc_strdup(tctx, "test"); break; */ case 1501: - r.in.info.info1501 = talloc_zero(tctx, struct sec_desc_buf); + info.info1501 = talloc_zero(tctx, struct sec_desc_buf); break; } - + + r.in.info = &info; + status = dcerpc_srvsvc_NetShareSetInfo(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetShareGetInfo failed"); torture_assert_werr_equal(tctx, r.out.result, levels[i].expected, "NetShareSetInfo failed"); @@ -584,7 +586,7 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx, 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.info502->comment, "test comment 2", "comment"); + 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; @@ -593,17 +595,17 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx, 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.info2->max_users, 502, "max users"); - torture_assert_str_equal(tctx, q.out.info.info2->path, "C:\\", "path"); + 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.info502->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.info2->max_users, 1006, "Max users"); + torture_assert_int_equal(tctx, q.out.info.info1006->max_users, 1006, "Max users"); break; /* case 1007: break; -- cgit