Subject: Re: pcvt and TIOCCONS
To: Matt Ragan <matt@ibmoto.com>
From: Chris G Demetriou <Chris_G_Demetriou@UX2.SP.CS.CMU.EDU>
List: current-users
Date: 04/17/1996 01:17:37
[ ... behind on my e-mail. ]

Matt Ragan said:
> Chris G Demetriou wrote:
> >
> >In particular, what i _really_ want is some way to specify explicit
> >actions to be invoked on log-out.
> >
> >For instance, say i want JoeBob to own the console CD-ROM device when
> >he logs in.  I also want a mechanism by which i can forcibly unmount
> >anything he's mounted from there (let's not forget about user mounts!)
> >and eject the CD-ROM, when he logs out.  (That, in addition to
> >specifying the perms and ownership/group of the file, to be set on
> >logout.)
> 
> I can see where this would be a nice feature, but what do you do in the
> case where JoeBob gets the CD and mounts his NiftyCool(tm) XXTP Server
> CD and starts up his xxtpd running from the CD then logs out, or runs
> xxtpd which does a chdir() into the CD-mounted directory?  Do you kill
> off any process which is currently accessing the mounted directory, or
> do you just let it go and leave it mounted?  Should it be a run-time
> option in /etc/fbtab or equivalent?  If the unmount fails or is not
> performed for some reason, you probably don't want to change the
> owner or permissions on the device.

That should be a site-specific decision.

I figure, you should be able to specify a set of commands that will be
run at logout from a tty, and a set of devices to change modes on
etc., in a well-defined way.

Any or all of those commands could be a shell-script, custom binary,
or who knows what.


My point is, only minimal policy should be encoded in the file.  In
particular, i think that the following is "OK":
	(1) login to a certain tty may cause certain actions to be taken,
	(2) log-out from a tty may cause certain actions to be taken.

I _DO NOT_ want the set of actions to be constrained to a certain set
of built-in functions (like 'chown', 'chmod', and 'unmount').

Actually, performance, security, and ease-of-use considerations aside,
a "perfect" implementation for me could be as simple as invoking a
script (say, "/etc/loginactions") with an argument that indicates
"login" or "logout", and with another argument that says which tty the
login is happening on.  One could replace that with C code, could code
a big sh case statement, or whatever...  Infinitely flexible...
However, that would always require an 'exec' at every login or logout,
regardless of whether any special handling would be done for that tty.
(In other words, in reality, that's not a perfect implementation...
but that's the amount of flexibility i'd like. 8-)



cgd