PERFORCE change 92128 for review

Christian S.J. Peron csjp at FreeBSD.org
Tue Feb 21 07:32:00 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=92128

Change 92128 by csjp at csjp_xor on 2006/02/21 15:31:43

	Do not ignore the return value of au_write. This function can fail so we
	should make sure it doesn't, but if it does, do the right thing.

Affected files ...

.. //depot/projects/trustedbsd/audit3/usr.bin/login/login_audit.c#14 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/usr.bin/login/login_audit.c#14 (text+ko) ====

@@ -110,13 +110,21 @@
 		syslog(LOG_AUTH | LOG_ERR, "au_to_subject32 failed");
 		errx(1, "Permission denied");
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	if ((tok = au_to_return32(0, 0)) == NULL) {
 		syslog(LOG_AUTH | LOG_ERR, "au_to_return32 failed");
 		errx(1, "Permission denied");
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	if (au_close(aufd, 1, AUE_login) == -1) {
 		syslog(LOG_AUTH | LOG_ERR, "audit record not committed");
@@ -176,21 +184,33 @@
 			errx(1, "Permission denied");
 		}
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	/* Include the error message. */
 	if ((tok = au_to_text(errmsg)) == NULL) {
 		syslog(LOG_AUTH | LOG_ERR, "au_to_text failed");
 		errx(1, "Permission denied");
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	if ((tok = au_to_return32(1, errno)) == NULL) {
 		syslog(LOG_AUTH | LOG_ERR,
 		    "login: Audit Error: au_to_return32() failed");
 		errx(1, "Permission denied");
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	if (au_close(aufd, 1, AUE_login) == -1) {
 		syslog(LOG_AUTH | LOG_ERR,
@@ -240,14 +260,22 @@
 		    "login: Audit Error: au_to_subject32() failed");
 		errx(1, "Permission denied");
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	if ((tok = au_to_return32(0, 0)) == NULL) {
 		syslog(LOG_AUTH | LOG_ERR,
 		    "login: Audit Error: au_to_return32() failed");
 		errx(1, "Permission denied");
 	}
-	au_write(aufd, tok);
+	if (au_write(aufd, tok) < 0) {
+		syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s",
+		    strerror(errno));
+		errx(1, "Permission denied");
+	}
 
 	if (au_close(aufd, 1, AUE_logout) == -1) {
 		syslog(LOG_AUTH | LOG_ERR, "Audit Record was not committed.");


More information about the trustedbsd-cvs mailing list