From owner-trustedbsd-cvs@FreeBSD.ORG Wed Aug 2 15:51:55 2006 Return-Path: X-Original-To: trustedbsd-cvs@freebsd.org Delivered-To: trustedbsd-cvs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C1FAD16A4E0 for ; Wed, 2 Aug 2006 15:51:55 +0000 (UTC) (envelope-from owner-perforce@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9DEB843D5A for ; Wed, 2 Aug 2006 15:51:44 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by cyrus.watson.org (Postfix) with ESMTP id 9758946D22 for ; Wed, 2 Aug 2006 11:51:41 -0400 (EDT) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id CFE4773EC0; Wed, 2 Aug 2006 15:50:44 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id C6DC816A4E5; Wed, 2 Aug 2006 15:50:44 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8588616A4DD for ; Wed, 2 Aug 2006 15:50:44 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D257D43D76 for ; Wed, 2 Aug 2006 15:50:37 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k72FobwV066495 for ; Wed, 2 Aug 2006 15:50:37 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k72Fob30066492 for perforce@freebsd.org; Wed, 2 Aug 2006 15:50:37 GMT (envelope-from csjp@freebsd.org) Date: Wed, 2 Aug 2006 15:50:37 GMT Message-Id: <200608021550.k72Fob30066492@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 103037 for review X-BeenThere: trustedbsd-cvs@FreeBSD.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: TrustedBSD CVS and Perforce commit message list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2006 15:51:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=103037 Change 103037 by csjp@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());