Date: Mon, 20 Nov 2006 13:21:14 +0200 From: Andriy Gapon <avg@icyb.net.ua> To: kde@freebsd.org Cc: freebsd-ports@freebsd.org Subject: [patch] konsole sessions not recorded in utmp Message-ID: <45618FAA.1010508@icyb.net.ua>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------020802080201090704060102 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit I noticed that konsole sessions are not reflected in utmp and that was a minor annoyance to me because in my opinion all terminal sessions should be recorded in utmp for a variety of reasons. I looked through various searches and archives, but couldn't find anything useful enough (I even found suggestions that konsole should not make utmp records by design). Anyway, I looked into the code and as a result I have the attached half-baked patch. The patch fixes support for using libutempter (sysutils/libutempter). It seems that the current code depended on some older incarnation of utempter utility. I think that this is a better method than making konsole suid (in this case login(3) method, which is also included in kpty, would work). I think that this patch should also be sent to main KDE developers for inclusion, if they haven't yet migrated from older utempter to newer libutempter. The patch is half-baked for the following reasons: 1. I am not sure how portable is usage of slaveFd in utempter_add_record. Using masterFd does not definitely work on FreeBSD 6.1, but I am not sure about other version and other OS that have libutempter, like Linux :-) And I am also slightly confused which is which and which should go to utmp. 2. if this patch is accepted then Makefile of x11/kdelibs3 should be modified to have sysutils/libutempter as a library dependency (maybe optional/auto-detected) Should I also create a PR ? -- Andriy Gapon --------------020802080201090704060102 Content-Type: text/x-patch; name="patch-kpty.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch-kpty.patch" --- kpty.cpp.orig Mon Nov 20 11:36:15 2006 +++ kpty.cpp Mon Nov 20 12:56:21 2006 @@ -79,6 +79,9 @@ #ifdef USE_LOGIN # include <utmp.h> #endif +#ifdef HAVE_UTEMPTER +# include <utempter.h> +#endif #ifdef HAVE_TERMIOS_H /* for HP-UX (some versions) the extern C is needed, and for other @@ -399,12 +402,8 @@ void KPty::login(const char *user, const char *remotehost) { #ifdef HAVE_UTEMPTER - KProcess_Utmp utmp; - utmp.cmdFd = d->masterFd; - utmp << "/usr/sbin/utempter" << "-a" << d->ttyName << ""; - utmp.start(KProcess::Block); + utempter_add_record(d->slaveFd, remotehost); Q_UNUSED(user); - Q_UNUSED(remotehost); #elif defined(USE_LOGIN) const char *str_ptr; struct utmp l_struct; @@ -442,10 +441,7 @@ void KPty::logout() { #ifdef HAVE_UTEMPTER - KProcess_Utmp utmp; - utmp.cmdFd = d->masterFd; - utmp << "/usr/sbin/utempter" << "-d" << d->ttyName; - utmp.start(KProcess::Block); + utempter_remove_added_record(); #elif defined(USE_LOGIN) const char *str_ptr = d->ttyName.data(); if (!memcmp(str_ptr, "/dev/", 5)) --- Makefile.am.orig Mon Nov 20 13:10:44 2006 +++ Makefile.am Mon Nov 20 13:11:14 2006 @@ -116,7 +116,7 @@ kqiodevicegzip_p.cpp ktimezones.cpp libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined -libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la +libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) $(LIBUTEMPTER) ../kdefx/libkdefx.la libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \ $(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck --------------020802080201090704060102--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45618FAA.1010508>