Fix broken utmp(5) support.

Reported by:	Jukka A. Ukkonen <jau at iki dot fi>
This commit is contained in:
Kirill Ponomarev 2005-09-28 14:18:36 +00:00
parent 976a924a4a
commit b1857a4f5a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=143694
2 changed files with 75 additions and 0 deletions

View file

@ -7,6 +7,7 @@
PORTNAME= xterm
PORTVERSION= 205
PORTREVISION= 1
CATEGORIES= x11
MASTER_SITES= ftp://invisible-island.net/xterm/ \
http://voodoo.oberon.net/download/

View file

@ -0,0 +1,74 @@
$FreeBSD$
--- main.c.orig
+++ main.c
@@ -379,14 +379,6 @@
#include <util.h>
#endif
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-#include <libutil.h>
-#include <grp.h>
-#endif
-
#if !defined(UTMP_FILENAME)
#if defined(UTMP_FILE)
#define UTMP_FILENAME UTMP_FILE
@@ -472,7 +464,7 @@
static Bool added_utmp_entry = False;
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__)
static gid_t utmpGid = -1;
#endif
@@ -1606,7 +1598,7 @@
strcpy(ptydev, PTYDEV);
#endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__)
get_pty(NULL, NULL);
seteuid(getuid());
setuid(getuid());
@@ -1944,7 +1936,7 @@
}
#endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__)
if (resource.utmpInhibit) {
/* Can totally revoke group privs */
setegid(getgid());
@@ -2354,7 +2346,7 @@
{
int result = 1;
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__)
static int m_tty = -1;
static int m_pty = -1;
struct group *ttygrp;
@@ -4061,7 +4053,7 @@
}
#endif /* USE_LASTLOG */
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__)
/* Switch to real gid after writing utmp entry */
utmpGid = getegid();
if (getgid() != getegid()) {
@@ -4436,7 +4428,7 @@
&& (resource.ptyHandshake && added_utmp_entry)
#endif /* OPT_PTY_HANDSHAKE */
) {
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__)
if (utmpGid != -1) {
/* Switch back to group utmp */
setegid(utmpGid);