From owner-p4-projects Sun May 5 15:51:46 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8229737B408; Sun, 5 May 2002 15:51:38 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id AD48E37B406 for ; Sun, 5 May 2002 15:51:37 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g45MpbM18270 for perforce@freebsd.org; Sun, 5 May 2002 15:51:37 -0700 (PDT) (envelope-from amigus@tislabs.com) Date: Sun, 5 May 2002 15:51:37 -0700 (PDT) Message-Id: <200205052251.g45MpbM18270@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to amigus@tislabs.com using -f From: Adam Migus Subject: PERFORCE change 10857 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=10857 Change 10857 by amigus@amigus_vmganyopa on 2002/05/05 15:51:37 Set the ttylabel before the chflags() and chown() are called. Affected files ... ... //depot/projects/trustedbsd/mac/usr.bin/login/login.c#16 edit Differences ... ==== //depot/projects/trustedbsd/mac/usr.bin/login/login.c#16 (text+ko) ==== @@ -171,7 +171,7 @@ char *arg0; const char *shell = NULL; login_cap_t *lc = NULL; - char *label_string; + const char *label_string; pid_t pid; (void)signal(SIGQUIT, SIG_IGN); @@ -414,17 +414,6 @@ login_fbtab(tty, pwd->pw_uid, pwd->pw_gid); /* - * Clear flags of the tty. None should be set, and when the - * user sets them otherwise, this can cause the chown to fail. - * Since it isn't clear that flags are useful on character - * devices, we just clear them. - */ - if (ttyn != tname && chflags(ttyn, 0) && errno != EOPNOTSUPP) - syslog(LOG_ERR, "chflags(%s): %m", ttyn); - if (ttyn != tname && chown(ttyn, pwd->pw_uid, - (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid)) - syslog(LOG_ERR, "chmod(%s): %m", ttyn); - /* * Assign the user's tty MAC label to the terminal device. */ label_string = login_getcapstr(lc, "ttylabel", NULL, NULL); @@ -436,7 +425,7 @@ if (pathconf(ttyn, _POSIX_MAC_PRESENT) > 0 && mac_set_file(ttyn, label) == -1) syslog(LOG_WARNING, - "mac_set_proc(%s): warning: %m", + "mac_set_file(%s): warning: %m", label_string); mac_free(label); } else @@ -444,6 +433,18 @@ } /* + * Clear flags of the tty. None should be set, and when the + * user sets them otherwise, this can cause the chown to fail. + * Since it isn't clear that flags are useful on character + * devices, we just clear them. + */ + if (ttyn != tname && chflags(ttyn, 0) && errno != EOPNOTSUPP) + syslog(LOG_ERR, "chflags(%s): %m", ttyn); + if (ttyn != tname && chown(ttyn, pwd->pw_uid, + (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid)) + syslog(LOG_ERR, "chown(%s): %m", ttyn); + + /* * Exclude cons/vt/ptys only, assume dialup otherwise * TODO: Make dialup tty determination a library call * for consistency (finger etc.) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message