Added group= facility to /etc/ttys for tty grouping for more

more manageable and convenient referencing by login.conf (login
class database) and (e.g.) login.access.

This is the first of a group of commits which implements the login
class capabilities database.
This commit is contained in:
David Nugent 1997-01-02 08:05:43 +00:00
parent 0cfdb0f162
commit 4ae89ecddd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=21189
4 changed files with 38 additions and 11 deletions

View File

@ -42,6 +42,8 @@
#define _TTYS_ON "on"
#define _TTYS_SECURE "secure"
#define _TTYS_WINDOW "window"
#define _TTYS_GROUP "group"
#define _TTYS_NOGROUP "none"
struct ttyent {
char *ty_name; /* terminal device name */
@ -52,6 +54,7 @@ struct ttyent {
int ty_status; /* status flags */
char *ty_window; /* command to start up window manager */
char *ty_comment; /* comment field */
char *ty_group; /* tty group */
};
#include <sys/cdefs.h>

View File

@ -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 @@ struct ttyent {
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 @@ Allow users with a uid of 0 to login on this terminal.
.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.

View File

@ -110,6 +110,7 @@ getttyent()
}
tty.ty_status = 0;
tty.ty_window = NULL;
tty.ty_group = _TTYS_NOGROUP;
#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 @@ getttyent()
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;
}

View File

@ -30,9 +30,9 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)ttys.5 8.1 (Berkeley) 6/4/93
.\" $Id: ttys.5,v 1.1.1.2 1996/04/13 15:33:16 joerg Exp $
.\" $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 @@ or
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 @@ string which
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
@ -142,6 +157,7 @@ ttyp1 none network off
.Xr getttyent 3 ,
.Xr ttyslot 3 ,
.Xr gettytab 5 ,
.Xr login.conf 5 ,
.Xr termcap 5 ,
.Xr getty 8 ,
.Xr init 8