From 051e5a3cc2fb3908ae5f517b78b59c7e7f494482 Mon Sep 17 00:00:00 2001 From: Liang Chang Date: Fri, 29 Jan 2021 23:59:22 -0500 Subject: [PATCH] dtlogin: add utmpx support to UtmpIdOpen. --- cde/programs/dtlogin/account.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cde/programs/dtlogin/account.c b/cde/programs/dtlogin/account.c index 3f4face0e..96019858a 100644 --- a/cde/programs/dtlogin/account.c +++ b/cde/programs/dtlogin/account.c @@ -406,11 +406,18 @@ Account( struct display *d, char *user, char *line, pid_t pid, int UtmpIdOpen( char *utmpId ) { - struct utmp *u; /* pointer to entry in utmp file */ int status = 1; /* return code */ -#if !defined(CSRG_BASED) +#if !defined(CSRG_BASED) || defined(HAS_PAM_LIBRARY) +#ifdef HAS_PAM_LIBRARY + struct utmpx *u; /* pointer to entry in utmp file */ + + while ( (u = getutxent()) != NULL ) { +#else + struct utmp *u; /* pointer to entry in utmp file */ + while ( (u = getutent()) != NULL ) { +#endif if ( (strncmp(u->ut_id, utmpId, 4) == 0 ) && u->ut_type != DEAD_PROCESS ) { @@ -420,7 +427,11 @@ UtmpIdOpen( char *utmpId ) } } +#ifdef HAS_PAM_LIBRARY + endutxent(); +#else endutent(); +#endif #endif return (status); }