From 6fe9423fc69f3c1a79d0e45ac47d0b3228e4d4d6 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 20 Oct 2003 21:10:18 +0000 Subject: Update structures after ethereal showed some marshalling/unmarshalling errors. (This used to be commit 9d0f322a851f487cea320e57076213435e5c6481) --- source3/include/rpc_epmapper.h | 5 +++-- source3/rpc_parse/parse_epmapper.c | 44 ++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/source3/include/rpc_epmapper.h b/source3/include/rpc_epmapper.h index 1b5b6b1876..de3a2cb08d 100644 --- a/source3/include/rpc_epmapper.h +++ b/source3/include/rpc_epmapper.h @@ -70,7 +70,6 @@ typedef struct typedef struct { - uint32 referent_id; uint32 max_length; uint32 length; uint16 num_floors; @@ -80,7 +79,8 @@ typedef struct typedef struct { - EPM_HANDLE handle; + EPM_HANDLE handle; + uint32 tower_ref_id; EPM_TOWER *tower; EPM_HANDLE term_handle; /* in/out */ uint32 max_towers; @@ -91,6 +91,7 @@ typedef struct uint32 max_count; uint32 offset; uint32 count; + uint32 *tower_ref_ids; EPM_TOWER *towers; } EPM_TOWER_ARRAY; diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 2bdb755deb..02340430ec 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -23,6 +23,9 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE +static uint32 internal_referent_id = 0; + + /******************************************************************* Reads or writes a handle. ********************************************************************/ @@ -211,7 +214,6 @@ BOOL epm_io_floor(const char *desc, EPM_FLOOR *floor, NTSTATUS init_epm_tower(TALLOC_CTX *ctx, EPM_TOWER *tower, const EPM_FLOOR *floors, int num_floors) { - static uint32 internal_referent_id = 0; int size = 0; int i; @@ -224,7 +226,6 @@ NTSTATUS init_epm_tower(TALLOC_CTX *ctx, EPM_TOWER *tower, size += floors[i].rhs.length; } - tower->referent_id = ++internal_referent_id; tower->max_length = tower->length = size; tower->num_floors = num_floors; tower->floors = talloc(ctx, sizeof(EPM_FLOOR) * num_floors); @@ -248,8 +249,9 @@ BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, prs_debug(ps, depth, desc, "epm_io_tower"); depth++; - if (!prs_uint32("referent_id", ps, depth, &tower->referent_id)) + if (!prs_align(ps)) return False; + if (!prs_uint32("max_length", ps, depth, &tower->max_length)) return False; if (!prs_uint32("length", ps, depth, &tower->length)) @@ -278,9 +280,18 @@ BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, NTSTATUS init_epm_tower_array(TALLOC_CTX *ctx, EPM_TOWER_ARRAY *array, const EPM_TOWER *towers, int num_towers) { + int i; + array->max_count = num_towers; array->offset = 0; array->count = num_towers; + array->tower_ref_ids = talloc(ctx, sizeof(uint32) * num_towers); + if (!array->tower_ref_ids) { + return NT_STATUS_NO_MEMORY; + } + for (i=0;itower_ref_ids[i] = ++internal_referent_id; + array->towers = talloc(ctx, sizeof(EPM_TOWER) * num_towers); if (!array->towers) { return NT_STATUS_NO_MEMORY; @@ -308,6 +319,18 @@ BOOL epm_io_tower_array(const char *desc, EPM_TOWER_ARRAY *array, if (!prs_uint32("count", ps, depth, &array->count)) return False; + + if (UNMARSHALLING(ps)) { + array->tower_ref_ids = talloc(ps->mem_ctx, + sizeof(uint32) * array->count); + if (!array->tower_ref_ids) { + return False; + } + } + for (i=0; i < array->count; i++) + if (!prs_uint32("ref_id", ps, depth, &array->tower_ref_ids[i])) + return False; + if (!prs_set_offset(ps, prs_offset(ps) + array->offset)) return False; @@ -376,6 +399,8 @@ NTSTATUS init_epm_q_map(TALLOC_CTX *ctx, EPM_Q_MAP *q_map, /* For now let's not take more than 4 towers per result */ q_map->max_towers = num_towers * 4; + q_map->tower_ref_id = ++internal_referent_id; + handle++; return NT_STATUS_OK; @@ -393,6 +418,9 @@ BOOL epm_io_q_map(const char *desc, EPM_Q_MAP *io_map, prs_struct *ps, if (!epm_io_handle("handle", &io_map->handle, ps, depth)) return False; + if (!prs_uint32("max_towers", ps, 0, &io_map->tower_ref_id)) + return False; + /* HACK: We need a more elegant way of doing this */ if (UNMARSHALLING(ps)) { io_map->tower = talloc(ps->mem_ctx, sizeof(EPM_TOWER)); @@ -416,8 +444,6 @@ BOOL epm_io_q_map(const char *desc, EPM_Q_MAP *io_map, prs_struct *ps, BOOL epm_io_r_map(const char *desc, EPM_R_MAP *io_map, prs_struct *ps, int depth) { - int i; - prs_debug(ps, depth, desc, "epm_io_r_map"); depth++; @@ -433,11 +459,11 @@ BOOL epm_io_r_map(const char *desc, EPM_R_MAP *io_map, if (!io_map->results) return False; } - for (i = 0; i < io_map->num_results; i++) { - if (!epm_io_tower_array("results", io_map->results + i, - ps, depth)) + if (!epm_io_tower_array("results", io_map->results, ps, depth)) return False; - } + + if (!prs_align(ps)) + return False; if (!prs_uint32("status", ps, depth, &io_map->status)) return False; -- cgit