From owner-freebsd-hackers Tue Feb 11 13:00:45 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA18142 for hackers-outgoing; Tue, 11 Feb 1997 13:00:45 -0800 (PST) Received: from awfulhak.demon.co.uk (awfulhak.demon.co.uk [158.152.17.1]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA18128 for ; Tue, 11 Feb 1997 13:00:30 -0800 (PST) Received: from awfulhak.demon.co.uk (localhost.coverform.lan [127.0.0.1]) by awfulhak.demon.co.uk (8.8.5/8.7.3) with ESMTP id UAA12501; Tue, 11 Feb 1997 20:57:41 GMT Message-Id: <199702112057.UAA12501@awfulhak.demon.co.uk> X-Mailer: exmh version 1.6.9 8/22/96 To: "Joseph D. Orthoefer" cc: hackers@FreeBSD.ORG Subject: Re: Modifcation to user mode ppp In-reply-to: Your message of "Mon, 10 Feb 1997 19:45:13 EST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 11 Feb 1997 20:57:41 +0000 From: Brian Somers Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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 , Don't _EVER_ lose your sense of humour....