This fixes the pty handling and switches Eterm from setuid root to
setgid utmp.

The extent of my testing was limited to running Eterm and
"ls -l `tty`", "w", and "id" inside, so if anybody uses this,
please give it a try.

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/eterm/Makefile,v
retrieving revision 1.37
diff -u -p -r1.37 Makefile
--- Makefile    23 Oct 2012 09:51:49 -0000      1.37
+++ Makefile    13 Dec 2012 20:18:30 -0000
@@ -6,10 +6,11 @@ COMMENT-kanji=        color japanese terminal e
 V=             0.9.5
 DISTNAME=      Eterm-$V
 DISTFILES=     ${DISTNAME}${EXTRACT_SUFX}
-PKGNAME=       eterm-$V# also see below
+# also see below
+PKGNAME=       eterm-$V
 SHARED_LIBS += Eterm                1.0      # .0.0
 CATEGORIES=    x11
-REVISION=      1
+REVISION=      2
 
 HOMEPAGE=      http://www.eterm.org/
 
@@ -33,11 +34,13 @@ LIB_DEPENDS=        devel/libast \
 USE_LIBTOOL=   Yes
 USE_GROFF =    Yes
 
-CONFIGURE_STYLE=gnu
+AUTOCONF_VERSION=2.59
+CONFIGURE_STYLE=autoconf
 CONFIGURE_ARGS=        ${CONFIGURE_SHARED} \
                --enable-trans \
                --enable-utmp \
                --enable-xim \
+               --without-pty-group \
                --with-theme-update \
                --with-backspace=bs \
                --without-terminfo
Index: patches/patch-config_h_in
===================================================================
RCS file: patches/patch-config_h_in
diff -N patches/patch-config_h_in
--- patches/patch-config_h_in   18 Nov 2007 12:55:58 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-$OpenBSD: patch-config_h_in,v 1.1 2007/11/18 12:55:58 jasper Exp $
---- config.h.in.orig   Tue Aug 22 20:25:54 2006
-+++ config.h.in        Wed Nov 14 17:14:21 2007
-@@ -174,6 +174,9 @@
- /* Define to 1 if you have the `seteuid' function. */
- #undef HAVE_SETEUID
- 
-+/* Define if you have the setegid function.  */
-+#undef HAVE_SETEGID
-+
- /* Define to 1 if you have the `setresgid' function. */
- #undef HAVE_SETRESGID
- 
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- patches/patch-configure     22 Sep 2009 04:42:02 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-configure,v 1.4 2009/09/22 04:42:02 jasper Exp $
---- configure.orig     Wed May 14 23:11:29 2008
-+++ configure  Mon Sep 21 23:01:14 2009
-@@ -22860,8 +22860,8 @@ _ACEOF
- 
- 
- for ac_func in atexit _exit unsetenv setutent \
--seteuid memmove putenv strsep setresuid setresgid \
--memmem usleep snprintf strcasestr strcasechr \
-+seteuid setegid memmove putenv strsep setresuid \
-+setresgid memmem usleep snprintf strcasestr strcasechr \
- strcasepbrk strrev nl_langinfo \
- 
- do
Index: patches/patch-configure_in
===================================================================
RCS file: patches/patch-configure_in
diff -N patches/patch-configure_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure_in  13 Dec 2012 20:18:30 -0000
@@ -0,0 +1,33 @@
+$OpenBSD$
+--- configure.in.orig  Wed May 14 21:49:22 2008
++++ configure.in       Thu Dec 13 21:02:23 2012
+@@ -220,7 +220,7 @@ AC_TYPE_UID_T
+ dnl# Checks for library functions.
+ AC_TYPE_SIGNAL
+ AC_CHECK_FUNCS(atexit _exit unsetenv setutent \
+-seteuid memmove putenv strsep setresuid setresgid \
++seteuid setegid memmove putenv strsep setresuid setresgid \
+ memmem usleep snprintf strcasestr strcasechr \
+ strcasepbrk strrev nl_langinfo \
+ )
+@@ -259,6 +259,9 @@ AC_ARG_WITH(debugging, [  --with-debugging[=num]  enab
+                   AC_DEFINE_UNQUOTED(DEBUG, 4, [Debugging level to compile 
in.])
+ ])
+ 
++AC_CHECK_FUNC(posix_openpt,
++              HAVE_POSIX_OPENPT=yes
++             )
+ AC_CHECK_FUNC(ptsname,
+               HAVE_PTSNAME=yes
+              )
+@@ -274,6 +277,10 @@ PTY_MECH=""
+ if test -c /dev/ptc ; then
+   AC_DEFINE(HAVE_DEV_PTC, , [Define for /dev/ptc support.])
+   PTY_MECH="AIX $PTY_MECH"
++fi
++if ! -z "$HAVE_POSIX_OPENPT" -a ! -z "$HAVE_PTSNAME" -a ! -z "$HAVE_GRANTPT" 
-a ! -z "$HAVE_UNLOCKPT"; then
++  AC_DEFINE(HAVE_POSIX_PTYS, , [Define for POSIX pty support.])
++  PTY_MECH="POSIX $PTY_MECH"
+ fi
+ if test -r /dev/ptmx -a ! -z "$HAVE_PTSNAME" -a ! -z "$HAVE_GRANTPT" -a ! -z 
"$HAVE_UNLOCKPT"; then
+   AC_DEFINE(HAVE_DEV_PTMX, , [Define for /dev/ptmx support.])
Index: patches/patch-src_command_c
===================================================================
RCS file: patches/patch-src_command_c
diff -N patches/patch-src_command_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_command_c 13 Dec 2012 20:18:30 -0000
@@ -0,0 +1,34 @@
+$OpenBSD$
+--- src/command.c.orig Thu Dec 13 21:00:06 2012
++++ src/command.c      Thu Dec 13 21:03:35 2012
+@@ -1386,7 +1386,7 @@ sco_get_pty(void)
+ }
+ #endif
+ 
+-#ifdef HAVE_DEV_PTMX
++#if defined(HAVE_POSIX_PTYS) || defined(HAVE_DEV_PTMX)
+ inline int svr_get_pty(void);
+ 
+ inline int
+@@ -1395,8 +1395,12 @@ svr_get_pty(void)
+ 
+     int fd = -1;
+ 
++#ifdef HAVE_POSIX_PTYS
++    if ((fd = posix_openpt(O_RDWR|O_NOCTTY)) < 0) {
++#else
+     /* open the STREAMS, clone device /dev/ptmx (master pty) */
+     if ((fd = open("/dev/ptmx", O_RDWR)) < 0) {
++#endif
+         return (-1);
+     } else {
+         if (grantpt(fd) != 0) {
+@@ -1459,7 +1463,7 @@ get_pty(void)
+     fd = sgi_get_pty();
+ #elif defined(HAVE_DEV_PTC)
+     fd = aix_get_pty();
+-#elif defined(HAVE_DEV_PTMX)
++#elif defined(HAVE_POSIX_PTYS) || defined(HAVE_DEV_PTMX)
+     fd = svr_get_pty();
+ #elif defined(HAVE_SCO_PTYS)
+     fd = sco_get_pty();
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/x11/eterm/pkg/PLIST,v
retrieving revision 1.10
diff -u -p -r1.10 PLIST
--- pkg/PLIST   22 Sep 2009 04:42:02 -0000      1.10
+++ pkg/PLIST   13 Dec 2012 20:18:30 -0000
@@ -6,9 +6,11 @@
 @bin bin/Etbg
 bin/Etbg_update_list
 bin/Etcolors
-@mode 4755
+@group utmp
+@mode g+s
 @bin bin/Eterm
 @mode
+@group
 bin/Etsearch
 @bin bin/Ettable
 bin/kEsetroot
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to