summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-27 10:18:00 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:46:23 +0100
commit9854192923d7daba3ba74d9fa6a0a3355b68b6cb (patch)
tree96e636b624332177793c1b3d3b089b51fc978fdb /source4
parentec739190fbd72cd8e585bcfa87eed1913bb94780 (diff)
downloadsamba-9854192923d7daba3ba74d9fa6a0a3355b68b6cb.tar.gz
samba-9854192923d7daba3ba74d9fa6a0a3355b68b6cb.tar.bz2
samba-9854192923d7daba3ba74d9fa6a0a3355b68b6cb.zip
r26147: Add IDL and torture test for wkssvc_NetrUseDel and wkssvc_NetrUseAdd.
Guenther (This used to be commit b5b3cc1667f539ab75f2d3d0c9c79b45d85e967e)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/wkssvc.idl43
-rw-r--r--source4/rpc_server/wkssvc/dcesrv_wkssvc.c16
-rw-r--r--source4/torture/rpc/wkssvc.c84
3 files changed, 124 insertions, 19 deletions
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl
index a3e08c9444..cc25ad3c2f 100644
--- a/source4/librpc/idl/wkssvc.idl
+++ b/source4/librpc/idl/wkssvc.idl
@@ -268,18 +268,11 @@ import "srvsvc.idl";
/*****************************/
/* Function 0x08 */
- WERROR WKSSVC_NETRUSEADD ();
-
- /*****************************/
- /* Function 0x09 */
- WERROR WKSSVC_NETRUSEGETINFO ();
-
- /*****************************/
- /* Function 0x0a */
- WERROR WKSSVC_NETRUSEDEL ();
+ typedef struct {
+ [string,charset(UTF16)] uint16 *unknown1;
+ [string,charset(UTF16)] uint16 *unknown2;
+ } wkssvc_NetrUseInfo3;
- /*****************************/
- /* Function 0x0b */
typedef struct {
[string,charset(UTF16)] uint16 *local;
[string,charset(UTF16)] uint16 *remote;
@@ -307,6 +300,34 @@ import "srvsvc.idl";
[string,charset(UTF16)] uint16 *remote;
} wkssvc_NetrUseInfo0;
+ typedef [switch_type(uint32)] union {
+ [case(0)] wkssvc_NetrUseInfo0 *info0;
+ [case(1)] wkssvc_NetrUseInfo1 *info1;
+ [case(2)] wkssvc_NetrUseInfo2 *info2;
+ [case(3)] wkssvc_NetrUseInfo3 *info3;
+ } wkssvc_NetrUseGetInfoCtr;
+
+ WERROR wkssvc_NetrUseAdd(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in] uint32 level,
+ [in] [switch_is(level)] [ref] wkssvc_NetrUseGetInfoCtr *ctr,
+ [in,out] uint32 *parm_err
+ );
+
+ /*****************************/
+ /* Function 0x09 */
+ WERROR WKSSVC_NETRUSEGETINFO ();
+
+ /*****************************/
+ /* Function 0x0a */
+ WERROR wkssvc_NetrUseDel(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *use_name,
+ [in] uint32 force_cond
+ );
+
+ /*****************************/
+ /* Function 0x0b */
typedef struct {
uint32 count;
[size_is(count)] wkssvc_NetrUseInfo2 *array;
diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
index 8380c8f9bd..7afed4f923 100644
--- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
+++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
@@ -182,11 +182,11 @@ static WERROR dcesrv_wkssvc_NetrWkstaTransportDel(struct dcesrv_call_state *dce_
}
-/*
- WKSSVC_NETRUSEADD
+/*
+ wkssvc_NetrUseAdd
*/
-static WERROR dcesrv_WKSSVC_NETRUSEADD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct WKSSVC_NETRUSEADD *r)
+static WERROR dcesrv_wkssvc_NetrUseAdd(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct wkssvc_NetrUseAdd *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
@@ -202,11 +202,11 @@ static WERROR dcesrv_WKSSVC_NETRUSEGETINFO(struct dcesrv_call_state *dce_call, T
}
-/*
- WKSSVC_NETRUSEDEL
+/*
+ wkssvc_NetrUseDel
*/
-static WERROR dcesrv_WKSSVC_NETRUSEDEL(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct WKSSVC_NETRUSEDEL *r)
+static WERROR dcesrv_wkssvc_NetrUseDel(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct wkssvc_NetrUseDel *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 8fe410057c..72f9f63ddd 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -26,6 +26,7 @@
#include "param/param.h"
#define SMBTORTURE_TRANSPORT_NAME "\\Device\\smbtrt_transport_name"
+#define SMBTORTURE_USE_NAME "S:"
static bool test_NetWkstaGetInfo(struct torture_context *tctx,
struct dcerpc_pipe *p)
@@ -298,6 +299,85 @@ static bool test_NetrUseEnum(struct torture_context *tctx,
return true;
}
+static bool test_NetrUseAdd(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ NTSTATUS status;
+ struct wkssvc_NetrUseAdd r;
+ struct wkssvc_NetrUseInfo0 info0;
+ struct wkssvc_NetrUseInfo1 info1;
+ union wkssvc_NetrUseGetInfoCtr *ctr;
+ uint32_t parm_err = 0;
+
+ ctr = talloc(tctx, union wkssvc_NetrUseGetInfoCtr);
+
+ ZERO_STRUCT(info0);
+
+ info0.local = SMBTORTURE_USE_NAME;
+ info0.remote = "\\\\localhost\\c$";
+
+ ctr->info0 = &info0;
+
+ r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.level = 0;
+ r.in.ctr = ctr;
+ r.in.parm_err = r.out.parm_err = &parm_err;
+
+ torture_comment(tctx, "testing NetrUseAdd level %u\n",
+ r.in.level);
+
+ status = dcerpc_wkssvc_NetrUseAdd(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetrUseAdd failed");
+ torture_assert_werr_equal(tctx, r.out.result, WERR_UNKNOWN_LEVEL,
+ "NetrUseAdd failed");
+
+ ZERO_STRUCT(r);
+ ZERO_STRUCT(info1);
+
+ info1.local = SMBTORTURE_USE_NAME;
+ info1.remote = "\\\\localhost\\sysvol";
+ info1.password = NULL;
+
+ ctr->info1 = &info1;
+
+ r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.level = 1;
+ r.in.ctr = ctr;
+ r.in.parm_err = r.out.parm_err = &parm_err;
+
+ torture_comment(tctx, "testing NetrUseAdd level %u\n",
+ r.in.level);
+
+ status = dcerpc_wkssvc_NetrUseAdd(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetrUseAdd failed");
+ torture_assert_werr_ok(tctx, r.out.result,
+ "NetrUseAdd failed");
+
+ return true;
+}
+
+static bool test_NetrUseDel(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ NTSTATUS status;
+ struct wkssvc_NetrUseDel r;
+
+ r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.use_name = SMBTORTURE_USE_NAME;
+ r.in.force_cond = 0;
+
+ torture_comment(tctx, "testing NetrUseDel\n");
+
+ status = dcerpc_wkssvc_NetrUseDel(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetrUseDel failed");
+ torture_assert_werr_ok(tctx, r.out.result,
+ "NetrUseDel failed");
+ return true;
+}
+
struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite;
@@ -322,8 +402,12 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
torture_rpc_tcase_add_test(tcase, "NetrWkstaUserGetInfo",
test_NetrWkstaUserGetInfo);
+ torture_rpc_tcase_add_test(tcase, "NetrUseDel",
+ test_NetrUseDel);
torture_rpc_tcase_add_test(tcase, "NetrUseEnum",
test_NetrUseEnum);
+ torture_rpc_tcase_add_test(tcase, "NetrUseAdd",
+ test_NetrUseAdd);
return suite;
}