From 46f6e1f7f3c86eb6d6f55f71fda6513ece8275bd Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 17 Jun 2006 00:57:22 +0000 Subject: [PATCH] Test for and use setutsent, based on a patch from Nate Yocom at Centrify. Modified to restrict the configure test to just the pty library. ticket: 3423 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18161 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/libpty/configure.in | 2 +- src/appl/libpty/update_utmp.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/appl/libpty/configure.in b/src/appl/libpty/configure.in index f8930d0e2..cb5fe7e71 100644 --- a/src/appl/libpty/configure.in +++ b/src/appl/libpty/configure.in @@ -63,7 +63,7 @@ AC_CHECK_HEADER(sys/ptyvar.h, [], [], # AC_CHECK_HEADERS(utmp.h utmpx.h) -AC_CHECK_FUNCS(setutent setutxent updwtmp updwtmpx logwtmp getutmp getutmpx) +AC_CHECK_FUNCS(setutent setutxent setutsent updwtmp updwtmpx logwtmp getutmp getutmpx) AC_CHECK_FUNCS(utmpname utmpxname) AC_DEFUN(K5_CHECK_UT_MEMBER, diff --git a/src/appl/libpty/update_utmp.c b/src/appl/libpty/update_utmp.c index 004582650..d2de6428f 100644 --- a/src/appl/libpty/update_utmp.c +++ b/src/appl/libpty/update_utmp.c @@ -252,6 +252,14 @@ * * There is no wtmpx file, despite there being utmp and utmpx files. * + * HP-UX 11.23: + * + * In addition to other HP-UX issues, 11.23 includes yet another utmp + * management interface in utmps.h. This interface updates a umtpd + * daemon which then manages local files. Directly accessing the files + * through the existing, yet deprecated, utmp.h interface results in + * nothing. + * * Irix 6.x: * * In utmpx, ut_exit contains __e_termination and __e_exit, which get @@ -324,10 +332,19 @@ /* * The following grossness exists to avoid duplicating lots of code * between the cases where we have an old-style sysV utmp and where we - * have a modern (Unix98 or XPG4) utmpx. See the above history rant - * for further explanation. + * have a modern (Unix98 or XPG4) utmpx, or the new (hp-ux 11.23) utmps. + * See the above history rant for further explanation. */ -#if defined(HAVE_SETUTXENT) || defined(HAVE_SETUTENT) +#if defined(HAVE_SETUTXENT) || defined(HAVE_SETUTENT) || defined(HAVE_SETUTSENT) +#ifdef HAVE_SETUTSENT +#include +#define PTY_STRUCT_UTMPX struct utmps +#define PTY_SETUTXENT setutsent +#define PTY_GETUTXENT GETUTSENT +#define PTY_GETUTXLINE GETUTSLINE +#define PTY_PUTUTXLINE PUTUTSLINE +#define PTY_ENDUTXENT endutsent +#else #ifdef HAVE_SETUTXENT #define PTY_STRUCT_UTMPX struct utmpx #define PTY_SETUTXENT setutxent @@ -343,7 +360,7 @@ #define PTY_PUTUTXLINE pututline #define PTY_ENDUTXENT endutent #endif - +#endif static int better(const PTY_STRUCT_UTMPX *, const PTY_STRUCT_UTMPX *, const PTY_STRUCT_UTMPX *); static int match_pid(const PTY_STRUCT_UTMPX *, -- 2.26.2