login_audit.c (169342) | login_audit.c (191297) |
---|---|
1/* 2 * Copyright (c) 2005 Apple Computer, Inc. 3 * All rights reserved. 4 * 5 * @APPLE_BSD_LICENSE_HEADER_START@ 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * @APPLE_BSD_LICENSE_HEADER_END@ 32 */ 33 34#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2005 Apple Computer, Inc. 3 * All rights reserved. 4 * 5 * @APPLE_BSD_LICENSE_HEADER_START@ 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * @APPLE_BSD_LICENSE_HEADER_END@ 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/usr.bin/login/login_audit.c 169342 2007-05-07 11:01:36Z dwmalone $"); | 35__FBSDID("$FreeBSD: head/usr.bin/login/login_audit.c 191297 2009-04-19 23:34:22Z rwatson $"); |
36 37#include <sys/types.h> 38 39#include <bsm/libbsm.h> 40#include <bsm/audit_uevents.h> 41 42#include <err.h> 43#include <errno.h> --- 18 unchanged lines hidden (view full) --- 62{ 63 token_t *tok; 64 int aufd; 65 au_mask_t aumask; 66 auditinfo_t auinfo; 67 uid_t uid = pwd->pw_uid; 68 gid_t gid = pwd->pw_gid; 69 pid_t pid = getpid(); | 36 37#include <sys/types.h> 38 39#include <bsm/libbsm.h> 40#include <bsm/audit_uevents.h> 41 42#include <err.h> 43#include <errno.h> --- 18 unchanged lines hidden (view full) --- 62{ 63 token_t *tok; 64 int aufd; 65 au_mask_t aumask; 66 auditinfo_t auinfo; 67 uid_t uid = pwd->pw_uid; 68 gid_t gid = pwd->pw_gid; 69 pid_t pid = getpid(); |
70 long au_cond; | 70 int au_cond; |
71 72 /* If we are not auditing, don't cut an audit record; just return. */ | 71 72 /* If we are not auditing, don't cut an audit record; just return. */ |
73 if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { | 73 if (auditon(A_GETCOND, &au_cond, sizeof(au_cond)) < 0) { |
74 if (errno == ENOSYS) 75 return; 76 errx(1, "login: Could not determine audit condition"); 77 } 78 if (au_cond == AUC_NOAUDIT) 79 return; 80 81 /* Compute and set the user's preselection mask. */ --- 28 unchanged lines hidden (view full) --- 110 * The following tokens are included in the audit record for failed 111 * login attempts: header, subject, text, return. 112 */ 113void 114au_login_fail(const char *errmsg, int na) 115{ 116 token_t *tok; 117 int aufd; | 74 if (errno == ENOSYS) 75 return; 76 errx(1, "login: Could not determine audit condition"); 77 } 78 if (au_cond == AUC_NOAUDIT) 79 return; 80 81 /* Compute and set the user's preselection mask. */ --- 28 unchanged lines hidden (view full) --- 110 * The following tokens are included in the audit record for failed 111 * login attempts: header, subject, text, return. 112 */ 113void 114au_login_fail(const char *errmsg, int na) 115{ 116 token_t *tok; 117 int aufd; |
118 long au_cond; | 118 int au_cond; |
119 uid_t uid; 120 gid_t gid; 121 pid_t pid = getpid(); 122 123 /* If we are not auditing, don't cut an audit record; just return. */ | 119 uid_t uid; 120 gid_t gid; 121 pid_t pid = getpid(); 122 123 /* If we are not auditing, don't cut an audit record; just return. */ |
124 if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { | 124 if (auditon(A_GETCOND, &au_cond, sizeof(au_cond)) < 0) { |
125 if (errno == ENOSYS) 126 return; 127 errx(1, "login: Could not determine audit condition"); 128 } 129 if (au_cond == AUC_NOAUDIT) 130 return; 131 132 if ((aufd = au_open()) == -1) --- 37 unchanged lines hidden (view full) --- 170void 171audit_logout(void) 172{ 173 token_t *tok; 174 int aufd; 175 uid_t uid = pwd->pw_uid; 176 gid_t gid = pwd->pw_gid; 177 pid_t pid = getpid(); | 125 if (errno == ENOSYS) 126 return; 127 errx(1, "login: Could not determine audit condition"); 128 } 129 if (au_cond == AUC_NOAUDIT) 130 return; 131 132 if ((aufd = au_open()) == -1) --- 37 unchanged lines hidden (view full) --- 170void 171audit_logout(void) 172{ 173 token_t *tok; 174 int aufd; 175 uid_t uid = pwd->pw_uid; 176 gid_t gid = pwd->pw_gid; 177 pid_t pid = getpid(); |
178 long au_cond; | 178 int au_cond; |
179 180 /* If we are not auditing, don't cut an audit record; just return. */ | 179 180 /* If we are not auditing, don't cut an audit record; just return. */ |
181 if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { | 181 if (auditon(A_GETCOND, &au_cond, sizeof(int)) < 0) { |
182 if (errno == ENOSYS) 183 return; 184 errx(1, "login: Could not determine audit condition"); 185 } 186 if (au_cond == AUC_NOAUDIT) 187 return; 188 189 if ((aufd = au_open()) == -1) --- 15 unchanged lines hidden --- | 182 if (errno == ENOSYS) 183 return; 184 errx(1, "login: Could not determine audit condition"); 185 } 186 if (au_cond == AUC_NOAUDIT) 187 return; 188 189 if ((aufd = au_open()) == -1) --- 15 unchanged lines hidden --- |