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 /usr/src/lib | |
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
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/auditd_plugins/syslog/sysplugin.c | 11 | ||||
-rw-r--r-- | usr/src/lib/auditd_plugins/syslog/systoken.c | 5 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/adr.c | 16 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/au_open.c | 26 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/au_to.c | 11 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/audit_cron.c | 11 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/audit_event.c | 66 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/generic.c | 5 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/libbsm.h | 4 | ||||
-rw-r--r-- | usr/src/lib/libbsm/common/mapfile-vers | 1 | ||||
-rw-r--r-- | usr/src/lib/libc/port/gen/ucred.c | 3 |
11 files changed, 57 insertions, 102 deletions
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); } |