From owner-freebsd-hackers Mon Feb 10 17:19:21 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id RAA00859 for hackers-outgoing; Mon, 10 Feb 1997 17:19:21 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA00834 for ; Mon, 10 Feb 1997 17:19:15 -0800 (PST) Received: from mailbox.tia.net (mailbox.tia.net [206.174.9.12]) by who.cdrom.com (8.7.5/8.6.11) with ESMTP id QAA29223 for ; Mon, 10 Feb 1997 16:47:24 -0800 (PST) Received: from localhost (jo295@localhost) by mailbox.tia.net (8.8.5/8.6.12) with SMTP id TAA24013 for ; Mon, 10 Feb 1997 19:45:13 -0500 (EST) Posted-Date: Mon Feb 10 19:45:13 1997 Date: Mon, 10 Feb 1997 19:45:13 -0500 (EST) From: "Joseph D. Orthoefer" To: hackers@FreeBSD.org Subject: Modifcation to user mode ppp Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.