utmp update for bsd systems (try 2)

David Lee t.d.lee at durham.ac.uk
Tue Apr 19 10:16:13 GMT 2005

On Tue, 19 Apr 2005, Luke Mewburn wrote:

> On Mon, Apr 18, 2005 at 06:48:29AM -0400, Michael Shalayeff wrote:
>  | Making, drinking tea and reading an opus magnum from David Lee:
>  | > On Sat, 16 Apr 2005, Andrew Bartlett wrote:
>  | > Use of the higher-level subroutines ("pututline()", "login()" etc.), where
>  | > provided by the OS, certainly seems preferable.  For one thing, it should
>  | > (assuming no bugs!) manage locking, in a consistent fashion, of the
>  | > underlying utmp/wtmp database files.  (Imagine two or more simultaneous
>  | > connects or disconnects of any entities (ftpd, telnetd, sshd, smbd, ...)
>  | > which try to update those database files.)
>  |
>  | those interfaces do not exist in *bsd.
>  | login/logout is unusable as well and it is explained
>  | in the comments in my diff WHY
> login(3) and logout(3) certainly exist in NetBSD's libutil, and NetBSD
> has had them since inception (March 1993).  FreeBSD has them.
> OpenBSD should have them as NetBSD had them at the time OpenBSD forked
> from NetBSD, unless they've since been removed.
> With the addition of utmpx(5) support in NetBSD a couple of years ago,
> NetBSD also provides loginx(3), logout(x) and logwtmpx(3) APIs in
> libutil, as well as the POSIX pututxline(3) (et al) API in libc.
> autoconf tests can be used to detect which particular utmp/wtmp/utmpx/wtmpx
> APIs are present and working on a given system so that Samba can DTRT.

Thanks, Luke.

Michael says "login/logout is unusable" (which I cannot assess either 
way).  Alas, the comments in his diff don't say why.

Luke: Do you have the inclination, time and resources to investigate 
whether a subroutine-based solution ("login()", "pututxline()") might be 
feasible on one or more of the *BSD variants?  (And, as a side-effect, 
checking whether the autoconf tests are adequate and sufficient?)

Further, in hunting through the "www.opensbd.org" CVS repository 
yesterday, I also found a "pam_lastlog", which looked promising.  At his 
point we need Andrew Bartlett again.

Andrew: I have a recollection (probably at least partially faulty) that 
your preferred solution to all this session related stuff is PAM (when 
available and when modules permit), falling back to "utmp.c:pututxline()", 
falling back to "utmpc.c:write()".  Comments?


:  David Lee                                I.T. Service          :
:  Senior Systems Programmer                Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham                :
:  Phone: +44 191 334 2752                  U.K.                  :

More information about the samba-technical mailing list