Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Dec 1996 17:13:58 +1100 (EST)
From:      David Nugent <davidn@nserver.usn.blaze.net.au>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2172: Request update to getttyent.c & minor addition to /etc/ttys format
Message-ID:  <199612080613.RAA03840@nserver.usn.blaze.net.au>
Resent-Message-ID: <199612080620.WAA28596@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2172
>Category:       bin
>Synopsis:       Request update to getttyent.c & minor addition to /etc/ttys format
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec  7 22:20:02 PST 1996
>Last-Modified:
>Originator:     David Nugent - davidn@blaze.net.au
>Organization:
Unique Computing, Melbourne, Australia
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	For -current branch.

>Description:

	This is a request to add a group=<name> field to /etc/ttys
	for "grouping" of ttys so the group can be referred to as a
	unit.  This is the most convenient/pertinent place to add
	this information, and will lead to enhancements that make
	the system easier to setup and maintain, such as
	/etc/login.access rules to allow specification of tty groups
	instead of or in addition to individual tty names (I will
	be happy to supply diffs for this separately).

	The change request is in anticipation of a similar access
	facility implemented via /etc/login.conf (login user classes)
	I am working on, but is different in nature to login.access.
	It is far less tedious to implement tty groups in /etc/ttys
	than any other place, and provides this data to the entire
	system rather than specific to one software package or
	subsystem.

	For existing implementations without this facility, the addition
	of group=<name> in /etc/ttys as the *last* statement on each
	line is backwards compatible with the current libc/getttyent(3)
	implementation (it is handled as a comment).

>How-To-Repeat:

	N/A

>Fix:
	
	The following patches implement this facility and document
	it in the relevent manpages.

/usr/src/lib/libc/gen/getttyent.c:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- /usr/src/lib/libc/gen/getttyent.c.old	Tue Oct 22 09:56:23 1996
+++ /usr/src/lib/libc/gen/getttyent.c	Mon Nov 18 14:24:12 1996
@@ -110,6 +110,7 @@
 	}
 	tty.ty_status = 0;
 	tty.ty_window = NULL;
+	tty.ty_group  = "none";
 
 #define	scmp(e)	!strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1])
 #define	vcmp(e)	!strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '='
@@ -122,6 +123,8 @@
 			tty.ty_status |= TTY_SECURE;
 		else if (vcmp(_TTYS_WINDOW))
 			tty.ty_window = value(p);
+		else if (vcmp(_TTYS_GROUP))
+			tty.ty_group = value(p);
 		else
 			break;
 	}

/usr/src/lib/libc/gen/getttyent.3:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- /usr/src/lib/libc/gen/getttyent.3.old	Fri May 27 14:56:34 1994
+++ /usr/src/lib/libc/gen/getttyent.3	Mon Nov 18 14:08:59 1996
@@ -31,7 +31,7 @@
 .\"
 .\"     @(#)getttyent.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 4, 1993
+.Dd November 17, 1996
 .Dt GETTTYENT 3
 .Os BSD 4.3
 .Sh NAME
@@ -69,6 +69,7 @@
 	int	ty_status;	/* flag values */
 	char	*ty_window;	/* command for window manager */
 	char	*ty_comment;	/* comment field */
+	char	*ty_group;	/* tty group name */
 };
 .Ed
 .Pp
@@ -98,6 +99,10 @@
 .El
 .It Fa ty_window
 The command to execute for a window system associated with the line.
+.It Fa ty_group
+A group name to which the tty belongs.
+If no group is specified in the ttys description file,
+then the tty is placed in an anonymous group called "none".
 .It Fa ty_comment
 Any trailing comment field, with any leading hash marks (``#'') or
 whitespace removed.

/usr/src/libexec/getty/ttys.5:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- /usr/src/libexec/getty/ttys.5.old	Mon May  6 05:01:13 1996
+++ /usr/src/libexec/getty/ttys.5	Mon Nov 18 14:09:04 1996
@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)ttys.5	8.1 (Berkeley) 6/4/93
 .\"	$Id: ttys.5,v 1.3 1996/05/05 19:01:13 joerg Exp $
 .\" "
-.Dd June 4, 1993
+.Dd November 17, 1996
 .Dt TTYS 5
 .Os
 .Sh NAME
@@ -86,10 +86,15 @@
 The remaining fields set flags in the
 .Fa ty_status
 entry (see
-.Xr getttyent 3 )
-or specify a window system process that
+.Xr getttyent 3 ),
+specify a window system process that
 .Xr init 8
-will maintain for the terminal line.
+will maintain for the terminal line, or specify a tty group
+name that allows the login class database (see
+.Xr login.conf 5 )
+to refer to many ttys as a group, to selectively allow or
+deny access or enable or disable accounting facilities for
+ttys as a group.
 .Pp
 As flag values, the strings ``on'' and ``off'' specify that
 .Xr init
@@ -117,21 +122,31 @@
 will execute
 .Em before
 starting the command specified by the second field.
+.Pp
+The string ``group='' may be followed by a group name comprised of
+alphanumeric characters that can be used by
+.Xr login.group 5
+to refer to many tty lines as a group to enable or disable access
+and accounting facilities.
+If no group is specified, then the tty becomes a member of the group
+"none".
+For backwards compatibility, the ``group='' should appear last on the
+line, immediately before the optional comment.
 .Sh EXAMPLES
 .Bd -literal
 # root login on console at 1200 baud
 console	"/usr/libexec/getty std.1200"	vt100	on secure
 # dialup at 1200 baud, no root logins
-ttyd0	"/usr/libexec/getty d1200"	dialup	on	# 555-1234
+ttyd0	"/usr/libexec/getty d1200"	dialup	on group=dialup	# 555-1234
 # Mike's terminal: hp2621
-ttyh0	"/usr/libexec/getty std.9600"	hp2621-nl	on	# 457 Evans
+ttyh0	"/usr/libexec/getty std.9600"	hp2621-nl	on group=dialup	# 457 Evans
 # John's terminal: vt100
-ttyh1	"/usr/libexec/getty std.9600"	vt100	on		# 459 Evans
+ttyh1	"/usr/libexec/getty std.9600"	vt100	on group=dialup		# 459 Evans
 # terminal emulate/window system
 ttyv0	"/usr/new/xterm -L :0"		vs100	on window="/usr/new/Xvs100 0"
 # Network pseudo ttys -- don't enable getty
-ttyp0	none	network
-ttyp1	none	network	off
+ttyp0	none	network 	group=pty
+ttyp1	none	network	off	group=pty
 .Ed
 .Sh FILES
 .Bl -tag -width /etc/ttys -compact


>Audit-Trail:
>Unformatted:



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