r26273: Add IDL and torture test for netr_NetrEnumerateTurstedDomains() and
authorGünther Deschner <gd@samba.org>
Mon, 3 Dec 2007 22:38:54 +0000 (23:38 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:56 +0000 (05:47 +0100)
netr_NetrEnumerateTurstedDomainsEx().

Guenther

source/librpc/idl/netlogon.idl
source/rpc_server/netlogon/dcerpc_netlogon.c
source/samba4-knownfail
source/torture/rpc/netlogon.c

index 190edcddbe7b3f6342b8a440df5bfa696a0acb59..9743f74b34538ab5e31ce0a14fb21893dee2f717 100644 (file)
@@ -903,7 +903,15 @@ interface netlogon
 
        /*****************/
        /* Function 0x13 */
-       WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ;
+       typedef struct {
+               uint32 length;
+               [size_is(length)] uint8 *data;
+       } netr_Blob;
+
+       WERROR netr_NetrEnumerateTrustedDomains(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [out,ref] netr_Blob *trusted_domains_blob
+               );
 
        /*****************/
        /* Function 0x14 */
@@ -1027,11 +1035,6 @@ interface netlogon
        /****************/
        /* Function 0x1d */
 
-       typedef struct {
-               uint32 length;
-               [size_is(length)] uint8 *data;
-       } netr_Blob;
-
        typedef [flag(NDR_PAHEX)] struct {
                uint16 length;
                uint16 size;
@@ -1153,7 +1156,52 @@ interface netlogon
 
        /****************/
        /* Function 0x24 */
-       WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX();
+       typedef [bitmap32bit] bitmap {
+               NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
+               NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
+               NETR_TRUST_FLAG_TREEROOT  = 0x00000004,
+               NETR_TRUST_FLAG_PRIMARY   = 0x00000008,
+               NETR_TRUST_FLAG_NATIVE    = 0x00000010,
+               NETR_TRUST_FLAG_INBOUND   = 0x00000020
+       } netr_TrustFlags;
+
+       typedef [v1_enum] enum {
+               NETR_TRUST_TYPE_DOWNLEVEL       = 1,
+               NETR_TRUST_TYPE_UPLEVEL         = 2,
+               NETR_TRUST_TYPE_MIT             = 3,
+               NETR_TRUST_TYPE_DCE             = 4
+       } netr_TrustType;
+
+       typedef [bitmap32bit] bitmap {
+               NETR_TRUST_ATTRIBUTE_NON_TRANSITIVE     = 0x00000001,
+               NETR_TRUST_ATTRIBUTE_UPLEVEL_ONLY       = 0x00000002,
+               NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
+               NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE  = 0x00000008,
+               NETR_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
+               NETR_TRUST_ATTRIBUTE_WITHIN_FOREST      = 0x00000020,
+               NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL  = 0x00000040
+       } netr_TrustAttributes;
+
+       typedef struct {
+               [string,charset(UTF16)] uint16                  *netbios_name;
+               [string,charset(UTF16)] uint16                  *dns_name;
+               netr_TrustFlags         trust_flags;
+               uint32                  parent_index;
+               netr_TrustType          trust_type;
+               netr_TrustAttributes    trust_attributes;
+               dom_sid2                *sid;
+               GUID                    guid;
+       } netr_DomainTrust;
+
+        typedef struct {
+                uint32 count;
+                [size_is(count)] netr_DomainTrust *array;
+        } netr_DomainTrustList;
+
+       WERROR netr_NetrEnumerateTrustedDomainsEx(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [out,ref] netr_DomainTrustList *dom_trust_list
+       );
 
        /****************/
        /* Function 0x25 */
@@ -1199,43 +1247,6 @@ interface netlogon
        /****************/
        /* Function 0x28 */
 
-       typedef [bitmap32bit] bitmap {
-               NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
-               NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
-               NETR_TRUST_FLAG_TREEROOT  = 0x00000004,
-               NETR_TRUST_FLAG_PRIMARY   = 0x00000008,
-               NETR_TRUST_FLAG_NATIVE    = 0x00000010,
-               NETR_TRUST_FLAG_INBOUND   = 0x00000020
-       } netr_TrustFlags;
-
-       typedef [v1_enum] enum {
-               NETR_TRUST_TYPE_DOWNLEVEL       = 1,
-               NETR_TRUST_TYPE_UPLEVEL         = 2,
-               NETR_TRUST_TYPE_MIT             = 3,
-               NETR_TRUST_TYPE_DCE             = 4
-       } netr_TrustType;
-
-       typedef [bitmap32bit] bitmap {
-               NETR_TRUST_ATTRIBUTE_NON_TRANSITIVE     = 0x00000001,
-               NETR_TRUST_ATTRIBUTE_UPLEVEL_ONLY       = 0x00000002,
-               NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
-               NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE  = 0x00000008,
-               NETR_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
-               NETR_TRUST_ATTRIBUTE_WITHIN_FOREST      = 0x00000020,
-               NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL  = 0x00000040
-       } netr_TrustAttributes;
-
-       typedef struct {
-               [string,charset(UTF16)] uint16                  *netbios_name;
-               [string,charset(UTF16)] uint16                  *dns_name;
-               netr_TrustFlags         trust_flags;
-               uint32                  parent_index;
-               netr_TrustType          trust_type;
-               netr_TrustAttributes    trust_attributes;
-               dom_sid2                *sid;
-               GUID                    guid;
-       } netr_DomainTrust;
-
        WERROR netr_DsrEnumerateDomainTrusts(
                [in]                 [string,charset(UTF16)] uint16           *server_name,
                [in]                 netr_TrustFlags  trust_flags,
index 0aa39ea7bd534e6370fb3e1c8f14744ea9a68da3..1c6a1d0588184881fb3004a8f16a7d7a65f68ccd 100644 (file)
@@ -761,10 +761,10 @@ static WERROR dcesrv_netr_LogonControl2Ex(struct dcesrv_call_state *dce_call, TA
 
 
 /* 
-  netr_NETRENUMERATETRUSTEDDOMAINS 
+  netr_NetrEnumerateTurstedDomains
 */
-static WERROR dcesrv_netr_NETRENUMERATETRUSTEDDOMAINS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-                      struct netr_NETRENUMERATETRUSTEDDOMAINS *r)
+static WERROR dcesrv_netr_NetrEnumerateTrustedDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+                      struct netr_NetrEnumerateTrustedDomains *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }
@@ -1101,11 +1101,11 @@ static WERROR dcesrv_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct dcesrv_call
 }
 
 
-/* 
-  netr_NETRENUMERATETRUSTEDDOMAINSEX 
+/*
+  netr_NetrEnumerateTrustedDomainsEx
 */
-static WERROR dcesrv_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
-                      struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r)
+static WERROR dcesrv_netr_NetrEnumerateTrustedDomainsEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+                      struct netr_NetrEnumerateTrustedDomainsEx *r)
 {
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 }
index dc32a698df31b8c9fc5a6f83427c6d0af7949648..e9226f86a701c03ec0475a466393cf2a4002254a 100644 (file)
@@ -24,6 +24,8 @@ RPC-NETLOGON.*/LogonControl
 RPC-NETLOGON.*/LogonControl2
 RPC-NETLOGON.*/GetAnyDCName
 RPC-NETLOGON.*/DsrEnumerateDomainTrusts
