Subject: lib/4638: tty class hook enhancement
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tsarna@bbs.endicor.com>
List: netbsd-bugs
Date: 12/04/1997 10:55:01
>Number:         4638
>Category:       lib
>Synopsis:       tty class hook enhancement
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Dec  4 09:05:02 1997
>Last-Modified:
>Originator:     Ty Sarna
>Organization:
	Endicor Technologies, Inc., San Antonio, Texas
>Release:        1.3_BETA-971202
>Environment:

System: NetBSD zoo-of-death.endicor.com 1.3_BETA-971202 NetBSD 1.3_BETA-971202 (ZOO-OF-DEATH) #6: Tue Dec 2 15:59:45 CST 1997 tsarna@zoo-of-death.endicor.com:/bbs/usr.src/sys/arch/i386/compile/ZOO-OF-DEATH i386


>Description:
	I poposed this enhancement in tech-userlevel and received no
	negative feedback. (Nor positive, for that matter). So, here it
	is.

	This enhancement adds an optional class= parameter to /etc/ttys
	and teaches getttyXXX() parse it. Like the user class in
	master.passwd, it is currently only a hook for local
	functionality (in my case, a log-out-idle-users daemon).
	In the future, it will probably be used as part of the
	login access control system aluded to in ttyaction(3).
	(ie, instead of listing which terminals a user may log in on,
	list the class or classes of terminals)

	This should be 100% backward and binary compatible. I'd be nice
	to bump the libc minor to note that it's there, though.
>How-To-Repeat:
	N/A
>Fix:
*** lib/libc/gen/getttyent.c.orig	Tue Dec  2 14:27:23 1997
--- lib/libc/gen/getttyent.c	Tue Dec  2 14:36:27 1997
***************
*** 136,141 ****
--- 136,143 ----
  			tty.ty_status |= TTY_MDMBUF;
  		else if (vcmp(_TTYS_WINDOW))
  			tty.ty_window = value(p);
+ 		else if (vcmp(_TTYS_CLASS))
+ 			tty.ty_class = value(p);
  		else
  			break;
  	}
*** lib/libc/gen/getttyent.3.orig	Tue Dec  2 14:27:23 1997
--- lib/libc/gen/getttyent.3	Tue Dec  2 14:39:53 1997
***************
*** 76,81 ****
--- 76,82 ----
  	int	ty_status;	/* flag values */
  	char	*ty_window;	/* command for window manager */
  	char	*ty_comment;	/* comment field */
+ 	char	*ty_class;	/* category of tty usage */
  };
  .Ed
  .Pp
***************
*** 121,126 ****
--- 122,132 ----
  .It Fa ty_comment
  Any trailing comment field, with any leading hash marks (``#'') or
  whitespace removed.
+ .It Fa ty_class
+ A key indexing into a termcap-style database (/etc/ttyclasses)
+ of attributes for this class of tty. No attributes are currently
+ defined or used, so there are currently no functions to retrieve
+ them.
  .El
  .Pp
  If any of the fields pointing to character strings are unspecified,
*** libexec/getty/ttys.5.orig	Tue Dec  2 15:03:23 1997
--- libexec/getty/ttys.5	Tue Dec  2 15:07:01 1997
***************
*** 90,96 ****
  .Xr getttyent 3 )
  or specify a window system process that
  .Xr init 8
! will maintain for the terminal line.
  .Pp
  As flag values, the strings ``on'' and ``off'' specify that
  .Xr init
--- 90,97 ----
  .Xr getttyent 3 )
  or specify a window system process that
  .Xr init 8
! will maintain for the terminal line
! or a key into a database of tty attributes (currently unused).
  .Pp
  As flag values, the strings ``on'' and ``off'' specify that
  .Xr init
***************
*** 118,123 ****
--- 119,130 ----
  will execute
  .Em before
  starting the command specified by the second field.
+ .Pp
+ The string ``class='' may be followed by a quoted string used
+ as a key into a database of attributes for that category of tty.
+ See
+ .Xr getttynam 3
+ for more information on this feature.
  .Sh EXAMPLES
  .Bd -literal
  # root login on console at 1200 baud
*** include/ttyent.h.orig	Tue Dec  2 14:41:53 1997
--- include/ttyent.h	Tue Dec  2 14:42:45 1997
***************
*** 44,49 ****
--- 44,50 ----
  #define	_TTYS_ON	"on"
  #define	_TTYS_SECURE	"secure"
  #define	_TTYS_WINDOW	"window"
+ #define	_TTYS_CLASS	"class"
  #define	_TTYS_LOCAL	"local"
  #define	_TTYS_RTSCTS	"rtscts"
  #define        _TTYS_DTRCTS    "dtrcts"
***************
*** 64,69 ****
--- 65,71 ----
  	int	ty_status;	/* status flags */
  	char 	*ty_window;	/* command to start up window manager */
  	char	*ty_comment;	/* comment field */
+ 	char 	*ty_class;	/* category of tty usage */
  };
  
  #include <sys/cdefs.h>

>Audit-Trail:
>Unformatted: