Subject: bin/14941: getty doesn't support non-standard MS-Windows PPP client
To: None <gnats-bugs@gnats.netbsd.org>
From: None <querbach@realtime.bc.ca>
List: netbsd-bugs
Date: 12/13/2001 16:44:32
>Number:         14941
>Category:       bin
>Synopsis:       getty doesn't support non-standard MS-Windows PPP client
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 16:45:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Querbach
>Release:        NetBSD-1.5.1
>Organization:
	Real-Time Systems Inc.
>Environment:
System: NetBSD qingdao 1.5.1 NetBSD 1.5.1 (RAID) #0: Tue Jul 17 22:25:40 PDT 2001 root@qingdao:/usr/src/sys/arch/i386/compile/RAID i386


>Description:
	MS-Windows 2000 offers a "direct-connect" PPP client option.  This
	client requires a non-standard handshake sequence before it will
	send the initial PPP packet which getty triggers on.  The handshake
	is as follows:

		The MS-Windows client sends the string "CLIENT" up to 5 or 6
		times, waiting for some undocumented response.  If the
		client receives  "\r\n", it will send the first PPP packet.

	Once getty receives the first PPP packet, it launches pppd as
	ppplogin, and the connection succeeds.

>How-To-Repeat:
	Change a com port's entry in /etc/gettytab to one of the ppp.<baud>
	entries, then HUP init to make it so.

	Use an MS-Windows 2000 client to attempt a direct PPP connection.
>Fix:
	Apply the following patch.  Note that the CVS version numbers are
	from my private archive.

Index: main.c
===================================================================
RCS file: /home/cvs/19/netbsd/src/libexec/getty/main.c,v
retrieving revision 1.1.1.1.10.1
diff -c -r1.1.1.1.10.1 main.c
*** main.c      2001/09/17 20:04:18     1.1.1.1.10.1
--- main.c      2001/12/14 00:43:27
***************
*** 536,541 ****
--- 536,551 ----
                        continue;
                *np++ = c;
                putchr(cs);
+ 
+               /*
+                * An MS-Windows direct connect PPP "client" won't send its
+                * first PPP packet until we respond to its "CLIENT" poll
+                * with a CRLF sequence.  We cater to yet another broken
+                * implementation of a previously-standard protocol...
+                */
+               *np = '\0';
+               if (strstr(name, "CLIENT"))
+                       putf("\r\n");
        }
        signal(SIGINT, SIG_IGN);
        *np = 0;
>Release-Note:
>Audit-Trail:
>Unformatted: