Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 1997 19:45:13 -0500 (EST)
From:      "Joseph D. Orthoefer" <j_orthoefer@tia.net>
To:        hackers@FreeBSD.org
Subject:   Modifcation to user mode ppp
Message-ID:  <Pine.BSF.3.95.970210191647.23696B-100000@mailbox.tia.net>

next 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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970210191647.23696B-100000>