From 0db243bacb356ce4787c1de7e12832942b55e9e1 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 28 Sep 1999 20:54:58 +0000 Subject: memory problems associated with when lsalookupsids returns NT_STATUS_NONE_MAPPED. (This used to be commit 9a43a2551186de02b6cf06a5b84c9591a66c1817) --- source3/rpc_client/cli_lsarpc.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index af00949325..45ec91d37c 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -361,8 +361,23 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum, LSA_Q_LOOKUP_SIDS q_l; BOOL valid_response = False; + ZERO_STRUCT(q_l); + if (hnd == NULL || num_sids == 0 || sids == NULL) return False; + if (num_names != NULL) + { + *num_names = 0; + } + if (types != NULL) + { + *types = NULL; + } + if (names != NULL) + { + *names = NULL; + } + prs_init(&buf , 1024, 4, SAFETY_MARGIN, False); prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True ); @@ -390,7 +405,9 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum, lsa_io_r_lookup_sids("", &r_l, &rbuf, 0); p = rbuf.offset != 0; - if (p && r_l.status != 0 && r_l.status != 0x107) + if (p && r_l.status != 0 && + r_l.status != 0x107 && + r_l.status != 0xC0000000 | NT_STATUS_NONE_MAPPED) { /* report error code */ DEBUG(1,("LSA_LOOKUP_SIDS: %s\n", get_nt_error_msg(r_l.status))); @@ -423,12 +440,12 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum, } } - if (types != NULL && valid_response && t_names.num_entries != 0) + if (types != NULL && valid_response && (*num_names) != 0) { (*types) = (uint8*)malloc((*num_names) * sizeof(uint8)); } - if (names != NULL && valid_response && t_names.num_entries != 0) + if (names != NULL && valid_response && (*num_names) != 0) { (*names) = (char**)malloc((*num_names) * sizeof(char*)); } -- cgit