Date: Tue, 21 Feb 2006 15:31:57 GMT From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92128 for review Message-ID: <200602211531.k1LFVvme042238@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92128 Change 92128 by csjp@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.");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602211531.k1LFVvme042238>