--- rxvt-unicode/src/ptytty.C 2006/01/17 15:17:39 1.40 +++ rxvt-unicode/src/ptytty.C 2006/01/17 16:50:42 1.43 @@ -74,9 +74,7 @@ #ifdef PTYS_ARE_OPENPTY char tty_name[sizeof "/dev/pts/????\0"]; - rxvt_privileges(RESTORE); int res = openpty (&pfd, fd_tty, tty_name, NULL, NULL); - rxvt_privileges(IGNORE); if (res != -1) { @@ -346,8 +344,6 @@ if (!name || !*name) return; - rxvt_privileges (RESTORE); - if (action == SAVE) { # ifndef RESET_TTY_TO_COMMON_DEFAULTS @@ -379,8 +375,6 @@ # endif } - - rxvt_privileges (IGNORE); } #endif @@ -398,7 +392,9 @@ rxvt_ptytty_unix::~rxvt_ptytty_unix () { +#if UTMP_SUPPORT logout (); +#endif put (); } @@ -463,7 +459,6 @@ { rxvt_ptytty *id; - rxvt_ptytty_proxy (); ~rxvt_ptytty_proxy (); bool get (); @@ -546,23 +541,23 @@ } else if (cmd.type == command::login) { +#if UTMP_SUPPORT if (find (ptys.begin (), ptys.end (), cmd.id)) { cmd.hostname[sizeof (cmd.hostname) - 1] = 0; cmd.id->login (cmd.cmd_pid, cmd.login_shell, cmd.hostname); } - else printf ("xxx hiya login no match %p\n", cmd.id); +#endif } else if (cmd.type == command::destroy) { rxvt_ptytty **pty = find (ptys.begin (), ptys.end (), cmd.id); - if (*pty) + if (pty) { - ptys.erase (pty); delete *pty; + ptys.erase (pty); } - else printf ("xxx hiya destroy no match %p\n", cmd.id); } else break; @@ -594,13 +589,15 @@ } else { + setgid (getegid ()); + setuid (geteuid ()); + // server, pty-helper sock_fd = sv[1]; - close (sv[0]);//D -// for (int fd = 0; fd < 1023; fd++) -// if (fd != sock_fd) -// close (fd); + for (int fd = 0; fd < 1023; fd++) + if (fd != sock_fd && fd != 1) + close (fd); serve (); _exit (EXIT_SUCCESS); @@ -614,10 +611,8 @@ { #if PTYTTY_HELPER if (pid > 0) - { - // use helper process - return new rxvt_ptytty_proxy; - } + // use helper process + return new rxvt_ptytty_proxy; else #endif return new rxvt_ptytty_unix;