r4203: the bind_info blob isn't a const.
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Dec 2004 07:18:58 +0000 (07:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:26 +0000 (13:07 -0500)
here's the idl to parse it, because we don't want the
callers to manually de/encode this

metze
(This used to be commit 983f74c3651759991378b0d7b13b0952d77b3544)

source4/librpc/idl/drsuapi.idl
source4/rpc_server/drsuapi/dcesrv_drsuapi.c

index b914292abb46fea02edab8af7b76447b96e13c7c..a85871e28e5efd0a5fbaf256facff176fb00b7b3 100644 (file)
@@ -12,33 +12,91 @@ interface drsuapi
        /*****************/
         /* Function 0x00 */
 
-       typedef [flag(NDR_PAHEX)] struct {
-               [range(1,10000)] uint32 length;
-               [size_is(length)] uint8 data[];
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_BASE                           = 0x00000001;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION              = 0x00000002;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI                      = 0x00000004;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2                     = 0x00000008;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS                = 0x00000010;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1                      = 0x00000020;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION       = 0x00000040;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_00000080                       = 0x00000080;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE                    = 0x00000100;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2                    = 0x00000200;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION       = 0x00000400;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2                      = 0x00000800;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD   = 0x00001000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND                    = 0x00002000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO                  = 0x00004000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION              = 0x00008000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01                     = 0x00010000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP          = 0x00020000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY                = 0x00040000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3                     = 0x00080000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_00100000                       = 0x00100000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2               = 0x00200000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6                   = 0x00400000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS                  = 0x00800000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8                   = 0x01000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5                 = 0x02000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6                 = 0x04000000;
+       /* the following 3 are correctly be the same value */
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3               = 0x08000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7                 = 0x08000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT                  = 0x08000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS                = 0x10000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_20000000                       = 0x20000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_40000000                       = 0x40000000;
+       const uint32 DRSUAPI_SUPPORTED_EXTENSION_80000000                       = 0x80000000;
+
+       /* this is used by w2k */
+       typedef struct {
+               uint32 supported_extensions;
+               GUID site_guid;
+               uint32 u1;
+       } drsuapi_DsBindInfo24;
+
+       /* this is used by w2k3 */
+       typedef struct {
+               uint32 supported_extensions;
+               GUID site_guid;
+               uint32 u1;
+               uint32 repl_epoch;
+       } drsuapi_DsBindInfo28;
+
+       typedef struct {
+               [flag(NDR_REMAINING)] DATA_BLOB info;
+       } drsuapi_DsBindInfoFallBack;
+
+       typedef [nodiscriminant] union {
+               [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
+               [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
+               [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
        } drsuapi_DsBindInfo;
 
+       /* the drsuapi_DsBindInfoCtr was this before
+        * typedef [flag(NDR_PAHEX)] struct {
+        *      [range(1,10000)] uint32 length;
+        *      [size_is(length)] uint8 data[];
+        * } drsuapi_DsBindInfo;
+        *
+        * but we don't want the caller to manually decode this blob,
+        * so we're doing it here
+        */
+
+       typedef struct {
+               [range(1,10000)] uint32 length;
+               [switch_is(length)] drsuapi_DsBindInfo info;
+       } drsuapi_DsBindInfoCtr;
+
        /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
         * 
         * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
         */
        const string DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
-       
-
-       /* this are the bind info blobs returned (seemed to be const):
-               w2k3    7ffbff1f81a6ff5d80139441a372e9b779d70268f801000000000000
-               w2k     7ffb1f00cb7fb9102391c143bda81fc90e0ff452f4000000
-       */
-       const uint8 DRSUAPI_DS_BIND_INFO_RESPONSE_W2K3[] = {    0x7f,0xfb,0xff,0x1f,0x81,0xa6,0xff,0x5d,
-                                                               0x80,0x13,0x94,0x41,0xa3,0x72,0xe9,0xb7,
-                                                               0x79,0xd7,0x02,0x68,0xf8,0x01,0x00,0x00,
-                                                               0x00,0x00,0x00,0x00};
-       const uint8 DRSUAPI_DS_BIND_INFO_RESPONSE_W2K[] = {     0x7f,0xfb,0x1f,0x00,0xcb,0x7f,0xb9,0x10,
-                                                               0x23,0x91,0xc1,0x43,0xbd,0xa8,0x1f,0xc9,
-                                                               0x0e,0x0f,0xf4,0x52,0xf4,0x00,0x00,0x00};
 
        WERROR drsuapi_DsBind(
                [in]        GUID *bind_guid,
-               [in,out]    drsuapi_DsBindInfo *bind_info,
+               [in,out]    drsuapi_DsBindInfoCtr *bind_info,
                [out,ref]   policy_handle *bind_handle
                );
 
index a8c48d680507184fccf90a535a31274e9243d430..5539c9117f36079469414e4b6c2023f112921269 100644 (file)
@@ -42,8 +42,8 @@ static WERROR drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem
 {
        struct drsuapi_bind_state *b_state;
        struct dcesrv_handle *handle;
-       struct drsuapi_DsBindInfo *bind_info;
-       const uint8_t bind_info_data[] = DRSUAPI_DS_BIND_INFO_RESPONSE_W2K3;
+       struct drsuapi_DsBindInfoCtr *bind_info;
+       struct GUID site_guid;
 
        r->out.bind_info = NULL;
        ZERO_STRUCTP(r->out.bind_handle);
@@ -66,12 +66,16 @@ static WERROR drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem
        handle->data = b_state;
        handle->destroy = drsuapi_handle_destroy;
 
-       bind_info = talloc_p(mem_ctx, struct drsuapi_DsBindInfo);
+       bind_info = talloc_p(mem_ctx, struct drsuapi_DsBindInfoCtr);
        WERR_TALLOC_CHECK(bind_info);
-       
-       bind_info->length = sizeof(bind_info_data);
-       bind_info->data = talloc_memdup(mem_ctx, bind_info_data, sizeof(bind_info_data));
-       WERR_TALLOC_CHECK(bind_info->data);
+
+       ZERO_STRUCT(site_guid);
+
+       bind_info->length                               = 28;
+       bind_info->info.info28.supported_extensions     = 0;
+       bind_info->info.info28.site_guid                = site_guid;
+       bind_info->info.info28.u1                       = 0;
+       bind_info->info.info28.repl_epoch               = 0;
 
        r->out.bind_info = bind_info;
        *r->out.bind_handle = handle->wire_handle;
@@ -109,8 +113,9 @@ static WERROR drsuapi_DsUnbind(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
 static WERROR drsuapi_DsReplicaSync(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct drsuapi_DsReplicaSync *r)
 {
-       /* TODO: implment this call correct!
-        *       for now we just say yes
+       /* TODO: implement this call correct!
+        *       for now we just say yes,
+        *       because we have no output parameter
         */
        return WERR_OK;
 }