+RPC-NETLOGON.*/NetrEnumerateTrustedDomains
+RPC-NETLOGON.*/NetrEnumerateTrustedDomainsEx
 RPC-NETLOGON.*/DsrGetDcSiteCoverageW
 RPC-NETLOGON.*/DsRAddressToSitenamesW
 RPC-NETLOGON.*/DsRAddressToSitenamesExW
index a8f408c0f6bc697e60bbb1499ab85f4f8d19d0d3..92fd27b8ce7f8ae05a3090e95e9d80fc7ce2d719 100644 (file)
@@ -1051,6 +1051,41 @@ static bool test_DsrEnumerateDomainTrusts(struct torture_context *tctx,
        return true;
 }
 
+static bool test_netr_NetrEnumerateTrustedDomains(struct torture_context *tctx,
+                                                 struct dcerpc_pipe *p)
+{
+       NTSTATUS status;
+       struct netr_NetrEnumerateTrustedDomains r;
+       struct netr_Blob trusted_domains_blob;
+
+       r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+       r.out.trusted_domains_blob = &trusted_domains_blob;
+
+       status = dcerpc_netr_NetrEnumerateTrustedDomains(p, tctx, &r);
+       torture_assert_ntstatus_ok(tctx, status, "netr_NetrEnumerateTrustedDomains");
+       torture_assert_werr_ok(tctx, r.out.result, "NetrEnumerateTrustedDomains");
+
+       return true;
+}
+
+static bool test_netr_NetrEnumerateTrustedDomainsEx(struct torture_context *tctx,
+                                                   struct dcerpc_pipe *p)
+{
+       NTSTATUS status;
+       struct netr_NetrEnumerateTrustedDomainsEx r;
+       struct netr_DomainTrustList dom_trust_list;
+
+       r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+       r.out.dom_trust_list = &dom_trust_list;
+
+       status = dcerpc_netr_NetrEnumerateTrustedDomainsEx(p, tctx, &r);
+       torture_assert_ntstatus_ok(tctx, status, "netr_NetrEnumerateTrustedDomainsEx");
+       torture_assert_werr_ok(tctx, r.out.result, "NetrEnumerateTrustedDomainsEx");
+
+       return true;
+}
+
+
 static bool test_netr_DsRGetSiteName(struct dcerpc_pipe *p, struct torture_context *tctx,
                                     const char *computer_name, 
                                     const char *expected_site) 
@@ -1479,6 +1514,8 @@ struct torture_suite *torture_rpc_netlogon(TALLOC_CTX *mem_ctx)
        torture_rpc_tcase_add_test_creds(tcase, "DatabaseSync2", test_DatabaseSync2);
        torture_rpc_tcase_add_test(tcase, "LogonControl2Ex", test_LogonControl2Ex);
        torture_rpc_tcase_add_test(tcase, "DsrEnumerateDomainTrusts", test_DsrEnumerateDomainTrusts);
+       torture_rpc_tcase_add_test(tcase, "NetrEnumerateTrustedDomains", test_netr_NetrEnumerateTrustedDomains);
+       torture_rpc_tcase_add_test(tcase, "NetrEnumerateTrustedDomainsEx", test_netr_NetrEnumerateTrustedDomainsEx);
        test = torture_rpc_tcase_add_test_creds(tcase, "GetDomainInfo_async", test_GetDomainInfo_async);
        test->dangerous = true;
        torture_rpc_tcase_add_test(tcase, "DsRGetDCName", test_netr_DsRGetDCName);