🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.4bsd
Article #1666

Re: Orphaned Response

#1666
From: nrh
Date: Tue, 09 Sep 1986 18:01
49 lines
2212 bytes
>/* Written  2:58 pm  Aug 20, 1986 by david@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);
Technical Details
Message-ID: <3000009@inmet>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!pyrnj!mirror!gabriel!inmet!nrh
References: <600@varian.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!pyrnj!mirror!gabriel!inmet!nrh
From: nrh@inmet.UUCP
Newsgroups: net.bugs.4bsd
Subject: Re: Orphaned Response
Message-ID: <3000009@inmet>
Date: Tue, 9-Sep-86 14:01:00 EDT
Article-I.D.: inmet.3000009
Posted: Tue Sep  9 14:01:00 1986
Date-Received: Wed, 10-Sep-86 20:13:08 EDT
References: <600@varian.UUCP>
Lines: 49
Nf-ID: #R:varian.UUCP:-60000:inmet:3000009:000:1647
Nf-From: inmet.UUCP!nrh    Sep  9 14:01:00 1986