PERFORCE change 103037 for review

Christian S.J. Peron csjp at FreeBSD.org
Wed Aug 2 15:51:55 UTC 2006


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

Change 103037 by csjp at csjp_xor on 2006/08/02 15:49:52

	Do some cosmetic changes to make merging into HEAD a bit easier.
	Should be no functional change here

Affected files ...

.. //depot/projects/trustedbsd/audit3/usr.bin/su/su.c#17 edit

Differences ...

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

@@ -217,9 +217,8 @@
 	 * Try to provide more helpful debugging output if su(1) is running
 	 * non-setuid, or was run from a file system not mounted setuid.
 	 */
-	if (geteuid() != 0) {
+	if (geteuid() != 0)
 		errx(1, "not running setuid");
-	}
 
 	if (strlen(user) > MAXLOGNAME - 1) {
 #ifdef USE_BSM_AUDIT
@@ -231,9 +230,8 @@
 	}
 
 	nargv = malloc(sizeof(char *) * (size_t)(argc + 4));
-	if (nargv == NULL) {
+	if (nargv == NULL)
 		errx(1, "malloc failure");
-	}
 
 	nargv[argc + 3] = NULL;
 	for (i = argc; i >= optind; i--)
@@ -266,9 +264,8 @@
 	}
 
 	username = strdup(pwd->pw_name);
-	if (username == NULL) {
+	if (username == NULL)
 		err(1, "strdup failure");
-	}
 
 	if (asme) {
 		if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') {
@@ -370,16 +367,14 @@
 			errx(1, "only root may use -c");
 		}
 		lc = login_getclass(class);
-		if (lc == NULL) {
+		if (lc == NULL)
 			errx(1, "unknown class: %s", class);
-		}
 	}
 
 	/* if asme and non-standard target shell, must be root */
 	if (asme) {
-		if (ruid != 0 && !chshell(pwd->pw_shell)) {
+		if (ruid != 0 && !chshell(pwd->pw_shell))
 			errx(1, "permission denied (shell)");
-		}
 	}
 	else if (pwd->pw_shell && *pwd->pw_shell) {
 		shell = pwd->pw_shell;
@@ -403,18 +398,16 @@
 
 	/* Switch to home directory */
 	if (asthem) {
-		if (chdir(pwd->pw_dir) < 0) {
+		if (chdir(pwd->pw_dir) < 0)
 			errx(1, "no directory");
-		}
 	}
 
 	/*
 	 * PAM modules might add supplementary groups in pam_setcred(), so
 	 * initialize them first.
 	 */
-	if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) < 0) {
+	if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) < 0)
 		err(1, "setusercontext");
-	}
 
 	retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED);
 	if (retcode != PAM_SUCCESS) {
@@ -478,9 +471,8 @@
 		child_pgrp = getpgid(child_pid);
 		if (tcgetpgrp(STDERR_FILENO) == child_pgrp)
 			tcsetpgrp(STDERR_FILENO, getpgrp());
-		if (pid == -1) {
+		if (pid == -1)
 			err(1, "waitpid");
-		}
 		PAM_END();
 		exit(WEXITSTATUS(statusp));
 	case -1:
@@ -512,9 +504,8 @@
 		 */
 		if ((asme || (!asthem && class == NULL)) && pwd->pw_uid)
 			setwhat &= ~(LOGIN_SETPRIORITY | LOGIN_SETRESOURCES);
-		if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) < 0) {
+		if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) < 0)
 			err(1, "setusercontext");
-		}
 
 		if (!asme) {
 			if (asthem) {
@@ -555,7 +546,7 @@
 		/* csh strips the first character... */
 		*np.a = asthem ? "-su" : iscsh == YES ? "_su" : "su";
 
-		if (ruid != 0) 
+		if (ruid != 0)
 			syslog(LOG_NOTICE, "%s to %s%s", username, user,
 			    ontty());
 


More information about the trustedbsd-cvs mailing list