summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbsm/common
diff options
context:
space:
mode:
authorgww <none@none>2006-04-10 14:36:15 -0700
committergww <none@none>2006-04-10 14:36:15 -0700
commit103b2b152ab1f30e081cd8f98b88e71e6cd6d2fc (patch)
tree4a6f2677f2e1147ea65e271d17bcb13462716239 /usr/src/lib/libbsm/common
parent69bbc66400b6af121ee9f95667811cc0acd84d6e (diff)
downloadillumos-joyent-103b2b152ab1f30e081cd8f98b88e71e6cd6d2fc.tar.gz
PSARC/2006/213 FMRI Audit Token
6401913 add FMRI audit token type to the adt_* infrastructure
Diffstat (limited to 'usr/src/lib/libbsm/common')
-rw-r--r--usr/src/lib/libbsm/common/adt_token.c35
-rw-r--r--usr/src/lib/libbsm/common/au_to.c28
2 files changed, 58 insertions, 5 deletions
diff --git a/usr/src/lib/libbsm/common/adt_token.c b/usr/src/lib/libbsm/common/adt_token.c
index 1c6aec718b..981049dbbc 100644
--- a/usr/src/lib/libbsm/common/adt_token.c
+++ b/usr/src/lib/libbsm/common/adt_token.c
@@ -248,6 +248,30 @@ adt_to_tid(datadef *def, void *p_data, int required,
}
/*
+ * au_to_frmi takes a char * that is the fmri.
+ */
+/* ARGSUSED */
+static void
+adt_to_frmi(datadef *def, void *p_data, int required,
+ struct adt_event_state *event, char *notUsed)
+{
+ char *fmri;
+
+ DPRINTF((" adt_to_fmri dd_datatype=%d\n", def->dd_datatype));
+
+ fmri = ((union convert *)p_data)->tcharstar;
+
+ if (fmri == NULL) {
+ if (required)
+ fmri = empty;
+ else
+ return;
+ }
+ DPRINTF((" fmri=%s\n", fmri));
+ (void) au_write(event->ae_event_handle, au_to_fmri(fmri));
+}
+
+/*
* au_to_newgroups takes a length and an array of gids
* as input. The input to adt_to_newgroups is a length
* and a pointer to an array of gids.
@@ -760,23 +784,24 @@ adt_to_zonename(datadef *def, void *p_data, int required,
* no function for trailer -- the trailer is generated by au_close()
*/
-#define MAX_TOKEN_JMP 15
+#define MAX_TOKEN_JMP 16
static struct token_jmp token_table[MAX_TOKEN_JMP] =
{
{AUT_CMD, adt_to_cmd},
{ADT_CMD_ALT, adt_to_cmd1},
- {AUT_TID, adt_to_tid},
- {AUT_NEWGROUPS, adt_to_newgroups},
- {AUT_PATH, adt_to_path},
- {-AUT_PATH, adt_to_pathlist}, /* private extension of token values */
{ADT_AUT_PRIV_L, adt_to_priv_limit},
{ADT_AUT_PRIV_I, adt_to_priv_inherit},
{ADT_AUT_PRIV_E, adt_to_priv_effective},
+ {AUT_NEWGROUPS, adt_to_newgroups},
+ {AUT_FMRI, adt_to_frmi},
+ {AUT_PATH, adt_to_path},
+ {-AUT_PATH, adt_to_pathlist}, /* private extension of token values */
{AUT_PROCESS, adt_to_process},
{AUT_RETURN, adt_to_return},
{AUT_SUBJECT, adt_to_subject},
{AUT_TEXT, adt_to_text},
+ {AUT_TID, adt_to_tid},
{AUT_UAUTH, adt_to_uauth},
{AUT_ZONENAME, adt_to_zonename}
};
diff --git a/usr/src/lib/libbsm/common/au_to.c b/usr/src/lib/libbsm/common/au_to.c
index 3747994d76..d3574bfe70 100644
--- a/usr/src/lib/libbsm/common/au_to.c
+++ b/usr/src/lib/libbsm/common/au_to.c
@@ -1314,3 +1314,31 @@ au_to_zonename(char *name)
return (token);
}
+
+/*
+ * au_to_fmri
+ * return s:
+ * pointer to a fmri token.
+ */
+token_t *
+au_to_fmri(char *fmri)
+{
+ token_t *token; /* local token */
+ adr_t adr; /* adr memory stream header */
+ char data_header = AUT_FMRI; /* header for this token */
+ short bytes; /* length of string */
+
+ if (fmri == NULL)
+ return (NULL);
+
+ bytes = strlen(fmri) + 1;
+ token = get_token((int)(sizeof (char) + sizeof (short) + bytes));
+ if (token == NULL)
+ return (NULL);
+ adr_start(&adr, token->tt_data);
+ adr_char(&adr, &data_header, 1);
+ adr_short(&adr, &bytes, 1);
+ adr_char(&adr, fmri, bytes);
+
+ return (token);
+}