diff options
author | Tony Nguyen <Ton.Nguyen@Sun.COM> | 2008-09-29 17:35:19 -0700 |
---|---|---|
committer | Tony Nguyen <Ton.Nguyen@Sun.COM> | 2008-09-29 17:35:19 -0700 |
commit | d0fa49b78d1f40d84ec76c363cdc38cf128511dd (patch) | |
tree | b3c9ec29c19b3ed52c5d16b21f7eb0d328f96d16 | |
parent | 6392794b28bef963aa5ad05c3da79435fd0a5a0b (diff) | |
download | illumos-joyent-d0fa49b78d1f40d84ec76c363cdc38cf128511dd.tar.gz |
1207395 au_event_t is a currently a short. It should be redefined to be a u_short
26 files changed, 120 insertions, 181 deletions
diff --git a/usr/src/cmd/auditconfig/auditconfig.c b/usr/src/cmd/auditconfig/auditconfig.c index 2072d72c72..444a95a7c2 100644 --- a/usr/src/cmd/auditconfig/auditconfig.c +++ b/usr/src/cmd/auditconfig/auditconfig.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * auditconfig - set and display audit parameters @@ -915,7 +914,7 @@ do_chkconf(void) len = sizeof (struct au_evclass_map); if (evp->ae_number <= as.as_numevent) { if (auditon(A_GETCLASS, (caddr_t)&cmap, len) == -1) { - (void) printf("%s(%d):%s", + (void) printf("%s(%hu):%s", evp->ae_name, evp->ae_number, gettext("UNKNOWN EVENT: Could not get " "class for event. Configuration may " @@ -934,7 +933,7 @@ do_chkconf(void) &pmask, 0); (void) printf(gettext( - "%s(%d): CLASS MISMATCH: " + "%s(%hu): CLASS MISMATCH: " "runtime class (%s) != " "configured class (%s)\n"), evp->ae_name, evp->ae_number, @@ -1065,7 +1064,7 @@ do_audit(char *event, char sorf, int retval, char *audit_str) AU_PRS_USECACHE); if (rtn == -1) { - exit_error("%s\n%s %d\n", + exit_error("%s\n%s %hu\n", gettext("Check audit event configuration."), gettext("Could not get audit class for event number"), evp->ae_number); @@ -1213,7 +1212,7 @@ do_getclass(char *event_str) ec.ec_number = event_number; eauditon(A_GETCLASS, (caddr_t)&ec, 0); - (void) printf(gettext("audit class mask for event %s(%d) = 0x%x\n"), + (void) printf(gettext("audit class mask for event %s(%hu) = 0x%x\n"), event_name, event_number, ec.ec_class); } @@ -1480,7 +1479,7 @@ do_lsevent(void) pmask.am_success = pmask.am_failure = evp->ae_class; if (getauditflagschar(auflags, &pmask, 0) == -1) (void) strcpy(auflags, "unknown"); - (void) printf("%-30s %5d %s %s\n", + (void) printf("%-30s %5hu %s %s\n", evp->ae_name, evp->ae_number, auflags, evp->ae_desc); } endauevent(); @@ -1568,7 +1567,7 @@ do_setsmask(char *asid_str, char *audit_flags) struct auditinfo ainfo; if (strisnum(asid_str)) - ainfo.ai_asid = (pid_t)atoi(asid_str); + ainfo.ai_asid = (au_asid_t)atoi(asid_str); else exit_usage(1); @@ -1583,7 +1582,7 @@ do_setumask(char *auid_str, char *audit_flags) struct auditinfo ainfo; if (strisnum(auid_str)) - ainfo.ai_auid = (pid_t)atoi(auid_str); + ainfo.ai_auid = (au_id_t)atoi(auid_str); else exit_usage(1); @@ -1840,7 +1839,7 @@ egetauevnum(au_event_t event_number) au_event_ent_t *evp; if ((evp = getauevnum(event_number)) == NULL) { - exit_error(gettext("Could not get audit event %d"), + exit_error(gettext("Could not get audit event %hu"), event_number); } @@ -2287,14 +2286,14 @@ chk_event_num(int etype, au_event_t event) if (event > as.as_numevent) { exit_error(gettext("Invalid kernel audit event " "number specified.\n" - "\t%d is outside allowable range 0-%d."), + "\t%hu is outside allowable range 0-%d."), event, as.as_numevent); } } else { /* user event */ if (event <= as.as_numevent) { exit_error(gettext("Invalid user level audit event " - "number specified %d."), event); + "number specified %hu."), event); } } } diff --git a/usr/src/cmd/auditreduce/option.c b/usr/src/cmd/auditreduce/option.c index 0e152feda6..28e31a0d29 100644 --- a/usr/src/cmd/auditreduce/option.c +++ b/usr/src/cmd/auditreduce/option.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * Command line option processing for auditreduce. @@ -304,7 +303,7 @@ proc_sid(char *optarg) return (-1); } flags |= M_SID; - m_sid = atol(optarg); + m_sid = (au_asid_t)atol(optarg); return (0); } @@ -436,7 +435,7 @@ obj_lkup(char *obj_str) return (&obj_tbl[i]); /* not in table */ - return ((obj_ent_t *)0); + return (NULL); } @@ -464,7 +463,7 @@ proc_type(char *optstr) flags |= M_TYPE; m_type = 0; if (a_isnum(optstr, TRUE)) { - if ((aep = getauevnam(optstr)) != (struct au_event_ent *)NULL) + if ((aep = getauevnam(optstr)) != NULL) m_type = aep->ae_number; } else { if ((aep = getauevnum((au_event_t)atoi(optstr))) != diff --git a/usr/src/cmd/auditreduce/proc.c b/usr/src/cmd/auditreduce/proc.c index 5e235675a9..2de2465990 100644 --- a/usr/src/cmd/auditreduce/proc.c +++ b/usr/src/cmd/auditreduce/proc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * Main processor for auditreduce. @@ -36,6 +33,7 @@ #include <sys/types.h> #include <locale.h> #include <bsm/libbsm.h> +#include <bsm/audit.h> #include "auditr.h" extern int write_header(); @@ -631,9 +629,9 @@ register audit_pcb_t *pcb; adr_t adr; struct timeval tv; uint_t bytes; - ushort_t id_modifier; + au_emod_t id_modifier; char version; - ushort_t event_type; + au_event_t event_type; char tokenid; int rc; /* return code */ diff --git a/usr/src/cmd/auditreduce/token.c b/usr/src/cmd/auditreduce/token.c index 1e3c37fbd2..a507780cf5 100644 --- a/usr/src/cmd/auditreduce/token.c +++ b/usr/src/cmd/auditreduce/token.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * Token processing for auditreduce. @@ -1362,7 +1361,7 @@ subject32_token(adr_t *adr) checkflags |= M_GROUPE; } if (flags & M_SID) { - if (m_sid == sid) + if (m_sid == (au_asid_t)sid) checkflags |= M_SID; } return (-1); @@ -1424,7 +1423,7 @@ subject32_ex_token(adr_t *adr) checkflags = checkflags | M_GROUPE; } if (flags & M_SID) { - if (m_sid == sid) + if (m_sid == (au_asid_t)sid) checkflags = checkflags | M_SID; } return (-1); @@ -1486,7 +1485,7 @@ subject64_token(adr_t *adr) checkflags |= M_GROUPE; } if (flags & M_SID) { - if (m_sid == sid) + if (m_sid == (au_asid_t)sid) checkflags |= M_SID; } return (-1); @@ -1549,7 +1548,7 @@ subject64_ex_token(adr_t *adr) checkflags = checkflags | M_GROUPE; } if (flags & M_SID) { - if (m_sid == sid) + if (m_sid == (au_asid_t)sid) checkflags = checkflags | M_SID; } return (-1); diff --git a/usr/src/cmd/praudit/format.c b/usr/src/cmd/praudit/format.c index aa7308dd82..7958057f8a 100644 --- a/usr/src/cmd/praudit/format.c +++ b/usr/src/cmd/praudit/format.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #define _REENTRANT @@ -57,7 +56,7 @@ static void convertascii(char *p, char *c, int size); static int convertbinary(char *p, char *c, int size); -static void eventmodifier2string(ushort_t emodifier, char *modstring, +static void eventmodifier2string(au_emod_t emodifier, char *modstring, size_t modlen); static int do_mtime32(pr_context_t *context, int status, int flag, uint32_t scale); @@ -1254,7 +1253,7 @@ bu2string(char basic_unit) * ------------------------------------------------------------------- */ static void -eventmodifier2string(ushort_t emodifier, char *modstring, size_t modlen) +eventmodifier2string(au_emod_t emodifier, char *modstring, size_t modlen) { register int i, j; @@ -2253,7 +2252,7 @@ int pa_event_modifier(pr_context_t *context, int status, int flag) { int returnstat; - ushort_t emodifier; + au_emod_t emodifier; uval_t uval; char modstring[64]; @@ -2306,7 +2305,7 @@ pa_event_modifier(pr_context_t *context, int status, int flag) int pa_event_type(pr_context_t *context, int status, int flag) { - ushort_t etype; + au_event_t etype; int returnstat; au_event_ent_t *p_event = NULL; uval_t uval; diff --git a/usr/src/cmd/smserverd/myaudit.c b/usr/src/cmd/smserverd/myaudit.c index 5e08097658..ecc0227c6d 100644 --- a/usr/src/cmd/smserverd/myaudit.c +++ b/usr/src/cmd/smserverd/myaudit.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <netdb.h> #include <netinet/in.h> @@ -114,7 +113,7 @@ audit_init(door_data_t *door_dp) door_dp->audit_text[0] = NULL; door_dp->audit_text1[0] = NULL; door_dp->audit_na = 0; - door_dp->audit_asid = -1; + door_dp->audit_asid = (au_asid_t)(-1); door_dp->audit_path = NULL; } diff --git a/usr/src/lib/auditd_plugins/syslog/sysplugin.c b/usr/src/lib/auditd_plugins/syslog/sysplugin.c index 83b4b5623e..745f512555 100644 --- a/usr/src/lib/auditd_plugins/syslog/sysplugin.c +++ b/usr/src/lib/auditd_plugins/syslog/sysplugin.c @@ -19,14 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * convert binary audit records to syslog messages and * send them off to syslog * */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * auditd_plugin_open(), auditd_plugin() and auditd_plugin_close() @@ -566,7 +565,7 @@ filter(const char *input, uint32_t sequence, char *output, if (cacheauevent(&event, ctx.out.sf_eventid) < 0) (void) snprintf(event_name, EVENT_NAME_LEN, - "%d", ctx.out.sf_eventid); + "%hu", ctx.out.sf_eventid); else (void) strlcpy(event_name, event->ae_desc, EVENT_NAME_LEN); @@ -599,13 +598,13 @@ filter(const char *input, uint32_t sequence, char *output, #if DEBUG if (ctx.out.sf_sequence != -1) fprintf(dbfp, - "syslog tossed (event=%d) record %u " + "syslog tossed (event=%hu) record %u " "/ buffer %u\n", ctx.out.sf_eventid, ctx.out.sf_sequence, sequence); else fprintf(dbfp, - "syslog tossed (event=%d) buffer %u\n", + "syslog tossed (event=%hu) buffer %u\n", ctx.out.sf_eventid, sequence); #endif @@ -652,7 +651,7 @@ filter(const char *input, uint32_t sequence, char *output, au_event_ent_t *event; if (cacheauevent(&event, ctx.out.sf_eventid) < 0) - used = snprintf(bp, remaining, "%d", + used = snprintf(bp, remaining, "%hu", ctx.out.sf_eventid); else used = strlcpy(bp, event->ae_desc, remaining); diff --git a/usr/src/lib/auditd_plugins/syslog/systoken.c b/usr/src/lib/auditd_plugins/syslog/systoken.c index f5c6117728..23e245ffb6 100644 --- a/usr/src/lib/auditd_plugins/syslog/systoken.c +++ b/usr/src/lib/auditd_plugins/syslog/systoken.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * Token processing for sysupd; each token function does one @@ -128,7 +127,7 @@ common_header(parse_context_t *ctx) { adrm_u_int32(&(ctx->adr), &(ctx->out.sf_reclen), 1); ctx->adr.adr_now += sizeof (char); /* version number */ - adrm_short(&(ctx->adr), &(ctx->out.sf_eventid), 1); + adrm_u_short(&(ctx->adr), &(ctx->out.sf_eventid), 1); ctx->adr.adr_now += sizeof (short); /* modifier */ } diff --git a/usr/src/lib/libbsm/common/adr.c b/usr/src/lib/libbsm/common/adr.c index 33eed0fc6a..abc2d9a3fb 100644 --- a/usr/src/lib/libbsm/common/adr.c +++ b/usr/src/lib/libbsm/common/adr.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * Adr memory based encoding @@ -72,6 +71,19 @@ adr_short(adr_t *adr, short *sp, int count) } /* + * adr_ushort - pull out ushorts + */ +void +adr_ushort(adr_t *adr, ushort_t *sp, int count) +{ + + for (; count-- > 0; sp++) { + *adr->adr_now++ = (char)((*sp >> 8) & 0x00ff); + *adr->adr_now++ = (char)(*sp & 0x00ff); + } +} + +/* * adr_int32 - pull out uint32 */ #pragma weak adr_long = adr_int32 diff --git a/usr/src/lib/libbsm/common/au_open.c b/usr/src/lib/libbsm/common/au_open.c index d1058ab3a4..b18d2806c4 100644 --- a/usr/src/lib/libbsm/common/au_open.c +++ b/usr/src/lib/libbsm/common/au_open.c @@ -24,7 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/param.h> #include <sys/time.h> @@ -59,11 +58,7 @@ static int au_d_required_length = AU_TABLE_LENGTH; /* new table length */ static mutex_t mutex_au_d = DEFAULTMUTEX; int -#ifdef __STDC__ au_open(void) -#else -au_open() -#endif { int d; /* descriptor */ token_t **au_d_new; @@ -115,13 +110,7 @@ au_open() */ int -#ifdef __STDC__ au_write(int d, token_t *m) -#else -au_write(d, m) - int d; - token_t *m; -#endif { token_t *mp; @@ -150,16 +139,9 @@ au_write(d, m) * Use the second parameter to indicate if it should be written or not. */ int -#ifdef __STDC__ -au_close(int d, int right, short e_type) -#else -au_close(d, right, e_type) - int d; - int right; - short e_type; -#endif +au_close(int d, int right, au_event_t e_type) { - short e_mod; + au_emod_t e_mod; struct timeval now; /* current time */ adr_t adr; /* adr header */ auditinfo_addr_t audit_info; @@ -249,8 +231,8 @@ au_close(d, right, e_type) adr_char(&adr, &data_header, 1); adr_int32(&adr, (int32_t *)&byte_count, 1); adr_char(&adr, &version, 1); - adr_short(&adr, &e_type, 1); - adr_short(&adr, &e_mod, 1); + adr_ushort(&adr, &e_type, 1); + adr_ushort(&adr, &e_mod, 1); if (data_header == HEADER_ID_EX) { adr_int32(&adr, (int32_t *)&host_info->at_type, 1); adr_char(&adr, (char *)&host_info->at_addr[0], diff --git a/usr/src/lib/libbsm/common/au_to.c b/usr/src/lib/libbsm/common/au_to.c index 813efe7571..45fa932b66 100644 --- a/usr/src/lib/libbsm/common/au_to.c +++ b/usr/src/lib/libbsm/common/au_to.c @@ -19,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/types.h> #include <unistd.h> @@ -101,8 +100,8 @@ au_to_header(au_event_t e_type, au_emod_t e_mod) adr_char(&adr, &data_header, 1); /* token ID */ adr_int32(&adr, &byte_count, 1); /* length of audit record */ adr_char(&adr, &version, 1); /* version of audit tokens */ - adr_short(&adr, &e_type, 1); /* event ID */ - adr_short(&adr, &e_mod, 1); /* event ID modifier */ + adr_ushort(&adr, &e_type, 1); /* event ID */ + adr_ushort(&adr, &e_mod, 1); /* event ID modifier */ #ifdef _LP64 adr_int64(&adr, (int64_t *)&tv, 2); /* time & date */ #else @@ -160,8 +159,8 @@ au_to_header_ex(au_event_t e_type, au_emod_t e_mod) adr_char(&adr, &data_header, 1); /* token ID */ adr_int32(&adr, &byte_count, 1); /* length of audit record */ adr_char(&adr, &version, 1); /* version of audit tokens */ - adr_short(&adr, &e_type, 1); /* event ID */ - adr_short(&adr, &e_mod, 1); /* event ID modifier */ + adr_ushort(&adr, &e_type, 1); /* event ID */ + adr_ushort(&adr, &e_mod, 1); /* event ID modifier */ adr_int32(&adr, (int32_t *)&host_info->at_type, 1); adr_char(&adr, (char *)host_info->at_addr, (int)host_info->at_type); diff --git a/usr/src/lib/libbsm/common/audit_cron.c b/usr/src/lib/libbsm/common/audit_cron.c index a860f8ce1e..106e28a946 100644 --- a/usr/src/lib/libbsm/common/audit_cron.c +++ b/usr/src/lib/libbsm/common/audit_cron.c @@ -22,7 +22,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/types.h> #include <sys/systeminfo.h> @@ -47,7 +46,7 @@ #include <locale.h> #include "generic.h" -#define F_AUID "%d\n" +#define F_AUID "%u\n" #define F_SMASK "%x\n" #define F_FMASK "%x\n" #define F_PORT "%lx\n" @@ -119,7 +118,7 @@ audit_cron_getinfo(char *fname, char *fname_aux, struct auditinfo_addr *info) F_TYPE F_MACH F_ASID, - (int *)&(info->ai_auid), + &(info->ai_auid), &(info->ai_mask.am_success), &(info->ai_mask.am_failure), &(info->ai_termid.at_port), @@ -128,7 +127,7 @@ audit_cron_getinfo(char *fname, char *fname_aux, struct auditinfo_addr *info) &(info->ai_termid.at_addr[1]), &(info->ai_termid.at_addr[2]), &(info->ai_termid.at_addr[3]), - (unsigned int *)&(info->ai_asid)) != 10) { + &(info->ai_asid)) != 10) { audit_cron_syslog(msg); goto delete_first; } @@ -201,7 +200,7 @@ audit_cron_setinfo(char *fname, struct auditinfo_addr *info) F_TYPE F_MACH F_ASID, - (int)info->ai_auid, + info->ai_auid, info->ai_mask.am_success, info->ai_mask.am_failure, info->ai_termid.at_port, @@ -210,7 +209,7 @@ audit_cron_setinfo(char *fname, struct auditinfo_addr *info) info->ai_termid.at_addr[1], info->ai_termid.at_addr[2], info->ai_termid.at_addr[3], - (unsigned int)info->ai_asid); + info->ai_asid); if (write(fd, textbuf, len) != len) goto audit_setinfo_clean; diff --git a/usr/src/lib/libbsm/common/audit_event.c b/usr/src/lib/libbsm/common/audit_event.c index f35d4c939b..b724f14b7f 100644 --- a/usr/src/lib/libbsm/common/audit_event.c +++ b/usr/src/lib/libbsm/common/audit_event.c @@ -24,7 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * Interfaces to audit_event(5) (/etc/security/audit_event) @@ -118,7 +117,7 @@ getauevent_r(au_event_entry) if (!au_event_file) if (!(au_event_file = fopen(au_event_fname, "rF"))) { (void) mutex_unlock(&mutex_eventfile); - return ((au_event_ent_t *)0); + return (NULL); } while (fgets(input, AU_EVENT_LINE_MAX, au_event_file)) { @@ -133,7 +132,7 @@ getauevent_r(au_event_entry) /* parse number */ i = strcspn(s, ":"); s[i] = '\0'; - (void) sscanf(s, "%hd", &au_event_entry->ae_number); + (void) sscanf(s, "%hu", &au_event_entry->ae_number); s = &s[i+1]; /* parse event name */ @@ -171,18 +170,13 @@ getauevent_r(au_event_entry) if (!error && found) { return (au_event_entry); } else { - return ((au_event_ent_t *)0); + return (NULL); } } au_event_ent_t * -#ifdef __STDC__ getauevnam(char *name) -#else -getauevnam(name) - char *name; -#endif { static au_event_ent_t au_event_entry; static char ename[AU_EVENT_NAME_MAX]; @@ -196,13 +190,7 @@ getauevnam(name) } au_event_ent_t * -#ifdef __STDC__ getauevnam_r(au_event_ent_t *e, char *name) -#else -getauevnam_r(e, name) - au_event_ent_t &e; - char *name; -#endif { setauevent(); while (getauevent_r(e) != NULL) { @@ -212,17 +200,11 @@ getauevnam_r(e, name) } } endauevent(); - return ((au_event_ent_t *)NULL); + return (NULL); } au_event_ent_t * -#ifdef __STDC__ getauevnum_r(au_event_ent_t *e, au_event_t event_number) -#else -getauevnum_r(e, event_number) - au_event_ent_t *e; - au_event_t event_number; -#endif { setauevent(); while (getauevent_r(e) != NULL) { @@ -232,16 +214,11 @@ getauevnum_r(e, event_number) } } endauevent(); - return ((au_event_ent_t *)NULL); + return (NULL); } au_event_ent_t * -#ifdef __STDC__ getauevnum(au_event_t event_number) -#else -getauevnum(event_number) - au_event_t event_number; -#endif { static au_event_ent_t e; static char ename[AU_EVENT_NAME_MAX]; @@ -255,12 +232,7 @@ getauevnum(event_number) } au_event_t -#ifdef __STDC__ getauevnonam(char *event_name) -#else -getauevnonam(event_name) - char *event_name; -#endif { au_event_ent_t e; char ename[AU_EVENT_NAME_MAX]; @@ -270,8 +242,8 @@ getauevnonam(event_name) e.ae_name = ename; e.ae_desc = edesc; - if (getauevnam_r(&e, event_name) == (au_event_ent_t *)0) { - return (-1); + if (getauevnam_r(&e, event_name) == NULL) { + return (0); } return (e.ae_number); } @@ -289,16 +261,10 @@ getauevnonam(event_name) */ int -#ifdef __STDC__ cacheauevent(au_event_ent_t **result, au_event_t event_number) -#else -cacheauevent(result, event_number) - au_event_ent_t **result; /* set this pointer to an entry in the cache */ - au_event_t event_number; /* request this event number */ -#endif { - static ushort_t max; /* the highest event number in the file */ - static ushort_t min; /* the lowest event number in the file */ + static au_event_t max; /* the highest event number in the file */ + static au_event_t min; /* the lowest event number in the file */ static int invalid; /* 1+index of the highest event number */ static au_event_ent_t **index_tbl; static au_event_ent_t **p_tbl; @@ -359,10 +325,10 @@ cacheauevent(result, event_number) #ifdef DEBUG2 printevent(p_tbl[lines]); #endif - if ((ushort_t)p_event->ae_number > max) { + if (p_event->ae_number > max) { max = p_event->ae_number; } - if ((ushort_t)p_event->ae_number < min) { + if (p_event->ae_number < min) { min = p_event->ae_number; } lines++; @@ -375,7 +341,7 @@ cacheauevent(result, event_number) (void) mutex_unlock(&mutex_eventcache); return (-4); } - p_tbl[invalid]->ae_number = -1; + p_tbl[invalid]->ae_number = (au_event_t)-1; p_tbl[invalid]->ae_name = "invalid event number"; p_tbl[invalid]->ae_desc = p_tbl[invalid]->ae_name; p_tbl[invalid]->ae_class = (au_class_t)-1; @@ -396,23 +362,23 @@ cacheauevent(result, event_number) } /* intialize the index_tbl to the invalid event number */ - for (i = 0; (ushort_t)i < max; i++) { + for (i = 0; (au_event_t)i < max; i++) { index_tbl[i] = p_tbl[invalid]; } /* point each index_tbl element at the corresponding event */ for (i = 0; i < size; i++) { - index_tbl[(ushort_t)p_tbl[i]->ae_number] = p_tbl[i]; + index_tbl[p_tbl[i]->ae_number] = p_tbl[i]; } called_once = 1; } - if ((ushort_t)event_number > max || (ushort_t)event_number < min) { + if (event_number > max || event_number < min) { *result = index_tbl[invalid]; } else { - *result = index_tbl[(ushort_t)event_number]; + *result = index_tbl[event_number]; hit = 1; } (void) mutex_unlock(&mutex_eventcache); diff --git a/usr/src/lib/libbsm/common/generic.c b/usr/src/lib/libbsm/common/generic.c index 7fc7abc5f0..5e59bcd1ce 100644 --- a/usr/src/lib/libbsm/common/generic.c +++ b/usr/src/lib/libbsm/common/generic.c @@ -19,10 +19,9 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <netdb.h> #include <netinet/in.h> @@ -122,7 +121,7 @@ aug_init() aug_text1 = NULL; aug_text2 = NULL; aug_na = 0; - aug_asid = -1; + aug_asid = (au_asid_t)(-1); aug_afunc = NULL; aug_path = NULL; } diff --git a/usr/src/lib/libbsm/common/libbsm.h b/usr/src/lib/libbsm/common/libbsm.h index bf4a859c2e..d09bfcb7b1 100644 --- a/usr/src/lib/libbsm/common/libbsm.h +++ b/usr/src/lib/libbsm/common/libbsm.h @@ -26,7 +26,6 @@ #ifndef _BSM_LIBBSM_H #define _BSM_LIBBSM_H -#pragma ident "%Z%%M% %I% %E% SMI" #include <secdb.h> #include <stdio.h> @@ -108,6 +107,7 @@ extern void adr_int32(adr_t *, int32_t *, int); extern void adr_uid(adr_t *, uid_t *, int); extern void adr_int64(adr_t *, int64_t *, int); extern void adr_short(adr_t *, short *, int); +extern void adr_ushort(adr_t *, ushort_t *, int); extern void adr_start(adr_t *, char *); extern int adrf_char(adrf_t *, char *, int); @@ -140,7 +140,7 @@ extern void adrm_putint32(adr_t *, int32_t *, int); * Functions that do I/O for audit files */ -extern int au_close(int, int, short); +extern int au_close(int, int, au_event_t); extern int au_open(void); extern int au_write(int, token_t *); diff --git a/usr/src/lib/libbsm/common/mapfile-vers b/usr/src/lib/libbsm/common/mapfile-vers index e5dd7bf85c..fae1e40730 100644 --- a/usr/src/lib/libbsm/common/mapfile-vers +++ b/usr/src/lib/libbsm/common/mapfile-vers @@ -138,6 +138,7 @@ SUNWprivate_1.1 { adrm_u_short; adrm_uid; adr_short; + adr_ushort; adr_start; adt_alloc_event; adt_audit_enabled; diff --git a/usr/src/lib/libc/port/gen/ucred.c b/usr/src/lib/libc/port/gen/ucred.c index f56e7caf63..69dfa3c71b 100644 --- a/usr/src/lib/libc/port/gen/ucred.c +++ b/usr/src/lib/libc/port/gen/ucred.c @@ -24,7 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #pragma weak _ucred_free = ucred_free #pragma weak _ucred_get = ucred_get @@ -334,7 +333,7 @@ ucred_getasid(const ucred_t *uc) const auditinfo64_addr_t *ainfo = UCAUD(uc); if (ainfo == NULL) - return (-1); + return ((au_asid_t)-1); return (ainfo->ai_asid); } diff --git a/usr/src/uts/common/c2/audit.c b/usr/src/uts/common/c2/audit.c index cb459a8bca..66b0e4a3ff 100644 --- a/usr/src/uts/common/c2/audit.c +++ b/usr/src/uts/common/c2/audit.c @@ -1005,7 +1005,7 @@ audit_closef(struct file *fp) struct vnode *vp; token_t *ad = NULL; struct vattr attr; - short evmod = 0; + au_emod_t evmod = 0; const auditinfo_addr_t *ainfo; int getattr_ret; cred_t *cr; @@ -1019,7 +1019,7 @@ audit_closef(struct file *fp) /* audit record already generated by system call envelope */ if (tad->tad_event == AUE_CLOSE) { /* so close audit event will have bits set */ - tad->tad_evmod |= (short)fad->fad_flags; + tad->tad_evmod |= (au_emod_t)fad->fad_flags; return; } @@ -1058,7 +1058,7 @@ audit_closef(struct file *fp) } } - evmod = (short)fad->fad_flags; + evmod = (au_emod_t)fad->fad_flags; if (fad->fad_aupath != NULL) { au_write((caddr_t *)&(ad), au_to_path(fad->fad_aupath)); } else { diff --git a/usr/src/uts/common/c2/audit.h b/usr/src/uts/common/c2/audit.h index 81893db8e7..c5c1b70923 100644 --- a/usr/src/uts/common/c2/audit.h +++ b/usr/src/uts/common/c2/audit.h @@ -31,8 +31,6 @@ #ifndef _BSM_AUDIT_H #define _BSM_AUDIT_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -85,10 +83,10 @@ extern "C" { /* * Some typedefs for the fundamentals */ -typedef pid_t au_asid_t; +typedef uint_t au_asid_t; typedef uint_t au_class_t; -typedef short au_event_t; -typedef short au_emod_t; +typedef ushort_t au_event_t; +typedef ushort_t au_emod_t; typedef uid_t au_id_t; /* @@ -436,7 +434,6 @@ struct audit_stat { uint32_t as_memused; /* no longer used */ }; typedef struct audit_stat au_stat_t; -extern int au_naevent; /* * Secondary stat structure for file size stuff. The stat structure was @@ -554,8 +551,8 @@ void audit_sock(int, struct queue *, struct msgb *, int); void audit_free(void); int audit_start(unsigned int, unsigned int, int, klwp_t *); void audit_finish(unsigned int, unsigned int, int, union rval *); -int audit_async_start(label_t *, int, int); -void audit_async_finish(caddr_t *, int, int); +int audit_async_start(label_t *, au_event_t, int); +void audit_async_finish(caddr_t *, au_event_t, au_emod_t); void audit_async_discard_backend(void *); void audit_async_done(caddr_t *, int); void audit_async_drop(caddr_t *, int); diff --git a/usr/src/uts/common/c2/audit_event.c b/usr/src/uts/common/c2/audit_event.c index c37ae13f18..723212aa52 100644 --- a/usr/src/uts/common/c2/audit_event.c +++ b/usr/src/uts/common/c2/audit_event.c @@ -77,7 +77,6 @@ #include <sys/port_impl.h> -int au_naevent; char _depends_on[] = "fs/sockfs"; static au_event_t aui_open(au_event_t); @@ -1845,7 +1844,7 @@ aus_close(struct t_audit_data *tad) return; fad = F2A(fp); - tad->tad_evmod = (short)fad->fad_flags; + tad->tad_evmod = (au_emod_t)fad->fad_flags; if (fad->fad_aupath != NULL) { au_uwrite(au_to_path(fad->fad_aupath)); if ((vp = fp->f_vnode) != NULL) { diff --git a/usr/src/uts/common/c2/audit_io.c b/usr/src/uts/common/c2/audit_io.c index a508edd4cc..04dab516c2 100644 --- a/usr/src/uts/common/c2/audit_io.c +++ b/usr/src/uts/common/c2/audit_io.c @@ -25,7 +25,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/door.h> #include <sys/param.h> @@ -102,7 +101,8 @@ au_write(caddr_t *d, token_t *m) * Use the second parameter to indicate if it should be written or not. */ void -au_close(au_kcontext_t *kctx, caddr_t *d, int flag, short e_type, short e_mod) +au_close(au_kcontext_t *kctx, caddr_t *d, int flag, au_event_t e_type, + au_emod_t e_mod) { token_t *dchain; /* au_membuf chain which is the tokens */ t_audit_data_t *tad = U2A(u); @@ -134,7 +134,7 @@ au_close(au_kcontext_t *kctx, caddr_t *d, int flag, short e_type, short e_mod) * syscall end time it will be pulled off. */ void -au_close_defer(token_t *dchain, int flag, short e_type, short e_mod) +au_close_defer(token_t *dchain, int flag, au_event_t e_type, au_emod_t e_mod) { au_defer_info_t *attr; t_audit_data_t *tad = U2A(u); @@ -224,8 +224,8 @@ au_save_time(adr_t *hadrp, timestruc_t *time, int size) * current time. */ void -au_close_time(au_kcontext_t *kctx, token_t *dchain, int flag, short e_type, - short e_mod, timestruc_t *etime) +au_close_time(au_kcontext_t *kctx, token_t *dchain, int flag, au_event_t e_type, + au_emod_t e_mod, timestruc_t *etime) { token_t *record; /* au_membuf chain == the record */ int byte_count; @@ -776,7 +776,7 @@ audit_async_drop(caddr_t *rpp, int flags) } int -audit_async_start(label_t *jb, int event, int sorf) +audit_async_start(label_t *jb, au_event_t event, int sorf) { t_audit_data_t *tad = U2A(u); au_state_t estate; @@ -815,7 +815,7 @@ audit_async_start(label_t *jb, int event, int sorf) * work can be done in a safe context. */ void -audit_async_finish(caddr_t *ad, int aid, int amod) +audit_async_finish(caddr_t *ad, au_event_t aid, au_emod_t amod) { au_kcontext_t *kctx; diff --git a/usr/src/uts/common/c2/audit_kernel.h b/usr/src/uts/common/c2/audit_kernel.h index 2c2311f7aa..f7d59881c2 100644 --- a/usr/src/uts/common/c2/audit_kernel.h +++ b/usr/src/uts/common/c2/audit_kernel.h @@ -26,7 +26,6 @@ #ifndef _BSM_AUDIT_KERNEL_H #define _BSM_AUDIT_KERNEL_H -#pragma ident "%Z%%M% %I% %E% SMI" /* * This file contains the basic auditing control structure definitions. @@ -130,8 +129,8 @@ typedef struct au_termid au_termid_t; typedef struct au_defer_info { struct au_defer_info *audi_next; /* next on linked list */ void *audi_ad; /* audit record */ - int audi_e_type; /* audit event id */ - int audi_e_mod; /* audit event modifier */ + au_event_t audi_e_type; /* audit event id */ + au_emod_t audi_e_mod; /* audit event modifier */ int audi_flag; /* au_close*() flags */ timestruc_t audi_atime; /* audit event timestamp */ } au_defer_info_t; @@ -202,8 +201,8 @@ extern kmem_cache_t *au_pad_cache; struct t_audit_data { kthread_id_t tad_thread; /* DEBUG pointer to parent thread */ unsigned int tad_scid; /* system call ID for finish */ - short tad_event; /* event for audit record */ - short tad_evmod; /* event modifier for audit record */ + au_event_t tad_event; /* event for audit record */ + au_emod_t tad_evmod; /* event modifier for audit record */ int tad_ctrl; /* audit control/status flags */ void *tad_errjmp; /* error longjmp (audit record aborted) */ int tad_flag; /* to audit or not to audit */ diff --git a/usr/src/uts/common/c2/audit_record.h b/usr/src/uts/common/c2/audit_record.h index 9ccc29a78d..dcff6235ba 100644 --- a/usr/src/uts/common/c2/audit_record.h +++ b/usr/src/uts/common/c2/audit_record.h @@ -26,7 +26,6 @@ #ifndef _BSM_AUDIT_RECORD_H #define _BSM_AUDIT_RECORD_H -#pragma ident "%Z%%M% %I% %E% SMI" #ifdef _KERNEL #include <sys/priv.h> @@ -430,7 +429,7 @@ struct au_header32_tok { uint_t length; uchar_t version; au_event_t event; - ushort_t emod; + au_emod_t emod; /* really timestruct_t (struct timespec) from hrestime */ int32_t sec; /* seconds since epoc */ int32_t nsec; /* nanoseconds */ @@ -441,7 +440,7 @@ struct au_header64_tok { uint_t length; uchar_t version; au_event_t event; - ushort_t emod; + au_emod_t emod; /* really timestruct_t (struct timespec) from hrestime */ int64_t sec; /* seconds since epoc */ int64_t nsec; /* nanoseconds */ diff --git a/usr/src/uts/common/c2/audit_syscalls.c b/usr/src/uts/common/c2/audit_syscalls.c index 1cc44b0bbf..039405e431 100644 --- a/usr/src/uts/common/c2/audit_syscalls.c +++ b/usr/src/uts/common/c2/audit_syscalls.c @@ -28,7 +28,6 @@ * */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/param.h> #include <sys/systm.h> @@ -1554,7 +1553,7 @@ getclass(caddr_t data) if (copyin(data, &event, sizeof (au_evclass_map_t))) return (EFAULT); - if (event.ec_number < 0 || event.ec_number > (au_naevent - 1)) + if (event.ec_number > MAX_KEVENTS) return (EINVAL); event.ec_class = kctx->auk_ets[event.ec_number]; @@ -1579,7 +1578,7 @@ setclass(caddr_t data) if (copyin(data, &event, sizeof (au_evclass_map_t))) return (EFAULT); - if (event.ec_number < 0 || event.ec_number > (au_naevent - 1)) + if (event.ec_number > MAX_KEVENTS) return (EINVAL); kctx->auk_ets[event.ec_number] = event.ec_class; diff --git a/usr/src/uts/common/c2/audit_token.c b/usr/src/uts/common/c2/audit_token.c index f3df1d3c32..bc217a6109 100644 --- a/usr/src/uts/common/c2/audit_token.c +++ b/usr/src/uts/common/c2/audit_token.c @@ -63,7 +63,7 @@ * pointer to au_membuf chain containing a header token. */ token_t * -au_to_header(int byte_count, short e_type, short e_mod) +au_to_header(int byte_count, au_event_t e_type, au_emod_t e_mod) { adr_t adr; /* adr memory stream header */ token_t *m; /* au_membuf pointer */ @@ -83,8 +83,8 @@ au_to_header(int byte_count, short e_type, short e_mod) adr_int32(&adr, (int32_t *)&byte_count, 1); /* length of */ /* audit record */ adr_char(&adr, &version, 1); /* version of audit tokens */ - adr_short(&adr, &e_type, 1); /* event ID */ - adr_short(&adr, &e_mod, 1); /* event ID modifier */ + adr_ushort(&adr, &e_type, 1); /* event ID */ + adr_ushort(&adr, &e_mod, 1); /* event ID modifier */ #ifdef _LP64 adr_int64(&adr, zerotime, 2); /* time & date space */ #else @@ -118,8 +118,8 @@ au_to_header_ex(int byte_count, au_event_t e_type, au_emod_t e_mod) adr_int32(&adr, (int32_t *)&byte_count, 1); /* length of */ /* audit record */ adr_char(&adr, &version, 1); /* version of audit tokens */ - adr_short(&adr, &e_type, 1); /* event ID */ - adr_short(&adr, &e_mod, 1); /* event ID modifier */ + adr_ushort(&adr, &e_type, 1); /* event ID */ + adr_ushort(&adr, &e_mod, 1); /* event ID modifier */ adr_uint32(&adr, &kctx->auk_info.ai_termid.at_type, 1); adr_char(&adr, (char *)&kctx->auk_info.ai_termid.at_addr[0], (int)kctx->auk_info.ai_termid.at_type); diff --git a/usr/src/uts/common/c2/audit_zone.c b/usr/src/uts/common/c2/audit_zone.c index a0ba4385f8..9b311d33da 100644 --- a/usr/src/uts/common/c2/audit_zone.c +++ b/usr/src/uts/common/c2/audit_zone.c @@ -23,7 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <c2/audit.h> #include <c2/audit_kernel.h> @@ -54,7 +53,6 @@ au_zone_init(zoneid_t zone) if (zone == 0) { global_kctx = kctx; global_zone->zone_audit_kctxt = kctx; - au_naevent = sizeof (kctx->auk_ets) / sizeof (au_state_t); } else { kctx->auk_policy = global_kctx->auk_policy; curproc->p_zone->zone_audit_kctxt = kctx; @@ -75,7 +73,7 @@ au_zone_init(zoneid_t zone) /* statistics per zone */ kctx->auk_statistics.as_version = TOKEN_VERSION; - kctx->auk_statistics.as_numevent = au_naevent; + kctx->auk_statistics.as_numevent = MAX_KEVENTS; /* door IO buffer: */ kctx->auk_dbuffer = |