DISABLE_UTMP on HP-UX
Kevin Steves
stevesk at sweden.hp.com
Sat Sep 16 20:10:11 EST 2000
On Wed, 6 Sep 2000, Kevin Steves wrote:
> This is my analysis having not looked much at loginrec.c before:
>
> finger -R is looking at ut_addr in the utmp struct for Where. HP-UX
> 11.0 has both utmp and utmpx and by default we use the library interface
> to write utmp* entries. The problem is that both are used: first
> pututline(), then pututxline(). We should use one *or* the other
> because pututxline() overwrites pututline() data:
>
> pututline() Writes out the supplied utmp structure into the
> utmp file, translates the supplied utmp structure
> int a utmpx structure and writes it to a utmpx
> file.
>
> pututxline() Writes out the supplied utmpx structure into the
> utmpx file, translates the supplied utmpx
> structure into a utmp structure and writes it to a
> utmp file.
>
> What you see results from the fact that ut_addr isn't set for utmpx
> data:
>
> # ifdef HAVE_ADDR_IN_UTMPX
> /* FIXME: (ATL) not supported yet */
> # endif
>
> If you build with #define DISABLE_UTMPX finger -R works as expected.
> However, I think we should use utmpx (longer host names for one), and
> it's just a question of when everything is supported. So the best fix I
> feel is to define DISABLE_UTMP for 11.0 (and maybe 10.20 though I'm not
> using that myself) and finish up utmpx support in loginrec.
>
> Also, HAVE_ENDUTENT and HAVE_ENDUTXENT are not set in configure; should
> they be?
Here's a configure fix for what I suggested above, as well as adding addr
in utmpx support, which I hope is a "portable" fix (configure checks for
the struct member).
Also, loginrec works quite well on HP-UX 11.
--- configure.in~ Sat Sep 16 06:55:52 2000
+++ configure.in Sat Sep 16 10:52:52 2000
@@ -74,6 +74,7 @@
IPADDR_IN_DISPLAY=yes
AC_DEFINE(USE_PIPES)
AC_DEFINE(DISABLE_SHADOW)
+ AC_DEFINE(DISABLE_UTMP)
LIBS="$LIBS -lsec"
MANTYPE='$(CATMAN)'
mansubdir=cat
@@ -83,6 +84,7 @@
IPADDR_IN_DISPLAY=yes
AC_DEFINE(USE_PIPES)
AC_DEFINE(DISABLE_SHADOW)
+ AC_DEFINE(DISABLE_UTMP)
LIBS="$LIBS -lsec"
MANTYPE='$(CATMAN)'
mansubdir=cat
--- loginrec.c~ Tue Sep 5 07:13:07 2000
+++ loginrec.c Sat Sep 16 10:57:24 2000
@@ -678,7 +678,9 @@
strncpy(utx->ut_host, li->hostname, MIN_SIZEOF(utx->ut_host, li->hostname));
# endif
# ifdef HAVE_ADDR_IN_UTMPX
- /* FIXME: (ATL) not supported yet */
+ /* this is just a 32-bit IP address */
+ if (li->hostaddr.sa.sa_family == AF_INET)
+ utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
# endif
# ifdef HAVE_SYSLEN_IN_UTMPX
/* ut_syslen is the length of the utx_host string */
More information about the openssh-unix-dev
mailing list