components/sudo/patches/audit-event.patch
author Darren J Moffat <Darren.Moffat@Oracle.COM>
Wed, 25 Apr 2012 16:59:00 +0100
changeset 797 ef9656f77cca
parent 447 7ca7b95abd2f
child 840 926eb95ceab3
permissions -rw-r--r--
7140964 Problem with utility/sudo

--- sudo-1.8.3p2/plugins/sudoers/bsm_audit.c	Fri Oct 21 14:01:25 2011
+++ /tmp/bsm_audit.c	Mon Jan 30 17:06:00 2012
@@ -30,8 +30,10 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include "gettext.h"
 #include "bsm_audit.h"
 
+
 /*
  * Solaris auditon() returns EINVAL if BSM audit not configured.
  * OpenBSM returns ENOSYS for unimplemented options.
@@ -100,7 +102,7 @@
 		log_error(0, _("au_open: failed"));
 	if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) == 0) {
 		tok = au_to_subject_ex(auid, geteuid(), getegid(), getuid(),
-		    getuid(), pid, pid, &ainfo_addr.ai_termid);
+		    getuid(), pid, &ainfo_addr.ai_asid, &ainfo_addr.ai_termid);
 	} else if (errno == ENOSYS) {
 		/*
 		 * NB: We should probably watch out for ERANGE here.
@@ -108,7 +110,7 @@
 		if (getaudit(&ainfo) < 0)
 			log_error(0, _("getaudit: failed"));
 		tok = au_to_subject(auid, geteuid(), getegid(), getuid(),
-		    getuid(), pid, pid, &ainfo.ai_termid);
+		    getuid(), pid, &ainfo.ai_asid, &ainfo.ai_termid);
 	} else
 		log_error(0, _("getaudit: failed"));
 	if (tok == NULL)
@@ -122,7 +124,7 @@
 	if (tok == NULL)
 		log_error(0, _("au_to_return32: failed"));
 	au_write(aufd, tok);
-	if (au_close(aufd, 1, AUE_sudo) == -1)
+	if (au_close(aufd, 1, AUE_sudo, PAD_FAILURE) == -1)
 		log_error(0, _("unable to commit audit record"));
 }
 
@@ -142,7 +144,7 @@
 	/*
 	 * If we are not auditing, don't cut an audit record; just return.
 	 */
-	if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) {
+	if (auditon(A_GETCOND, (caddr_t)&au_cond, sizeof(long)) < 0) {
 		if (errno == AUDIT_NOT_CONFIGURED)
 			return;
 		log_error(0, _("Could not determine audit condition"));
@@ -157,12 +159,12 @@
 		log_error(0, _("au_open: failed"));
 	if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) == 0) { 
 		tok = au_to_subject_ex(auid, geteuid(), getegid(), getuid(),
-		    getuid(), pid, pid, &ainfo_addr.ai_termid);
+		    getuid(), pid, &ainfo_addr.ai_asid, &ainfo_addr.ai_termid);
 	} else if (errno == ENOSYS) {
 		if (getaudit(&ainfo) < 0) 
 			log_error(0, _("getaudit: failed"));
 		tok = au_to_subject(auid, geteuid(), getegid(), getuid(),
-		    getuid(), pid, pid, &ainfo.ai_termid);
+		    getuid(), pid, &ainfo.ai_asid, &ainfo.ai_termid);
 	} else
 		log_error(0, _("getaudit: failed"));
 	if (tok == NULL)
@@ -181,6 +183,6 @@
 	if (tok == NULL)
 		log_error(0, _("au_to_return32: failed"));
 	au_write(aufd, tok);
-	if (au_close(aufd, 1, AUE_sudo) == -1)
+	if (au_close(aufd, 1, AUE_sudo, PAD_FAILURE) == -1)
 		log_error(0, _("unable to commit audit record"));
 }