Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 May 2002 15:51:37 -0700 (PDT)
From:      Adam Migus <amigus@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 10857 for review
Message-ID:  <200205052251.g45MpbM18270@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
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




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