Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Feb 1997 20:57:41 +0000
From:      Brian Somers <brian@awfulhak.demon.co.uk>
To:        "Joseph D. Orthoefer" <j_orthoefer@tia.net>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Modifcation to user mode ppp 
Message-ID:  <199702112057.UAA12501@awfulhak.demon.co.uk>
In-Reply-To: Your message of "Mon, 10 Feb 1997 19:45:13 EST." <Pine.BSF.3.95.970210191647.23696B-100000@mailbox.tia.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> I've added a few lines of code to modem.c to allow user mode ppp to start
> up a shell hanging off a pty (using forkpty() from libutil), and to use
> the master half of the pty as its modem device, this allows me to use the
> "term" command whilst running ppp and establish an 8 bit clean connection,
> like rsh or secure shell, and utilize ppp over that.  Right now I have it
> execle'ing /usr/bin/login instead of /bin/sh since, for some reason,
> simply setuid()'ing the forked child back to a normal user right before
> exec'ing a shell results in the shell not working.  Not setuid()'ing
> before execing results in a root shell.
> 
> Here's the bit I can't get to work if I just have it exec a sh.
> 
> OpenPtyChild()
> {
> 	int	fdm;
> 	pid_t	pid;
> 	char	slave_name[20];
> 
> 	fdm = NULL;
> 	pid = forkpty(&fdm, slave_name, NULL, NULL);
> 	if (pid == 0) { /* child */
> 	  /* why don't I work */
>  	  setreuid(getuid,getuid);
>           execle("/bin/sh", "sh", "-i", NULL);
> 	}
> 	return(fdm);
> }
> 
> Plus two or three lines down in OpenModem() (in modem.c) to get it
> to recognize "pty"  as a device type, and call the previous function.
> 
> 
I suspect the problem is that getuid is a function....

Why is all this necessary ?  Are you trying to do something smarter than
chat can handle ?
-- 
Brian <brian@awfulhak.demon.co.uk>, <brian@freebsd.org>
      <http://www.awfulhak.demon.co.uk/>;
Don't _EVER_ lose your sense of humour....





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702112057.UAA12501>