summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorMarc VanHeyningen <marc.vanheyningen@isilon.com>2008-03-14 14:26:28 -0800
committerVolker Lendecke <vl@samba.org>2008-03-17 20:52:25 +0100
commite06aa46b9fab1e107fea8f6453fb13deffa91e96 (patch)
treedb972999f1b17db3e6b100fec70b5f4643632172 /source3/printing
parent6274929b1e1ddf89f4c5e93414121eaf06b6ab14 (diff)
downloadsamba-e06aa46b9fab1e107fea8f6453fb13deffa91e96.tar.gz
samba-e06aa46b9fab1e107fea8f6453fb13deffa91e96.tar.bz2
samba-e06aa46b9fab1e107fea8f6453fb13deffa91e96.zip
Coverity fixes
(This used to be commit 3fc85d22590550f0539215d020e4411bf5b14363)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index d5803b711b..04dde0e8a0 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -358,7 +358,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
ZERO_STRUCT( ps );
- prs_init( &ps, 0, ctx, UNMARSHALL );
+ prs_init_empty( &ps, ctx, UNMARSHALL );
prs_give_memory( &ps, (char *)data.dptr, data.dsize, False );
if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_orig, &ps, 1 ) ) {
@@ -405,7 +405,10 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
/* create a new SEC_DESC with the appropriate owner and group SIDs */
- string_to_sid(&sid, "S-1-5-32-544" );
+ if (!string_to_sid(&sid, "S-1-5-32-544" )) {
+ prs_mem_free( &ps );
+ return 0;
+ }
new_sec = make_sec_desc( ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
&sid, &sid,
NULL, NULL, &size_new_sec );
@@ -431,7 +434,10 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
sd_size = ndr_size_security_descriptor(sd_store->sd, 0)
+ sizeof(SEC_DESC_BUF);
- prs_init(&ps, sd_size, ctx, MARSHALL);
+ if ( !prs_init(&ps, sd_size, ctx, MARSHALL) ) {
+ DEBUG(0,("sec_desc_upg_fn: Failed to allocate prs memory for %s\n", key.dptr ));
+ return 0;
+ }
if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_store, &ps, 1 ) ) {
DEBUG(0,("sec_desc_upg_fn: Failed to parse new sec_desc for %s\n", key.dptr ));
@@ -4551,7 +4557,7 @@ static bool convert_driver_init( TALLOC_CTX *ctx, NT_DEVICEMODE *nt_devmode, uin
ZERO_STRUCT(devmode);
- prs_init(&ps, 0, ctx, UNMARSHALL);
+ prs_init_empty(&ps, ctx, UNMARSHALL);
ps.data_p = (char *)data;
ps.buffer_size = data_len;
@@ -5396,9 +5402,13 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr)
/* Store the security descriptor in a tdb */
- prs_init(&ps,
- (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0)
- + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL);
+ if (!prs_init(&ps,
+ (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0)
+ + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL) ) {
+ status = WERR_NOMEM;
+ goto out;
+ }
+
prs_init_done = true;
@@ -5546,8 +5556,9 @@ bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **s
/* Save default security descriptor for later */
- prs_init(&ps, (uint32)ndr_size_security_descriptor((*secdesc_ctr)->sd, 0) +
- sizeof(SEC_DESC_BUF), ctx, MARSHALL);
+ if (!prs_init(&ps, (uint32)ndr_size_security_descriptor((*secdesc_ctr)->sd, 0) +
+ sizeof(SEC_DESC_BUF), ctx, MARSHALL))
+ return False;
if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
tdb_prs_store(tdb_printers, kbuf, &ps);