Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!apple!snorkelwacker!bloom-beacon!ATHENA.MIT.EDU!jfc From: jfc@ATHENA.MIT.EDU (John Carr) Newsgroups: comp.windows.x Subject: Xterm and utmpInhibit Message-ID: <9001052251.AA00344@ACHATES.MIT.EDU> Date: 5 Jan 90 22:51:57 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 65 This is cc-ed to xpert as I have seen this problem reported there. Program: xterm in R4 release Problem: When the "utmpInhibit" resource is turned on, xterm exits with no error message. Details: The initgroups() call in clients/xterm/main.c derefecences the variable "pw" (a struct passwd *) without checking that it is non-NULL. This causes the child of xterm to die, and the xterm process itself to exit when utmpInhibit is true or the user's id can not be converted to a username. Environment: IBM RT running 4.3. Should happen on any system with utmp and HAS_BSD_GROUPS defined. Fix: *** /tmp/,RCSt1000336 Fri Jan 5 17:48:17 1990 --- main.c Thu Jan 4 18:07:33 1990 *************** *** 1781,1788 **** tslot = ttyslot(); added_utmp_entry = False; { ! if (!resource.utmpInhibit && ! (pw = getpwuid(screen->uid)) && (i = open(etc_utmp, O_WRONLY)) >= 0) { bzero((char *)&utmp, sizeof(struct utmp)); (void) strncpy(utmp.ut_line, --- 1781,1788 ---- tslot = ttyslot(); added_utmp_entry = False; { ! if ((pw = getpwuid(screen->uid)) && ! !resource.utmpInhibit && (i = open(etc_utmp, O_WRONLY)) >= 0) { bzero((char *)&utmp, sizeof(struct utmp)); (void) strncpy(utmp.ut_line, *************** *** 1852,1858 **** (void) setgid (screen->gid); #ifdef HAS_BSD_GROUPS ! if (geteuid() == 0) initgroups (pw->pw_name, pw->pw_gid); #endif (void) setuid (screen->uid); --- 1852,1858 ---- (void) setgid (screen->gid); #ifdef HAS_BSD_GROUPS ! if(pw && geteuid() == 0) initgroups (pw->pw_name, pw->pw_gid); #endif (void) setuid (screen->uid); --John Carr (jfc@athena.mit.edu) Project Athena Systems Development