Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 1997 12:37:42 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        davidn@labs.usn.blaze.net.au (David Nugent)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: utmp/wtmp interface
Message-ID:  <199707210307.MAA20639@genesis.atrad.adelaide.edu.au>
In-Reply-To: <199707170828.SAA04602@labs.usn.blaze.net.au> from David Nugent at "Jul 17, 97 06:28:00 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
David Nugent stands accused of saying:
> For anyone who may be interested, my interim work on a lastlog/utmp/wtmp
> api has been posted on freefall and is available via the web. It is not
> as thoroughly tested as I would like, and the proposed 'new' wtmp format
> has not been tested at all (it isn't the default, and won't be initially
> activated anyway, when committed, for backwards compatibility with ports).
> 
> Comments, patches, flames and insults - any feedback welcome. :-)

Hmm.  "More documentation" 8)

Seriously; I think that perhaps going in a similar direction to the 
/etc/passwd approach might be good; write the 'old-format' files 
when generating the records, but use an improved binary format under a 
new (but related) filename when accessing it from the library.

In particular, a self-describing format for something like utmp/wtmp
would be very sexy.  I think your changed interface for lastlog
is better, although there are a few problems in lastlog.c :

    modes = xl->ll_time ? (O_RDWR|O_CREAT) : O_RDONLY;
    if (xl == NULL)
        errno = EINVAL;

This fragment is pretty bad.

                static char sbuf[sizeof(pl) * 2];

                /* time */
                xl->ll_time = pl.ll_time;
                /* line */
                xl->ll_line = strncpy(sbuf + l, pl.ll_line,
                                      sizeof(pl.ll_line));
                sbuf[l + sizeof(pl.ll_line)] = '\0';
                if (!*xl->ll_line)
                    xl->ll_line = NULL;
                else
                    l += strlen(xl->ll_line) + 1;
                /* host */
                xl->ll_host = strncpy(sbuf + l, pl.ll_host,
                                      sizeof(pl.ll_host));
                sbuf[l + sizeof(pl.ll_host)] = '\0';
                if (!*xl->ll_host)
                    xl->ll_host = NULL;

Using a static buffer here isn't so great either.  It's going to give
the threaded version cooties by default. 8)

-- 
]] Mike Smith, Software Engineer        msmith@gsoft.com.au             [[
]] Genesis Software                     genesis@gsoft.com.au            [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707210307.MAA20639>