Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jan 2006 20:52:33 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 90644 for review
Message-ID:  <200601292052.k0TKqX4q000850@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=90644

Change 90644 by rwatson@rwatson_peppercorn on 2006/01/29 20:52:03

	style(9).

Affected files ...

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

Differences ...

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

@@ -130,7 +130,7 @@
 static void		 sigint(int);
 static void		 timedout(int);
 static void		 usage(void);
-static void		 au_success();
+static void		 au_success(void);
 static void		 au_fail(char *, int);
 
 #define	TTYGRPNAME		"tty"			/* group to own ttys */
@@ -376,8 +376,8 @@
 		pam_cleanup();
 
 		/*
-		 * we are not exiting here, but this corresponds to
-		 * a failed login event, so set exitstatus to 1
+		 * We are not exiting here, but this corresponds to a failed
+		 * login event, so set exitstatus to 1.
 		 */
 		au_fail("Login incorrect", 1);
 
@@ -403,7 +403,7 @@
 
 	endpwent();
 
-	/* Audit successful login */
+	/* Audit successful login. */
 	if (auditsuccess)
 		au_success();
 
@@ -809,13 +809,10 @@
 
 /*
  * The following tokens are included in the audit record for a successful 
- * login:
- * header
- * subject
- * return
+ * login: header, subject, return.
  */ 
 static void
-au_success()
+au_success(void)
 {
 	token_t *tok;
 	int aufd;
@@ -826,40 +823,41 @@
 	pid_t pid = getpid();
 	long au_cond;
 
-	/* If we are not auditing, don't cut an audit record; just return */
+	/* If we are not auditing, don't cut an audit record; just return. */
  	if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) {
 		if (errno == ENOSYS)
 			return;
-		fprintf(stderr, "login: Could not determine audit condition\n");
+		fprintf(stderr,
+		    "login: Could not determine audit condition\n");
 		exit(1);
 	}
 	if (au_cond == AUC_NOAUDIT)
 		return;
 
-	/* Compute and Set the user's preselection mask */ 
-	if(au_user_mask(pwd->pw_name, &aumask) == -1) {
+	/* Compute and set the user's preselection mask. */ 
+	if (au_user_mask(pwd->pw_name, &aumask) == -1) {
 		fprintf(stderr, "login: Could not set audit mask\n");
 		exit(1);
 	}
 
-	/* Set the audit info for the user */
+	/* Set the audit info for the user. */
 	auinfo.ai_auid = uid;
 	auinfo.ai_asid = pid;
 	bcopy(&tid, &auinfo.ai_termid, sizeof(auinfo.ai_termid));
 	bcopy(&aumask, &auinfo.ai_mask, sizeof(auinfo.ai_mask));
-	if(setaudit(&auinfo) != 0) {
+	if (setaudit(&auinfo) != 0) {
 		fprintf(stderr, "login: setaudit failed:  %s\n", 
 		    strerror(errno));
 		exit(1);
 	}
 
-	if((aufd = au_open()) == -1) {
+	if ((aufd = au_open()) == -1) {
 		fprintf(stderr, "login: Audit Error: au_open() failed\n");
 		exit(1);
 	}
 
-	/* The subject that is created (euid, egid of the current process) */
-	if((tok = au_to_subject32(uid, geteuid(), getegid(), 
+	/* 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) {
 		fprintf(stderr, 
 		    "login: Audit Error: au_to_subject32() failed\n");
@@ -867,14 +865,14 @@
 	}
 	au_write(aufd, tok);
 
-	if((tok = au_to_return32(0, 0)) == NULL) {
+	if ((tok = au_to_return32(0, 0)) == NULL) {
 		fprintf(stderr, 
 		    "login: Audit Error: au_to_return32() failed\n");
 		exit(1);
 	}
 	au_write(aufd, tok);
 
-	if(au_close(aufd, 1, AUE_login) == -1) {
+	if (au_close(aufd, 1, AUE_login) == -1) {
 		fprintf(stderr, "login: Audit Record was not committed.\n");
 		exit(1);
 	}
@@ -882,11 +880,7 @@
 
 /*
  * The following tokens are included in the audit record for failed 
- * login attempts:
- * header
- * subject
- * text
- * return
+ * login attempts: header, subject, text, return.
  */ 
 static void
 au_fail(char *errmsg, int na)
@@ -898,39 +892,39 @@
 	gid_t gid;
 	pid_t pid = getpid();
 
-	/* If we are not auditing, don't cut an audit record; just return */
+	/* If we are not auditing, don't cut an audit record; just return. */
  	if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) {
 		if (errno == ENOSYS)
 			return;
-		fprintf(stderr, "login: Could not determine audit condition\n");
+		fprintf(stderr,
+		    "login: Could not determine audit condition\n");
 		exit(1);
 	}
 	if (au_cond == AUC_NOAUDIT)
 		return;
 
-	if((aufd = au_open()) == -1) {
+	if ((aufd = au_open()) == -1) {
 		fprintf(stderr, "login: Audit Error: au_open() failed\n");
 		exit(1);
 	}
 
-	if(na) {
-		/* Non attributable event */
-		/* Assuming that login is not called within a user's 
-		 * session => auid,asid == -1 */
-		if((tok = au_to_subject32(-1, geteuid(), getegid(), -1, -1, 
-				pid, -1, &tid)) == NULL) {
-
+	if (na) {
+		/*
+		 * Non attributable event.  Assuming that login is not called
+		 * within a user's session => auid,asid == -1.
+		 */
+		if ((tok = au_to_subject32(-1, geteuid(), getegid(), -1, -1, 
+		    pid, -1, &tid)) == NULL) {
 			fprintf(stderr, 
 			    "login: Audit Error: au_to_subject32() failed\n");
 			exit(1);
 		}
-	}
-	else {
-		/* we know the subject -- so use its value instead */
+	} else {
+		/* We know the subject -- so use its value instead. */
 		uid = pwd->pw_uid;
 		gid = pwd->pw_gid;
-		if((tok = au_to_subject32(uid, geteuid(), getegid(), 
-				uid, gid, pid, pid, &tid)) == NULL) {
+		if ((tok = au_to_subject32(uid, geteuid(), getegid(), uid,
+		    gid, pid, pid, &tid)) == NULL) {
 			fprintf(stderr, 
 			    "login: Audit Error: au_to_subject32() failed\n");
 			exit(1);
@@ -938,21 +932,21 @@
 	}
 	au_write(aufd, tok);
 
-	/* Include the error message */
-	if((tok = au_to_text(errmsg)) == NULL) {
+	/* Include the error message. */
+	if ((tok = au_to_text(errmsg)) == NULL) {
 		fprintf(stderr, "login: Audit Error: au_to_text() failed\n");
 		exit(1);
 	}
 	au_write(aufd, tok);
 
-	if((tok = au_to_return32(1, errno)) == NULL) {
+	if ((tok = au_to_return32(1, errno)) == NULL) {
 		fprintf(stderr, 
 		    "login: Audit Error: au_to_return32() failed\n");
 		exit(1);
 	}
 	au_write(aufd, tok);
 
-	if(au_close(aufd, 1, AUE_login) == -1) {
+	if (au_close(aufd, 1, AUE_login) == -1) {
 		fprintf(stderr, 
 		    "login: Audit Error: au_close()  was not committed\n");
 		exit(1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601292052.k0TKqX4q000850>