Subject: bin/3135: pppd/chat REPORT does not report entire line as documented
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bruce@zuhause.mn.org>
List: netbsd-bugs
Date: 01/23/1997 23:16:02
>Number:         3135
>Category:       bin
>Synopsis:       pppd/char REPORT does not report entire line as documented
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 23 21:35:02 1997
>Last-Modified:
>Originator:     Bruce Albrecht
>Organization:
	
>Release:        1/18/97 tar files
>Environment:
	NetBSD-current Amiga
System: NetBSD zuhause 1.2B NetBSD 1.2B (ZuHause) #0: Wed Nov 27 01:41:50 CST 1996 root@zuhause:/NetBSD-current/usr/src/sys/arch/amiga/compile/ZuHause amiga


>Description:
	
The chat documentation says that REPORT strings will be displayed in the log through
the end of line.  This is useful for checking to see at which speed the connection
was made.  However, if the REPORT string is the same as the EXPECT string, it will
only display the EXPECT string in the log and drop the rest of the line.
>How-To-Repeat:
	
REPORT CONNECT
ABORT BUSY
ABORT 'NO CARRIER'
'' AT+FCLASS=0Z2
OK AT&n10&u10M1DT<YOUR FAVORITE PPP # HERE>
CONNECT ''
>Fix:
	
*** /usr/src/usr.sbin/pppd/chat/chat.c	Mon Oct 14 12:03:46 1996
--- /home/bruce/chat.c	Thu Jan 23 23:03:33 1997
***************
*** 1163,1169 ****
  register char *string;
      {
      char temp[STR_LEN];
!     int c, printed = 0, len, minlen;
      register char *s = temp, *end = s + STR_LEN;
  
      fail_reason = (char *)0;
--- 1163,1169 ----
  register char *string;
      {
      char temp[STR_LEN];
!     int c, printed = 0, len, minlen, gotit=0;
      register char *s = temp, *end = s + STR_LEN;
  
      fail_reason = (char *)0;
***************
*** 1223,1260 ****
  
  	*s++ = c;
  
- 	if (s - temp >= len &&
- 	    c == string[len - 1] &&
- 	    strncmp(s - len, string, len) == 0)
- 	    {
- 	    if (verbose)
- 		{
- 		logf(" -- got it\n");
- 		}
- 
- 	    alarm(0);
- 	    alarmed = 0;
- 	    return (1);
- 	    }
- 
- 	for (n = 0; n < n_aborts; ++n)
- 	    {
- 	    if (s - temp >= (abort_len = strlen(abort_string[n])) &&
- 		strncmp(s - abort_len, abort_string[n], abort_len) == 0)
- 	        {
- 		if (verbose)
- 		    {
- 		    logf(" -- failed\n");
- 		    }
- 		
- 		alarm(0);
- 		alarmed = 0;
- 		exit_code = n + 4;
- 		strcpy(fail_reason = fail_buffer, abort_string[n]);
- 		return (0);
- 	        }
- 	    }
- 
  	if (!report_gathering)
  	    {
  	    for (n = 0; n < n_reports; ++n)
--- 1223,1228 ----
***************
*** 1287,1292 ****
--- 1255,1304 ----
  	        {
  		report_gathering = 0;
  		fprintf (report_fp, "chat:  %s\n", report_buffer);
+ 		if (gotit)
+ 		    {
+ 		    alarm(0);
+ 		    alarmed=0;
+ 		    return (1);
+ 		    }
+ 	        }
+ 	    }
+ 
+ 	if (s - temp >= len &&
+ 	    c == string[len - 1] &&
+ 	    strncmp(s - len, string, len) == 0)
+ 	    {
+ 	    if (verbose)
+ 		{
+ 		logf(" -- got it\n");
+ 		}
+ 	    if (!report_gathering)
+ 		{
+ 	    	alarm(0);
+ 	    	alarmed = 0;
+ 	    	return (1);
+ 		}
+ 	    else
+ 		{
+ 		gotit=1;
+ 		}
+ 	    }
+ 
+ 	for (n = 0; n < n_aborts; ++n)
+ 	    {
+ 	    if (s - temp >= (abort_len = strlen(abort_string[n])) &&
+ 		strncmp(s - abort_len, abort_string[n], abort_len) == 0)
+ 	        {
+ 		if (verbose)
+ 		    {
+ 		    logf(" -- failed\n");
+ 		    }
+ 		
+ 		alarm(0);
+ 		alarmed = 0;
+ 		exit_code = n + 4;
+ 		strcpy(fail_reason = fail_buffer, abort_string[n]);
+ 		return (0);
  	        }
  	    }
  
>Audit-Trail:
>Unformatted: