components/sudo/patches/audit-event.patch
author April Chin <april.chin@oracle.com>
Tue, 05 Jun 2012 09:51:55 -0700
branchs11-sru
changeset 2285 cb43727425f0
parent 2273 f05fa0c3ac62
child 1209 5fd82ed384aa
permissions -rw-r--r--
7169436 Problem with utility/sudo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
     1
diff -rupN sudo-1.8.4p5.orig/plugins/sudoers/bsm_audit.c sudo-1.8.4p5/plugins/sudoers/bsm_audit.c
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
     2
--- sudo-1.8.4p5.orig/plugins/sudoers/bsm_audit.c	2012-03-29 10:37:01.000000000 -0700
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
     3
+++ sudo-1.8.4p5/plugins/sudoers/bsm_audit.c	2012-05-18 14:20:39.003982000 -0700
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
     4
@@ -104,7 +104,7 @@ bsm_audit_success(char **exec_args)
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
     5
 		log_error(0, _("au_open: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
     6
 	if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) == 0) {
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
     7
 		tok = au_to_subject_ex(auid, geteuid(), getegid(), getuid(),
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
     8
-		    getuid(), pid, pid, &ainfo_addr.ai_termid);
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
     9
+		    getuid(), pid, ainfo_addr.ai_asid, &ainfo_addr.ai_termid);
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    10
 	} else if (errno == ENOSYS) {
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    11
 		/*
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    12
 		 * NB: We should probably watch out for ERANGE here.
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    13
@@ -112,7 +112,7 @@ bsm_audit_success(char **exec_args)
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    14
 		if (getaudit(&ainfo) < 0)
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    15
 			log_error(0, _("getaudit: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    16
 		tok = au_to_subject(auid, geteuid(), getegid(), getuid(),
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    17
-		    getuid(), pid, pid, &ainfo.ai_termid);
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    18
+		    getuid(), pid, ainfo.ai_asid, &ainfo.ai_termid);
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    19
 	} else
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    20
 		log_error(0, _("getaudit: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    21
 	if (tok == NULL)
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    22
@@ -126,7 +126,7 @@ bsm_audit_success(char **exec_args)
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    23
 	if (tok == NULL)
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    24
 		log_error(0, _("au_to_return32: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    25
 	au_write(aufd, tok);
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    26
-	if (au_close(aufd, 1, AUE_sudo) == -1)
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    27
+	if (au_close(aufd, 1, AUE_sudo, PAD_FAILURE) == -1)
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    28
 		log_error(0, _("unable to commit audit record"));
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    29
 	debug_return;
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    30
 }
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    31
@@ -148,7 +148,7 @@ bsm_audit_failure(char **exec_args, char
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    32
 	/*
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    33
 	 * If we are not auditing, don't cut an audit record; just return.
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    34
 	 */
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    35
-	if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) {
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    36
+	if (auditon(A_GETCOND, (caddr_t)&au_cond, sizeof(long)) < 0) {
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    37
 		if (errno == AUDIT_NOT_CONFIGURED)
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    38
 			debug_return;
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    39
 		log_error(0, _("Could not determine audit condition"));
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    40
@@ -163,12 +163,12 @@ bsm_audit_failure(char **exec_args, char
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    41
 		log_error(0, _("au_open: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    42
 	if (getaudit_addr(&ainfo_addr, sizeof(ainfo_addr)) == 0) { 
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    43
 		tok = au_to_subject_ex(auid, geteuid(), getegid(), getuid(),
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    44
-		    getuid(), pid, pid, &ainfo_addr.ai_termid);
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    45
+		    getuid(), pid, ainfo_addr.ai_asid, &ainfo_addr.ai_termid);
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    46
 	} else if (errno == ENOSYS) {
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    47
 		if (getaudit(&ainfo) < 0) 
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    48
 			log_error(0, _("getaudit: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    49
 		tok = au_to_subject(auid, geteuid(), getegid(), getuid(),
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    50
-		    getuid(), pid, pid, &ainfo.ai_termid);
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    51
+		    getuid(), pid, ainfo.ai_asid, &ainfo.ai_termid);
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    52
 	} else
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    53
 		log_error(0, _("getaudit: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    54
 	if (tok == NULL)
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    55
@@ -187,7 +187,7 @@ bsm_audit_failure(char **exec_args, char
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    56
 	if (tok == NULL)
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    57
 		log_error(0, _("au_to_return32: failed"));
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    58
 	au_write(aufd, tok);
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    59
-	if (au_close(aufd, 1, AUE_sudo) == -1)
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    60
+	if (au_close(aufd, 1, AUE_sudo, PAD_FAILURE) == -1)
2273
f05fa0c3ac62 7140964 Problem with utility/sudo
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents: 447
diff changeset
    61
 		log_error(0, _("unable to commit audit record"));
2285
cb43727425f0 7169436 Problem with utility/sudo
April Chin <april.chin@oracle.com>
parents: 2273
diff changeset
    62
 	debug_return;
447
7ca7b95abd2f PSARC/2011/252 sudo 1.8.1
Darren J Moffat <Darren.Moffat@Oracle.COM>
parents:
diff changeset
    63
 }