From e06aa46b9fab1e107fea8f6453fb13deffa91e96 Mon Sep 17 00:00:00 2001 From: Marc VanHeyningen Date: Fri, 14 Mar 2008 14:26:28 -0800 Subject: Coverity fixes (This used to be commit 3fc85d22590550f0539215d020e4411bf5b14363) --- source3/rpc_server/srv_pipe.c | 16 ++++++++-------- source3/rpc_server/srv_pipe_hnd.c | 6 +++--- source3/rpc_server/srv_spoolss_nt.c | 6 +++++- source3/rpc_server/srv_winreg_nt.c | 6 ++++-- 4 files changed, 20 insertions(+), 14 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 19c8db0533..6c1b65b858 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -151,7 +151,7 @@ static bool create_next_pdu_ntlmssp(pipes_struct *p) * data. */ - prs_init( &outgoing_pdu, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); /* Store the header in the data stream. */ @@ -358,7 +358,7 @@ static bool create_next_pdu_schannel(pipes_struct *p) * data. */ - prs_init( &outgoing_pdu, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); /* Store the header in the data stream. */ @@ -531,7 +531,7 @@ static bool create_next_pdu_noauth(pipes_struct *p) * data. */ - prs_init( &outgoing_pdu, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); /* Store the header in the data stream. */ @@ -812,7 +812,7 @@ static bool setup_bind_nak(pipes_struct *p) * header and are never sending more than one PDU here. */ - prs_init( &outgoing_rpc, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_rpc, p->mem_ctx, MARSHALL); prs_give_memory( &outgoing_rpc, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); /* @@ -875,7 +875,7 @@ bool setup_fault_pdu(pipes_struct *p, NTSTATUS status) * header and are never sending more than one PDU here. */ - prs_init( &outgoing_pdu, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); /* @@ -944,7 +944,7 @@ bool setup_cancel_ack_reply(pipes_struct *p, prs_struct *rpc_in_p) * header and are never sending more than one PDU here. */ - prs_init( &outgoing_pdu, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_pdu, p->mem_ctx, MARSHALL); prs_give_memory( &outgoing_pdu, (char *)p->out_data.current_pdu, sizeof(p->out_data.current_pdu), False); /* @@ -1522,7 +1522,7 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) return setup_bind_nak(p); } - prs_init( &outgoing_rpc, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_rpc, p->mem_ctx, MARSHALL); /* * Marshall directly into the outgoing PDU space. We @@ -1794,7 +1794,7 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) prs_struct outgoing_rpc; int auth_len = 0; - prs_init( &outgoing_rpc, 0, p->mem_ctx, MARSHALL); + prs_init_empty( &outgoing_rpc, p->mem_ctx, MARSHALL); /* * Marshall directly into the outgoing PDU space. We diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 95ce496ba6..45f649d0ce 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -348,7 +348,7 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name, /* * Initialize the outgoing RPC data buffer with no memory. */ - prs_init(&p->out_data.rdata, 0, p->mem_ctx, MARSHALL); + prs_init_empty(&p->out_data.rdata, p->mem_ctx, MARSHALL); fstrcpy(p->name, pipe_name); @@ -408,7 +408,7 @@ static ssize_t unmarshall_rpc_header(pipes_struct *p) return -1; } - prs_init( &rpc_in, 0, p->mem_ctx, UNMARSHALL); + prs_init_empty( &rpc_in, p->mem_ctx, UNMARSHALL); prs_set_endian_data( &rpc_in, p->endian); prs_give_memory( &rpc_in, (char *)&p->in_data.current_in_pdu[0], @@ -693,7 +693,7 @@ static void process_complete_pdu(pipes_struct *p) return; } - prs_init( &rpc_in, 0, p->mem_ctx, UNMARSHALL); + prs_init_empty( &rpc_in, p->mem_ctx, UNMARSHALL); /* * Ensure we're using the corrent endianness for both the diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 3758c8fd63..403beb6782 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6033,7 +6033,11 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level, /* NT seems to like setting the security descriptor even though nothing may have actually changed. */ - nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr); + if ( !nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr)) { + DEBUG(2,("update_printer_sec: nt_printing_getsec() failed\n")); + result = WERR_BADFID; + goto done; + } if (DEBUGLEVEL >= 10) { SEC_ACL *the_acl; diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index c76bc19d9c..6e076ea372 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -239,7 +239,8 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r) if(regkey->key->type == REG_KEY_HKPD) { if(strequal(r->in.value_name.name, "Global")) { - prs_init(&prs_hkpd, *r->in.data_size, p->mem_ctx, MARSHALL); + if (!prs_init(&prs_hkpd, *r->in.data_size, p->mem_ctx, MARSHALL)) + return WERR_NOMEM; status = reg_perfcount_get_hkpd( &prs_hkpd, *r->in.data_size, &outbuf_size, NULL); outbuf = (uint8_t *)prs_hkpd.data_p; @@ -260,7 +261,8 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r) else if(isdigit(r->in.value_name.name[0])) { /* we probably have a request for a specific object * here */ - prs_init(&prs_hkpd, *r->in.data_size, p->mem_ctx, MARSHALL); + if (!prs_init(&prs_hkpd, *r->in.data_size, p->mem_ctx, MARSHALL)) + return WERR_NOMEM; status = reg_perfcount_get_hkpd( &prs_hkpd, *r->in.data_size, &outbuf_size, r->in.value_name.name); -- cgit