PERFORCE change 90133 for review
Wayne Salamon
wsalamon at FreeBSD.org
Sat Jan 21 22:30:43 GMT 2006
http://perforce.freebsd.org/chv.cgi?CH=90133
Change 90133 by wsalamon at gretsch on 2006/01/21 22:29:50
Integrate the recent changes in the OpenBSM branch into audit3,
picking up more FlexeLint changes and the AUE_NMOUNT event.
Affected files ...
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/bsm/Makefile#3 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/bsm/audit_internal.h#4 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/bsm/audit_kevents.h#12 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_audit.c#5 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_class.c#6 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_control.c#5 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#5 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_flags.c#6 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_io.c#7 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_mask.c#5 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_token.c#7 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_wrappers.c#4 integrate
Differences ...
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/bsm/Makefile#3 (text+ko) ====
@@ -13,6 +13,7 @@
all:
default:
+depend:
clean:
install:
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/bsm/audit_internal.h#4 (text+ko) ====
@@ -63,33 +63,33 @@
*/
#define ADD_U_CHAR(loc, val) \
do { \
- *loc = val; \
- loc += sizeof(u_char); \
+ *(loc) = (val); \
+ (loc) += sizeof(u_char); \
} while(0)
#define ADD_U_INT16(loc, val) \
do { \
- be16enc(loc, val); \
- loc += sizeof(u_int16_t); \
+ be16enc((loc), (val)); \
+ (loc) += sizeof(u_int16_t); \
} while(0)
#define ADD_U_INT32(loc, val) \
do { \
- be32enc(loc, val); \
- loc += sizeof(u_int32_t); \
+ be32enc((loc), (val)); \
+ (loc) += sizeof(u_int32_t); \
} while(0)
#define ADD_U_INT64(loc, val) \
do { \
- be64enc(loc, val); \
- loc += sizeof(u_int64_t); \
+ be64enc((loc), (val)); \
+ (loc) += sizeof(u_int64_t); \
} while(0)
#define ADD_MEM(loc, data, size) \
do { \
- memcpy(loc, data, size); \
- loc += size; \
+ memcpy((loc), (data), (size)); \
+ (loc) += size; \
} while(0)
#define ADD_STRING(loc, data, size) ADD_MEM(loc, data, size)
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/bsm/audit_kevents.h#12 (text+ko) ====
@@ -355,6 +355,7 @@
#define AUE_KQUEUE 377 /* FreeBSD */
#define AUE_KEVENT 378 /* FreeBSD */
#define AUE_FSYNC 379
+#define AUE_NMOUNT 380 /* FreeBSD */
/*
* XXXRW: Values not yet assigned.
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_audit.c#5 (text+ko) ====
@@ -237,7 +237,7 @@
token_t *tok;
/* Free the token list */
- while ((tok = TAILQ_FIRST(&rec->token_q))) {
+ while ((tok = TAILQ_FIRST(&rec->token_q)) != NULL) {
TAILQ_REMOVE(&rec->token_q, tok, tokens);
free(tok->t_data);
free(tok);
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_class.c#6 (text+ko) ====
@@ -39,9 +39,9 @@
* Parse the contents of the audit_class file to return struct au_class_ent
* entries.
*/
-static FILE *fp = NULL;
-static char linestr[AU_LINE_MAX];
-static char *delim = ":";
+static FILE *fp = NULL;
+static char linestr[AU_LINE_MAX];
+static const char *classdelim = ":";
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -50,15 +50,15 @@
* au_class_ent elements; store the result in c.
*/
static struct au_class_ent *
-classfromstr(char *str, char *delim, struct au_class_ent *c)
+classfromstr(char *str, struct au_class_ent *c)
{
char *classname, *classdesc, *classflag;
char *last;
/* Each line contains flag:name:desc. */
- classflag = strtok_r(str, delim, &last);
- classname = strtok_r(NULL, delim, &last);
- classdesc = strtok_r(NULL, delim, &last);
+ classflag = strtok_r(str, classdelim, &last);
+ classname = strtok_r(NULL, classdelim, &last);
+ classdesc = strtok_r(NULL, classdelim, &last);
if ((classflag == NULL) || (classname == NULL) || (classdesc == NULL))
return (NULL);
@@ -113,7 +113,7 @@
tokptr = linestr;
/* Parse tokptr to au_class_ent components. */
- if (classfromstr(tokptr, delim, c) == NULL)
+ if (classfromstr(tokptr, c) == NULL)
return (NULL);
return (c);
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_control.c#5 (text+ko) ====
@@ -94,8 +94,6 @@
}
}
}
-
- return (0); /* EOF */
}
/*
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#5 (text+ko) ====
@@ -39,9 +39,9 @@
* Parse the contents of the audit_event file to return
* au_event_ent entries
*/
-static FILE *fp = NULL;
-static char linestr[AU_LINE_MAX];
-static char *delim = ":";
+static FILE *fp = NULL;
+static char linestr[AU_LINE_MAX];
+static const char *eventdelim = ":";
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -49,16 +49,16 @@
* Parse one line from the audit_event file into the au_event_ent structure.
*/
static struct au_event_ent *
-eventfromstr(char *str, char *delim, struct au_event_ent *e)
+eventfromstr(char *str, struct au_event_ent *e)
{
char *evno, *evname, *evdesc, *evclass;
struct au_mask evmask;
char *last;
- evno = strtok_r(str, delim, &last);
- evname = strtok_r(NULL, delim, &last);
- evdesc = strtok_r(NULL, delim, &last);
- evclass = strtok_r(NULL, delim, &last);
+ evno = strtok_r(str, eventdelim, &last);
+ evname = strtok_r(NULL, eventdelim, &last);
+ evdesc = strtok_r(NULL, eventdelim, &last);
+ evclass = strtok_r(NULL, eventdelim, &last);
if ((evno == NULL) || (evname == NULL) || (evdesc == NULL) ||
(evclass == NULL))
@@ -144,7 +144,7 @@
* XXXRW: Perhaps we should keep reading lines until we find a valid
* one, rather than stopping when we hit an invalid one?
*/
- if (eventfromstr(linestr, delim, e) == NULL)
+ if (eventfromstr(linestr, e) == NULL)
return (NULL);
return (e);
@@ -200,7 +200,7 @@
if ((nl = strrchr(linestr, '\n')) != NULL)
*nl = '\0';
- if (eventfromstr(linestr, delim, e) != NULL) {
+ if (eventfromstr(linestr, e) != NULL) {
if (strcmp(name, e->ae_name) == 0)
return (e);
}
@@ -254,7 +254,7 @@
if ((nl = strrchr(linestr, '\n')) != NULL)
*nl = '\0';
- if (eventfromstr(linestr, delim, e) != NULL) {
+ if (eventfromstr(linestr, e) != NULL) {
if (event_number == e->ae_number)
return (e);
}
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_flags.c#6 (text+ko) ====
@@ -34,7 +34,7 @@
#include <stdio.h>
#include <string.h>
-static const char *delim = ",";
+static const char *flagdelim = ",";
/*
* Convert the character representation of audit values into the au_mask_t
@@ -45,17 +45,11 @@
{
char class_ent_name[AU_CLASS_NAME_MAX];
char class_ent_desc[AU_CLASS_DESC_MAX];
- struct au_class_ent c, *cp;
+ struct au_class_ent c;
char *tok;
char sel, sub;
char *last;
-
- if ((auditstr == NULL) || (masks == NULL)) {
- errno = EINVAL;
- return (-1);
- }
-
bzero(&c, sizeof(c));
bzero(class_ent_name, sizeof(class_ent_name));
bzero(class_ent_desc, sizeof(class_ent_desc));
@@ -65,7 +59,7 @@
masks->am_success = 0;
masks->am_failure = 0;
- tok = strtok_r(auditstr, delim, &last);
+ tok = strtok_r(auditstr, flagdelim, &last);
while (tok != NULL) {
/* Check for the events that should not be audited. */
if (tok[0] == '^') {
@@ -84,7 +78,7 @@
} else
sel = AU_PRS_BOTH;
- if ((cp = getauclassnam_r(&c, tok)) != NULL) {
+ if ((getauclassnam_r(&c, tok)) != NULL) {
if (sub)
SUB_FROM_MASK(masks, c.ac_class, sel);
else
@@ -95,7 +89,7 @@
}
/* Get the next class. */
- tok = strtok_r(NULL, delim, &last);
+ tok = strtok_r(NULL, flagdelim, &last);
}
return (0);
}
@@ -118,15 +112,10 @@
{
char class_ent_name[AU_CLASS_NAME_MAX];
char class_ent_desc[AU_CLASS_DESC_MAX];
- struct au_class_ent c, *cp;
+ struct au_class_ent c;
char *strptr = auditstr;
u_char sel;
- if ((auditstr == NULL) || (masks == NULL)) {
- return (EINVAL);
- return (-1);
- }
-
bzero(&c, sizeof(c));
bzero(class_ent_name, sizeof(class_ent_name));
bzero(class_ent_desc, sizeof(class_ent_desc));
@@ -138,7 +127,7 @@
* the success or failure masks.
*/
setauclass();
- while ((cp = getauclassent_r(&c)) != NULL) {
+ while ((getauclassent_r(&c)) != NULL) {
sel = 0;
/* Dont do anything for class = no. */
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_io.c#7 (text+ko) ====
@@ -97,11 +97,11 @@
} while (0)
#define SET_PTR(buf, len, ptr, size, bytesread, err) do { \
- if (bytesread + size > len) \
- err = 1; \
+ if ((bytesread) + (size) > (len)) \
+ (err) = 1; \
else { \
- ptr = buf + bytesread; \
- bytesread += size; \
+ (ptr) = (buf) + (bytesread); \
+ (bytesread) += (size); \
} \
} while (0)
@@ -109,7 +109,7 @@
* Prints the delimiter string.
*/
static void
-print_delim(FILE *fp, char *del)
+print_delim(FILE *fp, const char *del)
{
fprintf(fp, "%s", del);
@@ -288,14 +288,14 @@
static void
print_sec32(FILE *fp, u_int32_t sec, char raw)
{
- time_t time;
+ time_t timestamp;
char timestr[26];
if (raw)
fprintf(fp, "%u", sec);
else {
- time = (time_t)sec;
- ctime_r(&time, timestr);
+ timestamp = (time_t)sec;
+ ctime_r(×tamp, timestr);
timestr[24] = '\0'; /* No new line */
fprintf(fp, "%s", timestr);
}
@@ -308,14 +308,14 @@
static void
print_sec64(FILE *fp, u_int64_t sec, char raw)
{
- time_t time;
+ time_t timestamp;
char timestr[26];
if (raw)
fprintf(fp, "%u", (u_int32_t)sec);
else {
- time = (time_t)sec;
- ctime_r(&time, timestr);
+ timestamp = (time_t)sec;
+ ctime_r(×tamp, timestr);
timestr[24] = '\0'; /* No new line */
fprintf(fp, "%s", timestr);
}
@@ -369,12 +369,12 @@
struct in_addr ipv4;
struct in6_addr ipv6;
char dst[INET6_ADDRSTRLEN];
- const char *ret = NULL;
switch (type) {
case AU_IPv4:
ipv4.s_addr = (in_addr_t)(ipaddr[0]);
- ret = inet_ntop(AF_INET, &ipv4, dst, INET6_ADDRSTRLEN);
+ fprintf(fp, "%s", inet_ntop(AF_INET, &ipv4, dst,
+ INET6_ADDRSTRLEN));
break;
case AU_IPv6:
@@ -382,13 +382,12 @@
ipv6.__u6_addr.__u6_addr32[1] = ipaddr[1];
ipv6.__u6_addr.__u6_addr32[2] = ipaddr[2];
ipv6.__u6_addr.__u6_addr32[3] = ipaddr[3];
- ret = inet_ntop(AF_INET6, &ipv6, dst, INET6_ADDRSTRLEN);
+ fprintf(fp, "%s", inet_ntop(AF_INET6, &ipv6, dst,
+ INET6_ADDRSTRLEN));
break;
- }
- if (ret != NULL) {
- fprintf(fp, "%s", ret);
- /* XXX Is ret heap memory? Leaked if so */
+ default:
+ fprintf(fp, "invalid");
}
}
@@ -696,7 +695,7 @@
break;
case AU_IPv6:
- READ_TOKEN_BYTES(buf, len, &tok->tt.hdr64_ex.addr,
+ READ_TOKEN_BYTES(buf, len, tok->tt.hdr64_ex.addr,
sizeof(tok->tt.hdr64_ex.addr), tok->len, err);
break;
}
@@ -755,7 +754,8 @@
}
static void
-print_trailer_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_trailer_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "trailer", raw);
@@ -795,7 +795,8 @@
}
static void
-print_arg32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_arg32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "argument", raw);
@@ -833,7 +834,8 @@
}
static void
-print_arg64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_arg64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "argument", raw);
@@ -898,7 +900,8 @@
}
static void
-print_arb_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_arb_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
char *str;
char *format;
@@ -1022,7 +1025,8 @@
}
static void
-print_attr32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_attr32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "attribute", raw);
@@ -1081,7 +1085,8 @@
}
static void
-print_attr64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_attr64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "attribute", raw);
@@ -1120,7 +1125,8 @@
}
static void
-print_exit_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_exit_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "exit", raw);
@@ -1134,7 +1140,8 @@
* count 4 bytes
* text count null-terminated string(s)
*/
-static int fetch_execarg_tok(tokenstr_t *tok, char *buf, int len)
+static int
+fetch_execarg_tok(tokenstr_t *tok, char *buf, int len)
{
int err = 0;
int i;
@@ -1144,7 +1151,7 @@
if (err)
return (-1);
- for (i = 0; i< tok->tt.execarg.count; i++) {
+ for (i = 0; i < tok->tt.execarg.count; i++) {
bptr = buf + tok->len;
tok->tt.execarg.text[i] = bptr;
@@ -1163,7 +1170,8 @@
}
static void
-print_execarg_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_execarg_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
int i;
@@ -1209,7 +1217,8 @@
}
static void
-print_execenv_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_execenv_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
int i;
@@ -1252,7 +1261,8 @@
}
static void
-print_file_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_file_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "file", raw);
@@ -1289,7 +1299,8 @@
}
static void
-print_newgroups_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_newgroups_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
int i;
@@ -1317,7 +1328,8 @@
}
static void
-print_inaddr_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_inaddr_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "ip addr", raw);
@@ -1344,7 +1356,7 @@
if (err)
return (-1);
} else if (tok->tt.inaddr_ex.type == AU_IPv6) {
- READ_TOKEN_BYTES(buf, len, &tok->tt.inaddr_ex.addr,
+ READ_TOKEN_BYTES(buf, len, tok->tt.inaddr_ex.addr,
sizeof(tok->tt.inaddr_ex.addr), tok->len, err);
if (err)
return (-1);
@@ -1355,7 +1367,8 @@
}
static void
-print_inaddr_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_inaddr_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "ip addr ex", raw);
@@ -1418,7 +1431,8 @@
}
static void
-print_ip_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_ip_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "ip", raw);
@@ -1465,7 +1479,8 @@
}
static void
-print_ipc_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_ipc_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "IPC", raw);
@@ -1521,7 +1536,8 @@
}
static void
-print_ipcperm_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_ipcperm_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "IPC perm", raw);
@@ -1557,7 +1573,8 @@
}
static void
-print_iport_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_iport_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "ip port", raw);
@@ -1587,7 +1604,8 @@
}
static void
-print_opaque_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_opaque_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "opaque", raw);
@@ -1618,7 +1636,8 @@
}
static void
-print_path_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_path_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "path", raw);
@@ -1684,7 +1703,8 @@
}
static void
-print_process32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_process32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "process", raw);
@@ -1757,7 +1777,7 @@
if (err)
return (-1);
} else if (tok->tt.proc32_ex.tid.type == AU_IPv6) {
- READ_TOKEN_BYTES(buf, len, &tok->tt.proc32_ex.tid.addr,
+ READ_TOKEN_BYTES(buf, len, tok->tt.proc32_ex.tid.addr,
sizeof(tok->tt.proc32_ex.tid.addr), tok->len, err);
if (err)
return (-1);
@@ -1769,7 +1789,7 @@
static void
print_process32ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
- char sfrm)
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "process_ex", raw);
@@ -1815,7 +1835,8 @@
}
static void
-print_return32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_return32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "return", raw);
@@ -1842,7 +1863,8 @@
}
static void
-print_return64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_return64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "return", raw);
@@ -1868,7 +1890,8 @@
}
static void
-print_seq_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_seq_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "sequence", raw);
@@ -1905,7 +1928,7 @@
static void
print_sock_inet32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-char sfrm)
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "socket-inet", raw);
@@ -1929,7 +1952,7 @@
if (err)
return (-1);
- READ_TOKEN_BYTES(buf, len, &tok->tt.sockunix.path, 104, tok->len,
+ READ_TOKEN_BYTES(buf, len, tok->tt.sockunix.path, 104, tok->len,
err);
if (err)
return (-1);
@@ -1939,7 +1962,7 @@
static void
print_sock_unix_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
- char sfrm)
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "socket-unix", raw);
@@ -1987,7 +2010,8 @@
}
static void
-print_socket_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_socket_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "socket", raw);
@@ -2061,7 +2085,8 @@
}
static void
-print_subject32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_subject32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "subject", raw);
@@ -2143,7 +2168,8 @@
}
static void
-print_subject64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_subject64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "subject", raw);
@@ -2229,7 +2255,7 @@
if (err)
return (-1);
} else if (tok->tt.subj32_ex.tid.type == AU_IPv6) {
- READ_TOKEN_BYTES(buf, len, &tok->tt.subj32_ex.tid.addr,
+ READ_TOKEN_BYTES(buf, len, tok->tt.subj32_ex.tid.addr,
sizeof(tok->tt.subj32_ex.tid.addr), tok->len, err);
if (err)
return (-1);
@@ -2241,7 +2267,7 @@
static void
print_subject32ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
- char sfrm)
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "subject_ex", raw);
@@ -2288,7 +2314,8 @@
}
static void
-print_text_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_text_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "text", raw);
@@ -2350,7 +2377,7 @@
static void
print_socketex32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
- char sfrm)
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "socket", raw);
@@ -2372,7 +2399,7 @@
int err = 0;
int recoversize;
- recoversize = len - tok->len - BSM_TRAILER_SIZE;
+ recoversize = len - (tok->len + BSM_TRAILER_SIZE);
if (recoversize <= 0)
return (-1);
@@ -2386,7 +2413,8 @@
}
static void
-print_invalid_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_invalid_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+ __unused char sfrm)
{
print_tok_type(fp, tok->id, "unknown", raw);
@@ -2569,6 +2597,7 @@
case AUT_ATTR64:
print_attr64_tok(outfp, tok, del, raw, sfrm);
+ return;
case AUT_EXIT:
print_exit_tok(outfp, tok, del, raw, sfrm);
@@ -2737,7 +2766,7 @@
bptr += sizeof(u_int32_t);
/* now read remaining record bytes */
- bytestoread = recsize - sizeof(u_int32_t) - sizeof(u_char);
+ bytestoread = recsize - (sizeof(u_int32_t) + sizeof(u_char));
if (fread(bptr, 1, bytestoread, fp) < bytestoread) {
free(*buf);
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_mask.c#5 (text+ko) ====
@@ -165,7 +165,10 @@
switch (flag) {
case AU_PRS_REREAD:
flush_cache();
- load_event_table();
+ if (load_event_table() == -1) {
+ pthread_mutex_unlock(&mutex);
+ return (-1);
+ }
ev = read_from_cache(event);
break;
case AU_PRS_USECACHE:
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_token.c#7 (text+ko) ====
@@ -47,6 +47,7 @@
#include <netinet/in_systm.h>
#include <netinet/ip.h>
+#include <assert.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
@@ -57,16 +58,18 @@
#include <bsm/libbsm.h>
#define GET_TOKEN_AREA(t, dptr, length) do { \
- t = malloc (sizeof(token_t)); \
- if (t != NULL) { \
- t->len = (length); \
- t->t_data = malloc ((length) * sizeof(u_char)); \
- if ((dptr = t->t_data) == NULL) { \
+ (t) = malloc(sizeof(token_t)); \
+ if ((t) != NULL) { \
+ (t)->len = (length); \
+ (dptr) = (t->t_data) = malloc((length) * sizeof(u_char)); \
+ if ((dptr) == NULL) { \
free(t); \
- t = NULL; \
+ (t) = NULL; \
} else \
- memset(dptr, 0, (length)); \
- } \
+ memset((dptr), 0, (length)); \
+ } else \
+ (dptr) = NULL; \
+ assert(t == NULL || dptr != NULL); \
} while (0)
/*
@@ -628,8 +631,9 @@
}
token_t *
-au_to_process64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, gid_t rgid,
- pid_t pid, au_asid_t sid, au_tid_t *tid)
+au_to_process64(__unused au_id_t auid, __unused uid_t euid,
+ __unused gid_t egid, __unused uid_t ruid, __unused gid_t rgid,
+ __unused pid_t pid, __unused au_asid_t sid, __unused au_tid_t *tid)
{
errno = ENOTSUP;
@@ -637,8 +641,9 @@
}
token_t *
-au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, gid_t rgid,
- pid_t pid, au_asid_t sid, au_tid_t *tid)
+au_to_process(__unused au_id_t auid, __unused uid_t euid,
+ __unused gid_t egid, __unused uid_t ruid, __unused gid_t rgid,
+ __unused pid_t pid, __unused au_asid_t sid, __unused au_tid_t *tid)
{
return (au_to_process32(auid, euid, egid, ruid, rgid, pid, sid,
@@ -1172,7 +1177,8 @@
}
token_t *
-au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod)
+au_to_header64(__unused int rec_size, __unused au_event_t e_type,
+ __unused au_emod_t e_mod)
{
errno = ENOTSUP;
==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_wrappers.c#4 (text+ko) ====
@@ -34,7 +34,6 @@
#include <unistd.h>
#include <syslog.h>
-#include <stdarg.h>
#include <string.h>
#include <errno.h>
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list