More utmp stuff

Steve Langasek vorlon at netexpress.net
Mon Mar 27 16:02:21 GMT 2000


On Mon, 27 Mar 2000, David Lee wrote:

> o  I had originally sketched it with "connection.c" for self-containment
>    and ease of debugging, but agree that autoconf/configure.in/etc. is
>    probably the most appropriate place in general.

> o  My traditional understanding was that caution should be exercised in
>    using #defines with a leading "_", and that the publicly-used variables
>    did not have a leading "_".

glibc also does

#define UTMP_FILE    _PATH_UTMP

in the header file.  It seems that the _PATH_UTMP variable is /preferred/
under glibc, but both are usable.  I think all that really needs to be done is
to put together a list of available names for the macro and sort them in order
of preference (if there's even any need for sorting).

Perhaps an autoconf check:

AC_ARG_WITH(utmpfile,
[  --with-utmpfile=file  Use alternate utmp file <file>
  --without-utmpfile    Don't include utmp support],
[ case "$withval" in
  yes|no)
  #
  # Just in case anybody does it
  #
    AC_MSG_WARN([--with-utmpfile called without argument - will use default])
  ;;
  * )
    utmpfile="$withval"
    AC_DEFINE(SMB_UTMP_FILE,"$utmpfile")
    ;;
  esac],
  [ <do something else here to turn off utmp support> ]
)

A line in config.h.in:

/* Define to specify an alternate (default) path to the system utmp file.  */
#undef SMB_UTMP_FILE

... and then a check in one of the other header files:

#ifndef SMB_UTMP_FILE
#ifdef UTMP_FILE
#define SMB_UTMP_FILE UTMP_FILE
#else
...
#endif


And repeat for wtmp.  Is there a need for checking utmp v. utmpx at this
point?  I think that would only come into play when checking for features.

Steve Langasek
postmodern programmer



More information about the samba-technical mailing list