Date: Tue, 21 Feb 2006 18:16:29 GMT From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92132 for review Message-ID: <200602211816.k1LIGT30056420@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92132 Change 92132 by csjp@csjp_xor on 2006/02/21 18:15:32 Keep audit error syslog messages using a consistent format, prefix all error messages with "audit", remove redundant data which will show up in the syslog messages. Affected files ... .. //depot/projects/trustedbsd/audit3/usr.bin/login/login_audit.c#15 edit Differences ... ==== //depot/projects/trustedbsd/audit3/usr.bin/login/login_audit.c#15 (text+ko) ==== @@ -74,7 +74,7 @@ if (errno == ENOSYS) return; syslog(LOG_AUTH | LOG_ERR, - "Could not determine audit condition: %s", + "audit: could not determine audit condition: %s", strerror(errno)); errx(1, "Permission denied"); } @@ -84,7 +84,7 @@ /* Compute and set the user's preselection mask. */ if (au_user_mask(pwd->pw_name, &aumask) == -1) { syslog(LOG_AUTH | LOG_ERR, - "Could not set audit mask: %s", strerror(errno)); + "audit: could not set audit mask: %s", strerror(errno)); errx(1, "Permission denied"); } @@ -94,40 +94,41 @@ bcopy(&tid, &auinfo.ai_termid, sizeof(auinfo.ai_termid)); bcopy(&aumask, &auinfo.ai_mask, sizeof(auinfo.ai_mask)); if (setaudit(&auinfo) != 0) { - syslog(LOG_AUTH | LOG_ERR, "setaudit failed: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: setaudit failed: %s", strerror(errno)); errx(1, "Permission denied"); } if ((aufd = au_open()) == -1) { - syslog(LOG_AUTH | LOG_ERR, "au_open failed: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: au_open failed: %s", strerror(errno)); errx(1,"Permission denied"); } if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid, gid, pid, pid, &tid)) == NULL) { - syslog(LOG_AUTH | LOG_ERR, "au_to_subject32 failed"); + syslog(LOG_AUTH | LOG_ERR, "audit: au_to_subject32 failed"); errx(1, "Permission denied"); } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: 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"); + syslog(LOG_AUTH | LOG_ERR, "audit: au_to_return32 failed"); errx(1, "Permission denied"); } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: 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"); + syslog(LOG_AUTH | LOG_ERR, + "audit: audit record not committed"); errx(1, "Permission denied"); } } @@ -151,7 +152,7 @@ if (errno == ENOSYS) return; syslog(LOG_AUTH | LOG_ERR, - "could not determine audit condition: %s", + "audit: could not determine audit condition: %s", strerror(errno)); errx(1, "Permission denied"); } @@ -159,7 +160,7 @@ return; if ((aufd = au_open()) == -1) { - syslog(LOG_AUTH | LOG_ERR, "au_open failed: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: au_open failed: %s", strerror(errno)); errx(1, "Permission denied"); } @@ -171,7 +172,8 @@ */ if ((tok = au_to_subject32(-1, geteuid(), getegid(), -1, -1, pid, -1, &tid)) == NULL) { - syslog(LOG_AUTH | LOG_ERR, "au_to_subject32 failed"); + syslog(LOG_AUTH | LOG_ERR, + "audit: au_to_subject32 failed"); errx(1, "Permission denied"); } } else { @@ -180,41 +182,42 @@ gid = pwd->pw_gid; if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid, gid, pid, pid, &tid)) == NULL) { - syslog(LOG_AUTH | LOG_ERR, "au_to_subject32 failed"); + syslog(LOG_AUTH | LOG_ERR, + "audit: au_to_subject32 failed"); errx(1, "Permission denied"); } } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: 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"); + syslog(LOG_AUTH | LOG_ERR, "audit: au_to_text failed"); errx(1, "Permission denied"); } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: 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"); + "audit: au_to_return32() failed"); errx(1, "Permission denied"); } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: au_write faied: %s", strerror(errno)); errx(1, "Permission denied"); } if (au_close(aufd, 1, AUE_login) == -1) { syslog(LOG_AUTH | LOG_ERR, - "login: Audit Error: au_close() was not committed"); + "audit: au_close() was not committed"); errx(1, "Permission denied"); } } @@ -240,7 +243,7 @@ if (errno == ENOSYS) return; syslog(LOG_AUTH | LOG_ERR, - "login: Could not determine audit condition: %s", + "audit: could not determine audit condition: %s", strerror(errno)); errx(1, "Permission denied"); } @@ -248,37 +251,34 @@ return; if ((aufd = au_open()) == -1) { - syslog(LOG_AUTH | LOG_ERR, - "login: Audit Error: au_open() failed"); + syslog(LOG_AUTH | LOG_ERR, "audit: au_open() failed"); errx(1, "Permission denied"); } /* The subject that is created (euid, egid of the current process). */ if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid, gid, pid, pid, &tid)) == NULL) { - syslog(LOG_AUTH | LOG_ERR, - "login: Audit Error: au_to_subject32() failed"); + syslog(LOG_AUTH | LOG_ERR, "audit: au_to_subject32() failed"); errx(1, "Permission denied"); } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: 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"); + syslog(LOG_AUTH | LOG_ERR, "audit: au_to_return32() failed"); errx(1, "Permission denied"); } if (au_write(aufd, tok) < 0) { - syslog(LOG_AUTH | LOG_ERR, "au_write faied: %s", + syslog(LOG_AUTH | LOG_ERR, "audit: 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."); + syslog(LOG_AUTH | LOG_ERR, "audit: record was not committed."); errx(1, "Permission denied"); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602211816.k1LIGT30056420>