[2986] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

krb5-appl/648: rlogin speed-handling

daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Sun Oct 25 15:31:01 1998

Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, ghudson@MIT.EDU
Date: Sun, 25 Oct 1998 15:27:12 -0500
From: ghudson@MIT.EDU
Reply-To: ghudson@MIT.EDU
To: krb5-bugs@MIT.EDU


>Number:         648
>Category:       krb5-appl
>Synopsis:       rlogin dumps core at high tty speeds
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    krb5-unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Sun Oct 25 15:28:01 EST 1998
>Last-Modified:
>Originator:     Greg Hudson
>Organization:
MIT
>Release:        1.0pl1
>Environment:
	
System: SunOS small-gods.mit.edu 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

>Description:
rlogin dumps core if the tty speed is over 38400.
>How-To-Repeat:
stty 115200
rlogin somewhere
>Fix:
This rewrite of the affected code mirrors the code in login.c.  In particular,
the arrays are borrowed from that file.

Index: krlogin.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/third/krb5/src/appl/bsd/krlogin.c,v
retrieving revision 1.3
diff -c -r1.3 krlogin.c
*** krlogin.c	1998/06/17 17:43:19	1.3
--- krlogin.c	1998/10/25 19:36:39
***************
*** 188,205 ****
  					   the original characteristics */
  int	confirm = 0;			/* ask if ~. is given before dying. */
  int	litout;
- #if defined(hpux) || defined(__hpux)
- char	*speeds[] =
- { "0", "50", "75", "110", "134", "150", "200", "300", "600",
-     "900", "1200", "1800", "2400", "3600", "4800", "7200", "9600",
-     "19200", "38400", "EXTA", "EXTB" };
- #else
- char    *speeds[] =
- { "0", "50", "75", "110", "134", "150", "200", "300",
-     "600", "1200", "1800", "2400", "4800", "9600", "19200", "38400" };
- #endif
  char	term[256] = "network";
  
  #ifndef POSIX_SIGNALS
  #ifndef sigmask
  #define sigmask(m)    (1 << ((m)-1))
--- 188,209 ----
  					   the original characteristics */
  int	confirm = 0;			/* ask if ~. is given before dying. */
  int	litout;
  char	term[256] = "network";
  
+ char *speeds[] = {
+ 	"0", "50", "75", "110", "134", "150", "200", "300", "600",
+ 	"1200", "1800", "2400", "4800", "9600", "19200", "38400",
+ };
+ #define	NSPEEDS	(sizeof(speeds) / sizeof(speeds[0]))
+ 
+ #ifdef POSIX_TERMIOS
+ /* this must be in sync with the list above */
+ speed_t b_speeds[] = {
+ 	B0, B50, B75, B110, B134, B150, B200, B300, B600,
+ 	B1200, B1800, B2400, B4800, B9600, B19200, B38400,
+ };
+ #endif
+ 
  #ifndef POSIX_SIGNALS
  #ifndef sigmask
  #define sigmask(m)    (1 << ((m)-1))
***************
*** 504,526 ****
        (void) strcpy(term, cp);
  #ifdef POSIX_TERMIOS
  	if (tcgetattr(0, &ttyb) == 0) {
! 		int ospeed = cfgetospeed (&ttyb);
  
! 		(void) strcat(term, "/");
! 		if (ospeed >= 50)
! 			/* On some systems, ospeed is the baud rate itself,
! 			   not a table index.  */
! 			sprintf (term + strlen (term), "%d", ospeed);
! 		else {
! 			(void) strcat(term, speeds[ospeed]);
! #if 0
! 			/* XXX - Not used, since the above code was
! 			 * not ifdef'd and it relied on cfget... */
! 
! 			/* some "posix" systems don't have cfget...
! 			 * so used CBAUD if it's there */
! 			(void) strcat(term, speeds[ttyb.c_cflag & CBAUD]);
! #endif
  		}
  	}
  #else
--- 508,521 ----
        (void) strcpy(term, cp);
  #ifdef POSIX_TERMIOS
  	if (tcgetattr(0, &ttyb) == 0) {
! 		int i;
! 		speed_t ospeed = cfgetospeed (&ttyb);
  
! 		for (i = 0; i < NSPEEDS; i++) {
! 		    if (b_speeds[i] == ospeed) {
! 			sprintf(term + strlen(term), "/%d", speeds[i]);
! 			break;
! 		    }
  		}
  	}
  #else
>Audit-Trail:
>Unformatted:

home help back first fref pref prev next nref lref last post