lsa.idl: improve idl for lsa_ForestTrust*Record*
authorStefan Metzmacher <metze@samba.org>
Wed, 4 Feb 2015 18:00:44 +0000 (18:00 +0000)
committerGünther Deschner <gd@samba.org>
Thu, 12 Mar 2015 16:13:44 +0000 (17:13 +0100)
The meaning of lsa_ForestTrustRecordFlags is based lsa_ForestTrustRecordType,
but the type is not always available so it's not possible to use an union.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
librpc/idl/lsa.idl
source3/rpc_server/lsa/srv_lsa_nt.c
source4/rpc_server/lsa/dcesrv_lsa.c

index 2236581948c757c2ef52448d1342f8720f1ae117..9e8d50876f89fd45586d2864f315dfa80faf2ea7 100644 (file)
@@ -1255,6 +1255,26 @@ import "misc.idl", "security.idl";
        [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
 
        /* Function 0x49 */
+       typedef [bitmap32bit,public] bitmap {
+               /* these apply to LSA_FOREST_TRUST_TOP_LEVEL_NAME */
+               LSA_TLN_DISABLED_NEW            = 0x00000001,
+               LSA_TLN_DISABLED_ADMIN          = 0x00000002,
+               LSA_TLN_DISABLED_CONFLICT       = 0x00000004,
+
+               /* these apply to LSA_FOREST_TRUST_DOMAIN_INFO */
+               LSA_SID_DISABLED_ADMIN          = 0x00000001,
+               LSA_SID_DISABLED_CONFLICT       = 0x00000002,
+               LSA_NB_DISABLED_ADMIN           = 0x00000004,
+               LSA_NB_DISABLED_CONFLICT        = 0x00000008
+       } lsa_ForestTrustRecordFlags;
+
+       typedef enum {
+               LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
+               LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
+               LSA_FOREST_TRUST_DOMAIN_INFO = 2,
+               LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
+       } lsa_ForestTrustRecordType;
+
        typedef struct {
                [range(0,131072)] uint3264 length;
                [size_is(length)] uint8 *data;
@@ -1266,24 +1286,17 @@ import "misc.idl", "security.idl";
                lsa_StringLarge netbios_domain_name;
        } lsa_ForestTrustDomainInfo;
 
-       typedef [switch_type(uint32)] union {
+       typedef [switch_type(lsa_ForestTrustRecordType)] union {
                [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_StringLarge top_level_name;
                [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
                [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
                [default] lsa_ForestTrustBinaryData data;
        } lsa_ForestTrustData;
 
-       typedef enum {
-               LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
-               LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
-               LSA_FOREST_TRUST_DOMAIN_INFO = 2,
-               LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
-       } lsa_ForestTrustRecordType;
-
        typedef struct {
-               uint32 flags;
+               lsa_ForestTrustRecordFlags flags;
                lsa_ForestTrustRecordType type;
-               hyper time;
+               NTTIME_hyper time;
                [switch_is(type)] lsa_ForestTrustData forest_trust_data;
        } lsa_ForestTrustRecord;
 
@@ -1308,31 +1321,10 @@ import "misc.idl", "security.idl";
                LSA_FOREST_TRUST_COLLISION_OTHER = 2
        } lsa_ForestTrustCollisionRecordType;
 
-       /* if type is CollisionTdo, flags can be */
-       typedef [bitmap32bit] bitmap {
-               LSA_TLN_DISABLED_NEW            = 0x00000001,
-               LSA_TLN_DISABLED_ADMIN          = 0x00000002,
-               LSA_TLN_DISABLED_CONFLICT       = 0x00000004
-       } lsa_ForestTrustCollisionTDOFlags;
-
-       /* if type is CollisionXref, flags can be */
-       typedef [bitmap32bit] bitmap {
-               LSA_SID_DISABLED_ADMIN          = 0x00000001,
-               LSA_SID_DISABLED_CONFLICT       = 0x00000002,
-               LSA_NB_DISABLED_ADMIN           = 0x00000004,
-               LSA_NB_DISABLED_CONFLICT        = 0x00000008
-       } lsa_ForestTrustCollisionXrefFlags;
-
-       typedef [nodiscriminant] union {
-               [case(LSA_FOREST_TRUST_COLLISION_TDO)] lsa_ForestTrustCollisionTDOFlags flags;
-               [case(LSA_FOREST_TRUST_COLLISION_XREF)] lsa_ForestTrustCollisionXrefFlags flags;
-               [default] uint32 flags;
-       } lsa_ForestTrustCollisionFlags;
-
        typedef [public] struct {
                uint32 index;
                lsa_ForestTrustCollisionRecordType type;
-               [switch_is(type)] lsa_ForestTrustCollisionFlags flags;
+               lsa_ForestTrustRecordFlags flags;
                lsa_String name;
        } lsa_ForestTrustCollisionRecord;
 
index 039206b68d81895d0d51d8d49c8150d3852e73cb..f9d1c13a1eff7d0cec9f03952825e87d17c4aa5c 100644 (file)
@@ -4318,7 +4318,7 @@ static NTSTATUS add_collision(struct lsa_ForestTrustCollisionInfo *c_info,
 
        es[i]->index = idx;
        es[i]->type = collision_type;
-       es[i]->flags.flags = conflict_type;
+       es[i]->flags = conflict_type;
        es[i]->name.string = talloc_strdup(es[i], tdo_name);
        if (!es[i]->name.string) {
                return NT_STATUS_NO_MEMORY;
index 688702b939d1b0ca699d46e4d806e75cb6de41e4..b355eafeeca69fba5b5318f6ccb5ba2b4d35edb5 100644 (file)
@@ -4372,7 +4372,7 @@ static NTSTATUS add_collision(struct lsa_ForestTrustCollisionInfo *c_info,
 
        es[i]->index = idx;
        es[i]->type = collision_type;
-       es[i]->flags.flags = conflict_type;
+       es[i]->flags = conflict_type;
        es[i]->name.string = talloc_strdup(es[i], tdo_name);
        if (!es[i]->name.string) {
                return NT_STATUS_NO_MEMORY;