Path: utzoo!attcan!uunet!lll-winken!ames!ncar!gatech!rutgers!psuvax1!schwartz@shire.cs.psu.edu From: schwartz@shire.cs.psu.edu (Scott Schwartz) Newsgroups: comp.windows.x Subject: Xterm vs 4.3BSD tty ownership Summary: 4.3 and friends want ttys to be group "tty" Message-ID: <4242@psuvax1.cs.psu.edu> Date: 26 Jan 89 07:10:02 GMT Sender: news@psuvax1.cs.psu.edu Reply-To: schwartz@shire.cs.psu.edu (Scott Schwartz) Organization: Pennsylvania State University, Computer Science Lines: 46 4.3BSD and related systems (e.g. SunOS 4.0) normally have active ttys owned by group "tty". Xterm does not currently provide for this convention. The following patch adds the necessary functionality; I hope the good people at MIT will look it over and include it in the standard xterm if they so choose. This is diff-ed against $XConsortium: main.c,v 1.99 88/01/04 14:33:47 jim Exp $ *** main.c.mit Thu Jan 26 01:31:14 1989 --- main.c Thu Jan 26 01:49:26 1989 *************** *** 1451,1461 **** --- 1451,1479 ---- (void) strcpy(ttydev, ptr); } + #ifdef USE_BSD43_TTY + { + #include + struct group *ttygrp; + if (ttygrp = getgrnam("tty")) { + /* change ownership of tty to real uid, "tty" gid */ + chown (ttydev, screen->uid, ttygrp->gr_gid); + } + else { + /* change ownership of tty to real group and user id */ + chown (ttydev, screen->uid, screen->gid); + } + endgrent(); + /* change protection of tty */ + chmod (ttydev, 0620); + } + #else /* change ownership of tty to real group and user id */ chown (ttydev, screen->uid, screen->gid); /* change protection of tty */ chmod (ttydev, 0622); + #endif USE_BSD43_TTY if (!get_ty) { #ifdef USE_SYSV_TERMIO -- Scott Schwartz