2.0.7pre2, utmp in particular

David Lee T.D.Lee at durham.ac.uk
Sun Mar 19 19:04:06 GMT 2000

On Sat, 18 Mar 2000, Freddie wrote:

> Downloaded 2.0.7pre2, configured --with-utmp, compiled, backed up my old 
> dir (2.0.5a still), installed the new one. Added these two lines to smb.conf:
> utmp = Yes
> utmp dir = /var/run
> But... if we don't have utmpx.h (Debian 2.1, 2.0.38 kernel, glibc 2.0.7 
> doesn't), it doesn't try to set the ut_host field. So I added a single line 
> to utmp_update() that writes it for me. Tada! I don't have the disk space 
> left to untar another copy of the .tar.gz, and I have no idea how to just 
> extract one file, soo... use your imagination.
> source/smbd/connection.c:
> (line 367)
> #else
> 	pstrcpy(fname, dirname);
> 	pstrcat(fname, "utmp");
> replace with:
> #else
> 	pstrcpy(u->ut_host, host);
> 	pstrcpy(fname, dirname);
> 	pstrcat(fname, "utmp");
> No idea if ut_host is a part of other systems' definition of struct utmp.

In Solaris 2.x, which is where I began the experimental utmp/utmpx
implementation, the "ut_host" field only occurs in the x-files.

As people tried 2.0.7pre(1), all sorts of "interesting" system-specific
wrinkles crawled out from under their utmp{,x} stones.  (Memo to self: 
must work on my metaphors).  Examples: 

o  ut_host is 257 (presumably intended as 256+1) on Solaris, but 64 on
   other systems; it is probably yet other sizes elsewhere.

o  At least one OS declares utmpx but doesn't implement it.

o  ut_syslen isn't always implemented.

o  Some OSs put the w-files in a different directory from the u-files.

Samba's "--with-XYZ" things are deemed experimental anyway.  This was the
first pass at utmp{,x} support;  utmp{,x} has shown itself to have many
more flavours than might have been anticipated.  So we should probably
still regard it as "significantly under development" as it is tried on
different systems. 

But the fact that "utmp directory" does not have a sensible default is a
different story.  It was a shortcoming in the original utmp code I
submitted, for which my apologies. 

I since submitted a patch that ought to fix this (17th Feb), but sadly
this does not seem to have been incorporated into 2.0.7pre2 .  It also
tried to address the problem reported by others of u-files and w-files
being in different directories.  Its subject field was:
   Subject: pre-2.0.7: utmp adjustment

Did it get missed?  Was it unsuitable? 

I also submitted a warning flag that the copying into the "ut_host" field
ought to be checked for possible overflow.  (I'm not sufficiently expert
in those parts of Samba to know whether "ptrscpy()" and "pstrcat()" are

Has this been checked by someone who know the string-handling in Samba?

Anyway, thanks to Jeremy for including this utmp functionality, and to the
folks who have tried to make it more portable. 


:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/~dcl0tdl            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :

More information about the samba-technical mailing list