Module Name: othersrc Committed By: lukem Date: Sun Apr 25 07:50:37 UTC 2021
Modified Files: othersrc/usr.bin/tnftp/src: cmds.c fetch.c ftp.1 ftp.c main.c progressbar.c progressbar.h ssl.c version.h Log Message: Merge differences between NetBSD-20200608 and NetBSD-2021-01-31 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 othersrc/usr.bin/tnftp/src/cmds.c cvs rdiff -u -r1.24 -r1.25 othersrc/usr.bin/tnftp/src/fetch.c cvs rdiff -u -r1.16 -r1.17 othersrc/usr.bin/tnftp/src/ftp.1 \ othersrc/usr.bin/tnftp/src/progressbar.c cvs rdiff -u -r1.22 -r1.23 othersrc/usr.bin/tnftp/src/ftp.c cvs rdiff -u -r1.21 -r1.22 othersrc/usr.bin/tnftp/src/main.c cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/tnftp/src/progressbar.h cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/tnftp/src/ssl.c cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/tnftp/src/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/usr.bin/tnftp/src/cmds.c diff -u othersrc/usr.bin/tnftp/src/cmds.c:1.19 othersrc/usr.bin/tnftp/src/cmds.c:1.20 --- othersrc/usr.bin/tnftp/src/cmds.c:1.19 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/cmds.c Sun Apr 25 07:50:37 2021 @@ -1,8 +1,8 @@ -/* $NetBSD: cmds.c,v 1.19 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: cmds.c,v 1.140 2019/02/06 07:56:42 martin Exp */ +/* $NetBSD: cmds.c,v 1.20 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: cmds.c,v 1.141 2021/01/06 09:15:59 lukem Exp */ /*- - * Copyright (c) 1996-2009 The NetBSD Foundation, Inc. + * Copyright (c) 1996-2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -101,7 +101,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -__RCSID(" NetBSD: cmds.c,v 1.140 2019/02/06 07:56:42 martin Exp "); +__RCSID(" NetBSD: cmds.c,v 1.141 2021/01/06 09:15:59 lukem Exp "); #endif #endif /* not lint */ @@ -1138,7 +1138,7 @@ setdebug(int argc, char *argv[]) options |= SO_DEBUG; else options &= ~SO_DEBUG; - fprintf(ttyout, "Debugging %s (ftp_debug=%d).\n", onoff(ftp_debug), ftp_debug); + fprintf(ttyout, "Debugging %s (debug=%d).\n", onoff(ftp_debug), ftp_debug); code = ftp_debug > 0; } Index: othersrc/usr.bin/tnftp/src/fetch.c diff -u othersrc/usr.bin/tnftp/src/fetch.c:1.24 othersrc/usr.bin/tnftp/src/fetch.c:1.25 --- othersrc/usr.bin/tnftp/src/fetch.c:1.24 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/fetch.c Sun Apr 25 07:50:37 2021 @@ -1,5 +1,5 @@ -/* $NetBSD: fetch.c,v 1.24 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: fetch.c,v 1.231 2019/04/04 00:36:09 christos Exp */ +/* $NetBSD: fetch.c,v 1.25 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: fetch.c,v 1.232 2020/07/11 00:29:38 lukem Exp */ /*- * Copyright (c) 1997-2015 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID(" NetBSD: fetch.c,v 1.231 2019/04/04 00:36:09 christos Exp "); +__RCSID(" NetBSD: fetch.c,v 1.232 2020/07/11 00:29:38 lukem Exp "); #endif /* not lint */ /* @@ -1302,7 +1302,7 @@ fetch_url(const char *url, const char *p DPRINTF("%s: `%s' proxyenv `%s'\n", __func__, url, STRorNULL(penv)); - oldquit = oldalrm = oldint = oldpipe = NULL; + oldquit = oldalrm = oldint = oldpipe = SIG_ERR; closefunc = NULL; fin = NULL; fout = NULL; @@ -1579,9 +1579,9 @@ fetch_url(const char *url, const char *p bytes = 0; hashbytes = mark; - if (oldalrm) { + if (oldalrm != SIG_ERR) { (void)xsignal(SIGALRM, oldalrm); - oldalrm = NULL; + oldalrm = SIG_ERR; } progressmeter(-1); @@ -1743,14 +1743,14 @@ chunkerror: warnx("Improper response from `%s:%s'", ui.host, ui.port); cleanup_fetch_url: - if (oldint) + if (oldint != SIG_ERR) (void)xsignal(SIGINT, oldint); - if (oldpipe) + if (oldpipe != SIG_ERR) (void)xsignal(SIGPIPE, oldpipe); - if (oldalrm) + if (oldalrm != SIG_ERR) (void)xsignal(SIGALRM, oldalrm); - if (oldquit) - (void)xsignal(SIGQUIT, oldpipe); + if (oldquit != SIG_ERR) + (void)xsignal(SIGQUIT, oldquit); if (fin != NULL) fetch_close(fin); else if (s != -1) Index: othersrc/usr.bin/tnftp/src/ftp.1 diff -u othersrc/usr.bin/tnftp/src/ftp.1:1.16 othersrc/usr.bin/tnftp/src/ftp.1:1.17 --- othersrc/usr.bin/tnftp/src/ftp.1:1.16 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/ftp.1 Sun Apr 25 07:50:37 2021 @@ -1,7 +1,7 @@ -.\" $NetBSD: ftp.1,v 1.16 2020/07/04 09:59:07 lukem Exp $ -.\" from NetBSD: ftp.1,v 1.136 2017/07/03 21:34:57 wiz Exp +.\" $NetBSD: ftp.1,v 1.17 2021/04/25 07:50:37 lukem Exp $ +.\" from NetBSD: ftp.1,v 1.144 2021/01/31 08:59:40 lukem Exp .\" -.\" Copyright (c) 1996-2015 The NetBSD Foundation, Inc. +.\" Copyright (c) 1996-2021 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation @@ -58,7 +58,7 @@ .\" .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94 .\" -.Dd April 24, 2015 +.Dd January 31, 2021 .Dt FTP 1 .Os .Sh NAME @@ -66,7 +66,7 @@ .Nd Internet file transfer program .Sh SYNOPSIS .Nm -.Op Fl 46AadefginpRtVv +.Op Fl 46AadefginpRtVv? .Op Fl N Ar netrc .Op Fl o Ar output .Op Fl P Ar port @@ -85,12 +85,11 @@ .Xc .Oc .Ek -.Op Fl x Ar xferbufsize +.Op Fl x Ar xfersize .Bk -words .\" [[user@]host [port]] .Oo -.Oo Ar user Ns Li \&@ Oc Ns Ar host -.Op Ar port +.Oo Ar user Ns Li \&@ Oc Ns Ar host Oo Ar port Oc .Oc .Ek .Bk -words @@ -123,7 +122,7 @@ .Ar host Oo Li \&: Ar port Oc .Li / Ar path .Op Li / -.Op Li ;type= Ar X +.Op Li ;type= Ar type .Oc .Sm on .Ek @@ -140,12 +139,24 @@ .Oc .Sm on .Ek -.Op Ar \&.\&.\&. +.Bk -words +.\" [https://[user[:password]@]host[:port]/path] +.Sm off +.Oo +.Li https:// +.Oo Ar user +.Op Li \&: Ar password +.Li \&@ Oc +.Ar host Oo Li \&: Ar port Oc +.Li / Ar path +.Oc +.Sm on +.Ek +.Ar \&... .Nm .Bk -words -.Fl u Ar URL Ar file +.Fl u Ar url Ar .Ek -.Op Ar \&.\&.\&. .Sh DESCRIPTION .Nm is the user interface to the Internet standard File Transfer Protocol. @@ -285,11 +296,11 @@ bytes/second. Refer to .Ic rate for more information. -.It Fl u Ar URL file Op \&.\&.\&. +.It Fl u Ar url Ar Upload files on the command line to -.Ar URL +.Ar url where -.Ar URL +.Ar url is one of the ftp URL types as supported by auto-fetch (with an optional target filename for single file uploads), and .Ar file @@ -313,12 +324,14 @@ Forces .Nm to show all responses from the remote server, as well as report on data transfer statistics. -.It Fl x Ar xferbufsize +.It Fl x Ar xfersize Set the size of the socket send and receive buffers to -.Ar xferbufsize . +.Ar xfersize . Refer to .Ic xferbuf for more information. +.It Fl ? +Display help to stdout, and exit. .El .Pp The client host with which @@ -443,6 +456,16 @@ when an ascii type transfer is made, the distinguished from a record delimiter only when .Ic \&cr is off. +.It Ic debug Op Ar debug-value +Toggle debugging mode. +If an optional +.Ar debug-value +is specified it is used to set the debugging level. +When debugging is on, +.Nm +prints each command sent to the remote machine, preceded +by the string +.Ql \-\-> . .It Ic delete Ar remote-file Delete the file .Ar remote-file @@ -478,18 +501,16 @@ Toggle command line editing, and context completion. This is automatically enabled if input is from a terminal, and disabled otherwise. -.It Ic epsv epsv4 epsv6 +.It Ic epsv , epsv4 , epsv6 Toggle the use of the extended .Dv EPSV and .Dv EPRT commands on all IP, IPv4, and IPv6 connections respectively. First try -.Dv EPSV / -.Dv EPRT , +.Dv EPSV Ns \^/\^ Ns Dv EPRT , and then -.Dv PASV / -.Dv PORT . +.Dv PASV Ns \^/\^ Ns Dv PORT . This is enabled by default. If an extended command fails then this option will be temporarily disabled for the duration of the current connection, or until @@ -520,16 +541,6 @@ format is .It Ic ftp Ar host Op Ar port A synonym for .Ic open . -.It Ic ftp_debug Op Ar ftp_debug-value -Toggle debugging mode. -If an optional -.Ar ftp_debug-value -is specified it is used to set the debugging level. -When debugging is on, -.Nm -prints each command sent to the remote machine, preceded -by the string -.Ql \-\-> . .It Ic gate Op Ar host Op Ar port Toggle gate-ftp mode, which used to connect through the TIS FWTK and Gauntlet ftp proxies. @@ -592,7 +603,7 @@ Expansion of a directory name is likely different from expansion of the name of an ordinary file: the exact result depends on the foreign operating system and ftp server, and can be previewed by doing -.Ql mls remote-files \- +.Sq Li mls remote-files \- . Note: .Ic mget , .Ic mput @@ -673,32 +684,32 @@ To invoke a macro, use the command (see above). .Pp The macro processor interprets -.Sq $ +.Ql $ and -.Sq \e +.Ql \e as special characters. A -.Sq $ +.Ql $ followed by a number (or numbers) is replaced by the corresponding argument on the macro invocation command line. A -.Sq $ +.Ql $ followed by an -.Sq i +.Ql i signals the macro processor that the executing macro is to be looped. On the first pass -.Dq $i +.Ql $i is replaced by the first argument on the macro invocation command line, on the second pass it is replaced by the second argument, and so on. A -.Sq \e +.Ql \e followed by any character is replaced by that character. Use the -.Sq \e +.Ql \e to prevent special treatment of the -.Sq $ . +.Ql $ . .It Ic mdelete Op Ar remote-files Delete the .Ar remote-files @@ -733,7 +744,7 @@ Files are transferred into the local wor which can be changed with .Ql lcd directory ; new local directories can be created with -.Ql "\&! mkdir directory" . +.Sq Li "\&! mkdir directory" . .It Ic mkdir Ar directory-name Make a directory on the remote machine. .It Ic mls Ar remote-files local-file @@ -756,7 +767,7 @@ Display the contents of in a machine-parsable form, using .Dv MLSD . The format of display can be changed with -.Sq "remopts mlst ..." . +.Sq Li "remopts mlst ..." . .It Ic mlst Op Ar remote-path Display the details about .Ar remote-path @@ -764,7 +775,7 @@ Display the details about in a machine-parsable form, using .Dv MLST . The format of display can be changed with -.Sq "remopts mlst ..." . +.Sq Li "remopts mlst ..." . .It Ic mode Ar mode-name Set the file transfer .Ic mode @@ -810,7 +821,7 @@ If the file does not exist on the current system, the remote file is considered .Ic newer . Otherwise, this command is identical to -.Ar get . +.Ic get . .It Ic nlist Op Ar remote-path Op Ar local-file A synonym for .Ic ls . @@ -835,7 +846,8 @@ The mapping follows the pattern set by .Ar inpattern and .Ar outpattern . -.Op Ar Inpattern +.Pp +.Ar inpattern is a template for incoming filenames (which may have already been processed according to the .Ic ntrans @@ -844,16 +856,16 @@ and settings). Variable templating is accomplished by including the sequences -.Dq $1 , -.Dq $2 , -\&... -.Dq $9 +.Ql $1 , +.Ql $2 , +\&...\|, +.Ql $9 in .Ar inpattern . Use -.Sq \e +.Ql \e to prevent this special treatment of the -.Sq $ +.Ql $ character. All other characters are treated literally, and are used to determine the .Ic nmap @@ -861,53 +873,72 @@ All other characters are treated literal variable values. For example, given .Ar inpattern -$1.$2 and the remote file name "mydata.data", $1 would have the value -"mydata", and $2 would have the value "data". +.Sq Li $1.$2 +and the remote file name +.Sq Li mydata.data , +.Ql $1 +would have the value +.Sq Li mydata , +and +.Ql $2 +would have the value +.Sq Li data . +.Pp The .Ar outpattern determines the resulting mapped filename. The sequences -.Dq $1 , -.Dq $2 , -\&... -.Dq $9 +.Ql $1 , +.Ql $2 , +\&...\|, +.Ql $9 are replaced by any value resulting from the .Ar inpattern template. The sequence -.Dq $0 +.Ql $0 is replaced by the original filename. Additionally, the sequence .Dq Op Ar seq1 , Ar seq2 is replaced by -.Op Ar seq1 +.Ar seq1 if .Ar seq1 is not a null string; otherwise it is replaced by .Ar seq2 . For example, the command .Pp -.Bd -literal -offset indent -compact -nmap $1.$2.$3 [$1,$2].[$2,file] -.Ed +.Dl nmap $1.$2.$3 [$1,$2].[$2,file] .Pp would yield -the output filename "myfile.data" for input filenames "myfile.data" and -"myfile.data.old", "myfile.file" for the input filename "myfile", and -"myfile.myfile" for the input filename ".myfile". +the output filename +.Sq Li myfile.data +for input filenames +.Sq Li myfile.data +and +.Sq Li myfile.data.old , +.Sq Li myfile.file +for the input filename +.Sq Li myfile , +and +.Sq Li myfile.myfile +for the input filename +.Sq Li "\&.myfile" . Spaces may be included in .Ar outpattern , as in the example: +.Pp .Dl nmap $1 sed "s/ *$//" > $1 +.Pp Use the -.Sq \e +.Ql \e character to prevent special treatment of the -.Sq $ , -.Sq \&[ , -.Sq \&] , +.Ql $ , +.Ql \&[ , +.Ql \&] , and -.Sq \&, +.Ql \&, characters. .It Ic ntrans Op Ar inchars Op Ar outchars Set or unset the filename character translation mechanism. @@ -1028,7 +1059,7 @@ The progress bar will be disabled for a as .Sq Fl or a command that starts with -.Sq \&| . +.Ql \&| . Refer to .Sx FILE NAMING CONVENTIONS for more information. @@ -1091,11 +1122,13 @@ The first command should be an .Ic open , to establish the secondary control connection. -Enter the command "proxy ?" to see other +Enter the command +.Sq Li "proxy ?" +to see other .Tn FTP commands executable on the secondary connection. The following commands behave differently when prefaced by -.Ic proxy : +.Ic proxy\^ : .Ic open will not define new macros during the auto-login process, .Ic close @@ -1140,7 +1173,7 @@ machine. .It Ic quit A synonym for .Ic bye . -.It Ic quote Ar arg1 arg2 ... +.It Ic quote Op Ar arg ... The arguments specified are sent, verbatim, to the remote .Tn FTP server. @@ -1154,7 +1187,7 @@ is 0, disable the throttle. .Pp .Ar direction may be one of: -.Bl -tag -width "all" -offset indent -compact +.Bl -tag -width ".Cm all" -offset indent -compact .It Cm all Both directions. .It Cm get @@ -1167,7 +1200,7 @@ Outgoing transfers. can be modified on the fly by .Ar increment bytes (default: 1024) each time a given signal is received: -.Bl -tag -width "SIGUSR1" -offset indent +.Bl -tag -width ".Dv SIGUSR1" -offset indent .It Dv SIGUSR1 Increment .Ar maximum @@ -1225,7 +1258,7 @@ to Remote .Tn FTP commands known to support options include: -.Sq MLST +.Dv MLST (used for .Dv MLSD and @@ -1278,10 +1311,16 @@ local filename for a .Ic get or .Ic mget -command, a ".1" is appended to the name. +command, a +.Ql \&.1 +is appended to the name. If the resulting name matches another existing file, -a ".2" is appended to the original name. -If this process continues up to ".99", an error +a +.Ql \&.2 +is appended to the original name. +If this process continues up to +.Ql .99 , +an error message is printed, and the transfer does not take place. The generated unique filename will be reported. Note that @@ -1359,7 +1398,7 @@ Defaults to Defaults to .Ev $FTPRPROMPT . .El -.It Ic site Ar arg1 arg2 ... +.It Ic site Op Ar arg ... The arguments specified are sent, verbatim, to the remote .Tn FTP server as a @@ -1480,7 +1519,7 @@ A synonym for .Pp Command arguments which have embedded spaces may be quoted with quote -.Sq \&" +.Ql \&\(dq marks. .Pp Commands which toggle settings can take an explicit @@ -1515,7 +1554,7 @@ If receives a .Dv SIGINFO (see the -.Dq status +.Cm status argument of .Xr stty 1 ) or @@ -1545,7 +1584,7 @@ contains a glob character and globbing i (see .Ic glob ) , then the equivalent of -.Ql mget path +.Sq Li mget path is performed. .Pp If the directory component of @@ -1558,10 +1597,10 @@ of in the current directory. Otherwise, the full remote name is used as the local name, relative to the local root directory. -.\" ftp://[user[:password]@]host[:port]/path[/][;type=X] +.\" ftp://[user[:password]@]host[:port]/path[/][;type=type] .It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \ Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \ -Ns Oo Li ;type= Ns Ar X Oc +Ns Oo Li ;type= Ns Ar type Oc An .Tn FTP URL, retrieved using the @@ -1584,9 +1623,9 @@ In this case, use if supplied, otherwise prompt the user for one. .Pp If a suffix of -.Sq ;type=A +.Sq Li \&;type=A or -.Sq ;type=I +.Sq Li \&;type=I is supplied, then the transfer type will take place as ascii or binary (respectively). The default transfer type is binary. @@ -1597,7 +1636,7 @@ In order to be compliant with interprets the .Ar path part of an -.Dq ftp:// +.Sq Li ftp:// auto-fetch URL as follows: .Bl -bullet .It @@ -1677,20 +1716,20 @@ user. If the .Pa / directory is required, use a leading path of -.Dq %2F . +.Sq Li \&%2F . If a user's home directory is required (and the remote server supports the syntax), use a leading path of -.Dq %7Euser/ . +.Sq Li \&%7E Ns Ar user Ns Li / . For example, to retrieve .Pa /etc/motd from -.Sq localhost +.Sq Li localhost as the user -.Sq myname +.Sq Li myname with the password -.Sq mypass , +.Sq Li mypass , use -.Dq ftp://myname:mypass@localhost/%2fetc/motd +.Sq Li ftp://myname:mypass@localhost/%2fetc/motd .It The exact .Ic cd @@ -1698,11 +1737,11 @@ and .Ic get commands can be controlled by careful choice of where to use -.Sq / +.Sq Li / and where to use -.Sq %2F +.Sq Li \&%2F (or -.Sq %2f ) . +.Sq Li %2f ) . For example, the following URLs correspond to the equivalents of the indicated commands: .Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile" @@ -1749,9 +1788,9 @@ If authorization is required to retrieve .Ar path , and -.Sq user +.Ar user (and optionally -.Sq password ) +.Ar password\^ ) is in the URL, use them for the first attempt to authenticate. .\" https://[user[:password]@]host[:port]/path .It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \ @@ -1771,9 +1810,9 @@ If authorization is required to retrieve .Ar path , and -.Sq user +.Ar user (and optionally -.Sq password ) +.Ar password\^ ) is in the URL, use them for the first attempt to authenticate. There is currently no certificate validation and verification. .\" file:///path @@ -1816,7 +1855,7 @@ is recommended, to avoid writing to unex If a classic format or an .Tn FTP URL format has a trailing -.Sq / +.Ql / or an empty .Ar path component, then @@ -1864,7 +1903,7 @@ to enter a username and password to auth When specifying IPv6 numeric addresses in a URL, you need to surround the address in square brackets. E.g.: -.Dq ftp://[::1]:21/ . +.Sq Li ftp://[::1]:21/ . This is because colons are used in IPv6 numeric address as well as being the separator for the port number. .Sh ABORTING A FILE TRANSFER @@ -1887,7 +1926,9 @@ sending the requested file. .Pp If the terminal interrupt key sequence is used whilst .Nm -is awaiting a reply from the remote server for the ABOR processing, +is awaiting a reply from the remote server for the +.Dv ABOR +processing, then the connection will be closed. This is different from the traditional behaviour (which ignores the terminal interrupt during this phase), but is considered more useful. @@ -1900,13 +1941,13 @@ commands are processed according to the If the file name .Sq Fl is specified, the -.Ar stdin +.Va stdin (for reading) or -.Ar stdout +.Va stdout (for writing) is used. .It If the first character of the file name is -.Sq \&| , +.Ql \&| , the remainder of the argument is interpreted as a shell command. .Nm @@ -1916,13 +1957,12 @@ with the argument supplied, and reads (w (stdin). If the shell command includes spaces, the argument must be quoted; e.g. -.Dq Qq Li \&| ls\ \-lt . +.Sq Li \(dq|\~ls\~\-lt\(dq . A particularly useful example of this mechanism is: -.Dq Li dir \&"\&" \&|more . +.Sq Li dir\~\(dq\(dq\~|more . .It -Failing the above checks, if -.Dq globbing +Failing the above checks, if globbing is enabled, local file names are expanded according to the rules used in the .Xr csh 1 ; @@ -1933,7 +1973,7 @@ If the .Nm command expects a single local file (e.g. .Ic put ) , -only the first filename generated by the "globbing" operation is used. +only the first filename generated by the globbing operation is used. .It For .Ic mget @@ -2134,7 +2174,7 @@ The .Xr editline 3 library is configured with a .Pa .editrc -file - refer to +file \(em refer to .Xr editrc 5 for more information. .Pp @@ -2151,7 +2191,7 @@ By default, this is bound to the TAB key By default, .Nm displays a command line prompt of -.Dq "ftp> " +.Sq Li ftp>\~ to the user. This can be changed with the .Ic "set prompt" @@ -2168,42 +2208,42 @@ information: .It Li \&%/ The current remote working directory. .\" %c[[0]n], %.[[0]n] -.It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc +.It Li \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc The trailing component of the current remote working directory, or -.Em n +.Ar n trailing components if a digit -.Em n +.Ar n is given. If -.Em n +.Ar n begins with -.Sq 0 , +.Ql 0 , the number of skipped components precede the trailing component(s) in the format .\" ``/<number>trailing'' .Do .Sm off -.Li / Li < Va number Li > -.Va trailing +.Li / Li < Ar number Li > +.Ar trailing .Sm on .Dc (for -.Sq \&%c ) +.Ql \&%c ) or .\" ``...trailing'' -.Dq Li \&... Ns Va trailing +.Dq Li \&... Ns Ar trailing (for -.Sq \&%. ) . +.Ql \&%. ) . .It Li \&%M The remote host name. .It Li \&%m -The remote host name, up to the first -.Sq \&. . +The remote host name, up to the first dot +.Ql \&. . .It Li \&%n The remote user name. .It Li \&%% -A single -.Sq % . +A single percent character +.Ql % . .El .Sh ENVIRONMENT .Nm @@ -2214,7 +2254,7 @@ Password to send in an anonymous .Tn FTP transfer. Defaults to -.Dq Li `whoami`@ . +.Dq Li \&\`whoami\`@ . .It Ev FTPMODE Overrides the default operation mode. Support values are: @@ -2235,14 +2275,13 @@ only .It Ev FTPPROMPT Command-line prompt to use. Defaults to -.Dq "ftp> " . +.Sq Li ftp>\~ . Refer to .Sx COMMAND LINE PROMPT for more information. .It Ev FTPRPROMPT Command-line right side prompt to use. -Defaults to -.Dq "" . +Defaults to empty string. Refer to .Sx COMMAND LINE PROMPT for more information. @@ -2255,9 +2294,9 @@ Port to use when connecting to gate-ftp .Ic gate is enabled. Default is port returned by a -.Fn getservbyname +.Xr getservbyname 3 lookup of -.Dq ftpgate/tcp . +.Dq Li ftpgate/tcp . .It Ev FTPUSERAGENT The value to send for the .Tn HTTP @@ -2305,9 +2344,9 @@ If .Dq unsafe URL characters are required in the username or password (for example -.Sq @ +.Ql @ or -.Sq / ) , +.Ql / ) , encode them with .Li RFC 3986 .Sq Li \&% Ns Ar XX @@ -2324,10 +2363,22 @@ may be incompatible with other programs .Em NOTE : this is not used for interactive sessions, only for command-line fetches. +.It Ev https_proxy +URL of +.Tn HTTPS +proxy to use when making +.Tn HTTPS +URL requests. +.Pp +See +.Ev http_proxy +for further notes about proxy use. .It Ev no_proxy A space or comma separated list of hosts (or domains) for which proxying is not to be used. -Each entry may have an optional trailing ":port", which restricts +Each entry may have an optional trailing +.Sq Li \&: Ns Ar port , +which restricts the matching to connections to that port. .El .Sh EXTENDED PASSIVE MODE AND FIREWALLS Index: othersrc/usr.bin/tnftp/src/progressbar.c diff -u othersrc/usr.bin/tnftp/src/progressbar.c:1.16 othersrc/usr.bin/tnftp/src/progressbar.c:1.17 --- othersrc/usr.bin/tnftp/src/progressbar.c:1.16 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/progressbar.c Sun Apr 25 07:50:37 2021 @@ -1,8 +1,8 @@ -/* $NetBSD: progressbar.c,v 1.16 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: progressbar.c,v 1.23 2019/06/22 23:40:33 christos Exp */ +/* $NetBSD: progressbar.c,v 1.17 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: progressbar.c,v 1.24 2021/01/06 04:43:14 lukem Exp */ /*- - * Copyright (c) 1997-2009 The NetBSD Foundation, Inc. + * Copyright (c) 1997-2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -36,7 +36,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID(" NetBSD: progressbar.c,v 1.23 2019/06/22 23:40:33 christos Exp "); +__RCSID(" NetBSD: progressbar.c,v 1.24 2021/01/06 04:43:14 lukem Exp "); #endif /* not lint */ /* @@ -204,7 +204,7 @@ progressmeter(int flag) if (quit_time > 0 || progress) { #endif /* !STANDALONE_PROGRESS */ if (flag == -1) { - (void)xsignal_restart(SIGALRM, updateprogressmeter, 1); + (void)xsignal(SIGALRM, updateprogressmeter); alarmtimer(1); /* set alarm timer for 1 Hz */ } else if (flag == 1) { alarmtimer(0); @@ -415,13 +415,11 @@ alarmtimer(int wait) setitimer(ITIMER_REAL, &itv, NULL); } - /* - * Install a POSIX signal handler, allowing the invoker to set whether - * the signal should be restartable or not + * Install a non-restartable POSIX signal handler. */ sigfunc -xsignal_restart(int sig, sigfunc func, int restartable) +xsignal(int sig, sigfunc func) { #ifdef ultrix /* XXX: this is lame - how do we test sigvec vs. sigaction? */ struct sigvec vec, ovec; @@ -437,62 +435,12 @@ xsignal_restart(int sig, sigfunc func, i act.sa_handler = func; sigemptyset(&act.sa_mask); -#if defined(SA_RESTART) /* 4.4BSD, Posix(?), SVR4 */ - act.sa_flags = restartable ? SA_RESTART : 0; -#elif defined(SA_INTERRUPT) /* SunOS 4.x */ - act.sa_flags = restartable ? 0 : SA_INTERRUPT; -#else -#error "system must have SA_RESTART or SA_INTERRUPT" + act.sa_flags = 0; +#if defined(SA_INTERRUPT) /* SunOS 4.x */ + act.sa_flags = SA_INTERRUPT; #endif if (sigaction(sig, &act, &oact) < 0) return (SIG_ERR); return (oact.sa_handler); #endif /* ! ultrix */ } - -/* - * Install a signal handler with the `restartable' flag set dependent upon - * which signal is being set. (This is a wrapper to xsignal_restart()) - */ -sigfunc -xsignal(int sig, sigfunc func) -{ - int restartable; - - /* - * Some signals print output or change the state of the process. - * There should be restartable, so that reads and writes are - * not affected. Some signals should cause program flow to change; - * these signals should not be restartable, so that the system call - * will return with EINTR, and the program will go do something - * different. If the signal handler calls longjmp() or siglongjmp(), - * it doesn't matter if it's restartable. - */ - - switch(sig) { -#ifdef SIGINFO - case SIGINFO: -#endif - case SIGQUIT: - case SIGUSR1: - case SIGUSR2: - case SIGWINCH: - restartable = 1; - break; - - case SIGALRM: - case SIGINT: - case SIGPIPE: - restartable = 0; - break; - - default: - /* - * This is unpleasant, but I don't know what would be better. - * Right now, this "can't happen" - */ - errx(1, "xsignal_restart: called with signal %d", sig); - } - - return(xsignal_restart(sig, func, restartable)); -} Index: othersrc/usr.bin/tnftp/src/ftp.c diff -u othersrc/usr.bin/tnftp/src/ftp.c:1.22 othersrc/usr.bin/tnftp/src/ftp.c:1.23 --- othersrc/usr.bin/tnftp/src/ftp.c:1.22 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/ftp.c Sun Apr 25 07:50:37 2021 @@ -1,8 +1,8 @@ -/* $NetBSD: ftp.c,v 1.22 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: ftp.c,v 1.169 2020/06/08 01:33:27 lukem Exp */ +/* $NetBSD: ftp.c,v 1.23 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: ftp.c,v 1.171 2021/01/06 04:43:14 lukem Exp */ /*- - * Copyright (c) 1996-2020 The NetBSD Foundation, Inc. + * Copyright (c) 1996-2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -98,7 +98,7 @@ #if 0 static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94"; #else -__RCSID(" NetBSD: ftp.c,v 1.169 2020/06/08 01:33:27 lukem Exp "); +__RCSID(" NetBSD: ftp.c,v 1.171 2021/01/06 04:43:14 lukem Exp "); #endif #endif /* not lint */ @@ -328,6 +328,17 @@ cmdtimeout(int notused) errno = oerrno; } +static int +issighandler(sigfunc func) +{ + return (func != SIG_IGN && + func != SIG_DFL && +#ifdef SIG_HOLD + func != SIG_HOLD && +#endif + func != SIG_ERR); +} + /*VARARGS*/ int command(const char *fmt, ...) @@ -367,8 +378,9 @@ command(const char *fmt, ...) (void)fflush(cout); cpend = 1; r = getreply(!strcmp(fmt, "QUIT")); - if (abrtflag && oldsigint != SIG_IGN) + if (abrtflag && issighandler(oldsigint)) { (*oldsigint)(SIGINT); + } (void)xsignal(SIGINT, oldsigint); return (r); } @@ -518,11 +530,14 @@ getreply(int expecteof) (void)xsignal(SIGALRM, oldsigalrm); if (code == 421 || originalcode == 421) lostpeer(0); - if (abrtflag && oldsigint != cmdabort && oldsigint != SIG_IGN) + if (abrtflag && oldsigint != cmdabort && + issighandler(oldsigint)) { (*oldsigint)(SIGINT); + } if (timeoutflag && oldsigalrm != cmdtimeout && - oldsigalrm != SIG_IGN) + issighandler(oldsigalrm)) { (*oldsigalrm)(SIGINT); + } return (n - '0'); } } @@ -586,7 +601,7 @@ abortxfer(int notused) /* * Read data from infd & write to outfd, using buf/bufsize as the temporary - * buffer, dealing with short writes. + * buffer, dealing with short reads or writes. * If rate_limit != 0, rate-limit the transfer. * If hash_interval != 0, fputc('c', ttyout) every hash_interval bytes. * Updates global variables: bytes. @@ -620,15 +635,25 @@ copy_bytes(int infd, int outfd, char *bu bufrem = bufchunk; while (bufrem > 0) { inc = read(infd, buf, MIN((off_t)bufsize, bufrem)); - if (inc <= 0) + if (inc < 0) { + if (errno == EINTR || errno == EAGAIN) { + continue; + } goto copy_done; + } else if (inc == 0) { + goto copy_done; + } bytes += inc; bufrem -= inc; bufp = buf; while (inc > 0) { outc = write(outfd, bufp, inc); - if (outc < 0) + if (outc < 0) { + if (errno == EINTR || errno == EAGAIN) { + continue; + } goto copy_done; + } inc -= outc; bufp += outc; } @@ -678,7 +703,7 @@ sendrequest(const char *cmd, const char FILE *volatile dout; int (*volatile closefunc)(FILE *); sigfunc volatile oldintr; - sigfunc volatile oldintp; + sigfunc volatile oldpipe; off_t volatile hashbytes; int hash_interval; const char *lmode; @@ -705,8 +730,8 @@ sendrequest(const char *cmd, const char if (curtype != type) changetype(type, 0); closefunc = NULL; - oldintr = NULL; - oldintp = NULL; + oldintr = SIG_ERR; + oldpipe = SIG_ERR; lmode = "w"; if (sigsetjmp(xferabort, 1)) { while (cpend) @@ -720,7 +745,7 @@ sendrequest(const char *cmd, const char fin = stdin; progress = 0; } else if (*local == '|') { - oldintp = xsignal(SIGPIPE, SIG_IGN); + oldpipe = xsignal(SIGPIPE, SIG_IGN); fin = popen(local + 1, "r"); if (fin == NULL) { warn("Can't execute `%s'", local + 1); @@ -794,7 +819,9 @@ sendrequest(const char *cmd, const char } progressmeter(-1); - oldintp = xsignal(SIGPIPE, SIG_IGN); + if (oldpipe == SIG_ERR) { + oldpipe = xsignal(SIGPIPE, SIG_IGN); + } hash_interval = (hash && (!progress || filesize < 0)) ? mark : 0; switch (curtype) { @@ -863,7 +890,7 @@ sendrequest(const char *cmd, const char abort: (void)xsignal(SIGINT, oldintr); - oldintr = NULL; + oldintr = SIG_ERR; if (!cpend) { code = -1; goto cleanupsend; @@ -882,10 +909,10 @@ sendrequest(const char *cmd, const char ptransfer(0); cleanupsend: - if (oldintr) + if (oldintr != SIG_ERR) (void)xsignal(SIGINT, oldintr); - if (oldintp) - (void)xsignal(SIGPIPE, oldintp); + if (oldpipe != SIG_ERR) + (void)xsignal(SIGPIPE, oldpipe); if (data >= 0) { (void)close(data); data = -1; @@ -907,7 +934,7 @@ recvrequest(const char *cmd, const char FILE *volatile din; int (*volatile closefunc)(FILE *); sigfunc volatile oldintr; - sigfunc volatile oldintp; + sigfunc volatile oldpipe; int c, d; int volatile is_retr; int volatile tcrflag; @@ -943,8 +970,8 @@ recvrequest(const char *cmd, const char return; } closefunc = NULL; - oldintr = NULL; - oldintp = NULL; + oldintr = SIG_ERR; + oldpipe = SIG_ERR; tcrflag = !crflag && is_retr; if (sigsetjmp(xferabort, 1)) { while (cpend) @@ -1025,7 +1052,7 @@ recvrequest(const char *cmd, const char progress = 0; preserve = 0; } else if (!ignorespecial && *local == '|') { - oldintp = xsignal(SIGPIPE, SIG_IGN); + oldpipe = xsignal(SIGPIPE, SIG_IGN); fout = popen(local + 1, "w"); if (fout == NULL) { warn("Can't execute `%s'", local+1); @@ -1191,10 +1218,10 @@ recvrequest(const char *cmd, const char ptransfer(0); cleanuprecv: - if (oldintr) + if (oldintr != SIG_ERR) (void)xsignal(SIGINT, oldintr); - if (oldintp) - (void)xsignal(SIGPIPE, oldintp); + if (oldpipe != SIG_ERR) + (void)xsignal(SIGPIPE, oldpipe); if (data >= 0) { (void)close(data); data = -1; @@ -1864,7 +1891,7 @@ proxtrans(const char *cmd, const char *l int volatile secndflag; const char *volatile cmd2; - oldintr = NULL; + oldintr = SIG_ERR; secndflag = 0; if (strcmp(cmd, "RETR")) cmd2 = "RETR"; Index: othersrc/usr.bin/tnftp/src/main.c diff -u othersrc/usr.bin/tnftp/src/main.c:1.21 othersrc/usr.bin/tnftp/src/main.c:1.22 --- othersrc/usr.bin/tnftp/src/main.c:1.21 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/main.c Sun Apr 25 07:50:37 2021 @@ -1,5 +1,5 @@ -/* $NetBSD: main.c,v 1.21 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: main.c,v 1.126 2019/02/04 04:09:13 mrg Exp */ +/* $NetBSD: main.c,v 1.22 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: main.c,v 1.127 2020/07/18 03:00:37 lukem Exp */ /*- * Copyright (c) 1996-2015 The NetBSD Foundation, Inc. @@ -103,7 +103,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19 #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; #else -__RCSID(" NetBSD: main.c,v 1.126 2019/02/04 04:09:13 mrg Exp "); +__RCSID(" NetBSD: main.c,v 1.127 2020/07/18 03:00:37 lukem Exp "); #endif #endif /* not lint */ @@ -137,7 +137,8 @@ __RCSID(" NetBSD: main.c,v 1.126 2019/02 #define NO_PROXY "no_proxy" /* env var with list of non-proxied * hosts, comma or space separated */ -__dead static void usage(void); +static int usage(void); +static int usage_help(void); static void setupoption(const char *, const char *, const char *); int @@ -275,7 +276,7 @@ main(int volatile argc, char **volatile } } - while ((ch = getopt(argc, argv, "46AadefginN:o:pP:q:r:Rs:tT:u:vVx:")) != -1) { + while ((ch = getopt(argc, argv, "?46AadefginN:o:pP:q:r:Rs:tT:u:vVx:")) != -1) { switch (ch) { case '4': family = AF_INET; @@ -387,15 +388,15 @@ main(int volatile argc, char **volatile if (*cp == '\0') { warnx("Bad throttle value `%s'", optarg); - usage(); - /* NOTREACHED */ + return usage(); } targv[targc++] = cp; if (targc >= 5) break; } - if (parserate(targc, targv, 1) == -1) - usage(); + if (parserate(targc, targv, 1) == -1) { + return usage(); + } free(oac); break; } @@ -424,8 +425,14 @@ main(int volatile argc, char **volatile rcvbuf_size = sndbuf_size; break; + case '?': + if (optopt == '?') { + return usage_help(); + } + return usage(); + default: - usage(); + errx(1, "unimplemented option -%c", ch); } } /* set line buffering on ttyout */ @@ -581,8 +588,9 @@ main(int volatile argc, char **volatile retry_connect = 0; /* connected, stop hiding msgs */ } } - if (isupload) - usage(); + if (isupload) { + return usage(); + } #ifndef NO_EDITCOMPLETE controlediting(); @@ -845,7 +853,6 @@ slurpstring(void) slrflag++; INC_CHKCURSOR(stringbase); return ((*sb == '!') ? bangstr : dollarstr); - /* NOTREACHED */ case 1: slrflag++; altarg = stringbase; @@ -974,7 +981,7 @@ help(int argc, char *argv[]) cmd = argv[0]; isusage = (strcmp(cmd, "usage") == 0); if (argc == 0 || (isusage && argc == 1)) { - UPRINTF("usage: %s [command [...]]\n", cmd); + UPRINTF("usage: %s [command ...]\n", cmd); return; } if (argc == 1) { @@ -1053,20 +1060,69 @@ setupoption(const char *name, const char set_option(name, value ? value : defaultvalue, 0); } -void -usage(void) +static void +synopsis(FILE * stream) { - const char *progname = getprogname(); + const char * progname = getprogname(); - (void)fprintf(stderr, -"usage: %s [-46AadefginpRtVv] [-N netrc] [-o outfile] [-P port] [-q quittime]\n" -" [-r retry] [-s srcaddr] [-T dir,max[,inc]] [-x xferbufsize]\n" -" [[user@]host [port]] [host:path[/]] [file:///file]\n" -" [ftp://[user[:pass]@]host[:port]/path[/]]\n" -" [http://[user[:pass]@]host[:port]/path] [...]\n" + fprintf(stream, +"usage: %s [-46AadefginpRtVv] [-N NETRC] [-o OUTPUT] [-P PORT] [-q QUITTIME]\n" +" [-r RETRY] [-s SRCADDR] [-T DIR,MAX[,INC]] [-x XFERSIZE]\n" +" [[USER@]HOST [PORT]]\n" +" [[USER@]HOST:[PATH][/]]\n" +" [file:///PATH]\n" +" [ftp://[USER[:PASSWORD]@]HOST[:PORT]/PATH[/][;type=TYPE]]\n" +" [http://[USER[:PASSWORD]@]HOST[:PORT]/PATH]\n" #ifdef WITH_SSL -" [https://[user[:pass]@]host[:port]/path] [...]\n" +" [https://[USER[:PASSWORD]@]HOST[:PORT]/PATH]\n" #endif -" %s -u URL file [...]\n", progname, progname); - exit(1); +" ...\n" +" %s -u URL FILE ...\n" +" %s -?\n", + progname, progname, progname); +} + +static int +usage_help(void) +{ + synopsis(stdout); +#ifndef NO_USAGE + printf( +" -4 Only use IPv4 addresses\n" +" -6 Only use IPv6 addresses\n" +" -A Force active mode\n" +" -a Use anonymous login\n" +" -d Enable debugging\n" +" -e Disable command-line editing\n" +" -f Force cache reload for FTP or HTTP proxy transfers\n" +" -g Disable file name globbing\n" +" -i Disable interactive prompt during multiple file transfers\n" +" -N NETRC Use NETRC instead of ~/.netrc\n" +" -n Disable auto-login\n" +" -o OUTPUT Save auto-fetched files to OUTPUT\n" +" -P PORT Use port PORT\n" +" -p Force passive mode\n" +" -q QUITTIME Quit if connection stalls for QUITTIME seconds\n" +" -R Restart non-proxy auto-fetch\n" +" -r RETRY Retry failed connection attempts after RETRY seconds\n" +" -s SRCADDR Use source address SRCADDR\n" +" -t Enable packet tracing\n" +" -T DIR,MAX[,INC]\n" +" Set maximum transfer rate for direction DIR to MAX bytes/s,\n" +" with optional increment INC bytes/s\n" +" -u URL URL to upload file arguments to\n" +" -V Disable verbose and progress\n" +" -v Enable verbose and progress\n" +" -x XFERSIZE Set socket send and receive size to XFERSIZE\n" +" -? Display this help and exit\n" + ); +#endif + return EXIT_SUCCESS; +} + +static int +usage(void) +{ + synopsis(stderr); + return EXIT_FAILURE; } Index: othersrc/usr.bin/tnftp/src/progressbar.h diff -u othersrc/usr.bin/tnftp/src/progressbar.h:1.9 othersrc/usr.bin/tnftp/src/progressbar.h:1.10 --- othersrc/usr.bin/tnftp/src/progressbar.h:1.9 Wed May 20 12:53:47 2009 +++ othersrc/usr.bin/tnftp/src/progressbar.h Sun Apr 25 07:50:37 2021 @@ -1,8 +1,8 @@ -/* $NetBSD: progressbar.h,v 1.9 2009/05/20 12:53:47 lukem Exp $ */ -/* from NetBSD: progressbar.h,v 1.8 2009/04/12 10:18:52 lukem Exp */ +/* $NetBSD: progressbar.h,v 1.10 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: progressbar.h,v 1.9 2021/01/06 04:43:14 lukem Exp */ /*- - * Copyright (c) 1996-2009 The NetBSD Foundation, Inc. + * Copyright (c) 1996-2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -69,7 +69,6 @@ int foregroundproc(void); void alarmtimer(int); void progressmeter(int); sigfunc xsignal(int, sigfunc); -sigfunc xsignal_restart(int, sigfunc, int); #ifndef STANDALONE_PROGRESS void psummary(int); Index: othersrc/usr.bin/tnftp/src/ssl.c diff -u othersrc/usr.bin/tnftp/src/ssl.c:1.4 othersrc/usr.bin/tnftp/src/ssl.c:1.5 --- othersrc/usr.bin/tnftp/src/ssl.c:1.4 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/ssl.c Sun Apr 25 07:50:37 2021 @@ -1,5 +1,5 @@ -/* $NetBSD: ssl.c,v 1.4 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: ssl.c,v 1.8 2019/04/07 00:44:54 christos Exp */ +/* $NetBSD: ssl.c,v 1.5 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: ssl.c,v 1.9 2021/01/06 04:43:14 lukem Exp */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav @@ -39,7 +39,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID(" NetBSD: ssl.c,v 1.8 2019/04/07 00:44:54 christos Exp "); +__RCSID(" NetBSD: ssl.c,v 1.9 2021/01/06 04:43:14 lukem Exp "); #endif #include <time.h> @@ -363,6 +363,10 @@ fetch_wait(struct fetch_connect *conn, s if (quit_time > 0) { gettimeofday(&now, NULL); if (!timercmp(timeout, &now, >)) { + fprintf(ttyout, "\r\n%s: transfer aborted" + " because stalled for %lu sec.\r\n", + getprogname(), (unsigned long)quit_time); + errno = ETIMEDOUT; conn->iserr = ETIMEDOUT; return -1; } Index: othersrc/usr.bin/tnftp/src/version.h diff -u othersrc/usr.bin/tnftp/src/version.h:1.8 othersrc/usr.bin/tnftp/src/version.h:1.9 --- othersrc/usr.bin/tnftp/src/version.h:1.8 Sat Jul 4 09:59:07 2020 +++ othersrc/usr.bin/tnftp/src/version.h Sun Apr 25 07:50:37 2021 @@ -1,8 +1,8 @@ -/* $NetBSD: version.h,v 1.8 2020/07/04 09:59:07 lukem Exp $ */ -/* from NetBSD: version.h,v 1.89 2020/06/08 01:33:27 lukem Exp */ +/* $NetBSD: version.h,v 1.9 2021/04/25 07:50:37 lukem Exp $ */ +/* from NetBSD: version.h,v 1.92 2021/01/06 04:43:14 lukem Exp */ /*- - * Copyright (c) 1999-2020 The NetBSD Foundation, Inc. + * Copyright (c) 1999-2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -35,5 +35,5 @@ #endif #ifndef FTP_VERSION -#define FTP_VERSION "20200608" +#define FTP_VERSION "20210106" #endif