Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Feb 1996 01:55:36 -0800
From:      David Muir Sharnoff <muir@idiom.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/1019: getty cannot detect ppp logins
Message-ID:  <199602120955.BAA09186@idiom.com>
Resent-Message-ID: <199602121000.CAA12222@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1019
>Category:       bin
>Synopsis:       getty cannot detect ppp logins
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 12 02:00:02 PST 1996
>Last-Modified:
>Originator:     David Muir Sharnoff
>Organization:
Idiom Consulting - ISP, http://www.idiom.com
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

	One of the most common PPP dialers out there, Netscape 
	Navigator Personal Edition for Windows, cannot handle a
	UNIX-style login process.  It expects to do its 
	authentication via PAP.

>Description:

	getty doesn't notice when someone is trying to speack
	PPP protocols rather than loging in.

>How-To-Repeat:

	Try to talk PPP to Navigator Personal Edition for Windows

>Fix:

While it would be nice to totally rewrite getty, the following
smallish change will do the trick.   All of the fax-getty programs
need to be changed too.  

diff -r -c getty/gettytab.5 idiomgetty/gettytab.5
*** getty/gettytab.5	Wed Feb 15 05:59:56 1995
--- idiomgetty/gettytab.5	Tue Feb  6 16:06:57 1996
***************
*** 140,146 ****
--- 140,148 ----
  .It "pe	bool	false	use printer (hard copy) erase algorithm"
  .It "pf	num	0	delay"
  between first prompt and following flush (seconds)
+ .It "pp	bool	false	recognize ppp startup characters"
  .It "ps	bool	false	line connected to a"
+ .Ir "pu str	pppuser	PPP startup user"
  .Tn MICOM
  port selector
  .It "qu	str" Ta So Li \&^\e Sc Ta
diff -r -c getty/gettytab.h idiomgetty/gettytab.h
*** getty/gettytab.h	Thu Aug 25 22:19:12 1994
--- idiomgetty/gettytab.h	Wed Feb  7 15:03:32 1996
***************
*** 84,89 ****
--- 84,90 ----
  #define FL	gettystrs[21].value
  #define WE	gettystrs[22].value
  #define LN	gettystrs[23].value
+ #define PU	gettystrs[24].value
  
  /*
   * Numeric definitions.
***************
*** 133,138 ****
--- 134,140 ----
  #define AB	gettyflags[19].value
  #define DX	gettyflags[20].value
  #define	NP	gettyflags[21].value
+ #define PP	gettyflags[22].value
  
  int	getent();
  long	getnum();
diff -r -c getty/init.c idiomgetty/init.c
*** getty/init.c	Thu Aug 25 22:19:13 1994
--- idiomgetty/init.c	Tue Feb  6 16:20:30 1996
***************
*** 74,79 ****
--- 74,80 ----
  	{ "fl", &ltc.t_flushc },	/* flush output */
  	{ "we", &ltc.t_werasc },	/* word erase */
  	{ "ln", &ltc.t_lnextc },	/* literal next */
+ 	{ "pu", "pppuser" },		/* PPP startup user */
  	{ 0 }
  };
  
***************
*** 117,121 ****
--- 118,123 ----
  	{ "ab", 0 },			/* auto-baud detect with '\r' */
  	{ "dx", 0 },			/* set decctlq */
  	{ "np", 0 },			/* no parity at all (8bit chars) */
+ 	{ "pp", 0 },			/* recognize ppp startup codes */
  	{ 0 }
  };
diff -r -c getty/main.c idiomgetty/main.c
*** getty/main.c	Tue Feb  6 15:22:59 1996
--- idiomgetty/main.c	Mon Feb 12 01:49:51 1996
***************
*** 268,275 ****
  {
  	register int c;
  	register char *np;
! 	char cs;
  	int flushin = 1 /*FREAD*/;
  
  	/*
  	 * Interrupt may happen if we use CBREAK mode
--- 268,276 ----
  {
  	register int c;
  	register char *np;
! 	unsigned char cs;
  	int flushin = 1 /*FREAD*/;
+ 	int prevraw = '\0';
  
  	/*
  	 * Interrupt may happen if we use CBREAK mode
***************
*** 293,298 ****
--- 294,308 ----
  		oflush();
  		if (read(STDIN_FILENO, &cs, 1) <= 0)
  			exit(0);
+ 		if (PP && (prevraw == 0x7e) && (cs == 0xff)) {
+ 			/* start of a PPP frame */
+ 			syslog(LOG_DEBUG, "found PPP packet header");
+ 			strcpy(name, PU);
+ 			lower = 1; upper = 0; digit = 0;
+ 			signal(SIGINT, SIG_IGN);
+ 			return (1);
+ 		}
+ 		prevraw = cs;
  		if ((c = cs&0177) == 0)
  			return (0);
  		if (c == EOT || c == 4 /*^D*/)
***************
*** 326,334 ****
  			continue;
  		} else if (isdigit(c))
  			digit++;
! 		if (IG && (c <= ' ' || c > 0176))
  			continue;
  		*np++ = c;
  		putchr(cs);
  	}
  	signal(SIGINT, SIG_IGN);
--- 336,354 ----
  			continue;
  		} else if (isdigit(c))
  			digit++;
! 		if (IG && ! PP && (c <= ' ' || c > 0176))
  			continue;
  		*np++ = c;
+ 		if (PP) 
+ 			*np = 0;
+ 		if (PP && strstr(name, " } } ")) {
+ 			/* A common PPP startup string garbage sequence */
+ 			syslog(LOG_DEBUG, "found PPP garbage sequence");
+ 			strcpy(name, PU);
+ 			signal(SIGINT, SIG_IGN);
+ 			lower = 1; upper = 0; digit = 0;
+ 			return (1);
+ 		}
  		putchr(cs);
  	}
  	signal(SIGINT, SIG_IGN);

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602120955.BAA09186>