Author: gd
Date: 2007-11-06 01:24:07 +0000 (Tue, 06 Nov 2007)
New Revision: 25848

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

Log:
Add IDL and torture test for dfs_SetDcAddress and dfs_GetDcAddress.

Guenther

Modified:
   branches/SAMBA_4_0/source/librpc/idl/dfs.idl
   branches/SAMBA_4_0/source/torture/rpc/dfs.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/dfs.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/dfs.idl        2007-11-06 01:05:26 UTC 
(rev 25847)
+++ branches/SAMBA_4_0/source/librpc/idl/dfs.idl        2007-11-06 01:24:07 UTC 
(rev 25848)
@@ -377,10 +377,20 @@
                );
 
        /* Function 0x10 */
-       WERROR dfs_GetDcAddress();
+       WERROR dfs_GetDcAddress(
+               [in]            [string,charset(UTF16)] uint16 servername[],
+               [in,out,ref]    [string,charset(UTF16)] uint16 
**server_fullname,
+               [in,out,ref]    boolean8 *is_root,
+               [in,out,ref]    uint32 *ttl
+               );
 
        /* Function 0x11 */
-       WERROR dfs_SetDcAddress();
+       WERROR dfs_SetDcAddress(
+               [in]            [string,charset(UTF16)] uint16 servername[],
+               [in]            [string,charset(UTF16)] uint16 
server_fullname[],
+               [in]            uint32  flags,
+               [in]            uint32  ttl
+               );
 
        /* Function 0x12 */
        WERROR dfs_FlushFtTable(

Modified: branches/SAMBA_4_0/source/torture/rpc/dfs.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/dfs.c 2007-11-06 01:05:26 UTC (rev 
25847)
+++ branches/SAMBA_4_0/source/torture/rpc/dfs.c 2007-11-06 01:24:07 UTC (rev 
25848)
@@ -522,6 +522,80 @@
        return ret;
 }
 
+static bool test_GetDcAddress(struct dcerpc_pipe *p,
+                             TALLOC_CTX *mem_ctx,
+                             const char *host)
+{
+       NTSTATUS status;
+       struct dfs_GetDcAddress r;
+       uint8_t is_root = 0;
+       uint32_t ttl = 0;
+       const char *ptr;
+
+       printf("Testing GetDcAddress\n");
+
+       ptr = host;
+
+       r.in.servername = host;
+       r.in.server_fullname = r.out.server_fullname = &ptr;
+       r.in.is_root = r.out.is_root = &is_root;
+       r.in.ttl = r.out.ttl = &ttl;
+
+       status = dcerpc_dfs_GetDcAddress(p, mem_ctx, &r);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("GetDcAddress failed - %s\n", nt_errstr(status));
+               return false;
+       } else if (!W_ERROR_IS_OK(r.out.result)) {
+               printf("dfs_GetDcAddress failed - %s\n",
+                       win_errstr(r.out.result));
+               return false;
+       }
+
+       return true;
+}
+
+static bool test_SetDcAddress(struct dcerpc_pipe *p,
+                             TALLOC_CTX *mem_ctx,
+                             const char *host)
+{
+       NTSTATUS status;
+       struct dfs_SetDcAddress r;
+
+       printf("Testing SetDcAddress\n");
+
+       r.in.servername = host;
+       r.in.server_fullname = host;
+       r.in.flags = 0;
+       r.in.ttl = 1000;
+
+       status = dcerpc_dfs_SetDcAddress(p, mem_ctx, &r);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("SetDcAddress failed - %s\n", nt_errstr(status));
+               return false;
+       } else if (!W_ERROR_IS_OK(r.out.result)) {
+               printf("dfs_SetDcAddress failed - %s\n",
+                       win_errstr(r.out.result));
+               return false;
+       }
+
+       return true;
+}
+
+static bool test_DcAddress(struct dcerpc_pipe *p,
+                          TALLOC_CTX *mem_ctx,
+                          const char *host)
+{
+       if (!test_GetDcAddress(p, mem_ctx, host)) {
+               return false;
+       }
+
+       if (!test_SetDcAddress(p, mem_ctx, host)) {
+               return false;
+       }
+
+       return true;
+}
+
 bool torture_rpc_dfs(struct torture_context *torture)
 {
        NTSTATUS status;
@@ -538,6 +612,7 @@
        ret &= test_Enum(p, torture);
        ret &= test_EnumEx(p, torture, host);
        ret &= test_StdRoot(p, torture, host);
+       ret &= test_DcAddress(p, torture, host);
 
        return ret;
 }

Reply via email to