samba-cvs.cvs
[Top] [All Lists]

svn commit: samba r26152 - in branches/SAMBA_4_0/source: librpc/idl rpc_

Subject: svn commit: samba r26152 - in branches/SAMBA_4_0/source: librpc/idl rpc_server/wkssvc torture/rpc
From:
Date: Tue, 27 Nov 2007 10:42:50 +0000 GMT
Author: gd
Date: 2007-11-27 10:42:50 +0000 (Tue, 27 Nov 2007)
New Revision: 26152

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26152

Log:
Add IDL and torture test for wkssvc_NetrEnumerateComputerNames().

Guenther

Modified:
   branches/SAMBA_4_0/source/librpc/idl/wkssvc.idl
   branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c
   branches/SAMBA_4_0/source/torture/rpc/wkssvc.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/wkssvc.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/wkssvc.idl     2007-11-27 10:34:53 UTC 
(rev 26151)
+++ branches/SAMBA_4_0/source/librpc/idl/wkssvc.idl     2007-11-27 10:42:50 UTC 
(rev 26152)
@@ -2,7 +2,7 @@
   wkssvc interface definitions
 */
 
-import "srvsvc.idl";
+import "srvsvc.idl", "lsa.idl";
 
 [ uuid("6bffd098-a112-3610-9833-46c3f87e345a"),
   version(1.0),
@@ -535,5 +535,22 @@
 
        /*****************************/
        /* Function        0x1e      */
-       WERROR WKSSVC_NETRENUMERATECOMPUTERNAMES ();
+       typedef enum {
+               NetPrimaryComputerName = 0,
+               NetAlternateComputerNames = 1,
+               NetAllComputerNames = 2,
+               NetComputerNameTypeMax = 3
+       } wkssvc_ComputerNameType;
+
+       typedef struct {
+               uint32 count;
+               [size_is(count)] lsa_String *computer_name;
+        } wkssvc_ComputerNamesCtr;
+
+       WERROR wkssvc_NetrEnumerateComputerNames(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] wkssvc_ComputerNameType name_type,
+               [in] uint32 Reserved,
+               [out] [ref] wkssvc_ComputerNamesCtr **ctr
+               );
 }

Modified: branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c 2007-11-27 
10:34:53 UTC (rev 26151)
+++ branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c 2007-11-27 
10:42:50 UTC (rev 26152)
@@ -402,11 +402,11 @@
 }
 
 
-/* 
-  WKSSVC_NETRENUMERATECOMPUTERNAMES 
+/*
+  wkssvc_NetrEnumerateComputerNames
 */
-static WERROR dcesrv_WKSSVC_NETRENUMERATECOMPUTERNAMES(struct 
dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-                      struct WKSSVC_NETRENUMERATECOMPUTERNAMES *r)
+static WERROR dcesrv_wkssvc_NetrEnumerateComputerNames(struct 
dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+                      struct wkssvc_NetrEnumerateComputerNames *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }

Modified: branches/SAMBA_4_0/source/torture/rpc/wkssvc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/wkssvc.c      2007-11-27 10:34:53 UTC 
(rev 26151)
+++ branches/SAMBA_4_0/source/torture/rpc/wkssvc.c      2007-11-27 10:42:50 UTC 
(rev 26152)
@@ -504,6 +504,59 @@
        return true;
 }
 
+static bool test_NetrEnumerateComputerNames_level(struct torture_context *tctx,
+                                                 struct dcerpc_pipe *p,
+                                                 uint16_t level)
+{
+       NTSTATUS status;
+       struct wkssvc_NetrEnumerateComputerNames r;
+       struct wkssvc_ComputerNamesCtr *ctr;
+
+       ctr = talloc_zero(tctx, struct wkssvc_ComputerNamesCtr);
+
+       r.in.server_name = dcerpc_server_name(p);
+       r.in.name_type = level;
+       r.in.Reserved = 0;
+       r.out.ctr = &ctr;
+
+       torture_comment(tctx, "testing NetrEnumerateComputerNames level %u\n",
+                       r.in.name_type);
+
+       status = dcerpc_wkssvc_NetrEnumerateComputerNames(p, tctx, &r);
+       torture_assert_ntstatus_ok(tctx, status,
+                                  "NetrEnumerateComputerNames failed");
+       torture_assert_werr_ok(tctx, r.out.result,
+                              "NetrEnumerateComputerNames failed");
+
+       if ((level == NetPrimaryComputerName) && ctr->count != 1) {
+               torture_comment(tctx,
+                               "NetrEnumerateComputerNames did not return one "
+                               "name but %u\n", ctr->count);
+               return false;
+       }
+
+       return true;
+}
+
+static bool test_NetrEnumerateComputerNames(struct torture_context *tctx,
+                                           struct dcerpc_pipe *p)
+{
+       uint16_t levels[] = {0,1,2};
+       int i;
+
+       for (i=0; i<ARRAY_SIZE(levels); i++) {
+
+               if (!test_NetrEnumerateComputerNames_level(tctx,
+                                                          p,
+                                                          levels[i]))
+               {
+                       return false;
+               }
+       }
+
+       return true;
+}
+
 static bool test_NetrValidateName(struct torture_context *tctx,
                                  struct dcerpc_pipe *p)
 {
@@ -605,6 +658,8 @@
                                   test_NetrLogonDomainNameDel);
        torture_rpc_tcase_add_test(tcase, "NetrLogonDomainNameAdd",
                                   test_NetrLogonDomainNameAdd);
+       torture_rpc_tcase_add_test(tcase, "NetrEnumerateComputerNames",
+                                  test_NetrEnumerateComputerNames);
 
        return suite;
 }

<Prev in Thread] Current Thread [Next in Thread>
  • svn commit: samba r26152 - in branches/SAMBA_4_0/source: librpc/idl rpc_server/wkssvc torture/rpc, gd <=