Subject: patch for screen 3.5.11 to make passwords and reattach work.
To: None <current-users@netbsd.org>
From: matthew green <mrg@splode.mame.mu.OZ.AU>
List: current-users
Date: 09/21/1994 21:36:03
hi.

if any of you have screen 3.5.11beta, and you were having problems with
it reattaching when you had a screen password, here's a patch that solves
the problem.  i don't think it's the best way to do it, but i thought of
the other way after i'd already fixed it ;-)

(the other method involves putting the sete?id() calls around an 
if (getuid() != geteuid()) type thing...)

.mrg.

ps, if you are wondering what screen 3.5.11 is, it is/was the latest
beta of screen.  i forget the ftp site (really), so don't bother asking
me for it.

pps, this is an unofficial patch, so don't bother the screen maintainers
if something breaks.  you can try bothering me, but it won't do you much
good ;-)


*** fileio.c.orig	Wed Sep 21 21:17:17 1994
--- fileio.c	Wed Sep 21 21:18:09 1994
***************
*** 670,684 ****
  #ifndef USE_SETEUID
    int q;
    struct stat stb;
  #endif
  
    debug3("secopen(%s, 0x%x, 0%03o)\n", name, flags, mode);
  #ifdef USE_SETEUID
    xseteuid(real_uid);
    xsetegid(real_gid);
    fd = open(name, flags, mode);
!   xseteuid(eff_uid);
!   xsetegid(eff_gid);
    return fd;
  #else
    if (eff_uid == real_uid)
--- 670,689 ----
  #ifndef USE_SETEUID
    int q;
    struct stat stb;
+ #else
+   uid_t euid;
+   gid_t egid;
  #endif
  
    debug3("secopen(%s, 0x%x, 0%03o)\n", name, flags, mode);
  #ifdef USE_SETEUID
+   euid = geteuid();
+   egid = getegid();
    xseteuid(real_uid);
    xsetegid(real_gid);
    fd = open(name, flags, mode);
!   xseteuid(euid);
!   xsetegid(egid);
    return fd;
  #else
    if (eff_uid == real_uid)