#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Makefile pathnames.h sliplogin.c sliplogin.8 slip.hosts
#   slip.login
# Wrapped by polk@delos.BSDI.COM on Wed Sep  7 10:00:56 1994
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(139 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#	@(#)Makefile	5.1 (Berkeley) 5/11/90
X
XPROG=	sliplogin
XMAN8=	sliplogin.0
XBINOWN=	root
XBINGRP= netdial
XBINMODE=4550
X
X.include <bsd.prog.mk>
END_OF_FILE
if test 139 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'pathnames.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pathnames.h'\"
else
echo shar: Extracting \"'pathnames.h'\" \(2007 characters\)
sed "s/^X//" >'pathnames.h' <<'END_OF_FILE'
X/*-
X * Copyright (c) 1990 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software developed by the University of
X *	California, Berkeley and its contributors.
X * 4. Neither the name of the University nor the names of its contributors
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X *	@(#)pathnames.h	5.2 (Berkeley) 4/1/91
X */
X
X#include <paths.h>
X
X#define	_PATH_ACCESS	"/etc/slip.hosts"
X#define	_PATH_LOGIN	"/etc/slip.login"
X#define	_PATH_LOGOUT	"/etc/slip.logout"
END_OF_FILE
if test 2007 -ne `wc -c <'pathnames.h'`; then
    echo shar: \"'pathnames.h'\" unpacked with wrong size!
fi
# end of 'pathnames.h'
fi
if test -f 'sliplogin.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sliplogin.c'\"
else
echo shar: Extracting \"'sliplogin.c'\" \(11054 characters\)
sed "s/^X//" >'sliplogin.c' <<'END_OF_FILE'
X/*-
X * Copyright (c) 1990 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software developed by the University of
X *	California, Berkeley and its contributors.
X * 4. Neither the name of the University nor the names of its contributors
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
Xchar copyright[] =
X"@(#) Copyright (c) 1990 The Regents of the University of California.\n\
X All rights reserved.\n";
X#endif /* not lint */
X
X#ifndef lint
Xstatic char sccsid[] = "@(#)sliplogin.c	5.6 (Berkeley) 3/2/91";
X#endif /* not lint */
X
X/*
X * sliplogin.c
X * [MUST BE RUN SUID, SLOPEN DOES A SUSER()!]
X *
X * This program initializes its own tty port to be an async TCP/IP interface.
X * It sets the line discipline to slip, invokes a shell script to initialize
X * the network interface, then pauses forever waiting for hangup.
X *
X * It is a remote descendant of several similar programs with incestuous ties:
X * - Kirk Smith's slipconf, modified by Richard Johnsson @ DEC WRL.
X * - slattach, probably by Rick Adams but touched by countless hordes.
X * - the original sliplogin for 4.2bsd, Doug Kingston the mover behind it.
X *
X * There are two forms of usage:
X *
X * "sliplogin"
X * Invoked simply as "sliplogin", the program looks up the username
X * in the file /etc/slip.hosts.
X * If an entry is found, the line on fd0 is configured for SLIP operation
X * as specified in the file.
X *
X * "sliplogin IPhostlogin </dev/ttyb"
X * Invoked by root with a username, the name is looked up in the
X * /etc/slip.hosts file and if found fd0 is configured as in case 1.
X */
X
X#include <sys/param.h>
X#include <sys/socket.h>
X#include <sys/signal.h>
X#include <sys/file.h>
X#include <sys/syslog.h>
X#include <netdb.h>
X
X#if BSD >= 199006
X#define POSIX
X#endif
X#ifdef POSIX
X#include <sys/termios.h>
X#include <sys/ioctl.h>
X#include <ttyent.h>
X#else
X#include <sgtty.h>
X#endif
X#include <netinet/in.h>
X#include <net/if.h>
X#include <net/if_slvar.h>
X
X#include <stdio.h>
X#include <errno.h>
X#include <ctype.h>
X#include <string.h>
X#include "pathnames.h"
X
Xint	unit;
Xint	slip_mode;
Xint	speed;
Xint	uid;
Xchar	loginargs[BUFSIZ];
Xchar	loginfile[MAXPATHLEN];
Xchar	loginname[BUFSIZ];
X
Xstruct slip_modes {
X	char	*sm_name;
X	int	sm_value;
X}	 modes[] = {
X	"normal",	0,              
X	"compress",	SC_COMPRESS,   
X	"noicmp",	SC_NOICMP,
X	"autocomp",	SC_AUTOCOMP
X};
X
Xvoid
Xfindid(name)
X	char *name;
X{
X	FILE *fp;
X	static char slopt[5][16];
X	static char laddr[16];
X	static char raddr[16];
X	static char mask[16];
X	char user[16];
X	int i, j, n;
X
X	(void)strcpy(loginname, name);
X	if ((fp = fopen(_PATH_ACCESS, "r")) == NULL) {
X		(void)fprintf(stderr, "sliplogin: %s: %s\n",
X		    _PATH_ACCESS, strerror(errno));
X		syslog(LOG_ERR, "%s: %m\n", _PATH_ACCESS);
X		exit(1);
X	}
X	while (fgets(loginargs, sizeof(loginargs) - 1, fp)) {
X		if (ferror(fp))
X			break;
X		n = sscanf(loginargs, "%15s%*[ \t]%15s%*[ \t]%15s%*[ \t]%15s%*[ \t]%15s%*[ \t]%15s%*[ \t]%15s%*[ \t]%15s%*[ \t]%15s\n",
X                        user, laddr, raddr, mask, slopt[0], slopt[1], 
X			slopt[2], slopt[3], slopt[4]);
X		if (user[0] == '#' || isspace(user[0]))
X			continue;
X		if (strcmp(user, name) != 0)
X			continue;
X
X		slip_mode = 0;
X		for (i = 0; i < n - 4; i++) {
X			for (j = 0; j < sizeof(modes)/sizeof(struct slip_modes);
X				j++) {
X				if (strcmp(modes[j].sm_name, slopt[i]) == 0) {
X					slip_mode |= modes[j].sm_value;
X					break;
X				}
X			}
X		}
X
X		/*
X		 * we've found the guy we're looking for -- see if
X		 * there's a login file we can use.  First check for
X		 * one specific to this host.  If none found, try for
X		 * a generic one.
X		 */
X		(void)sprintf(loginfile, "%s.%s", _PATH_LOGIN, name);
X		if (access(loginfile, R_OK|X_OK) != 0) {
X			(void)strcpy(loginfile, _PATH_LOGIN);
X			if (access(loginfile, R_OK|X_OK)) {
X				fputs("access denied - no login file\n",
X				      stderr);
X				syslog(LOG_ERR,
X				       "access denied for %s - no %s\n",
X				       name, _PATH_LOGIN);
X				exit(5);
X			}
X		}
X
X		(void) fclose(fp);
X		return;
X	}
X	(void)fprintf(stderr, "SLIP access denied for %s\n", name);
X	syslog(LOG_ERR, "SLIP access denied for %s\n", name);
X	exit(4);
X	/* NOTREACHED */
X}
X
Xchar *
Xsigstr(s)
X	int s;
X{
X	static char buf[32];
X
X	switch (s) {
X	case SIGHUP:	return("HUP");
X	case SIGINT:	return("INT");
X	case SIGQUIT:	return("QUIT");
X	case SIGILL:	return("ILL");
X	case SIGTRAP:	return("TRAP");
X	case SIGIOT:	return("IOT");
X	case SIGEMT:	return("EMT");
X	case SIGFPE:	return("FPE");
X	case SIGKILL:	return("KILL");
X	case SIGBUS:	return("BUS");
X	case SIGSEGV:	return("SEGV");
X	case SIGSYS:	return("SYS");
X	case SIGPIPE:	return("PIPE");
X	case SIGALRM:	return("ALRM");
X	case SIGTERM:	return("TERM");
X	case SIGURG:	return("URG");
X	case SIGSTOP:	return("STOP");
X	case SIGTSTP:	return("TSTP");
X	case SIGCONT:	return("CONT");
X	case SIGCHLD:	return("CHLD");
X	case SIGTTIN:	return("TTIN");
X	case SIGTTOU:	return("TTOU");
X	case SIGIO:	return("IO");
X	case SIGXCPU:	return("XCPU");
X	case SIGXFSZ:	return("XFSZ");
X	case SIGVTALRM:	return("VTALRM");
X	case SIGPROF:	return("PROF");
X	case SIGWINCH:	return("WINCH");
X#ifdef SIGLOST
X	case SIGLOST:	return("LOST");
X#endif
X	case SIGUSR1:	return("USR1");
X	case SIGUSR2:	return("USR2");
X	}
X	(void)sprintf(buf, "sig %d", s);
X	return(buf);
X}
X
Xvoid
Xhup_handler(s)
X	int s;
X{
X	char logoutfile[MAXPATHLEN];
X
X	(void)sprintf(logoutfile, "%s.%s", _PATH_LOGOUT, loginname);
X	if (access(logoutfile, R_OK|X_OK) != 0)
X		(void)strcpy(logoutfile, _PATH_LOGOUT);
X	if (access(logoutfile, R_OK|X_OK) == 0) {
X		char logincmd[2*MAXPATHLEN+32];
X
X		(void) sprintf(logincmd, "%s %d %d %s", logoutfile, unit, speed,
X			      loginargs);
X		(void) system(logincmd);
X	}
X	(void) close(0);
X	syslog(LOG_INFO, "closed %s slip unit %d (%s)\n", loginname, unit,
X	       sigstr(s));
X	exit(1);
X	/* NOTREACHED */
X}
X
Xmain(argc, argv)
X	int argc;
X	char *argv[];
X{
X	int fd, s, ldisc, odisc;
X	char *name;
X#ifdef POSIX
X	struct termios tios, otios;
X#else
X	struct sgttyb tty, otty;
X#endif
X	char logincmd[2*BUFSIZ+32];
X	extern uid_t getuid();
X
X	if ((name = strrchr(argv[0], '/')) == NULL)
X		name = argv[0];
X	s = getdtablesize();
X	for (fd = 3 ; fd < s ; fd++)
X		(void) close(fd);
X	openlog(name, LOG_PID, LOG_DAEMON);
X	uid = getuid();
X	if (argc > 1) {
X		findid(argv[1]);
X
X		/*
X		 * Disassociate from current controlling terminal, if any,
X		 * and ensure that the slip line is our controlling terminal.
X		 */
X#ifdef POSIX
X		if (fork() > 0)
X			exit(0);
X		if (setsid() != 0)
X			perror("setsid");
X#else
X		if ((fd = open("/dev/tty", O_RDONLY, 0)) >= 0) {
X			extern char *ttyname();
X
X			(void) ioctl(fd, TIOCNOTTY, (caddr_t)0);
X			(void) close(fd);
X			/* open slip tty again to acquire as controlling tty? */
X			fd = open(ttyname(0), O_RDWR, 0);
X			if (fd >= 0)
X				(void) close(fd);
X		}
X		(void) setpgrp(0, getpid());
X#endif
X		if (argc > 2) {
X			if ((fd = open(argv[2], O_RDWR)) == -1) {
X				perror(argv[2]);
X				exit(2);
X			}
X			(void) dup2(fd, 0);
X			if (fd > 2)
X				close(fd);
X		}
X#ifdef TIOCSCTTY
X		if (ioctl(0, TIOCSCTTY, (caddr_t)0) != 0)
X			perror("ioctl (TIOCSCTTY)");
X#endif
X	} else {
X		extern char *getlogin();
X
X		if ((name = getlogin()) == NULL) {
X			(void) fprintf(stderr, "access denied - no username\n");
X			syslog(LOG_ERR, "access denied - getlogin returned 0\n");
X			exit(1);
X		}
X		findid(name);
X	}
X	(void) fchmod(0, 0600);
X	(void) fprintf(stderr, "starting slip login for %s\n", loginname);
X#ifdef POSIX
X	/* set up the line parameters */
X	if (tcgetattr(0, &tios) < 0) {
X		syslog(LOG_ERR, "tcgetattr: %m");
X		exit(1);
X	}
X	otios = tios;
X	cfmakeraw(&tios);
X	tios.c_iflag &= ~IMAXBEL;
X	if (tcsetattr(0, TCSAFLUSH, &tios) < 0) {
X		syslog(LOG_ERR, "tcsetattr: %m");
X		exit(1);
X	}
X	speed = cfgetispeed(&tios);
X#else
X	/* set up the line parameters */
X	if (ioctl(0, TIOCGETP, (caddr_t)&tty) < 0) {
X		syslog(LOG_ERR, "ioctl (TIOCGETP): %m");
X		exit(1);
X	}
X	otty = tty;
X	speed = tty.sg_ispeed;
X	tty.sg_flags = RAW | ANYP;
X	if (ioctl(0, TIOCSETP, (caddr_t)&tty) < 0) {
X		syslog(LOG_ERR, "ioctl (TIOCSETP): %m");
X		exit(1);
X	}
X#endif
X	/* find out what ldisc we started with */
X	if (ioctl(0, TIOCGETD, (caddr_t)&odisc) < 0) {
X		syslog(LOG_ERR, "ioctl(TIOCGETD) (1): %m");
X		exit(1);
X	}
X	ldisc = SLIPDISC;
X	if (ioctl(0, TIOCSETD, (caddr_t)&ldisc) < 0) {
X		syslog(LOG_ERR, "ioctl(TIOCSETD): %m");
X		exit(1);
X	}
X	/* find out what unit number we were assigned */
X	if (ioctl(0, SLIOCGUNIT, (caddr_t)&unit) < 0) {
X		syslog(LOG_ERR, "ioctl (SLIOCGUNIT): %m");
X		exit(1);
X	}
X	(void) signal(SIGHUP, hup_handler);
X	(void) signal(SIGTERM, hup_handler);
X
X	syslog(LOG_INFO, "attaching slip unit %d for %s\n", unit, loginname);
X	(void)sprintf(logincmd, "%s %d %d %s", loginfile, unit, speed,
X		      loginargs);
X	/*
X	 * aim stdout and errout at /dev/null so logincmd output won't
X	 * babble into the slip tty line.
X	 */
X	(void) close(1);
X	if ((fd = open(_PATH_DEVNULL, O_WRONLY)) != 1) {
X		if (fd < 0) {
X			syslog(LOG_ERR, "open /dev/null: %m");
X			exit(1);
X		}
X		(void) dup2(fd, 1);
X		(void) close(fd);
X	}
X	(void) dup2(1, 2);
X
X	/*
X	 * Run login and logout scripts as root (real and effective);
X	 * current route(8) is setuid root, and checks the real uid
X	 * to see whether changes are allowed (or just "route get").
X	 */
X	(void) setuid(0);
X	if (s = system(logincmd)) {
X		syslog(LOG_ERR, "%s login failed: exit status %d from %s",
X		       loginname, s, loginfile);
X		(void) ioctl(0, TIOCSETD, (caddr_t)&odisc);
X		exit(6);
X	}
X	if (ioctl(0, SLIOCSFLAGS, (caddr_t)&slip_mode) < 0) {
X		syslog(LOG_ERR, "ioctl (SLIOCSFLAGS): %m");
X		exit(1);
X	}
X
X	/* twiddle thumbs until we get a signal */
X	while (1)
X		sigpause(0);
X
X	/* NOTREACHED */
X}
END_OF_FILE
if test 11054 -ne `wc -c <'sliplogin.c'`; then
    echo shar: \"'sliplogin.c'\" unpacked with wrong size!
fi
# end of 'sliplogin.c'
fi
if test -f 'sliplogin.8' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sliplogin.8'\"
else
echo shar: Extracting \"'sliplogin.8'\" \(6309 characters\)
sed "s/^X//" >'sliplogin.8' <<'END_OF_FILE'
X.\" Copyright (c) 1990, 1991 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\"    notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\"    notice, this list of conditions and the following disclaimer in the
X.\"    documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\"    must display the following acknowledgement:
X.\"	This product includes software developed by the University of
X.\"	California, Berkeley and its contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\"    may be used to endorse or promote products derived from this software
X.\"    without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.\"     @(#)sliplogin.8	5.4 (Berkeley) 8/5/91
X.\"
X.Dd August 5, 1991
X.Dt SLIPLOGIN 8
X.Os
X.Sh NAME
X.Nm sliplogin
X.Nd attach a serial line network interface
X.Sh SYNOPSIS
X.Nm sliplogin
X.Op Ar loginname
X.Sh DESCRIPTION
X.Nm Sliplogin
Xis used to turn the terminal line on standard input into
Xa Serial Line IP
X.Pq Tn SLIP
Xlink to a remote host.  To do this, the program
Xsearches the file
X.Pa /etc/slip.hosts
Xfor an entry matching
X.Ar loginname
X(which defaults to the current login name if omitted).
XIf a matching entry is found, the line is configured appropriately
Xfor slip (8-bit transparent i/o) and converted to
X.Tn SLIP
Xline
Xdiscipline.  Then a shell script is invoked to initialize the slip
Xinterface with the appropriate local and remote
X.Tn IP
Xaddress,
Xnetmask, etc.
X.Pp
XThe usual initialization script is
X.Pa /etc/slip.login
Xbut, if particular hosts need special initialization, the file
X.Pa /etc/slip.login. Ns Ar loginname
Xwill be executed instead if it exists.
XThe script is invoked with the parameters
X.Bl -tag -width slipunit
X.It Em slipunit
XThe unit number of the slip interface assigned to this line.  E.g.,
X.Sy 0
Xfor
X.Sy sl0 .
X.It Em speed
XThe speed of the line.
X.It Em args
XThe arguments from the
X.Pa /etc/slip.hosts
Xentry, in order starting with
X.Ar loginname .
X.El
X.Pp
XOnly the super-user may attach a network interface.  The interface is
Xautomatically detached when the other end hangs up or the
X.Nm sliplogin
Xprocess dies.  If the kernel slip
Xmodule has been configured for it, all routes through that interface will
Xalso disappear at the same time.  If there is other processing a site
Xwould like done on hangup, the file
X.Pa /etc/slip.logout
Xor
X.Pa /etc/slip.logout. Ns Ar loginname
Xis executed if it exists.  It is given the same arguments as the login script.
X.Ss Format of /etc/slip.hosts
XComments (lines starting with a `#') and blank lines are ignored.
XOther lines must start with a
X.Ar loginname
Xbut the remaining arguments can be whatever is appropriate for the
X.Pa  slip.login
Xfile that will be executed for that name.
XArguments are separated by white space and follow normal
X.Xr sh 1
Xquoting conventions (however,
X.Ar loginname
Xcannot be quoted).
XUsually, lines have the form
X.Bd -literal -offset indent
Xloginname local-address remote-address netmask opt-args
X.Ed
X.Pp
Xwhere
X.Em local-address
Xand
X.Em remote-address
Xare the IP host names or addresses of the local and remote ends of the
Xslip line and
X.Em netmask
Xis the appropriate IP netmask.  These arguments are passed
Xdirectly to
X.Xr ifconfig 8 .
X.Em Opt-args
Xare optional arguments used to configure the line.
X.Sh EXAMPLE
XThe normal use of
X.Nm sliplogin
Xis to create a
X.Pa /etc/passwd
Xentry for each legal, remote slip site with
X.Nm sliplogin
Xas the shell for that entry.  E.g.,
X.Bd -literal
XSfoo:ikhuy6:2010:1:slip line to foo:/tmp:/etc/sliplogin
X.Ed
X.Pp
X(Our convention is to name the account used by remote host
X.Ar hostname
Xas
X.Em Shostname . )
XThen an entry is added to
X.Pa slip.hosts
Xthat looks like:
X.Pp
X.Bd -literal -offset indent -compact
XSfoo	`hostname`	foo	netmask
X.Ed
X.Pp
Xwhere
X.Em `hostname`
Xwill be evaluated by
X.Xr sh
Xto the local host name and
X.Em netmask
Xis the local host IP netmask.
X.Pp
XNote that
X.Nm sliplogin
Xmust be setuid to root and, while not a security hole, moral defectives
Xcan use it to place terminal lines in an unusable state and/or deny
Xaccess to legitimate users of a remote slip line.  To prevent this,
Xthe system is shipped with sliplogin executable only by root and users
Xin the 
X.Em netdial
Xgroup.  Slip accounts must be members of this group in order to 
Xexecute 
X.Nm sliplogin .
X.Sh DIAGNOSTICS
X.Nm Sliplogin
Xlogs various information to the system log daemon,
X.Xr syslogd 8 ,
Xwith a facility code of
X.Em daemon .
XThe messages are listed here, grouped by severity level.
X.Pp
X.Sy Error Severity
X.Bl -tag -width Ds -compact
X.It Sy ioctl (TCGETS): Em reason
XA
X.Dv TCGETS
X.Fn ioctl
Xto get the line parameters failed.
X.Pp
X.It Sy ioctl (TCSETS): Em reason
XA
X.Dv TCSETS
X.Fn ioctl
Xto set the line parameters failed.
X.Pp
X.It Sy /etc/slip.hosts: Em reason
XThe
X.Pa /etc/slip.hosts
Xfile could not be opened.
X.Pp
X.It Sy access denied for Em user
XNo entry for
X.Em user
Xwas found in
X.Pa /etc/slip.hosts .
X.El
X.Pp
X.Sy Notice Severity
X.Bl -tag -width Ds -compact
X.It Sy "attaching slip unit" Em unit Sy for Ar loginname
X.Tn SLIP
Xunit
X.Em unit
Xwas successfully attached.
X.El
X.Sh SEE ALSO
X.Xr slattach 8 ,
X.Xr syslogd 8
X.Sh HISTORY
XThe
X.Nm
Xcommand
X.Bt
END_OF_FILE
if test 6309 -ne `wc -c <'sliplogin.8'`; then
    echo shar: \"'sliplogin.8'\" unpacked with wrong size!
fi
# end of 'sliplogin.8'
fi
if test -f 'slip.hosts' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'slip.hosts'\"
else
echo shar: Extracting \"'slip.hosts'\" \(308 characters\)
sed "s/^X//" >'slip.hosts' <<'END_OF_FILE'
X#
X# login	local-addr	remote-addr	mask		opt1	opt2 
X#						(normal,compress,noicmp)	
X#
XShavoc	okeeffe         havoc		0xffffff00	normal
XSoxford	okeeffe		oxford-gw	0xffffff00	compress
XSchez	okeeffe		chez		0xffffff00	compress
XSmjk	okeeffe		pissaro		0xffffff00	compress
XSmjk2	okeeffe		pissaro		0xffffff00	compress
END_OF_FILE
if test 308 -ne `wc -c <'slip.hosts'`; then
    echo shar: \"'slip.hosts'\" unpacked with wrong size!
fi
# end of 'slip.hosts'
fi
if test -f 'slip.login' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'slip.login'\"
else
echo shar: Extracting \"'slip.login'\" \(326 characters\)
sed "s/^X//" >'slip.login' <<'END_OF_FILE'
X#!/bin/sh -
X#
X#	@(#)slip.login	5.1 (Berkeley) 7/1/90
X
X#
X# generic login file for a slip line.  sliplogin invokes this with
X# the parameters:
X#      1        2         3        4          5         6     7-n
X#   slipunit ttyspeed loginname local-addr remote-addr mask opt-args
X#
X/sbin/ifconfig sl$1 inet $4 $5 netmask $6 
Xexit
END_OF_FILE
if test 326 -ne `wc -c <'slip.login'`; then
    echo shar: \"'slip.login'\" unpacked with wrong size!
fi
# end of 'slip.login'
fi
echo shar: End of shell archive.
exit 0
