From b01b59e369b297df1b370a7ef94d2b9230d04452 Mon Sep 17 00:00:00 2001 From: Robert Mustacchi Date: Thu, 16 Apr 2015 15:01:56 +0000 Subject: 5853 pfexec_call() error handling could be improved 5854 pfexecd should initialize pfexec response buffers Reviewed by: Jerry Jelinek Reviewed by: Richard Lowe Reviewed by: Dan McDonald Reviewed by: Steven Williamson Approved by: Garrett D'Amore --- usr/src/cmd/pfexecd/pfexecd.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'usr/src/cmd/pfexecd/pfexecd.c') diff --git a/usr/src/cmd/pfexecd/pfexecd.c b/usr/src/cmd/pfexecd/pfexecd.c index c8ec8a12df..1d25c09188 100644 --- a/usr/src/cmd/pfexecd/pfexecd.c +++ b/usr/src/cmd/pfexecd/pfexecd.c @@ -19,7 +19,7 @@ * CDDL HEADER END * * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * + * Copyright 2015, Joyent, Inc. */ #define _POSIX_PTHREAD_SEMANTICS 1 @@ -360,6 +360,21 @@ callback_pfexec(pfexec_arg_t *pap) size_t mysz = repsz - 2 * setsz; char *path = pap->pfa_path; + /* + * Initialize the pfexec_reply_t to a sane state. + */ + res->pfr_vers = pap->pfa_vers; + res->pfr_len = 0; + res->pfr_ruid = PFEXEC_NOTSET; + res->pfr_euid = PFEXEC_NOTSET; + res->pfr_rgid = PFEXEC_NOTSET; + res->pfr_egid = PFEXEC_NOTSET; + res->pfr_setcred = B_FALSE; + res->pfr_scrubenv = B_TRUE; + res->pfr_allowed = B_FALSE; + res->pfr_ioff = 0; + res->pfr_loff = 0; + uuid = pap->pfa_uid; if (getpwuid_r(uuid, &pw, buf, sizeof (buf), &pwd) != 0 || pwd == NULL) -- cgit v1.2.3