Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: binary MIME-Version: 1.0 X-Mailer: MIME-tools 5.411 (Entity 5.404) X-RT-Original-Encoding: iso-8859-1 Content-Length: 4068 From ghudson@MIT.EDU Sun Oct 25 15:27:15 1998 Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id PAA22021 for ; Sun, 25 Oct 1998 15:27:14 -0500 Received: from SMALL-GODS.MIT.EDU by MIT.EDU with SMTP id AA08533; Sun, 25 Oct 98 15:27:15 EST Received: by small-gods.mit.edu (SMI-8.6/4.7) id PAA29926; Sun, 25 Oct 1998 15:27:12 -0500 Message-Id: <199810252027.PAA29926@small-gods.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 Subject: rlogin speed-handling X-Send-Pr-Version: 3.99 >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: