diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index c27f58ac26..c0530f8987 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1207,13 +1207,25 @@ static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct { uint32 i; uint32 num_entries = tp0->num_entries_read; - if (num_entries > MAX_TPRT_ENTRIES) - { - num_entries = MAX_TPRT_ENTRIES; /* report this! */ - } prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2)); + if (ps->io) + { + /* reading */ + tp0->info_0 = (TPRT_INFO_0*)malloc(num_entries * + sizeof(tp0->info_0[0])); + + tp0->info_0_str = (TPRT_INFO_0_STR*)malloc(num_entries * + sizeof(tp0->info_0_str[0])); + + if (tp0->info_0 == NULL || tp0->info_0_str == NULL) + { + free_srv_tprt_info_0(tp0); + return False; + } + } + for (i = 0; i < num_entries; i++) { prs_grow(ps); @@ -1231,10 +1243,33 @@ static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct prs_align(ps); } + if (!ps->io) + { + /* writing */ + free_srv_tprt_info_0(tp0); + } + return True; } /******************************************************************* +frees a structure. +********************************************************************/ +void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0) +{ + if (tp0->info_0 != NULL) + { + free(tp0->info_0); + tp0->info_0 = NULL; + } + if (tp0->info_0_str != NULL) + { + free(tp0->info_0_str); + tp0->info_0_str = NULL; + } +} + +/******************************************************************* reads or writes a structure. ********************************************************************/ static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct *ps, int depth) @@ -1273,6 +1308,27 @@ static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct /******************************************************************* reads or writes a structure. ********************************************************************/ +void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr) +{ + switch (ctr->switch_value) + { + case 0: + { + free_srv_tprt_info_0(&(ctr->tprt.info0)); + break; + } + default: + { + DEBUG(5,("no transport info at switch_value %d\n", + ctr->switch_value)); + break; + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, char *srv_name, uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, |