summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-27 09:41:50 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:46:22 +0100
commit7769f9db3408d5b98560045b07529a8359ca6911 (patch)
treea86901a1c33e363921f1429c163903645b5941cd
parentce0af45ef11b7661771dfcebb7298d81d1d2b80e (diff)
downloadsamba-7769f9db3408d5b98560045b07529a8359ca6911.tar.gz
samba-7769f9db3408d5b98560045b07529a8359ca6911.tar.bz2
samba-7769f9db3408d5b98560045b07529a8359ca6911.zip
r26143: Add IDL and torture test for wkssvc_NetrWkstaUserGetInfo.
Guenther (This used to be commit b358f953e9ba03bc89a241ab5232c823d836057f)
-rw-r--r--source4/librpc/idl/wkssvc.idl17
-rw-r--r--source4/rpc_server/wkssvc/dcesrv_wkssvc.c8
-rw-r--r--source4/torture/rpc/wkssvc.c51
3 files changed, 71 insertions, 5 deletions
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl
index 311accfd89..5df7cb2df5 100644
--- a/source4/librpc/idl/wkssvc.idl
+++ b/source4/librpc/idl/wkssvc.idl
@@ -192,7 +192,22 @@ import "srvsvc.idl";
/*****************************/
/* Function 0x03 */
- WERROR WKSSVC_NETRWKSTAUSERGETINFO ();
+ typedef struct {
+ [string,charset(UTF16)] uint16 *other_domains;
+ } wkssvc_NetrWkstaUserInfo1101;
+
+ typedef [switch_type(uint32)] union {
+ [case(0)] wkssvc_NetrWkstaUserInfo0 *info0;
+ [case(1)] wkssvc_NetrWkstaUserInfo1 *info1;
+ [case(1101)] wkssvc_NetrWkstaUserInfo1101 *info1101;
+ } wkssvc_NetrWkstaUserInfo;
+
+ WERROR wkssvc_NetrWkstaUserGetInfo(
+ [in] [string,charset(UTF16)] uint16 *unknown,
+ [in] uint32 level,
+ [out] [switch_is(level)] [ref] wkssvc_NetrWkstaUserInfo *info
+ );
+
/*****************************/
/* Function 0x04 */
diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
index d284fc5b4f..dfd3d04d11 100644
--- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
+++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
@@ -112,11 +112,11 @@ static WERROR dcesrv_wkssvc_NetWkstaEnumUsers(struct dcesrv_call_state *dce_call
}
-/*
- WKSSVC_NETRWKSTAUSERGETINFO
+/*
+ wkssvc_NetrWkstaUserGetInfo
*/
-static WERROR dcesrv_WKSSVC_NETRWKSTAUSERGETINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct WKSSVC_NETRWKSTAUSERGETINFO *r)
+static WERROR dcesrv_wkssvc_NetrWkstaUserGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct wkssvc_NetrWkstaUserGetInfo *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 5b777948ea..9592870cdf 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -22,6 +22,8 @@
#include "torture/torture.h"
#include "librpc/gen_ndr/ndr_wkssvc_c.h"
#include "torture/rpc/rpc.h"
+#include "lib/cmdline/popt_common.h"
+#include "param/param.h"
static bool test_NetWkstaGetInfo(struct torture_context *tctx,
struct dcerpc_pipe *p)
@@ -129,6 +131,53 @@ static bool test_NetWkstaEnumUsers(struct torture_context *tctx,
return true;
}
+
+static bool test_NetrWkstaUserGetInfo(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ NTSTATUS status;
+ struct wkssvc_NetrWkstaUserGetInfo r;
+ union wkssvc_NetrWkstaUserInfo info;
+ const char *dom = lp_workgroup(global_loadparm);
+ struct cli_credentials *creds = cmdline_credentials;
+ const char *user = cli_credentials_get_username(creds);
+ int i;
+
+ const struct {
+ const char *unknown;
+ uint32_t level;
+ WERROR result;
+ } tests[] = {
+ { NULL, 0, WERR_NO_SUCH_LOGON_SESSION },
+ { NULL, 1, WERR_NO_SUCH_LOGON_SESSION },
+ { NULL, 1101, WERR_OK },
+ { dom, 0, WERR_INVALID_PARAM },
+ { dom, 1, WERR_INVALID_PARAM },
+ { dom, 1101, WERR_INVALID_PARAM },
+ { user, 0, WERR_INVALID_PARAM },
+ { user, 1, WERR_INVALID_PARAM },
+ { user, 1101, WERR_INVALID_PARAM },
+ };
+
+ for (i=0; i<ARRAY_SIZE(tests); i++) {
+ r.in.unknown = tests[i].unknown;
+ r.in.level = tests[i].level;
+ r.out.info = &info;
+
+ torture_comment(tctx, "testing NetrWkstaUserGetInfo level %u\n",
+ r.in.level);
+
+ status = dcerpc_wkssvc_NetrWkstaUserGetInfo(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetrWkstaUserGetInfo failed");
+ torture_assert_werr_equal(tctx, r.out.result,
+ tests[i].result,
+ "NetrWkstaUserGetInfo failed");
+ }
+
+ return true;
+}
+
struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite;
@@ -144,6 +193,8 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
test_NetWkstaTransportEnum);
torture_rpc_tcase_add_test(tcase, "NetWkstaEnumUsers",
test_NetWkstaEnumUsers);
+ torture_rpc_tcase_add_test(tcase, "NetrWkstaUserGetInfo",
+ test_NetrWkstaUserGetInfo);
return suite;
}