Orphaned Response

nrh at inmet.UUCP nrh at inmet.UUCP
Wed Sep 10 04:01:00 AEST 1986


>/* Written  2:58 pm  Aug 20, 1986 by david at varian.UUCP in inmet:net.bugs.4bsd */
>/* ---------- "tip shell escape (4.3BSD)" ---------- */
>I've been having problems using tip on 4.3BSD.  When I try to use any
>tilde command that requires forking a shell (~!, ~$, etc.), I get:
>
>	/bin/csh: permission denied
>
>My environment variable SHELL is set to /bin/csh; when I change this
>to /bin/sh, the subshell mechanism works. I've temporarily removed
>my .cshrc file; this didn't help.  I've looked at the code
>where the fork and execl() are done (/usr/src/usr.bin/tip/cmds.c) and
>don't see anything unusual.
>
>The permissions on /bin/csh look normal (755).

The problem is due to the new version of csh being picky about 
effective uid not being equal to real uid.  In one sense, this
is exactly right -- the child of a tip fork should set its euid equal
to its real uid just after the fork --  but it's a little odd that
the shell should be the one to find this error.

Doing this appears to cause some other problems (your "tip" session
stops spontaneously after you exit the shell), but I haven't gotten
around to looking at that yet.

Here are the changes:

*** /tmp/,RCSt1008084	Tue Sep  9 13:59:07 1986
--- cmds.c	Tue Sep  9 13:41:26 1986
***************
*** 547,552
  			cp = value(SHELL);
  		else
  			cp++;
  		execl(value(SHELL), cp, 0);
  		printf("\r\ncan't execl!\r\n");
  		exit(1);

--- 547,555 -----
  			cp = value(SHELL);
  		else
  			cp++;
+ 
+ 		setuid(getuid());  /* Avoid "permission denied" problem */
+ 		setgid(getgid());  /* ditto? */
  		execl(value(SHELL), cp, 0);
  		printf("\r\ncan't execl!\r\n");
  		exit(1);



More information about the Comp.bugs.4bsd.ucb-fixes mailing list