X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=net%2Fnetlabel%2Fnetlabel_user.c;h=a3fd75ac3fa50187bd7ff6924700569b2b1cebc4;hb=4434ade8c9334a3ab975d8993de456f06841899e;hp=eeb7d768d2bb558c7c963f372ec4b7b585d6b675;hpb=fcd48280643e92ec6cb29a04e9079dd7b6b5bfef;p=safe%2Fjmp%2Flinux-2.6 diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c index eeb7d76..a3fd75a 100644 --- a/net/netlabel/netlabel_user.c +++ b/net/netlabel/netlabel_user.c @@ -32,6 +32,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -56,7 +60,7 @@ * non-zero on failure. * */ -int netlbl_netlink_init(void) +int __init netlbl_netlink_init(void) { int ret_val; @@ -74,3 +78,47 @@ int netlbl_netlink_init(void) return 0; } + +/* + * NetLabel Audit Functions + */ + +/** + * netlbl_audit_start_common - Start an audit message + * @type: audit message type + * @audit_info: NetLabel audit information + * + * Description: + * Start an audit message using the type specified in @type and fill the audit + * message with some fields common to all NetLabel audit messages. Returns + * a pointer to the audit buffer on success, NULL on failure. + * + */ +struct audit_buffer *netlbl_audit_start_common(int type, + struct netlbl_audit *audit_info) +{ + struct audit_buffer *audit_buf; + char *secctx; + u32 secctx_len; + + if (audit_enabled == 0) + return NULL; + + audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type); + if (audit_buf == NULL) + return NULL; + + audit_log_format(audit_buf, "netlabel: auid=%u ses=%u", + audit_info->loginuid, + audit_info->sessionid); + + if (audit_info->secid != 0 && + security_secid_to_secctx(audit_info->secid, + &secctx, + &secctx_len) == 0) { + audit_log_format(audit_buf, " subj=%s", secctx); + security_release_secctx(secctx, secctx_len); + } + + return audit_buf; +}