r26147: Add IDL and torture test for wkssvc_NetrUseDel and wkssvc_NetrUseAdd.
authorGünther Deschner <gd@samba.org>
Tue, 27 Nov 2007 09:18:00 +0000 (10:18 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:46:23 +0000 (05:46 +0100)
Guenther
(This used to be commit b5b3cc1667f539ab75f2d3d0c9c79b45d85e967e)

source4/librpc/idl/wkssvc.idl
source4/rpc_server/wkssvc/dcesrv_wkssvc.c
source4/torture/rpc/wkssvc.c

index a3e08c9444987ef421b2a5c886f6a6b11bc325fb..cc25ad3c2f0e14388fb541a5c3526a6e11aa9ee6 100644 (file)
@@ -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;
index 8380c8f9bda73811f0466bb3db3ed7dd4a2553df..7afed4f923dec06825b58663aa88ccce57f5c7f4 100644 (file)
@@ -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);
 }
index 8fe410057c2cb99f6a7fa002eed0bebf1498edad..72f9f63dddef64201061a340d1594c678179394a 100644 (file)
@@ -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;
 }