Re: Proposal: Hotkey-handling with kerneld

Martin Buck (martin-2.buck@student.uni-ulm.de)
Thu, 2 May 96 01:15 MET DST


On Apr 28, 8:12am, Gonzalo Tornaria wrote:
> It would be great. However, we should think a bit in the format of the
> messages. Now, it's just a unsigned char that is sent (the number of the hotkey
> that was pressed). Should we put more structure to de msgs? For one,
> it would be good to have info about key releases; when a key is press the first
> time and when is an auto repeat, etc. That is the info we have in the
> keyboard.c handler, so why don't pass it. Should we use another channel for
> key releases, or Yet Another Message Sub-Type?
>
> struct msg_kbdreq{
> unsigned char type;
> unsigned char key;
> unsigned char flags;
> unsigned char reserved;
> }
>
> Where type is either CONSOLED_PRESS or CONSOLED_RELEASE. key is the number
> of the hotkey that was pressed/released. In flags we could put "rep". What do
> you think?

This seems like a very good idea. If we already have the info, why not send
it. Nobody forces us to do something with it in consoled at the moment, but
it might be useful in the future.

> I've done this... I still use system() (directly!), but I'm
> planning to change it to fork()/exec() (it should be better,
> shouldn't it?). Unless there is a good reason to keep using
> system(). The new version is like the other in
> <http://www.cmat.edu.uy/~tornaria/consoled/>

system() might not be a problem because conseld doesn't run setuid, but we
need to do a fork() anyway, so there's probably no reason to use system().

> Mmm.. what if nobody is logged? You trigger the hotkey as uid 0? You
> don't trigger hotkeys when nobody logged? You make it configurable for each
> hotkey?

The problem is: how do you detect if anybody is logged in on a console?
getty changes the tty's owner to root if you log out, and messing around
with utmp doesn't seem to be a good idea, if we're concerned about security.

On the other hand, if there's only one global config-file for the hotkeys
(so only the sysadmin can control which programs might be executed), we
probably don't need to know which user is logged in on the current VC
anyway. The possible actions for hotkeys that come to my mind at the moment
((un)mounting removable media, controlling selection, doing
screen-hardcopies) don't have to be handled different for different users
necessarily. But it might be useful to be able to control whether the
hotkey-handlers should be run with uid 0 or some unpriviledged uid in
consoled's config-file.

Martin

-- 
/* Martin Buck                      E-Mail: martin-2.buck@student.uni-ulm.de */
/* Student of electrical engineering   WWW: http://www.uni-ulm.de/~s_mbuck1/ */
/* University of Ulm, Germany  Snail-Mail: Paukengasse 2, 89077 Ulm, Germany */
#include <disclaimer.h>            /* PGP Key available    MIME-Mail welcome */