Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37910362
en ru br
ALT Linux repos
S:0.28.2-alt4
5.0: 0.20.2-alt1
4.1: 0.17.4-alt1.M41.1
4.0: 0.14.1-alt1
3.0: 0.11.13-alt2

Group :: Terminals
RPM: vte

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: vte-0.14.0-utempter.patch
Download


--- vte-0.14.0/configure.in.orig	2006-09-11 22:35:42 +0400
+++ vte-0.14.0/configure.in	2006-09-11 22:35:42 +0400
@@ -429,6 +429,14 @@
 fi
 AM_CONDITIONAL(BUILD_GNOME_PTY_HELPER,[test "$enable_gnome_pty_helper" != no])
 
+AC_ARG_WITH(utempter,
+	    AC_HELP_STRING(--with-utempter, [Use utempter to update utmp/wtmp]),
+	    ,
+	    with_utempter=no)
+if test "$with_utempter" != no -a "$enable_gnome_pty_helper" = no; then
+	AC_MSG_WARN([utempter is not used when gnome-pty-helper is disabled])
+fi
+
 ################################################################################
 
 GTK_DOC_CHECK([1.0])
--- vte-0.14.0/gnome-pty-helper/gnome-utmp.c.orig	2006-08-24 03:12:29 +0400
+++ vte-0.14.0/gnome-pty-helper/gnome-utmp.c	2006-09-11 22:35:42 +0400
@@ -57,8 +57,8 @@
 #include "gnome-login-support.h"
 
 
-
-#if !defined(UTMP_OUTPUT_FILENAME)
+#if !defined(HAVE_LIBUTEMPTER)
+#  if !defined(UTMP_OUTPUT_FILENAME)
 #    if defined(UTMP_FILE)
 #        define UTMP_OUTPUT_FILENAME UTMP_FILE
 #    elif defined(_PATH_UTMP) /* BSD systems */
@@ -66,9 +66,9 @@
 #    else
 #        define UTMP_OUTPUT_FILENAME "/etc/utmp"
 #    endif
-#endif
+#  endif
 
-#if !defined(WTMP_OUTPUT_FILENAME)
+#  if !defined(WTMP_OUTPUT_FILENAME)
 #    if defined(WTMPX_FILE)
 #        define WTMP_OUTPUT_FILENAME WTMPX_FILE
 #    elif defined(_PATH_WTMPX)
@@ -82,6 +82,7 @@
 #    else
 #        define WTMP_OUTPUT_FILENAME "/etc/wtmp"
 #    endif
+#  endif
 #endif
 
 #if defined(_PATH_LASTLOG) /* BSD systems */
@@ -90,6 +91,9 @@
 #    define LASTLOG_OUTPUT_FILE	"/var/log/lastlog"
 #endif
 
+
+#if !defined(HAVE_LIBUTEMPTER)
+
 #if defined(HAVE_UPDWTMPX)
 #include <utmpx.h>
 #define update_wtmp updwtmpx
@@ -195,6 +199,8 @@
 #define update_utmp(ut)
 #endif
 
+#endif /* !HAVE_LIBUTEMPTER */
+
 #if !defined(HAVE_LASTLOG)
 #define update_lastlog(login_name, ut)
 #else
@@ -232,7 +238,10 @@
 void
 write_logout_record (char *login_name, void *data, int utmp, int wtmp)
 {
-	UTMP put, *ut = data;
+	UTMP *ut = data;
+
+#if !defined(HAVE_LIBUTEMPTER)
+	UTMP put;
 
 	memset (&put, 0, sizeof(UTMP));
 
@@ -263,6 +272,8 @@
 	if (wtmp)
 		update_wtmp (WTMP_OUTPUT_FILENAME, &put);
 
+#endif /* !HAVE_LIBUTEMPTER */
+
 	free (ut);
 }
 
@@ -346,11 +357,14 @@
 	ut->ut_syslen = strlen (ut->ut_host);
 #    endif
 #endif
+
+#if !defined(HAVE_LIBUTEMPTER)
 	if (utmp)
 		update_utmp (ut);
 
 	if (wtmp)
 		update_wtmp (WTMP_OUTPUT_FILENAME, ut);
+#endif
 
 	if (lastlog)
 		update_lastlog(login_name, ut);
--- vte-0.14.0/gnome-pty-helper/gnome-pty-helper.c.orig	2006-08-24 03:12:29 +0400
+++ vte-0.14.0/gnome-pty-helper/gnome-pty-helper.c	2006-09-11 22:38:18 +0400
@@ -62,6 +62,11 @@
 #include <sys/syslimits.h>
 #endif
 
+#ifdef HAVE_UTEMPTER_H
+#include <utempter.h>
+#endif
+
+
 static struct passwd *pwent;
 static char login_name_buffer [48];
 static char *login_name, *display_name;
@@ -72,6 +77,9 @@
 	char   *line;
 	void   *data;
 	char   utmp, wtmp, lastlog;
+#ifdef HAVE_LIBUTEMPTER
+	int master_fd;
+#endif
 };
 
 typedef struct pty_info pty_info;
@@ -235,9 +243,17 @@
 static void
 shutdown_pty (pty_info *pi)
 {
-	if (pi->utmp || pi->wtmp || pi->lastlog)
+	if (pi->utmp || pi->wtmp || pi->lastlog) {
 		if (pi->data)
 			write_logout_record (pi->login_name, pi->data, pi->utmp, pi->wtmp);
+#ifdef HAVE_LIBUTEMPTER
+		if (pi->utmp || pi->wtmp) {
+			utempter_remove_record(pi->master_fd);
+			/* Close the lingering PTY master descriptor */
+			close(pi->master_fd);
+		}
+#endif
+	}
 
 	pty_remove (pi);
 }
@@ -537,14 +553,26 @@
 		exit (0);
 	}
 
+#ifdef HAVE_LIBUTEMPTER
+	if (utmp || wtmp) {
+		utempter_add_record(master_pty, display_name);
+		/* Let the master PTY descriptor linger */
+		p->master_fd = master_pty;
+	} else {
+		close (master_pty);
+	}
+	utmp = 0;
+	wtmp = 0;
+#else
+	close (master_pty);
+#endif
+	close (slave_pty);
+
 	if (utmp || wtmp || lastlog) {
 		p->data = write_login_record (login_name, display_name,
 					      term_name, utmp, wtmp, lastlog);
 	}
 
-	close (master_pty);
-	close (slave_pty);
-
 	return 1;
 }
 
--- vte-0.14.0/gnome-pty-helper/configure.in.orig	2006-08-21 22:15:47 +0400
+++ vte-0.14.0/gnome-pty-helper/configure.in	2006-09-11 22:35:42 +0400
@@ -15,7 +15,7 @@
 AC_CHECK_LIB(c,grantpt,true,[AC_CHECK_LIB(pt,grantpt)])
 AC_CHECK_LIB(c,openpty,true,[AC_CHECK_LIB(util,openpty)])
 AC_CHECK_LIB(c,sendmsg,true,[AC_CHECK_LIB(socket,sendmsg,LIBS="$LIBS -lsocket -lnsl",,-lnsl)])
-AC_CHECK_FUNCS(endutent fcntl forkpty getttyent getutent getutmpx grantpt flock login_tty openpty revoke sendmsg seteuid setreuid setutent strrchr updwtmp updwtmpx utmpname utmpxname)
+AC_CHECK_FUNCS(fcntl forkpty grantpt flock login_tty openpty revoke sendmsg seteuid setreuid strrchr)
 GPH_CHECK_UTMP
 
 AC_CHECK_HEADERS(stropts.h)
@@ -42,4 +42,18 @@
 
 AM_CONFIG_HEADER(config.h)
 
+AC_ARG_WITH(utempter,
+	    AC_HELP_STRING(--with-utempter, [Use utempter to update utmp/wtmp]),
+	    ,
+	    with_utempter=no)
+if test "$with_utempter" = no; then
+	AC_CHECK_FUNCS(endutent getttyent getutent getutmpx setutent updwtmp updwtmpx utmpname utmpxname)
+else
+	AC_CHECK_HEADERS(utempter.h,
+		AC_CHECK_LIB(utempter, utempter_add_record,
+			,
+			AC_MSG_ERROR([-lutempter is not found])),
+		AC_MSG_ERROR([utempter.h is not found]))
+fi
+
 AC_OUTPUT(Makefile)
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin