robert@ modified src/*: replace login_fbtab with the wscons group if the users is on the glass console
Historically login_fbtab(3) was called on user login to change permission of devices for the user logging in on the console or xdm [xenodm] and this mechanism had its quirks.
In [an] effort to make this better, introduce the LOGIN_SETWSCONSGROUP flag for setusercontext(3), which will append the special wscons group to a user context if the user is logging in on the "glass" [physical] console.
Callers of setusercontex(3) can also use the new login_wscons(const char *tty) libutil function to determine if the tty is appropriate for setting the group.
The last part of this commit also changes the device node entries so that the wscons group has write access to a specific list of devices that were previously handled by fbtab, e.g. for amd64 (for other arches it might differ):
- /dev/console
- /dev/wskbd
- /dev/wskbd0
- /dev/wsmouse
- /dev/wsmouse0
- /dev/ttyCcfg
- /dev/ttyC4
- /dev/dri/card0
- /dev/dri/renderD128
Additionally access to /dev/video is also granted (protected by a sysctl anyway).
This is a major crank for libutil due to the removal of login_fbtab.
tested by and ok aja@, landry@, matthieu@
let's do it by deraadt@, kettenis@
This was followed up by an xenocara commit adding support to xenodm(1).