summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/wkssvc.idl33
-rw-r--r--source4/torture/rpc/wkssvc.c76
2 files changed, 84 insertions, 25 deletions
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl
index 8f3fceb319..311accfd89 100644
--- a/source4/librpc/idl/wkssvc.idl
+++ b/source4/librpc/idl/wkssvc.idl
@@ -152,39 +152,42 @@ import "srvsvc.idl";
/*****************************/
/* Function 0x02 */
typedef struct {
- [string,charset(UTF16)] uint16 *user;
- } USER_INFO_0;
+ [string,charset(UTF16)] uint16 *user_name;
+ } wkssvc_NetrWkstaUserInfo0;
typedef struct {
uint32 entries_read;
- [size_is(entries_read)] USER_INFO_0 *user0;
- } USER_INFO_0_CONTAINER;
+ [size_is(entries_read)] wkssvc_NetrWkstaUserInfo0 *user0;
+ } wkssvc_NetWkstaEnumUsersCtr0;
typedef struct {
[string,charset(UTF16)] uint16 *user_name;
[string,charset(UTF16)] uint16 *logon_domain;
[string,charset(UTF16)] uint16 *other_domains;
[string,charset(UTF16)] uint16 *logon_server;
- } USER_INFO_1;
+ } wkssvc_NetrWkstaUserInfo1;
typedef struct {
uint32 entries_read;
- [size_is(entries_read)] USER_INFO_1 *user1;
- } USER_INFO_1_CONTAINER;
+ [size_is(entries_read)] wkssvc_NetrWkstaUserInfo1 *user1;
+ } wkssvc_NetWkstaEnumUsersCtr1;
typedef [switch_type(uint32)] union {
- [case(0)] USER_INFO_0_CONTAINER *user0;
- [case(1)] USER_INFO_1_CONTAINER *user1;
- } WKS_USER_ENUM_UNION;
+ [case(0)] wkssvc_NetWkstaEnumUsersCtr0 *user0;
+ [case(1)] wkssvc_NetWkstaEnumUsersCtr1 *user1;
+ } wkssvc_NetWkstaEnumUsersCtr;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] wkssvc_NetWkstaEnumUsersCtr ctr;
+ } wkssvc_NetWkstaEnumUsersInfo;
WERROR wkssvc_NetWkstaEnumUsers(
[in] [string,charset(UTF16)] uint16 *server_name,
- [in] uint32 level,
- [in] [out] [ref] WKS_USER_ENUM_UNION *users,
+ [in,out,ref] wkssvc_NetWkstaEnumUsersInfo *info,
[in] uint32 prefmaxlen,
- [out] uint32 *entriesread,
- [out] uint32 *totalentries,
- [in] [out] [ref] uint32 *resumehandle
+ [out,ref] uint32 *entries_read,
+ [in,out] uint32 *resume_handle
);
/*****************************/
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 87eae78c06..5b777948ea 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -1,19 +1,19 @@
-/*
+/*
Unix SMB/CIFS implementation.
test suite for wkssvc rpc operations
Copyright (C) Andrew Tridgell 2003
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -23,7 +23,7 @@
#include "librpc/gen_ndr/ndr_wkssvc_c.h"
#include "torture/rpc/rpc.h"
-static bool test_NetWkstaGetInfo(struct torture_context *tctx,
+static bool test_NetWkstaGetInfo(struct torture_context *tctx,
struct dcerpc_pipe *p)
{
NTSTATUS status;
@@ -39,9 +39,9 @@ static bool test_NetWkstaGetInfo(struct torture_context *tctx,
r.in.level = levels[i];
torture_comment(tctx, "testing NetWkstaGetInfo level %u\n", r.in.level);
status = dcerpc_wkssvc_NetWkstaGetInfo(p, tctx, &r);
- torture_assert_ntstatus_ok(tctx, status,
+ torture_assert_ntstatus_ok(tctx, status,
talloc_asprintf(tctx, "NetWkstaGetInfo level %u failed", r.in.level));
- torture_assert_werr_ok(tctx, r.out.result,
+ torture_assert_werr_ok(tctx, r.out.result,
talloc_asprintf(tctx, "NetWkstaGetInfo level %u failed", r.in.level));
}
@@ -71,12 +71,64 @@ static bool test_NetWkstaTransportEnum(struct torture_context *tctx,
status = dcerpc_wkssvc_NetWkstaTransportEnum(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "NetWkstaTransportEnum failed");
- torture_assert_werr_ok(tctx, r.out.result, talloc_asprintf(tctx,
+ torture_assert_werr_ok(tctx, r.out.result, talloc_asprintf(tctx,
"NetWkstaTransportEnum level %u failed", r.in.level));
return true;
}
+static bool test_NetWkstaEnumUsers(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ NTSTATUS status;
+ struct wkssvc_NetWkstaEnumUsers r;
+ uint32_t handle = 0;
+ uint32_t entries_read = 0;
+ struct wkssvc_NetWkstaEnumUsersInfo info;
+ struct wkssvc_NetWkstaEnumUsersCtr0 *user0;
+ struct wkssvc_NetWkstaEnumUsersCtr1 *user1;
+ uint32_t levels[] = { 0, 1 };
+ int i;
+
+ for (i=0; i<ARRAY_SIZE(levels); i++) {
+
+ ZERO_STRUCT(info);
+
+ info.level = levels[i];
+ switch (info.level) {
+ case 0:
+ user0 = talloc_zero(tctx,
+ struct wkssvc_NetWkstaEnumUsersCtr0);
+ info.ctr.user0 = user0;
+ break;
+ case 1:
+ user1 = talloc_zero(tctx,
+ struct wkssvc_NetWkstaEnumUsersCtr1);
+ info.ctr.user1 = user1;
+ break;
+ default:
+ break;
+ }
+
+ r.in.server_name = dcerpc_server_name(p);
+ r.in.prefmaxlen = (uint32_t)-1;
+ r.in.info = r.out.info = &info;
+ r.in.resume_handle = r.out.resume_handle = &handle;
+
+ r.out.entries_read = &entries_read;
+
+ torture_comment(tctx, "testing NetWkstaEnumUsers level %u\n",
+ levels[i]);
+
+ status = dcerpc_wkssvc_NetWkstaEnumUsers(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetWkstaEnumUsers failed");
+ torture_assert_werr_ok(tctx, r.out.result,
+ "NetWkstaEnumUsers failed");
+ }
+
+ return true;
+}
struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite;
@@ -86,8 +138,12 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
tcase = torture_suite_add_rpc_iface_tcase(suite, "wkssvc",
&ndr_table_wkssvc);
- torture_rpc_tcase_add_test(tcase, "NetWkstaGetInfo", test_NetWkstaGetInfo);
- torture_rpc_tcase_add_test(tcase, "NetWkstaTransportEnum",
+ torture_rpc_tcase_add_test(tcase, "NetWkstaGetInfo",
+ test_NetWkstaGetInfo);
+ torture_rpc_tcase_add_test(tcase, "NetWkstaTransportEnum",
test_NetWkstaTransportEnum);
+ torture_rpc_tcase_add_test(tcase, "NetWkstaEnumUsers",
+ test_NetWkstaEnumUsers);
+
return suite;
}