summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbsm
diff options
context:
space:
mode:
authorme23304 <none@none>2006-02-09 14:08:56 -0800
committerme23304 <none@none>2006-02-09 14:08:56 -0800
commit26706799998ca499307df9f2515e8be432a95eda (patch)
tree465d201c87c8f9eabcaf20820f014ae383bf204c /usr/src/lib/libbsm
parent4f5c01f9a280183d32b11a58cc2701be45f1a8aa (diff)
downloadillumos-gate-26706799998ca499307df9f2515e8be432a95eda.tar.gz
6378413 c2_bsm/utility adt_set_from_ucred() can leak a ucred_t
Diffstat (limited to 'usr/src/lib/libbsm')
-rw-r--r--usr/src/lib/libbsm/common/adt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr/src/lib/libbsm/common/adt.c b/usr/src/lib/libbsm/common/adt.c
index b8b5842085..c6a40cff95 100644
--- a/usr/src/lib/libbsm/common/adt.c
+++ b/usr/src/lib/libbsm/common/adt.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1520,13 +1520,14 @@ adt_set_user(const adt_session_data_t *session_data,
*/
int
adt_set_from_ucred(const adt_session_data_t *session_data,
- const ucred_t *ucred,
- enum adt_user_context user_context)
+ const ucred_t *uc, enum adt_user_context user_context)
{
adt_internal_state_t *state;
int rc = -1;
const au_tid64_addr_t *tid64;
au_tid_addr_t termid, *tid;
+ ucred_t *ucred = (ucred_t *)uc;
+ boolean_t local_uc = B_FALSE;
if (session_data == NULL) /* no session exists to audit */
return (0);
@@ -1539,6 +1540,7 @@ adt_set_from_ucred(const adt_session_data_t *session_data,
if (ucred == NULL)
goto return_rc;
+ local_uc = B_TRUE;
}
switch (user_context) {
@@ -1590,6 +1592,9 @@ adt_set_from_ucred(const adt_session_data_t *session_data,
state->as_egid = ucred_getegid(ucred);
return_rc:
+ if (local_uc) {
+ ucred_free(ucred);
+ }
return (rc);
}