diff options
| author | gww <none@none> | 2007-11-28 15:04:00 -0800 |
|---|---|---|
| committer | gww <none@none> | 2007-11-28 15:04:00 -0800 |
| commit | f72effdea24d97a107b04e4b041cf5081dae0ee9 (patch) | |
| tree | 323892f80a6f52697092da0836ac08e8788d3cc4 /usr/src/cmd/praudit | |
| parent | 5b3e1433c6213363bcb6387e66fc84ee9ff21a5d (diff) | |
| download | illumos-joyent-f72effdea24d97a107b04e4b041cf5081dae0ee9.tar.gz | |
6607434 praudit(1M) output in error --- no newline after exec_args,0
6624513 return token values from userland should be able to include errno.
6624525 praudit:token.c has nits
6627669 the PSARC/2000/517 audit interfaces do not support the in_peer token
6629752 praudit displays the ip port token in HEX rather than in_port_t
Diffstat (limited to 'usr/src/cmd/praudit')
| -rw-r--r-- | usr/src/cmd/praudit/format.c | 19 | ||||
| -rw-r--r-- | usr/src/cmd/praudit/praudit.h | 2 | ||||
| -rw-r--r-- | usr/src/cmd/praudit/token.c | 16 |
3 files changed, 23 insertions, 14 deletions
diff --git a/usr/src/cmd/praudit/format.c b/usr/src/cmd/praudit/format.c index 44920d8584..aa7308dd82 100644 --- a/usr/src/cmd/praudit/format.c +++ b/usr/src/cmd/praudit/format.c @@ -2610,9 +2610,9 @@ do_mtime64(pr_context_t *context, int status, int flag, uint64_t scale) void pa_error(const uchar_t err, char *buf, size_t buflen) { - if (err == 0) { + if (err == ADT_SUCCESS) { (void) strlcpy(buf, gettext("success"), buflen); - } else if ((char)err == -1) { + } else if ((char)err == ADT_FAILURE) { (void) strlcpy(buf, gettext("failure"), buflen); } else { char *emsg = strerror(err); @@ -2636,7 +2636,7 @@ pa_error(const uchar_t err, char *buf, size_t buflen) * ----------------------------------------------------------------------- */ void -pa_retval(const int32_t retval, char *buf, size_t buflen) +pa_retval(const uchar_t err, const int32_t retval, char *buf, size_t buflen) { struct msg_text *msglist = &adt_msg_text[ADT_LIST_FAIL_VALUE]; @@ -2647,11 +2647,20 @@ pa_retval(const int32_t retval, char *buf, size_t buflen) gettext(msglist->ml_msg_list[retval + msglist->ml_offset]), buflen); } else if ((retval >= ADT_FAIL_PAM) && - (retval < ADT_FAIL_PAM + PAM_TOTAL_ERRNUM)) + (retval < ADT_FAIL_PAM + PAM_TOTAL_ERRNUM)) { (void) strlcpy(buf, pam_strerror(NULL, retval - ADT_FAIL_PAM), buflen); - else + } else if ((char)err == ADT_FAILURE) { + char *emsg = strerror(retval); + + if (emsg != NULL) { + (void) strlcpy(buf, emsg, buflen); + } else { + (void) snprintf(buf, buflen, "%d", retval); + } + } else { (void) snprintf(buf, buflen, "%d", retval); + } } diff --git a/usr/src/cmd/praudit/praudit.h b/usr/src/cmd/praudit/praudit.h index 4f6ada3154..bcb5151492 100644 --- a/usr/src/cmd/praudit/praudit.h +++ b/usr/src/cmd/praudit/praudit.h @@ -227,7 +227,7 @@ extern int pa_liaison(pr_context_t *context, int status, int flag); extern int pa_xgeneric(pr_context_t *context); extern int pa_xid(pr_context_t *context, int status, int flag); extern void pa_error(const uchar_t err, char *buf, size_t buflen); -extern void pa_retval(const int32_t value, char *buf, size_t buflen); +extern void pa_retval(const uchar_t, const int32_t, char *, size_t); extern int pa_ip_addr(pr_context_t *context, int status, int flag); extern int pr_adr_char(pr_context_t *context, char *cp, int count); extern int pr_adr_short(pr_context_t *context, short *sp, int count); diff --git a/usr/src/cmd/praudit/token.c b/usr/src/cmd/praudit/token.c index d2a0125d84..d4a53b4e8e 100644 --- a/usr/src/cmd/praudit/token.c +++ b/usr/src/cmd/praudit/token.c @@ -717,7 +717,7 @@ collapse_path(char *s) if (id > 0) id--; while (id > 0 && s[--id] != '/') - ; + continue; id++; continue; } @@ -727,12 +727,12 @@ collapse_path(char *s) if (id > 0) id--; while (id > 0 && s[--id] != '/') - ; + continue; id++; continue; } while (is < ls && (s[id++] = s[is++]) != '/') - ; + continue; is--; } return (s); @@ -1072,7 +1072,7 @@ return_value32_token(pr_context_t *context) context, &value, 1)) != 0) return (returnstat); - pa_retval(value, pb, sizeof (pb)); + pa_retval(number, value, pb, sizeof (pb)); } else { uval.uvaltype = PRA_INT32; if ((char)number == -1) @@ -1177,7 +1177,7 @@ return_value64_token(pr_context_t *context) if ((returnstat = pr_adr_int64(context, &rval.r_vals, 1)) != 0) return (returnstat); - pa_retval(rval.r_val1, pb, sizeof (pb)); + pa_retval(number, rval.r_val1, pb, sizeof (pb)); } else { uval.uvaltype = PRA_INT32; if ((char)number == -1) @@ -1596,13 +1596,13 @@ ip_token(pr_context_t *context) * * Format of ip port token: * ip port address token id adr_char - * port address adr_short (in hex) + * port address adr_short (in_port_t == uint16_t) * ----------------------------------------------------------------------- */ int iport_token(pr_context_t *context) { - return (pa_adr_shorthex(context, 0, 1)); + return (pa_adr_u_short(context, 0, 1)); } /* @@ -1888,7 +1888,7 @@ string_token_common(pr_context_t *context, int tag) } if (num == 0) - return (0); + return (do_newline(context, 1)); for (; num > 1; num--) { if ((returnstat = (process_tag(context, tag, |
