diff options
author | Jan Friedel <Jan.Friedel@Sun.COM> | 2010-02-19 16:36:35 +0100 |
---|---|---|
committer | Jan Friedel <Jan.Friedel@Sun.COM> | 2010-02-19 16:36:35 +0100 |
commit | 8f775e0a5fbe731ba531e9ef613571bdb0adf6b3 (patch) | |
tree | 2dd09524c4d0947f5e1cb78b58a0f964cbb699cc /usr/src/lib/auditd_plugins | |
parent | 17b6b3808f6f7a84408070a1a441854f7e70b784 (diff) | |
download | illumos-gate-8f775e0a5fbe731ba531e9ef613571bdb0adf6b3.tar.gz |
6907614 Queue sequence number generated by auditd(1M) should be changed from uint32_t to uint64_t
Diffstat (limited to 'usr/src/lib/auditd_plugins')
-rw-r--r-- | usr/src/lib/auditd_plugins/auditd.h | 11 | ||||
-rw-r--r-- | usr/src/lib/auditd_plugins/binfile/binfile.c | 15 | ||||
-rw-r--r-- | usr/src/lib/auditd_plugins/remote/audit_remote.c | 14 | ||||
-rw-r--r-- | usr/src/lib/auditd_plugins/syslog/sysplugin.c | 42 | ||||
-rw-r--r-- | usr/src/lib/auditd_plugins/syslog/systoken.h | 6 |
5 files changed, 41 insertions, 47 deletions
diff --git a/usr/src/lib/auditd_plugins/auditd.h b/usr/src/lib/auditd_plugins/auditd.h index 99b24aaad6..6be801b6eb 100644 --- a/usr/src/lib/auditd_plugins/auditd.h +++ b/usr/src/lib/auditd_plugins/auditd.h @@ -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,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * This is an unstable interface; changes may be made without @@ -30,8 +29,6 @@ #ifndef _AUDITD_H #define _AUDITD_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <secdb.h> #include <sys/types.h> @@ -61,7 +58,7 @@ typedef enum auditd_rc auditd_rc_t; * arg 4 - optional explanation of error return (use NULL, * not an empty string if not used.) */ -auditd_rc_t auditd_plugin(const char *, size_t, uint32_t, char **); +auditd_rc_t auditd_plugin(const char *, size_t, uint64_t, char **); /* * auditd_plugin_open() * arg 1 - attr/val struct, use with kva_match() diff --git a/usr/src/lib/auditd_plugins/binfile/binfile.c b/usr/src/lib/auditd_plugins/binfile/binfile.c index d7b05877c7..cca9543a3d 100644 --- a/usr/src/lib/auditd_plugins/binfile/binfile.c +++ b/usr/src/lib/auditd_plugins/binfile/binfile.c @@ -784,7 +784,7 @@ save_maxsize(char *maxsize) { */ /* ARGSUSED */ auditd_rc_t -auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) +auditd_plugin(const char *input, size_t in_len, uint64_t sequence, char **error) { auditd_rc_t rc = AUDITD_FAIL; int open_status; @@ -798,16 +798,15 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) struct timeval now; #if DEBUG static char *last_file_written_to = NULL; - static uint32_t last_sequence = 0; - static uint32_t write_count = 0; + static uint64_t last_sequence = 0; + static uint64_t write_count = 0; if ((last_sequence > 0) && (sequence != last_sequence + 1)) - fprintf(dbfp, "binfile: buffer sequence=%d but prev=%d=n", + fprintf(dbfp, "binfile: buffer sequence=%llu but prev=%llu=n", sequence, last_sequence); last_sequence = sequence; - fprintf(dbfp, "binfile: input seq=%d, len=%d\n", - sequence, in_len); + fprintf(dbfp, "binfile: input seq=%llu, len=%d\n", sequence, in_len); #endif *error = NULL; /* @@ -866,7 +865,7 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) if (out_len == in_len) { DPRINT((dbfp, - "binfile: write_count=%u, sequence=%u," + "binfile: write_count=%llu, sequence=%llu," " l=%u\n", ++write_count, sequence, out_len)); allsoftfull_warning = 0; @@ -876,7 +875,7 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) break; } else if (!(activeDir->dl_flags & HARD_WARNED)) { DPRINT((dbfp, - "binfile: write failed, sequence=%u, " + "binfile: write failed, sequence=%llu, " "l=%u\n", sequence, out_len)); DPRINT((dbfp, "hard warning sent.\n")); __audit_dowarn("hard", activeDir->dl_dirname, diff --git a/usr/src/lib/auditd_plugins/remote/audit_remote.c b/usr/src/lib/auditd_plugins/remote/audit_remote.c index 2a66b292c4..d31691032c 100644 --- a/usr/src/lib/auditd_plugins/remote/audit_remote.c +++ b/usr/src/lib/auditd_plugins/remote/audit_remote.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * send audit records to remote host @@ -555,7 +555,7 @@ create_notify_pipe(int *notify_pipe, char **error) * */ auditd_rc_t -auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) +auditd_plugin(const char *input, size_t in_len, uint64_t sequence, char **error) { int rc = AUDITD_FAIL; int send_record_rc = SEND_RECORD_FAIL; @@ -567,15 +567,15 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) #if DEBUG char *rc_msg; - static uint32_t last_sequence = 0; + static uint64_t last_sequence = 0; if ((last_sequence > 0) && (sequence != last_sequence + 1)) { - DPRINT((dfile, "audit_remote: buffer sequence=%d but prev=%d\n", - sequence, last_sequence)); + DPRINT((dfile, "audit_remote: buffer sequence=%llu " + "but prev=%llu\n", sequence, last_sequence)); } last_sequence = sequence; - DPRINT((dfile, "audit_remote: input seq=%d, len=%d\n", + DPRINT((dfile, "audit_remote: input seq=%llu, len=%d\n", sequence, in_len)); #endif @@ -600,7 +600,7 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) current_host->host->h_name, attempts + 1, retries)); send_record_rc = send_record(current_host, input, in_len, - (uint64_t)sequence, &err_rsn); + sequence, &err_rsn); DPRINT((dfile, "send_record() returned %d - ", send_record_rc)); switch (send_record_rc) { diff --git a/usr/src/lib/auditd_plugins/syslog/sysplugin.c b/usr/src/lib/auditd_plugins/syslog/sysplugin.c index 745f512555..ded1ff98f1 100644 --- a/usr/src/lib/auditd_plugins/syslog/sysplugin.c +++ b/usr/src/lib/auditd_plugins/syslog/sysplugin.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * convert binary audit records to syslog messages and @@ -333,9 +333,9 @@ gethname(au_tid_addr_t *tid, char *p, size_t max, char *prefix, if (tid->at_type == AU_IPv6) { key = tid->at_addr[0] ^ - tid->at_addr[1] ^ - tid->at_addr[2] ^ - tid->at_addr[3]; + tid->at_addr[1] ^ + tid->at_addr[2] ^ + tid->at_addr[3]; } else key = (tid->at_addr[0]); @@ -467,7 +467,7 @@ getuname(uid_t uid, gid_t gid, char *p, size_t max, char *prefix, NULL) gidhash[ix].ht_length = snprintf(gidhash[ix].ht_value, GIDNAMELEN, - "%d", gid); + "%d", gid); else gidhash[ix].ht_length = strlcpy(gidhash[ix].ht_value, @@ -497,7 +497,7 @@ getuname(uid_t uid, gid_t gid, char *p, size_t max, char *prefix, #define EVENT_NAME_LEN 32 static auditd_rc_t -filter(const char *input, uint32_t sequence, char *output, +filter(const char *input, uint64_t sequence, char *output, size_t in_len, size_t out_len) { parse_context_t ctx; @@ -599,12 +599,12 @@ filter(const char *input, uint32_t sequence, char *output, if (ctx.out.sf_sequence != -1) fprintf(dbfp, "syslog tossed (event=%hu) record %u " - "/ buffer %u\n", + "/ buffer %llu\n", ctx.out.sf_eventid, ctx.out.sf_sequence, sequence); else fprintf(dbfp, - "syslog tossed (event=%hu) buffer %u\n", + "syslog tossed (event=%hu) buffer %llu\n", ctx.out.sf_eventid, sequence); #endif @@ -724,14 +724,14 @@ filter(const char *input, uint32_t sequence, char *output, */ if (ctx.out.sf_sequence != -1) { fprintf(dbfp, - "syslog writing record %u / buffer %u\n", + "syslog writing record %u / buffer %llu\n", ctx.out.sf_sequence, sequence); used = snprintf(bp, remaining, " seq %u", ctx.out.sf_sequence, sequence); remaining -= used; bp += used; } else - fprintf(dbfp, "syslog writing buffer %u\n", sequence); + fprintf(dbfp, "syslog writing buffer %llu\n", sequence); #endif /* * Long fields that may need truncation go here in @@ -781,18 +781,18 @@ filter(const char *input, uint32_t sequence, char *output, /* ARGSUSED */ auditd_rc_t -auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) +auditd_plugin(const char *input, size_t in_len, uint64_t sequence, char **error) { char *outbuf; auditd_rc_t rc = AUDITD_SUCCESS; #if DEBUG - static uint32_t last_sequence = 0; - static uint32_t write_count = 0; - static uint32_t toss_count = 0; + static uint64_t last_sequence = 0; + static uint64_t write_count = 0; + static uint64_t toss_count = 0; if ((last_sequence > 0) && (sequence != last_sequence + 1)) - fprintf(dbfp, "syslog: buffer sequence=%d but prev=%d\n", - sequence, last_sequence); + fprintf(dbfp, "syslog: buffer sequence=%llu but prev=%llu\n", + sequence, last_sequence); last_sequence = sequence; #endif @@ -800,7 +800,7 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) outbuf = malloc(OUTPUT_BUF_SIZE); if (outbuf == NULL) { - DPRINT((dbfp, "syslog: out of memory; seq=%u\n", + DPRINT((dbfp, "syslog: out of memory; seq=%llu\n", sequence)); rc = AUDITD_NO_MEMORY; *error = strdup(gettext("Can't allocate buffers")); @@ -810,17 +810,17 @@ auditd_plugin(const char *input, size_t in_len, uint32_t sequence, char **error) if (rc == AUDITD_SUCCESS) { __audit_syslog("audit", LOG_NDELAY, LOG_AUDIT, LOG_NOTICE, outbuf); - DPRINT((dbfp, "syslog: write_count=%u, " - "buffer=%u, tossed=%d\n", + DPRINT((dbfp, "syslog: write_count=%llu, " + "buffer=%llu, tossed=%llu\n", ++write_count, sequence, toss_count)); } else if (rc > 0) { /* -1 == discard it */ - DPRINT((dbfp, "syslog: parse failed for buffer %u\n", + DPRINT((dbfp, "syslog: parse failed for buffer %llu\n", sequence)); *error = strdup(gettext( "Unable to parse audit record")); } else { DPRINT((dbfp, "syslog: rc = %d (-1 is discard), " - "sequence=%u, toss_count=%d\n", + "sequence=%llu, toss_count=%llu\n", rc, sequence, ++toss_count)); rc = 0; } diff --git a/usr/src/lib/auditd_plugins/syslog/systoken.h b/usr/src/lib/auditd_plugins/syslog/systoken.h index d6107877f7..d1423ca85e 100644 --- a/usr/src/lib/auditd_plugins/syslog/systoken.h +++ b/usr/src/lib/auditd_plugins/syslog/systoken.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYSTOKEN_H #define _SYSTOKEN_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -43,7 +41,7 @@ extern "C" { struct parse_context { adr_t adr; /* input buffer pointers */ - uint32_t id; /* message sequence number */ + uint64_t id; /* message sequence number */ tosyslog_t out; /* output data */ }; typedef struct parse_context parse_context_t; |