On Sat, 16 Apr 2005, Andrew Bartlett wrote:

> On Sat, 2005-04-16 at 07:18 -0400, Michael Shalayeff wrote:
>> what is so "wrong" in it for you?
>> maybe we can "fix" it...

> I don't like such low-level messing with the utmp file. How does ftpd
> on the BSDs handle utmp? This is the modal David Lee used originally, I
> think.

It's nearly six years since I did the Samba utmp code, so my memory of it
is fading.

I never had access to, or experience of, BSD. In previous years we had
used SunOS 4, which seems to be similar and was likewise based on the BSD
subtree of UN*X, but we never used that with Samba.

So the comments in the source code about SunOS 4 and BSD are based simply
on a perusal of man pages (supplemented by some prior experience, though
none directly of umtp) of SunOS 4.

> If the login() and logout() apis are not useful (has this been tested?),
> can they be improved by the BSD crew to honour the contents of the
> struct utmp?
> Basically, I want anything that avoids doing a write() to those files
> directly.

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.)

Hope that helps.


: 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. :