Subject: login & telnetd editing/message ignore gettytab, ftp lacks PASV, chflags(1) source and chflags(2) manpage typos, rcmd(3) & rexec(3) have accept(2)/connect(2) usage Index: src/bin/login/Makefile,login.c src/ucb/ftp/* src/libexec/telnetd/Makfile,telnetd.c src/libexec/getty/gettytab.{c,h} src/lib/libc/net/{rcmd,rexec}.c Description: 1) -- The patch for login makes login use gettytab. Login used to set the local editing mode to a hardcoded 0, and second, if you specify a non-standard login prompt string in gettytab (lm), it was used by getty as the initial login prompt, but if you hit an incorrect password, login issued the next login prompt which did not use the value from gettytab. Also, telnet always had login issue the login prompt, so from there, the lm value in gettytab was never used. Now this should be proper no matter where you come from, or which login attempt it is. The local editing setting affected both telnet connections, and repeated login prompts by login. Since local mode was hardcoded to 0, any attempt at editing the username written at the login prompt was not echoed correctly when editing (basically, any delete would do the delete internally, but visually nothing showed). 2) -- ftp(1), the client, lacks the 'passive' command. ftpd(8), the server, does have support for passive mode. 3) -- The chflags(1) source has the incorrect name/sccsid block at the beginning of the file. 4) -- chflags(2) manpage has an incorrect flag name 5) -- rexec(3) and rcmd(3) call accept(2) and connect(2) with incorrect number of arguments. Repeat-By: 1) -- For lm, try setting a different login message, and connect on a normal serial line. Observe that the different login prompt is used. Enter a username and password that isn't valid, and note that the next prompt will say "login: " no matter what was specified using lm in gettytab. For telnet, just connect and observe that "login: " is always prompted, no matter what value is set in gettytab. For the editing try to connect over a serial line and enter a username and delete characters again, and observe that they will get visually deleted as well. Enter an invalid username and password, and at the next login: prompt enter a username and try to delete characters. Observe that nothing is shown indicating which characters have been deleted. Or do the same using telnet. With this patch, both those problems are now addressed. In addition, another class in gettytab will be searched for by login, named "login". The default class is always applied first, but things can then be overridden or extended by the login class. For editing to work as expected, it is recommended that "cb" and "ce" are added to the default class. telnetd had made a copy of the gettytab sources. The same copy was proposed for login. The idea of having 3 copies of the same gettytab parsing code in the system is bad. Changes have been made in the telnetd and login Makefile to use the VPATH macro and refer to the getty source directory. 2) -- [curlyjoe:~] sms% rlogin vernon ftp localhost Connected to LOCALHOST.2bsd.com. 220 vernon.2bsd.com FTP server (Version 5.83 Sat Oct 26 15:17:31 PDT 1996) ready. Name (localhost:sms): 331 Password required for sms. Password: 230 User sms logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> passive ?Invalid command ftp> quit 221 Goodbye. 3) -- Observation. When I created chflags.c I copied a template file to edit and forgot to change the header from symcompact.c to chflags.c 4) -- man 2 chflags Note "ARCHIVE" is used instead of "SF_ARCHIVE" for the archive flag. 5) -- Compile rcmd.c / rexec.c on a system that has a strict compiler: rcmd.c:78:47: error: too many arguments to function call, expected 3, have 4 The same thing happens for the use of connect(). lint will catch this on a 2.11BSD system with the message connect: variable # of args. /usr/share/lint/llib-lc(54) :: rcmd.c(76) Fix: The login/telnetd/getty Description, Repeat-By and patch provided by bqt@softjar.se Cut where indicated and save to a file (/tmp/487.patch). Then: cd / patch -p0 < /tmp/487.patch cd /usr/src/lib/libc/net make rcmd.o rexec.o ar rv /lib/libc.a rexec.o rcmd.o ranlib /lib/libc.a cd profiled ar rv /usr/lib/libc_p.a rexec.o rcmd.o ranlib /usr/lib/libc_p.a cd .. make clean cd /usr/src/bin/login make install make clean cd /usr/src/libexec/telnetd make install make clean rm gettytab.c gettytab.h init.c subr.c cd /usr/src/libexec/getty make install make clean cd /usr/src/man/man2 make chflags.0 install -o bin -g bin -m 444 chflags.0 /usr/man/cat2 cd /usr/src/ucb/ftp make install make clean This and previous updates to 2.11BSD are available at the following locations: ftp://ftp.dfupdate.se/pub/pdp11/2.11BSD https://www.tuhs.org/Archive/Distributions/UCB/2.11BSD/Patches/ ftp://ftp.2bsd.com/2.11BSD http://www.2bsd.com/2.11BSD ---------------------------cut here-------------------- *** ./usr/src/lib/libc/net/rcmd.c.old Sun Feb 13 12:45:41 2000 --- ./usr/src/lib/libc/net/rcmd.c Sat Mar 22 15:40:29 2025 *************** *** 16,23 **** */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)rcmd.c 5.20.1 (2.11BSD) 1999/10/24"; ! #endif /* LIBC_SCCS and not lint */ #include #include --- 16,23 ---- */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)rcmd.c 5.21 (2.11BSD) 2025/3/22"; ! #endif #include #include *************** *** 73,79 **** sin.sin_family = hp->h_addrtype; bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length); sin.sin_port = rport; ! if (connect(s, (caddr_t)&sin, sizeof (sin), 0) >= 0) break; (void) close(s); if (errno == EADDRINUSE) { --- 73,79 ---- sin.sin_family = hp->h_addrtype; bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length); sin.sin_port = rport; ! if (connect(s, (caddr_t)&sin, sizeof (sin)) >= 0) break; (void) close(s); if (errno == EADDRINUSE) { *************** *** 135,141 **** (void) close(s2); goto bad; } ! s3 = accept(s2, &from, &len, 0); (void) close(s2); if (s3 < 0) { perror("accept"); --- 135,141 ---- (void) close(s2); goto bad; } ! s3 = accept(s2, &from, &len); (void) close(s2); if (s3 < 0) { perror("accept"); *** ./usr/src/lib/libc/net/rexec.c.old Thu Oct 2 23:34:58 1997 --- ./usr/src/lib/libc/net/rexec.c Sat Mar 22 15:35:36 2025 *************** *** 5,12 **** */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)rexec.c 5.2.1 (2.11BSD) 1997/10/2"; ! #endif LIBC_SCCS and not lint #include #include --- 5,12 ---- */ #if defined(LIBC_SCCS) && !defined(lint) ! static char sccsid[] = "@(#)rexec.c 5.3 (2.11BSD) 2025/3/22"; ! #endif #include #include *************** *** 81,87 **** (void) sprintf(num, "%u", port); (void) write(s, num, strlen(num)+1); { int len = sizeof (from); ! s3 = accept(s2, &from, &len, 0); close(s2); if (s3 < 0) { perror("accept"); --- 81,87 ---- (void) sprintf(num, "%u", port); (void) write(s, num, strlen(num)+1); { int len = sizeof (from); ! s3 = accept(s2, &from, &len); close(s2); if (s3 < 0) { perror("accept"); *** ./usr/src/bin/login/Makefile.old Sun Dec 1 16:45:56 1996 --- ./usr/src/bin/login/Makefile Fri Mar 21 18:53:02 2025 *************** *** 19,31 **** CFLAGS= -O -i SRCS= login.c ! OBJS= login.o MAN= all: login login: ${OBJS} ${CC} -o $@ ${CFLAGS} ${OBJS} -lutil clean: rm -f ${OBJS} core login --- 19,34 ---- CFLAGS= -O -i SRCS= login.c ! OBJS= login.o gettytab.o subr.o init.o MAN= + VPATH= ../../libexec/getty all: login login: ${OBJS} ${CC} -o $@ ${CFLAGS} ${OBJS} -lutil + + ${OBJS}: ../../libexec/getty/gettytab.h clean: rm -f ${OBJS} core login *** ./usr/src/bin/login/login.c.old Thu Apr 13 06:23:01 2023 --- ./usr/src/bin/login/login.c Sat Mar 22 06:12:52 2025 *************** *** 20,26 **** "@(#) Copyright (c) 1980, 1987, 1988 The Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)login.c 5.41 (2.11BSD) 2023/4/13"; #endif /* --- 20,26 ---- "@(#) Copyright (c) 1980, 1987, 1988 The Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)login.c 5.42 (2.11BSD) 2025/3/21"; #endif /* *************** *** 51,56 **** --- 51,57 ---- #include #include #include "pathnames.h" + #include "../../libexec/getty/gettytab.h" #ifdef KERBEROS #include *************** *** 71,77 **** --- 72,89 ---- int failures; char term[64], *hostname, *username, *tty; + #define TABBUFSIZ 512 + + char defent[TABBUFSIZ]; + char defstrs[TABBUFSIZ]; + char tabent[TABBUFSIZ]; + char tabstrs[TABBUFSIZ]; + struct sgttyb sgttyb; + + struct sgttyb tmode = { + 0, 0, CERASE, CKILL, 0 + }; struct tchars tc = { CINTR, CQUIT, CSTART, CSTOP, CEOT, CBRK }; *************** *** 101,106 **** --- 113,120 ---- char *ctime(), *ttyname(), *stypeof(), *crypt(), *getpass(); time_t time(); off_t lseek(); + long allflags; + int someflags; (void)signal(SIGALRM, timedout); (void)alarm((u_int)timeout); *************** *** 154,167 **** } else ask = 1; ioctlval = 0; (void)ioctl(0, TIOCLGET, &oldioctlval); - (void)ioctl(0, TIOCLSET, &ioctlval); (void)ioctl(0, TIOCNXCL, 0); (void)fcntl(0, F_SETFL, ioctlval); (void)ioctl(0, TIOCGETP, &sgttyb); sgttyb.sg_erase = CERASE; sgttyb.sg_kill = CKILL; (void)ioctl(0, TIOCSLTC, <c); (void)ioctl(0, TIOCSETC, &tc); (void)ioctl(0, TIOCSETP, &sgttyb); --- 168,195 ---- } else ask = 1; + gettable("default", defent, defstrs); + gendefaults(); + gettable("login", tabent, tabstrs); + setdefaults(); + + setchars(); + ioctlval = 0; (void)ioctl(0, TIOCLGET, &oldioctlval); (void)ioctl(0, TIOCNXCL, 0); (void)fcntl(0, F_SETFL, ioctlval); (void)ioctl(0, TIOCGETP, &sgttyb); sgttyb.sg_erase = CERASE; sgttyb.sg_kill = CKILL; + + allflags = setflags(2); + tmode.sg_flags = allflags & 0xffff; + if (NL) tmode.sg_flags |= CRMOD; + ioctl(0, TIOCSETP, &tmode); + someflags = allflags >> 16; + ioctl(0, TIOCLSET, &someflags); + (void)ioctl(0, TIOCSLTC, <c); (void)ioctl(0, TIOCSETC, &tc); (void)ioctl(0, TIOCSETP, &sgttyb); *************** *** 181,190 **** openlog("login", LOG_ODELAY, LOG_AUTH); ! for (cnt = 0;; ask = 1) { ! ioctlval = 0; ! (void)ioctl(0, TIOCSETD, &ioctlval); if (ask) { fflag = 0; getloginname(); --- 209,218 ---- openlog("login", LOG_ODELAY, LOG_AUTH); ! ioctlval = NTTYDISC; ! (void)ioctl(0, TIOCSETD, &ioctlval); + for (cnt = 0;; ask = 1) { if (ask) { fflag = 0; getloginname(); *************** *** 452,458 **** static char nbuf[UT_NAMESIZE + 1]; for (;;) { ! (void)printf("login: "); for (p = nbuf; (ch = getchar()) != '\n'; ) { if (ch == EOF) { badlogin(username); --- 480,486 ---- static char nbuf[UT_NAMESIZE + 1]; for (;;) { ! (void)printf(LM); for (p = nbuf; (ch = getchar()) != '\n'; ) { if (ch == EOF) { badlogin(username); *************** *** 578,600 **** struct ttyent *t; return(ttyid && (t = getttynam(ttyid)) ? t->ty_type : UNKNOWN); - } - - getstr(buf, cnt, err) - char *buf, *err; - int cnt; - { - char ch; - - do { - if (read(0, &ch, sizeof(ch)) != sizeof(ch)) - exit(1); - if (--cnt < 0) { - (void)fprintf(stderr, "%s too long\r\n", err); - sleepexit(1); - } - *buf++ = ch; - } while (ch); } sleepexit(eval) --- 606,611 ---- *** ./usr/src/libexec/telnetd/Makefile.old Wed Apr 26 08:50:47 2023 --- ./usr/src/libexec/telnetd/Makefile Fri Mar 21 18:53:03 2025 *************** *** 7,17 **** --- 7,20 ---- OBJS= telnetd.o gettytab.o subr.o init.o MAN= telnetd.0 MANSRC= telnetd.8 + VPATH= ../getty all: telnetd telnetd.0 telnetd: ${OBJS} ${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS} + + ${OBJS}: ../getty/gettytab.h telnetd.0: ${MANSRC} /usr/man/manroff ${MANSRC} > ${MAN} *** ./usr/src/libexec/telnetd/telnetd.c.old Thu Mar 13 12:52:07 2025 --- ./usr/src/libexec/telnetd/telnetd.c Fri Mar 21 19:16:20 2025 *************** *** 36,42 **** #include #include ! #include "gettytab.h" #define OPT_NO 0 /* won't do this option */ #define OPT_YES 1 /* will do this option */ --- 36,42 ---- #include #include ! #include "../getty/gettytab.h" #define OPT_NO 0 /* won't do this option */ #define OPT_YES 1 /* will do this option */ *** ./usr/src/libexec/getty/main.c.old Sat Mar 22 15:06:44 2025 --- ./usr/src/libexec/getty/main.c Sat Mar 22 15:09:12 2025 *************** *** 25,30 **** --- 25,32 ---- #include #include #include + #include + #include #include #include "gettytab.h" *************** *** 50,59 **** char hostname[32]; char name[16]; char dev[] = "/dev/"; - char ctty[] = "/dev/console"; char ttyn[32]; char *portselector(); - char *ttyname(); #define OBUFSIZ 128 #define TABBUFSIZ 512 --- 52,59 ---- *************** *** 437,443 **** char *ttyn, *slash; char datebuffer[60]; extern char editedhost[]; - extern char *ttyname(), *rindex(); while (*cp) { if (*cp != '%') { --- 437,442 ---- *** ./usr/src/libexec/getty/gettytab.h.old Thu Apr 13 06:23:01 2023 --- ./usr/src/libexec/getty/gettytab.h Fri Mar 21 18:53:03 2025 *************** *** 84,90 **** --- 84,96 ---- #define OPset gettyflags[2].set #define AP gettyflags[4].value #define APset gettyflags[2].set + /* EC is defined and used also for telnet, with a different meaning. + * However, in telnetd, we don't care about the getty EC anyway, so + * we just protect ourself from a double definition error this way. + */ + #ifndef EC #define EC gettyflags[5].value + #endif #define CO gettyflags[6].value #define CB gettyflags[7].value #define CK gettyflags[8].value *** ./usr/src/libexec/getty/gettytab.c.old Wed Mar 8 16:53:11 1989 --- ./usr/src/libexec/getty/gettytab.c Sat Mar 22 15:04:13 2025 *************** *** 4,12 **** * specifies the terms and conditions for redistribution. */ ! #ifndef lint ! static char sccsid[] = "@(#)gettytab.c 5.1 (Berkeley) 4/29/85"; ! #endif not lint #include --- 4,12 ---- * specifies the terms and conditions for redistribution. */ ! #if defined(DOSCCS) && !defined(lint) ! static char sccsid[] = "@(#)gettytab.c 5.2 (2.11BSD) 2025/3/22"; ! #endif #include *************** *** 30,36 **** register int c; register int i = 0, cnt = 0; char ibuf[TABBUFSIZ]; - char *cp2; int tf; tbuf = bp; --- 30,35 ---- *** ./usr/src/bin/chflags/chflags.c.old Sun Dec 4 01:38:23 1994 --- ./usr/src/bin/chflags/chflags.c Mon Mar 17 16:34:53 2025 *************** *** 1,12 **** /* ! * Program Name: symcompact.c ! * Date: December 3, 1994 ! * Author: S.M. Schultz ! * ! * ----------------- Modification History --------------- ! * Version Date Reason For Modification ! * 1.0 03Dec94 1. Initial release into the public domain. */ #include #include --- 1,11 ---- /* ! * 1994/12/01 Initial Release. ! * 2025/03/17 Fix incorrect filename, add customary sccsid string. */ + + #if !defined(LINT) && defined(DOSCCS) + static char sccsid[] = "@(#)chflags.c 1.1 (2.11BSD) 2025/3/17"; + #endif #include #include *** ./usr/src/man/man2/chflags.2.old Tue Dec 13 21:43:50 1994 --- ./usr/src/man/man2/chflags.2 Mon Mar 17 16:24:45 2025 *************** *** 29,35 **** .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" ! .\" @(#)chflags.2 8.1.1 (2.11BSD GTE) 11/28/94 .\" .TH CHFLAGS 2 "November 28, 1994" .UC 4 --- 29,35 ---- .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" ! .\" @(#)chflags.2 8.2 (2.11BSD) 2025/3/17 .\" .TH CHFLAGS 2 "November 28, 1994" .UC 4 *************** *** 74,80 **** UF_APPEND The file may only be appended to. .TP 15 ! ARCHIVED File is archived. .TP 15 SF_IMMUTABLE --- 74,80 ---- UF_APPEND The file may only be appended to. .TP 15 ! SF_ARCHIVED File is archived. .TP 15 SF_IMMUTABLE *** ./usr/src/ucb/ftp/ftp.1.old Tue Mar 21 18:24:31 1989 --- ./usr/src/ucb/ftp/ftp.1 Fri Mar 21 18:45:51 2025 *************** *** 13,21 **** .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" ! .\" @(#)ftp.1 6.13 (Berkeley) 3/21/89 .\" ! .TH FTP 1 "March 14, 1989" .UC 5 .SH NAME ftp \- ARPANET file transfer program --- 13,21 ---- .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" ! .\" @(#)ftp.1 6.14 (2.11BSD) 2025/3/21 .\" ! .TH FTP 1 "March 21, 2025" .UC 5 .SH NAME ftp \- ARPANET file transfer program *************** *** 471,476 **** --- 471,497 ---- .I ftp will also attempt to automatically log the user in to the FTP server (see below). + .TP + \fBpassive\fP + Toggle passive mode. If passive mode is turned on + (default is on), the ftp client will send a + .I PASV + command for all data connections instead of the usual + .I PORT + command. The + .I PASV + command requests that the remote server open a port for the data connection + and return the address of that port. The remote server listens on that + port and the client connects to it. When using the more traditional + .I PORT + command, the client listens on a port and sends that address to the remote + server, who connects back to it. Passive mode is useful when using + \fBftp\fP + through a gateway router or host that controls the directionality of + traffic. + (Note that though ftp servers are required to support the + .I PASV + command by RFC 1123, some do not.) .TP .B prompt Toggle interactive prompting. Interactive prompting *** ./usr/src/ucb/ftp/ftp.c.old Mon Feb 10 22:53:27 2003 --- ./usr/src/ucb/ftp/ftp.c Fri Mar 21 18:53:02 2025 *************** *** 16,22 **** */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)ftp.c 5.28.2 (2.11BSD) 2002/8/18"; #endif #include --- 16,22 ---- */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)ftp.c 5.29 (2.11BSD) 2025/3/21"; #endif #include *************** *** 39,44 **** --- 39,45 ---- #include #include #include + #include #include "ftp_var.h" *************** *** 1092,1097 **** --- 1093,1102 ---- * Need to start a listen on the data channel * before we send the command, otherwise the * server's connect may fail. + * + * Alternatively, if we're in passive mode, we need to request + * the remote side to give us a port to connect to, and get it + * set up. */ int sendport = -1; *************** *** 1131,1136 **** --- 1136,1181 ---- perror("ftp: getsockname"); goto bad; } + if (passive) { + char *p; + unsigned int port; + union { + unsigned long ad; + char adb[4]; + } a; + int a1,a2,a3,a4,p1,p2; + struct sockaddr_in in; + + result = command("PASV"); + if (code != 227) { + printf("Unexpected response.\n"); + goto bad; + } + p = strchr(reply_string, '('); + if (p == NULL) { + printf("Badly formatted response.\n"); + goto bad; + } + ++p; + if (sscanf(p, "%d,%d,%d,%d,%d,%d", + &a1, &a2, &a3, &a4, &p1, &p2) != 6) { + printf("Bad response to passive command.\n"); + goto bad; + } + a.adb[0] = a1; + a.adb[1] = a2; + a.adb[2] = a3; + a.adb[3] = a4; + port = p1*256+p2; + in.sin_family = AF_INET; + in.sin_addr.s_addr = a.ad; + in.sin_port = htons(port); + if (connect(data, &in, sizeof(in)) < 0) { + perror("Failed to connect.\n"); + goto bad; + } + return 0; + } if (listen(data, 1) < 0) perror("ftp: listen"); if (sendport) { *************** *** 1165,1178 **** struct sockaddr_in from; int s, fromlen = sizeof (from); ! s = accept(data, (struct sockaddr *) &from, &fromlen); ! if (s < 0) { ! perror("ftp: accept"); ! (void) close(data), data = -1; ! return (NULL); } - (void) close(data); - data = s; return (fdopen(data, mode)); } --- 1210,1225 ---- struct sockaddr_in from; int s, fromlen = sizeof (from); ! if (!passive) { ! s = accept(data, (struct sockaddr *) &from, &fromlen); ! if (s < 0) { ! perror("ftp: accept"); ! (void) close(data), data = -1; ! return (NULL); ! } ! (void) close(data); ! data = s; } return (fdopen(data, mode)); } *** ./usr/src/ucb/ftp/ftp_var.h.old Tue Jan 11 00:16:10 1994 --- ./usr/src/ucb/ftp/ftp_var.h Fri Mar 21 18:53:02 2025 *************** *** 14,20 **** * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ! * @(#)ftp_var.h 5.5.1 (2.11BSD GTE) 1/1/94 */ /* --- 14,20 ---- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ! * @(#)ftp_var.h 5.5.2 (2.11BSD) 2025/3/21 */ /* *************** *** 33,38 **** --- 33,39 ---- int interactive; /* interactively prompt on m* cmds */ int debug; /* debugging level */ int bell; /* ring bell on cmd completion */ + int passive; /* passive mode */ int doglob; /* glob local file names */ int autologin; /* establish user account on connection */ int proxy; /* proxy server connection active */ *** ./usr/src/ucb/ftp/main.c.old Fri Oct 3 00:36:38 1997 --- ./usr/src/ucb/ftp/main.c Fri Mar 21 18:53:02 2025 *************** *** 20,26 **** "@(#) Copyright (c) 1985, 1989 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)main.c based on 5.13.1 (2.11BSD) 1997/10/2"; #endif /* --- 20,26 ---- "@(#) Copyright (c) 1985, 1989 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)main.c based on 5.14 (2.11BSD) 2025/3/21"; #endif /* *************** *** 113,118 **** --- 113,119 ---- cpend = 0; /* no pending replies */ proxy = 0; /* proxy not active */ crflag = 1; /* strip c.r. on ascii gets */ + passive = 1; /* default to passive mode */ /* * Set up the home directory in case we're globbing. */ *** ./usr/src/ucb/ftp/cmds.c.old Mon Oct 31 10:55:57 2022 --- ./usr/src/ucb/ftp/cmds.c Fri Mar 21 18:53:02 2025 *************** *** 16,22 **** */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)cmds.c 5.18.2 (2.11BSD) 2022/10/31"; #endif /* --- 16,22 ---- */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)cmds.c 5.18.3 (2.11BSD) 2025/03/21"; #endif /* *************** *** 812,817 **** --- 812,818 ---- } pswitch(0); } + printf("Passive mode: %s\n", onoff(passive)); printf("Mode: %s; Type: %s; Form: %s; Structure: %s\n", modename, typename, formname, structname); printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n", *************** *** 853,858 **** --- 854,871 ---- bell = !bell; printf("Bell mode %s.\n", onoff(bell)); code = bell; + } + + /* + * Set active or passive mode + */ + /*VARARGS*/ + setpassive() + { + + passive = !passive; + printf("Passive mode %s.\n", onoff(passive)); + code = passive; } /* *** ./usr/src/ucb/ftp/cmdtab.c.old Tue Jan 11 00:15:55 1994 --- ./usr/src/ucb/ftp/cmdtab.c Sat Mar 22 15:12:52 2025 *************** *** 15,22 **** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ ! #if !defined(lint) && !defined(pdp11) ! static char sccsid[] = "@(#)cmdtab.c 5.9.1 (2.11BSD GTE) 1/1/94"; #endif #include "ftp_var.h" --- 15,22 ---- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ ! #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)cmdtab.c 5.9.2 (2.11BSD) 2025/3/21"; #endif #include "ftp_var.h" *************** *** 26,32 **** */ int setascii(), setbell(), setbinary(), setdebug(), setform(); int setglob(), sethash(), setmode(), setpeer(), setport(); ! int setprompt(), setstruct(); int settenex(), settrace(), settype(), setverbose(); int disconnect(), restart(), reget(), syst(); int cd(), lcd(), delete(), mdelete(), user(); --- 26,32 ---- */ int setascii(), setbell(), setbinary(), setdebug(), setform(); int setglob(), sethash(), setmode(), setpeer(), setport(); ! int setprompt(), setstruct(), setpassive(); int settenex(), settrace(), settype(), setverbose(); int disconnect(), restart(), reget(), syst(); int cd(), lcd(), delete(), mdelete(), user(); *************** *** 76,81 **** --- 76,82 ---- char nmaphelp[] = "set templates for default file name mapping"; char ntranshelp[] = "set translation table for default file name mapping"; char porthelp[] = "toggle use of PORT cmd for each data connection"; + char passivehelp[] = "toggle passive transfer mode"; char prompthelp[] = "force interactive prompting on multiple commands"; char proxyhelp[] = "issue command on alternate connection"; char pwdhelp[] = "print working directory on remote machine"; *************** *** 147,152 **** --- 148,154 ---- { "nlist", nlisthelp, 1, 1, 1, ls }, { "ntrans", ntranshelp, 0, 0, 1, setntrans }, { "open", connecthelp, 0, 0, 1, setpeer }, + { "passive", passivehelp, 0, 0, 0, setpassive }, { "prompt", prompthelp, 0, 0, 0, setprompt }, { "proxy", proxyhelp, 0, 0, 1, doproxy }, { "sendport", porthelp, 0, 0, 0, setport }, *** ./VERSION.old Fri Mar 21 06:33:48 2025 --- ./VERSION Fri Mar 21 18:31:30 2025 *************** *** 1,5 **** ! Current Patch Level: 486 ! Date: March 21, 2025 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 487 ! Date: March 22, 2025 2.11 BSD ============