Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Apr 1997 21:46:22 +1000 (EST)
From:      "Daniel O'Callaghan" <danny@panda.hilink.com.au>
To:        Adrian Chadd <adrian@staff.psinet.net.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Best way to hook into user logins / logouts ?
Message-ID:  <Pine.BSF.3.91.970423214242.10264M@panda.hilink.com.au>
In-Reply-To: <Pine.LNX.3.93.970423162956.4080A-100000@staff.psinet.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 23 Apr 1997, Adrian Chadd wrote:

> For what I'm working on I need to hook into when users login and logout.
> The "best" way I can find currently is hooking into the wtmp updates in
> libc (especially for the logouts), does anyone know any better ways?

Well, you can write a small program which does

while (1) {
 bytes=read(wtmp);
 switch(bytes) {
	case -1: error ; break;
	case  0: sleep X; break;
	default: process entry;
 }
}

I have a program working like that now.

Another way to trap logouts on modem lines is to insert a small program
between init and getty.  Declare the small program in /etc/ttys and have 
it exec getty when it is finished.

Danny



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970423214242.10264M>