mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r26147: Add IDL and torture test for wkssvc_NetrUseDel and wkssvc_NetrUseAdd.
Guenther
(This used to be commit b5b3cc1667
)
This commit is contained in:
parent
ec739190fb
commit
9854192923
@ -268,18 +268,11 @@ import "srvsvc.idl";
|
||||
|
||||
/*****************************/
|
||||
/* Function 0x08 */
|
||||
WERROR WKSSVC_NETRUSEADD ();
|
||||
typedef struct {
|
||||
[string,charset(UTF16)] uint16 *unknown1;
|
||||
[string,charset(UTF16)] uint16 *unknown2;
|
||||
} wkssvc_NetrUseInfo3;
|
||||
|
||||
/*****************************/
|
||||
/* Function 0x09 */
|
||||
WERROR WKSSVC_NETRUSEGETINFO ();
|
||||
|
||||
/*****************************/
|
||||
/* Function 0x0a */
|
||||
WERROR WKSSVC_NETRUSEDEL ();
|
||||
|
||||
/*****************************/
|
||||
/* 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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user