Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!agate!ig!uwmcsd1!bbn!rochester!pt.cs.cmu.edu!cadre!jack From: jack@cadre.dsl.PITTSBURGH.EDU (Jack Nelson) Newsgroups: comp.bugs.2bsd Subject: tip bug fix Message-ID: <1160@cadre.dsl.PITTSBURGH.EDU> Date: 3 May 88 19:07:08 GMT Organization: Decision Systems Lab., Univ. of Pittsburgh, PA. Lines: 49 Keywords: shell escape Index: /usr/src/usr.bin/tip/cmds.c 2.10BSD Description: tip(1) will not properly run a shell if the environment SHELL is /bin/csh or /bin/tcsh. Repeat-By: Procedure to repeat the problem: try it. Works ok if SHELL=/bin/sh or if .tiprc has a line "SHELL=/bin/sh", but then you get /bin/sh. Fix: Description of how to fix the problem: patch cmds.c to use the "-b" option as documented in csh(1) to be necessary when you run setuid and try to fork a csh. The patch calls sh(1) without that flag, all other with it. If you use some other shell besides csh or tcsh this will not be general enough. UUCP: { akgua | allegra | cmcl2 | idis | ihnp4 | mi-cec | pitt | psuvax1 | sun | sunrise | vax135 } ! cadre ! nelslab ! jack ARPA: jack@cadre.dsl.pittsburgh.edu John P. Nelson, M.D., 3811 O'Hara St, Pittsburgh, PA 15213, t:412-624-1769 Dept. of Psychiatry, U. of Pittsburgh Cut:-------------- *** cmds.c.org Wed Dec 16 16:24:47 1987 --- cmds.c Fri Mar 25 15:35:15 1988 *************** *** 547,553 **** cp = value(SHELL); else cp++; ! execl(value(SHELL), cp, 0); printf("\r\ncan't execl!\r\n"); exit(1); } --- 547,556 ---- cp = value(SHELL); else cp++; ! if (strcmp(cp,"sh") == 0) ! execl(value(SHELL), cp, 0); ! else ! execl(value(SHELL), cp, "-b", 0); printf("\r\ncan't execl!\r\n"); exit(1); } -- John P. Nelson, M.D., 3811 O'Hara St, Pittsburgh, PA 15213, t:412-624-1769 Dept. of Psychiatry, U. of Pittsburgh UUCP: { akgua | allegra | cmcl2 | idis | ihnp4 | mi-cec | pitt | psuvax1 | sun | sunrise | vax135 } ! cadre ! jack ARPA: jack@cadre.dsl.pittsburgh.edu