netlogon.idl: fix the marshalling of netr_trust_extension_container for NDR64
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Aug 2019 11:22:43 +0000 (13:22 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 20 Sep 2019 01:14:43 +0000 (01:14 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
librpc/idl/netlogon.idl
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/torture/rpc/netlogon.c

index e6fda421ea59e822671a128f2b7569da06d45424..be6e45054a9f63c1bcb5fd97b2416e306aa6c89f 100644 (file)
@@ -1386,21 +1386,27 @@ interface netlogon
        } netr_WorkstationInfo;
 
        typedef struct {
-               /* these first 3 values come from the fact windows
-                  actually encodes this structure as a UNICODE_STRING
-                  - see MS-NRPC section 2.2.1.3.9 */
-               [value(8)] uint32 length;
-               [value(0)] uint32 dummy;
-               [value(8)] uint32 size;
                netr_TrustFlags flags;
                uint32 parent_index;
                lsa_TrustType trust_type;
                lsa_TrustAttributes trust_attributes;
+       } netr_trust_extension_info;
+
+       typedef struct {
+               /* these first 3 values come from the fact windows
+                  actually encodes this structure as a UNICODE_STRING
+                  - see MS-NRPC section 2.2.1.3.9 */
+               [value(8)] uint3264 length;
+               [value(0)] uint3264 dummy;
+               [value(8)] uint3264 size;
+               [subcontext(0),subcontext_size(size*2)]
+               netr_trust_extension_info info;
        } netr_trust_extension;
 
        typedef struct {
-               uint16 length; /* value is 16 when info != NULL, otherwise 0 */
-               [value(length)] uint16 size;   /* value is 16 when info != NULL, otherwise 0 */
+               /* value is 16 when info != NULL, otherwise 0 */
+               [value(info == NULL ? 0 : 16)] uint16 length;
+               [value(info == NULL ? 0 : 16)] uint16 size;
                netr_trust_extension *info;
        } netr_trust_extension_container;
 
index 49a075137ff680e34f9c82618b84cd94d9750069..6163eb92ff3a435613523708c482b8bece2a7d51 100644 (file)
@@ -2203,13 +2203,15 @@ static NTSTATUS fill_our_one_domain_info(TALLOC_CTX *mem_ctx,
        ZERO_STRUCTP(info);
 
        if (is_trust_list) {
-               struct netr_trust_extension *tei = NULL;
+               struct netr_trust_extension *te = NULL;
+               struct netr_trust_extension_info *tei = NULL;
 
                /* w2k8 only fills this on trusted domains */
-               tei = talloc_zero(mem_ctx, struct netr_trust_extension);
-               if (tei == NULL) {
+               te = talloc_zero(mem_ctx, struct netr_trust_extension);
+               if (te == NULL) {
                        return NT_STATUS_NO_MEMORY;
                }
+               tei = &te->info;
                tei->flags |= NETR_TRUST_FLAG_PRIMARY;
 
                /*
@@ -2230,8 +2232,7 @@ static NTSTATUS fill_our_one_domain_info(TALLOC_CTX *mem_ctx,
                 */
                tei->trust_attributes = 0;
 
-               info->trust_extension.info = tei;
-               info->trust_extension.length = 16;
+               info->trust_extension.info = te;
        }
 
        if (is_trust_list) {
@@ -2264,15 +2265,17 @@ static NTSTATUS fill_trust_one_domain_info(TALLOC_CTX *mem_ctx,
                                const struct lsa_TrustDomainInfoInfoEx *tdo,
                                struct netr_OneDomainInfo *info)
 {
-       struct netr_trust_extension *tei = NULL;
+       struct netr_trust_extension *te = NULL;
+       struct netr_trust_extension_info *tei = NULL;
 
        ZERO_STRUCTP(info);
 
        /* w2k8 only fills this on trusted domains */
-       tei = talloc_zero(mem_ctx, struct netr_trust_extension);
-       if (tei == NULL) {
+       te = talloc_zero(mem_ctx, struct netr_trust_extension);
+       if (te == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
+       tei = &te->info;
 
        if (tdo->trust_direction & LSA_TRUST_DIRECTION_INBOUND) {
                tei->flags |= NETR_TRUST_FLAG_INBOUND;
@@ -2294,8 +2297,7 @@ static NTSTATUS fill_trust_one_domain_info(TALLOC_CTX *mem_ctx,
        tei->trust_type = tdo->trust_type;
        tei->trust_attributes = tdo->trust_attributes;
 
-       info->trust_extension.info = tei;
-       info->trust_extension.length = 16;
+       info->trust_extension.info = te;
 
        info->domainname.string = tdo->netbios_name.string;
        if (tdo->trust_type != LSA_TRUST_TYPE_DOWNLEVEL) {
index 94fe4020fa913a0d2b3b9a90f372ba627ecb392a..65188d2dc8569d17122b79b7629b8f540a075b9b 100644 (file)
@@ -4096,7 +4096,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = NULL;
        struct netr_OneDomainInfo *odi1 = NULL;
        struct netr_OneDomainInfo *odi2 = NULL;
-       struct netr_trust_extension *tex2 = NULL;
+       struct netr_trust_extension_info *tex2 = NULL;
 
        torture_comment(tctx, "Testing netr_LogonGetDomainInfo\n");
 
@@ -4481,13 +4481,13 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
        for (i=0; i < info.domain_info->trusted_domain_count; i++) {
                struct netr_OneDomainInfo *odiT =
                        &info.domain_info->trusted_domains[i];
-               struct netr_trust_extension *texT = NULL;
+               struct netr_trust_extension_info *texT = NULL;
 
                torture_assert_int_equal(tctx, odiT->trust_extension.length, 16,
                                         "trust_list should have extension");
                torture_assert(tctx, odiT->trust_extension.info != NULL,
                               "trust_list should have extension");
-               texT = odiT->trust_extension.info;
+               texT = &odiT->trust_extension.info->info;
 
                if (GUID_equal(&odiT->domain_guid, &odi1->domain_guid)) {
                        odi2 = odiT;
@@ -4562,7 +4562,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
                                 "trust_list should have extension");
        torture_assert(tctx, odi2->trust_extension.info != NULL,
                       "trust_list should have extension");
-       tex2 = odi2->trust_extension.info;
+       tex2 = &odi2->trust_extension.info->info;
        torture_assert_int_equal(tctx,
                                 tex2->flags & NETR_TRUST_FLAG_PRIMARY,
                                 NETR_TRUST_FLAG_PRIMARY,