.\" SUCH DAMAGE.
.\"
.\" from: @(#)gettytab.5 8.4 (Berkeley) 4/19/94
-.\" $Id: gettytab.5,v 1.2 1996/08/11 05:41:42 deraadt Exp $
+.\" $Id: gettytab.5,v 1.3 1996/12/10 07:58:29 deraadt Exp $
.\"
.Dd April 19, 1994
.Dt GETTYTAB 5
.It "pe bool false use printer (hard copy) erase algorithm"
.It "pf num 0 delay"
between first prompt and following flush (seconds)
+.It "pp str unused PPP authentication program"
.It "ps bool false line connected to a"
.Tn MICOM
port selector
does not check parity of input characters in
.Dv RAW
mode.
+.Pp
+If
+.Em \&pp
+string is specified and a PPP link bringup sequence is recognized,
+getty will invoke the program referenced by the pp option. This
+can be used to handle incoming PPP calls.
.Sh SEE ALSO
.Xr login 1 ,
.Xr gethostname 2 ,
#ifndef lint
/*static char sccsid[] = "from: @(#)init.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$Id: init.c,v 1.2 1996/05/17 22:41:16 deraadt Exp $";
+static char rcsid[] = "$Id: init.c,v 1.3 1996/12/10 07:58:33 deraadt Exp $";
#endif /* not lint */
/*
{ "fl", &tmode.c_cc[VDISCARD] },/* flush output */
{ "we", &tmode.c_cc[VWERASE] }, /* word erase */
{ "ln", &tmode.c_cc[VLNEXT] }, /* literal next */
+ { "pp" }, /* ppp login program */
{ 0 }
};
#ifndef lint
/*static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93";*/
-static char rcsid[] = "$Id: main.c,v 1.4 1996/05/22 12:10:13 deraadt Exp $";
+static char rcsid[] = "$Id: main.c,v 1.5 1996/12/10 07:58:34 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
*/
#define GETTY_TIMEOUT 60 /* seconds */
+/* defines for auto detection of incoming PPP calls (->PAP/CHAP) */
+
+#define PPP_FRAME 0x7e /* PPP Framing character */
+#define PPP_STATION 0xff /* "All Station" character */
+#define PPP_ESCAPE 0x7d /* Escape Character */
+#define PPP_CONTROL 0x03 /* PPP Control Field */
+#define PPP_CONTROL_ESCAPED 0x23 /* PPP Control Field, escaped */
+#define PPP_LCP_HI 0xc0 /* LCP protocol - high byte */
+#define PPP_LCP_LOW 0x21 /* LCP protocol - low byte */
+
struct termios tmode, omode;
int crmod, digit, lower, upper;
long allflags;
int repcnt = 0, failopenlogged = 0;
struct rlimit limit;
+ int rval;
signal(SIGINT, SIG_IGN);
/*
signal(SIGALRM, dingdong);
alarm(TO);
}
- if (getname()) {
+ if ((rval = getname()) == 2) {
+ execle(PP, "ppplogin", ttyn, (char *) 0, env);
+ syslog(LOG_ERR, "%s: %m", PP);
+ exit(1);
+ } else if (rval) {
register int i;
oflush();
{
register int c;
register char *np;
- char cs;
+ unsigned char cs;
+ int ppp_state;
+ int ppp_connection = 0;
/*
* Interrupt may happen if we use CBREAK mode
exit(0);
if ((c = cs&0177) == 0)
return (0);
+
+ /*
+ * PPP detection state machine..
+ * Look for sequences:
+ * PPP_FRAME, PPP_STATION, PPP_ESCAPE, PPP_CONTROL_ESCAPED or
+ * PPP_FRAME, PPP_STATION, PPP_CONTROL (deviant from RFC)
+ * See RFC1662.
+ * Derived from code from Michael Hancock <michaelh@cet.co.jp>
+ * and Erik 'PPP' Olson <eriko@wrq.com>
+ */
+ if (PP && cs == PPP_FRAME) {
+ ppp_state = 1;
+ } else if (ppp_state == 1 && cs == PPP_STATION) {
+ ppp_state = 2;
+ } else if (ppp_state == 2 && cs == PPP_ESCAPE) {
+ ppp_state = 3;
+ } else if ((ppp_state == 2 && cs == PPP_CONTROL) ||
+ (ppp_state == 3 && cs == PPP_CONTROL_ESCAPED)) {
+ ppp_state = 4;
+ } else if (ppp_state == 4 && cs == PPP_LCP_HI) {
+ ppp_state = 5;
+ } else if (ppp_state == 5 && cs == PPP_LCP_LOW) {
+ ppp_connection = 1;
+ break;
+ } else {
+ ppp_state = 0;
+ }
+
if (c == EOT)
exit(1);
if (c == '\r' || c == '\n' || np >= &name[sizeof name]) {
for (np = name; *np; np++)
if (isupper(*np))
*np = tolower(*np);
- return (1);
+ return (1 + ppp_connection);
}
static void