Subject: ftp client long passwords, getty forcing even parity (#444) Index: ucb/ftp/ftp.c,libexec/getty/main.c 2.11BSD Description: 1. The ftp client program can not login into systems which use passwords longer than 8 characters. 2. Getty forcing even parity caused problems with folks using terminal emulator programs or the 'vt' (virtual tape) driver to load the distribution over a serial port. Repeat-By: 1. Use 'ftp' to connect to a system requiring a password longer than 8 characters. Login attempts will not succeed because 'ftp' only reads and passes 8 characters to the remote system. 2. When the system boots the kernel and init use 8n1 to print the bootup and autoconf information. Thus terminal emulators, etc were set to 8n1 but when getty started (to present the login prompt) getty would force even parity causing the data to be corrupted. Fix: I've been sitting on these changes for a long time (August 2002 at least) and finally decided to get them posted. Rather than implement long passwords for the system as a whole (a very large scale change) the 'ftp' client was modified to accept longer strings and send them over the socket to the remote system. Getty was modified to look at the 'Any Parity' (AP) flag from the gettytab(8) database and if set leave the parity alone. If AP is not set then even parity is used unless OP (Odd Parity) was specifically requested. This is necessary but might not be sufficient. The console driver in the kernel may need a change as well but since no response was received to the "test the getty change" I'll wait on the kernel change for a while. Simple to apply - cut where indicated and save to a file (/tmp/444) and then: patch -p0 < /tmp/444 cd /usr/src/libexec/getty make install make clean cd /usr/src/ucb/ftp make install make clean As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.CATO.GD-AIS.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. NOTE: try the first one (which has changed name due to managerial playing) since it's a faster link. Cheers, Steven Schultz -------------------------------cut here-------------------- *** /usr/src/libexec/getty/main.c.OLD Fri Dec 9 22:42:41 1994 --- /usr/src/libexec/getty/main.c Mon Feb 10 20:25:16 2003 *************** *** 9,15 **** "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)main.c 5.5.1 (2.11BSD GTE) 12/9/94"; #endif /* --- 9,15 ---- "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)main.c 5.5.2 (2.11BSD) 2003/2/10"; #endif /* *************** *** 383,391 **** char c; c = cc; ! c |= partab[c&0177] & 0200; ! if (OP) ! c ^= 0200; if (!UB) { outbuf[obufcnt++] = c; if (obufcnt >= OBUFSIZ) --- 383,400 ---- char c; c = cc; ! /* ! * If "any" parity do nothing otherwise set even parity unless OP is ! * set. Since 'ap' is set in the "default" entry of /etc/gettytab this ! * has the effect of disabling parity on output without having to change ! * the kernel. ! */ ! if (!AP) { ! c |= partab[c & 0177] & 0200; ! if (OP) ! c ^= 0200; ! } ! if (!UB) { outbuf[obufcnt++] = c; if (obufcnt >= OBUFSIZ) *** /usr/src/ucb/ftp/ftp.c.OLD Thu Oct 2 22:34:54 1997 --- /usr/src/ucb/ftp/ftp.c Sun Aug 18 16:11:39 2002 *************** *** 16,22 **** */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)ftp.c 5.28.1 (2.11BSD) 1997/10/2"; #endif #include --- 16,22 ---- */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)ftp.c 5.28.2 (2.11BSD) 2002/8/18"; #endif #include *************** *** 1700,1703 **** --- 1700,1742 ---- } } return(new); + } + + #include + + char * + getpass(prompt) + char *prompt; + { + struct sgttyb ttyb; + int flags; + register char *p; + register c; + FILE *fi; + static char pbuf[129]; + int (*signal())(); + int (*sig)(); + + if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL) + fi = stdin; + else + setbuf(fi, (char *)NULL); + sig = signal(SIGINT, SIG_IGN); + ioctl(fileno(fi), TIOCGETP, &ttyb); + flags = ttyb.sg_flags; + ttyb.sg_flags &= ~ECHO; + ioctl(fileno(fi), TIOCSETP, &ttyb); + fprintf(stderr, "%s", prompt); fflush(stderr); + for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) { + if (p < &pbuf[sizeof (pbuf) - 1]) + *p++ = c; + } + *p = '\0'; + fprintf(stderr, "\n"); fflush(stderr); + ttyb.sg_flags = flags; + ioctl(fileno(fi), TIOCSETP, &ttyb); + signal(SIGINT, sig); + if (fi != stdin) + fclose(fi); + return(pbuf); } *** /VERSION.OLD Sun Aug 4 09:37:10 2002 --- /VERSION Mon Feb 10 19:30:35 2003 *************** *** 1,5 **** ! Current Patch Level: 443 ! Date: August 4, 2002 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 444 ! Date: February 10, 2003 2.11 BSD ============