Add search for utempter helper

This resolves Bug 2841

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 7 years ago
parent 4d31e7d405
commit a14adb9ab9

@ -599,7 +599,26 @@ endif( HAVE_LIBMAGIC )
if( WITH_UTEMPTER ) if( WITH_UTEMPTER )
check_include_file( utempter.h HAVE_UTEMPTER_H ) check_include_file( utempter.h HAVE_UTEMPTER_H )
check_library_exists( utempter addToUtmp "" HAVE_ADDTOUTEMP ) check_library_exists( utempter addToUtmp "" HAVE_ADDTOUTEMP )
if( HAVE_UTEMPTER_H AND HAVE_ADDTOUTEMP ) if( NOT DEFINED UTEMPTER_HELPER )
message( STATUS "Looking for utempter helper" )
find_program( UTEMPTER_HELPER utempter
PATHS
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/utempter
/usr/lib/utempter
/usr/libexec/utempter
/usr/libexec
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/utempter
/usr/local/lib/utempter
/usr/local/libexec/utempter
/usr/local/libexec
)
if( UTEMPTER_HELPER )
message( STATUS "Looking for utempter helper - found" )
else( )
message( STATUS "Looking for utempter helper - not found" )
endif( )
endif( )
if( HAVE_UTEMPTER_H AND HAVE_ADDTOUTEMP AND UTEMPTER_HELPER )
set( HAVE_UTEMPTER 1 ) set( HAVE_UTEMPTER 1 )
set( UTEMPTER_LIBRARY utempter ) set( UTEMPTER_LIBRARY utempter )
else( ) else( )

@ -717,6 +717,7 @@
/* Define if you have the utempter helper for utmp managment */ /* Define if you have the utempter helper for utmp managment */
#cmakedefine HAVE_UTEMPTER 1 #cmakedefine HAVE_UTEMPTER 1
#cmakedefine UTEMPTER_HELPER "@UTEMPTER_HELPER@"
/* Define to 1 if you have the <util.h> header file. */ /* Define to 1 if you have the <util.h> header file. */
#cmakedefine HAVE_UTIL_H 1 #cmakedefine HAVE_UTIL_H 1

@ -453,7 +453,7 @@ void KPty::login(const char *user, const char *remotehost)
#ifdef HAVE_UTEMPTER #ifdef HAVE_UTEMPTER
TDEProcess_Utmp utmp; TDEProcess_Utmp utmp;
utmp.cmdFd = d->masterFd; utmp.cmdFd = d->masterFd;
utmp << "/usr/lib/utempter/utempter" << "add"; utmp << UTEMPTER_HELPER << "add";
if (remotehost) if (remotehost)
utmp << remotehost; utmp << remotehost;
utmp.start(TDEProcess::Block); utmp.start(TDEProcess::Block);
@ -498,7 +498,7 @@ void KPty::logout()
#ifdef HAVE_UTEMPTER #ifdef HAVE_UTEMPTER
TDEProcess_Utmp utmp; TDEProcess_Utmp utmp;
utmp.cmdFd = d->masterFd; utmp.cmdFd = d->masterFd;
utmp << "/usr/lib/utempter/utempter" << "del"; utmp << UTEMPTER_HELPER << "del";
utmp.start(TDEProcess::Block); utmp.start(TDEProcess::Block);
#elif defined(USE_LOGIN) #elif defined(USE_LOGIN)
const char *str_ptr = d->ttyName.data(); const char *str_ptr = d->ttyName.data();

Loading…
Cancel
Save