summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspz <spz@pkgsrc.org>2014-10-31 18:47:17 +0000
committerspz <spz@pkgsrc.org>2014-10-31 18:47:17 +0000
commit47ee748f38e47530659a243f584304026c105a9c (patch)
treef27184252d86f0fdfb3e75f38fbaa4d348c32d98
parent5d68979ba83ec846b3ffcab8ce20be5228014db0 (diff)
downloadpkgsrc-47ee748f38e47530659a243f584304026c105a9c.tar.gz
Fri Oct 31 04:07:38 UTC 2014 lukem
* Release as "tnftp 20141031". * Merge NetBSD usr.bin/ftp from 20130220 to 20141026: - Don't pay attention to special characters if they don't come from the command line (from jmcneill). Fixes CVE-2014-8517. - pr/34796: Hauke Fath: ftp does not timeout on http fetches. Sun May 5 13:51:47 UTC 2013 lukem * Release as "tnftp 20130505" * Implement --enable-ssl (and --with-openssl) to enable https:// fetch support. * Merge NetBSD ftp from 20090520 to 20130220. Changes: - https:// support. NetBSD problem report 47276 from NONAKA Kimihiro. - Allow -R to restart non-existent ftp:// URIs. - Don't assume AF_INET support is available. FreeBSD problem report 162661. - Parse HTTP 'Date' entries in the `C' locale rather than the user's. NetBSD problem report 42917 from KAMADA Ken'ichi. - Improve error handling when parsing of URI scheme. - Silence connection warnings to multi-homed hosts in non-verbose mode. - Fix compile warnings. - In ftpvis(), prevent incomplete escape sequences at end of dst, and ensure NUL-termination of dst. Fix from Uwe Stuehler and Stefan Sperling, via Marc Balmer. - When using the response to SYST to decide whether to default to 'binary' be a lot less specific. * Replace glob with newer copy from NetBSD that does not suffer from DoS exhaustion attacks. Fix in NetBSD from Maksymilian Arciemowicz. See CVE-2011-0418 Tue Jan 12 06:58:15 UTC 2010 lukem * Release as "tnftp 20100108" * Rename onoff() argument "bool" to "val". Tue Jan 5 09:12:01 UTC 2010 lukem * If ARG_MAX isn't defined, use the result from sysconf(_SC_ARG_MAX). Fixes build when using newer glibc. * Add libnetbsd.la to the LIBADD for libedit. Fix provided by Adam Sampson. Mon Jan 4 06:28:07 UTC 2010 lukem * Distribute various files not shipped by default automake rules, to use 'make dist' instead of 'cvs export'. Wed Dec 30 00:12:47 UTC 2009 lukem * Release as "tnftp 20091122" Sun Nov 15 10:14:44 UTC 2009 lukem * Merge NetBSD ftp from 20090520 to 20090915. Change: - Rename internal getline() to get_line() to avoid conflict with libc with former. - Avoid a NULL dereference in an error message. Sat Nov 14 09:21:19 UTC 2009 lukem * Convert to automake & libtool. Sat Jun 6 07:17:38 UTC 2009 lukem * Release as "tnftp 20090606" Fri May 22 01:11:15 UTC 2009 lukem * configure fixes: - Add the time.h headers to accheck_includes, for the strptime check. - Remove the check for el_init in libedit; we're always replacing the library and the presence of strvis() in some versions confuses other checks. Wed May 20 13:47:43 UTC 2009 lukem * Release as "tnftp 20090520" * Merge NetBSD ftp from 20070722 to 20090520. Changes: - Only attempt to el_parse() a command unknown by the default parser if editing is enabled. Fixes pr 38589. - Turn off the alarmtimer before resetting the SIGALRM handler back to SIG_DFL. Fixes pr 35630. - Add epsv6 and epsv to disable extended passive mode for ipv6 or both ipv4 and ipv6 respectively. This hack is due to our friends a Juniper Networks who break epsv in ipv6. Should be fixed in ScreenOS 6.2.X. - Improve parsing of chunked transfer chunks per RFC2616: - more stringent chunk-size parsing - ignore optional trailing ';chunk-ext' stuff, instead of barfing - detect EOF before final \r\n. - Use the service name to getaddrinfo() (along with the host name), so that features such as DNS Service Discovery have a better chance of working. Display the service name in various status & error messages. - Don't getservbyname() the :port component of a URL; RFC 3986 says it's just an unsigned number, not a service name. - Fix numerous WARNS=4 issues (-Wcast-qual -Wsign-compare). - Fix -Wshadow issues - Update copyrights - Remove clause 3 and 4 from TNF licenses - Rename HAVE_STRUCT_SOCKADDR_SA_LEN to HAVE_STRUCT_SOCKADDR_IN_SIN_LEN to accurately reflect the structure member being used. - Use AF_INET instead of AF_UNSPEC as the default family if !defined(INET6). * configure improvements: - Style tweaks. - Use AC_LANG_PROGRAM() instead of AC_LANG_SOURCE() - Add a check for strptime() requiring separators between conversions, and use our replacement one if it does. Sat Dec 20 15:28:24 UTC 2008 lukem * configure improvements: - Move IPv6 check from tnftp.h to configure.ac (as per tnftpd). - Rework option descriptions. - Highlight when tests are for a specific option. - Move configuration results to the end of the file. - Display $prefix in configure results. Fri Aug 15 03:03:36 UTC 2008 lukem * Add a "Configuration results" display at the end of configure. Cosmetic tweaks. Fri Feb 29 09:45:56 UTC 2008 lukem * Support @EXEEXT@ for Cygwin (etc).
-rw-r--r--net/tnftp/files/src/Makefile.in867
-rw-r--r--net/tnftp/files/src/cmds.c227
-rw-r--r--net/tnftp/files/src/fetch.c633
-rw-r--r--net/tnftp/files/src/progressbar.h15
-rw-r--r--net/tnftp/files/src/version.h16
5 files changed, 1365 insertions, 393 deletions
diff --git a/net/tnftp/files/src/Makefile.in b/net/tnftp/files/src/Makefile.in
index b4f449a1596..0c530d42c55 100644
--- a/net/tnftp/files/src/Makefile.in
+++ b/net/tnftp/files/src/Makefile.in
@@ -1,51 +1,848 @@
-# $NetBSD: Makefile.in,v 1.1.1.4 2007/05/09 04:44:36 lukem Exp $
-#
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
-srcdir = @srcdir@
-VPATH = @srcdir@
-SHELL = /bin/sh
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = tnftp$(EXEEXT)
+@USE_LIBEDIT_TRUE@am__append_1 = \
+@USE_LIBEDIT_TRUE@ -I$(top_srcdir)/libedit
+
+@USE_LIBEDIT_TRUE@am__append_2 = \
+@USE_LIBEDIT_TRUE@ ../libedit/libedit.la
+
+@WITH_SSL_TRUE@am__append_3 = \
+@WITH_SSL_TRUE@ ssl.c
+
+@WITH_SSL_TRUE@am__append_4 = \
+@WITH_SSL_TRUE@ $(OPENSSL_INCLUDES)
+
+@WITH_SSL_TRUE@am__append_5 = \
+@WITH_SSL_TRUE@ $(OPENSSL_LDFLAGS) \
+@WITH_SSL_TRUE@ $(OPENSSL_LIBS)
+
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/buildaux/ax_check_openssl.m4 \
+ $(top_srcdir)/buildaux/libtool.m4 \
+ $(top_srcdir)/buildaux/ltoptions.m4 \
+ $(top_srcdir)/buildaux/ltsugar.m4 \
+ $(top_srcdir)/buildaux/ltversion.m4 \
+ $(top_srcdir)/buildaux/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/tnftp_config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+PROGRAMS = $(bin_PROGRAMS)
+am__tnftp_SOURCES_DIST = cmds.c cmdtab.c complete.c domacro.c fetch.c \
+ ftp.c main.c progressbar.c ruserpass.c util.c ssl.c
+@WITH_SSL_TRUE@am__objects_1 = tnftp-ssl.$(OBJEXT)
+am_tnftp_OBJECTS = tnftp-cmds.$(OBJEXT) tnftp-cmdtab.$(OBJEXT) \
+ tnftp-complete.$(OBJEXT) tnftp-domacro.$(OBJEXT) \
+ tnftp-fetch.$(OBJEXT) tnftp-ftp.$(OBJEXT) tnftp-main.$(OBJEXT) \
+ tnftp-progressbar.$(OBJEXT) tnftp-ruserpass.$(OBJEXT) \
+ tnftp-util.$(OBJEXT) $(am__objects_1)
+tnftp_OBJECTS = $(am_tnftp_OBJECTS)
+am__DEPENDENCIES_1 =
+@WITH_SSL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \
+@WITH_SSL_TRUE@ $(am__DEPENDENCIES_1)
+tnftp_DEPENDENCIES = ../libnetbsd/libnetbsd.la $(am__append_2) \
+ $(am__DEPENDENCIES_2)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+DEFAULT_INCLUDES =
+depcomp = $(SHELL) $(top_srcdir)/buildaux/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(tnftp_SOURCES)
+DIST_SOURCES = $(am__tnftp_SOURCES_DIST)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man1_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_INCLUDES = @OPENSSL_INCLUDES@
+OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
datarootdir = @datarootdir@
-mandir = @mandir@
-transform = @program_transform_name@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+tnftp_SOURCES = cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c \
+ main.c progressbar.c ruserpass.c util.c $(am__append_3)
+tnftp_CPPFLAGS = -DHAVE_TNFTPD_H=1 \
+ -D_DEFAULT_CONFDIR=\"${sysconfdir}\" -I$(srcdir) \
+ -I$(top_srcdir)/libnetbsd -I$(top_srcdir) -I$(top_builddir) \
+ $(am__append_1) $(am__append_4)
+tnftp_LDADD = ../libnetbsd/libnetbsd.la $(am__append_2) \
+ $(am__append_5)
+man1_MANS = \
+ tnftp.1
+
+CLEANFILES = \
+ tnftp.1
+
+EXTRA_DIST = \
+ extern.h \
+ ftp.1 \
+ ftp_var.h \
+ progressbar.h \
+ ssl.h \
+ version.h
-mandircat1 = ${mandir}/cat1
+all: all-am
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPPFLAGS= -I${srcdir} -I${srcdir}/.. -I. -I.. @INCLUDES@ @CPPFLAGS@
-LIBS = @LIBS@
-LDFLAGS = @LDFLAGS@
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
-INSTALL = @INSTALL@
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-PROG = ftp
-SRCS = cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c \
- progressbar.c ruserpass.c util.c
-OBJS = ${SRCS:.c=.o}
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
-all: ${PROG}
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+tnftp$(EXEEXT): $(tnftp_OBJECTS) $(tnftp_DEPENDENCIES)
+ @rm -f tnftp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tnftp_OBJECTS) $(tnftp_LDADD) $(LIBS)
-${PROG}: ${OBJS} @LIBDEPENDS@
- ${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
-${OBJS}: ${srcdir}/../tnftp.h ../config.h
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-cmds.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-cmdtab.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-complete.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-domacro.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-fetch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-ftp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-progressbar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-ruserpass.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-ssl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnftp-util.Po@am__quote@
.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+tnftp-cmds.o: cmds.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-cmds.o -MD -MP -MF $(DEPDIR)/tnftp-cmds.Tpo -c -o tnftp-cmds.o `test -f 'cmds.c' || echo '$(srcdir)/'`cmds.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-cmds.Tpo $(DEPDIR)/tnftp-cmds.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmds.c' object='tnftp-cmds.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-cmds.o `test -f 'cmds.c' || echo '$(srcdir)/'`cmds.c
+
+tnftp-cmds.obj: cmds.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-cmds.obj -MD -MP -MF $(DEPDIR)/tnftp-cmds.Tpo -c -o tnftp-cmds.obj `if test -f 'cmds.c'; then $(CYGPATH_W) 'cmds.c'; else $(CYGPATH_W) '$(srcdir)/cmds.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-cmds.Tpo $(DEPDIR)/tnftp-cmds.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmds.c' object='tnftp-cmds.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-cmds.obj `if test -f 'cmds.c'; then $(CYGPATH_W) 'cmds.c'; else $(CYGPATH_W) '$(srcdir)/cmds.c'; fi`
+
+tnftp-cmdtab.o: cmdtab.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-cmdtab.o -MD -MP -MF $(DEPDIR)/tnftp-cmdtab.Tpo -c -o tnftp-cmdtab.o `test -f 'cmdtab.c' || echo '$(srcdir)/'`cmdtab.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-cmdtab.Tpo $(DEPDIR)/tnftp-cmdtab.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdtab.c' object='tnftp-cmdtab.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-cmdtab.o `test -f 'cmdtab.c' || echo '$(srcdir)/'`cmdtab.c
+
+tnftp-cmdtab.obj: cmdtab.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-cmdtab.obj -MD -MP -MF $(DEPDIR)/tnftp-cmdtab.Tpo -c -o tnftp-cmdtab.obj `if test -f 'cmdtab.c'; then $(CYGPATH_W) 'cmdtab.c'; else $(CYGPATH_W) '$(srcdir)/cmdtab.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-cmdtab.Tpo $(DEPDIR)/tnftp-cmdtab.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdtab.c' object='tnftp-cmdtab.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-cmdtab.obj `if test -f 'cmdtab.c'; then $(CYGPATH_W) 'cmdtab.c'; else $(CYGPATH_W) '$(srcdir)/cmdtab.c'; fi`
+
+tnftp-complete.o: complete.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-complete.o -MD -MP -MF $(DEPDIR)/tnftp-complete.Tpo -c -o tnftp-complete.o `test -f 'complete.c' || echo '$(srcdir)/'`complete.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-complete.Tpo $(DEPDIR)/tnftp-complete.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='complete.c' object='tnftp-complete.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-complete.o `test -f 'complete.c' || echo '$(srcdir)/'`complete.c
+
+tnftp-complete.obj: complete.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-complete.obj -MD -MP -MF $(DEPDIR)/tnftp-complete.Tpo -c -o tnftp-complete.obj `if test -f 'complete.c'; then $(CYGPATH_W) 'complete.c'; else $(CYGPATH_W) '$(srcdir)/complete.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-complete.Tpo $(DEPDIR)/tnftp-complete.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='complete.c' object='tnftp-complete.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-complete.obj `if test -f 'complete.c'; then $(CYGPATH_W) 'complete.c'; else $(CYGPATH_W) '$(srcdir)/complete.c'; fi`
+
+tnftp-domacro.o: domacro.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-domacro.o -MD -MP -MF $(DEPDIR)/tnftp-domacro.Tpo -c -o tnftp-domacro.o `test -f 'domacro.c' || echo '$(srcdir)/'`domacro.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-domacro.Tpo $(DEPDIR)/tnftp-domacro.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='domacro.c' object='tnftp-domacro.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-domacro.o `test -f 'domacro.c' || echo '$(srcdir)/'`domacro.c
+
+tnftp-domacro.obj: domacro.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-domacro.obj -MD -MP -MF $(DEPDIR)/tnftp-domacro.Tpo -c -o tnftp-domacro.obj `if test -f 'domacro.c'; then $(CYGPATH_W) 'domacro.c'; else $(CYGPATH_W) '$(srcdir)/domacro.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-domacro.Tpo $(DEPDIR)/tnftp-domacro.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='domacro.c' object='tnftp-domacro.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-domacro.obj `if test -f 'domacro.c'; then $(CYGPATH_W) 'domacro.c'; else $(CYGPATH_W) '$(srcdir)/domacro.c'; fi`
+
+tnftp-fetch.o: fetch.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-fetch.o -MD -MP -MF $(DEPDIR)/tnftp-fetch.Tpo -c -o tnftp-fetch.o `test -f 'fetch.c' || echo '$(srcdir)/'`fetch.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-fetch.Tpo $(DEPDIR)/tnftp-fetch.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fetch.c' object='tnftp-fetch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-fetch.o `test -f 'fetch.c' || echo '$(srcdir)/'`fetch.c
+
+tnftp-fetch.obj: fetch.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-fetch.obj -MD -MP -MF $(DEPDIR)/tnftp-fetch.Tpo -c -o tnftp-fetch.obj `if test -f 'fetch.c'; then $(CYGPATH_W) 'fetch.c'; else $(CYGPATH_W) '$(srcdir)/fetch.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-fetch.Tpo $(DEPDIR)/tnftp-fetch.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fetch.c' object='tnftp-fetch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-fetch.obj `if test -f 'fetch.c'; then $(CYGPATH_W) 'fetch.c'; else $(CYGPATH_W) '$(srcdir)/fetch.c'; fi`
+
+tnftp-ftp.o: ftp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-ftp.o -MD -MP -MF $(DEPDIR)/tnftp-ftp.Tpo -c -o tnftp-ftp.o `test -f 'ftp.c' || echo '$(srcdir)/'`ftp.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-ftp.Tpo $(DEPDIR)/tnftp-ftp.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ftp.c' object='tnftp-ftp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-ftp.o `test -f 'ftp.c' || echo '$(srcdir)/'`ftp.c
+
+tnftp-ftp.obj: ftp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-ftp.obj -MD -MP -MF $(DEPDIR)/tnftp-ftp.Tpo -c -o tnftp-ftp.obj `if test -f 'ftp.c'; then $(CYGPATH_W) 'ftp.c'; else $(CYGPATH_W) '$(srcdir)/ftp.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-ftp.Tpo $(DEPDIR)/tnftp-ftp.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ftp.c' object='tnftp-ftp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-ftp.obj `if test -f 'ftp.c'; then $(CYGPATH_W) 'ftp.c'; else $(CYGPATH_W) '$(srcdir)/ftp.c'; fi`
+
+tnftp-main.o: main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-main.o -MD -MP -MF $(DEPDIR)/tnftp-main.Tpo -c -o tnftp-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-main.Tpo $(DEPDIR)/tnftp-main.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='tnftp-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+
+tnftp-main.obj: main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-main.obj -MD -MP -MF $(DEPDIR)/tnftp-main.Tpo -c -o tnftp-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-main.Tpo $(DEPDIR)/tnftp-main.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='tnftp-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
+
+tnftp-progressbar.o: progressbar.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-progressbar.o -MD -MP -MF $(DEPDIR)/tnftp-progressbar.Tpo -c -o tnftp-progressbar.o `test -f 'progressbar.c' || echo '$(srcdir)/'`progressbar.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-progressbar.Tpo $(DEPDIR)/tnftp-progressbar.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='progressbar.c' object='tnftp-progressbar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-progressbar.o `test -f 'progressbar.c' || echo '$(srcdir)/'`progressbar.c
+
+tnftp-progressbar.obj: progressbar.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-progressbar.obj -MD -MP -MF $(DEPDIR)/tnftp-progressbar.Tpo -c -o tnftp-progressbar.obj `if test -f 'progressbar.c'; then $(CYGPATH_W) 'progressbar.c'; else $(CYGPATH_W) '$(srcdir)/progressbar.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-progressbar.Tpo $(DEPDIR)/tnftp-progressbar.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='progressbar.c' object='tnftp-progressbar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-progressbar.obj `if test -f 'progressbar.c'; then $(CYGPATH_W) 'progressbar.c'; else $(CYGPATH_W) '$(srcdir)/progressbar.c'; fi`
+
+tnftp-ruserpass.o: ruserpass.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-ruserpass.o -MD -MP -MF $(DEPDIR)/tnftp-ruserpass.Tpo -c -o tnftp-ruserpass.o `test -f 'ruserpass.c' || echo '$(srcdir)/'`ruserpass.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-ruserpass.Tpo $(DEPDIR)/tnftp-ruserpass.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ruserpass.c' object='tnftp-ruserpass.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-ruserpass.o `test -f 'ruserpass.c' || echo '$(srcdir)/'`ruserpass.c
+
+tnftp-ruserpass.obj: ruserpass.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-ruserpass.obj -MD -MP -MF $(DEPDIR)/tnftp-ruserpass.Tpo -c -o tnftp-ruserpass.obj `if test -f 'ruserpass.c'; then $(CYGPATH_W) 'ruserpass.c'; else $(CYGPATH_W) '$(srcdir)/ruserpass.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-ruserpass.Tpo $(DEPDIR)/tnftp-ruserpass.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ruserpass.c' object='tnftp-ruserpass.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-ruserpass.obj `if test -f 'ruserpass.c'; then $(CYGPATH_W) 'ruserpass.c'; else $(CYGPATH_W) '$(srcdir)/ruserpass.c'; fi`
+
+tnftp-util.o: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-util.o -MD -MP -MF $(DEPDIR)/tnftp-util.Tpo -c -o tnftp-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-util.Tpo $(DEPDIR)/tnftp-util.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='tnftp-util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c
+
+tnftp-util.obj: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-util.obj -MD -MP -MF $(DEPDIR)/tnftp-util.Tpo -c -o tnftp-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-util.Tpo $(DEPDIR)/tnftp-util.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='tnftp-util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
+
+tnftp-ssl.o: ssl.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-ssl.o -MD -MP -MF $(DEPDIR)/tnftp-ssl.Tpo -c -o tnftp-ssl.o `test -f 'ssl.c' || echo '$(srcdir)/'`ssl.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-ssl.Tpo $(DEPDIR)/tnftp-ssl.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssl.c' object='tnftp-ssl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-ssl.o `test -f 'ssl.c' || echo '$(srcdir)/'`ssl.c
+
+tnftp-ssl.obj: ssl.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tnftp-ssl.obj -MD -MP -MF $(DEPDIR)/tnftp-ssl.Tpo -c -o tnftp-ssl.obj `if test -f 'ssl.c'; then $(CYGPATH_W) 'ssl.c'; else $(CYGPATH_W) '$(srcdir)/ssl.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tnftp-ssl.Tpo $(DEPDIR)/tnftp-ssl.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssl.c' object='tnftp-ssl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(tnftp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tnftp-ssl.obj `if test -f 'ssl.c'; then $(CYGPATH_W) 'ssl.c'; else $(CYGPATH_W) '$(srcdir)/ssl.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man1_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+ { for i in $$list; do echo "$$i"; done; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically \`make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-man \
+ uninstall-man1
-install: all
- -mkdir -p ${bindir}
- ${INSTALL} -m 555 ${PROG} ${bindir}/`echo ${PROG}|sed '$(transform)'`
- -mkdir -p ${mandircat1}
- ${INSTALL} -m 444 ${srcdir}/${PROG}.cat1 ${mandircat1}/`echo ${PROG}|sed '$(transform)'`.1
-clean:
- rm -f core ${PROG} ${OBJS}
+tnftp.1: ftp.1
+ cp $(srcdir)/ftp.1 tnftp.1
-distclean: clean
- rm -f Makefile
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/net/tnftp/files/src/cmds.c b/net/tnftp/files/src/cmds.c
index b5ad5e069f5..bb10756d5b8 100644
--- a/net/tnftp/files/src/cmds.c
+++ b/net/tnftp/files/src/cmds.c
@@ -1,8 +1,8 @@
-/* $NetBSD: cmds.c,v 1.1.1.5 2007/08/06 04:33:23 lukem Exp $ */
-/* from NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp */
+/* $NetBSD: cmds.c,v 1.1.1.6 2014/10/31 18:47:18 spz Exp $ */
+/* from NetBSD: cmds.c,v 1.135 2012/12/22 16:57:09 christos Exp */
/*-
- * Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -20,13 +20,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -108,7 +101,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID(" NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp ");
+__RCSID(" NetBSD: cmds.c,v 1.135 2012/12/22 16:57:09 christos Exp ");
#endif
#endif /* not lint */
@@ -123,10 +116,12 @@ __RCSID(" NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp ");
#include <ctype.h>
#include <err.h>
+#include <errno.h>
#include <glob.h>
#include <limits.h>
#include <netdb.h>
#include <paths.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -139,24 +134,25 @@ __RCSID(" NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp ");
#include "version.h"
static struct types {
- char *t_name;
- char *t_mode;
- int t_type;
- char *t_arg;
+ const char *t_name;
+ const char *t_mode;
+ int t_type;
+ const char *t_arg;
} types[] = {
{ "ascii", "A", TYPE_A, 0 },
{ "binary", "I", TYPE_I, 0 },
{ "image", "I", TYPE_I, 0 },
{ "ebcdic", "E", TYPE_E, 0 },
{ "tenex", "L", TYPE_L, bytename },
- { NULL }
+ { NULL, NULL, 0, NULL }
};
static sigjmp_buf jabort;
static int confirm(const char *, const char *);
-static void mintr(int);
+__dead static void mintr(int);
static void mabort(const char *);
+static void set_type(const char *);
static const char *doprocess(char *, size_t, const char *, int, int, int);
static const char *domap(char *, size_t, const char *);
@@ -171,7 +167,7 @@ static int
confirm(const char *cmd, const char *file)
{
const char *errormsg;
- char line[BUFSIZ];
+ char cline[BUFSIZ];
const char *promptleft, *promptright;
if (!interactive || confirmrest)
@@ -186,12 +182,12 @@ confirm(const char *cmd, const char *file)
while (1) {
fprintf(ttyout, "%s %s [anpqy?]? ", promptleft, promptright);
(void)fflush(ttyout);
- if (getline(stdin, line, sizeof(line), &errormsg) < 0) {
+ if (get_line(stdin, cline, sizeof(cline), &errormsg) < 0) {
mflag = 0;
fprintf(ttyout, "%s; %s aborted\n", errormsg, cmd);
return (0);
}
- switch (tolower((unsigned char)*line)) {
+ switch (tolower((unsigned char)*cline)) {
case 'a':
confirmrest = 1;
fprintf(ttyout,
@@ -231,10 +227,9 @@ void
settype(int argc, char *argv[])
{
struct types *p;
- int comret;
if (argc == 0 || argc > 2) {
- char *sep;
+ const char *sep;
UPRINTF("usage: %s [", argv[0]);
sep = " ";
@@ -251,11 +246,20 @@ settype(int argc, char *argv[])
code = 0;
return;
}
+ set_type(argv[1]);
+}
+
+void
+set_type(const char *ttype)
+{
+ struct types *p;
+ int comret;
+
for (p = types; p->t_name; p++)
- if (strcmp(argv[1], p->t_name) == 0)
+ if (strcmp(ttype, p->t_name) == 0)
break;
if (p->t_name == 0) {
- fprintf(ttyout, "%s: unknown mode.\n", argv[1]);
+ fprintf(ttyout, "%s: unknown mode.\n", ttype);
code = -1;
return;
}
@@ -301,12 +305,6 @@ changetype(int newtype, int show)
verbose = oldverbose;
}
-char *stype[] = {
- "type",
- "",
- 0
-};
-
/*
* Set binary transfer type.
*/
@@ -320,8 +318,7 @@ setbinary(int argc, char *argv[])
code = -1;
return;
}
- stype[1] = "binary";
- settype(2, stype);
+ set_type("binary");
}
/*
@@ -337,8 +334,7 @@ setascii(int argc, char *argv[])
code = -1;
return;
}
- stype[1] = "ascii";
- settype(2, stype);
+ set_type("ascii");
}
/*
@@ -354,8 +350,7 @@ settenex(int argc, char *argv[])
code = -1;
return;
}
- stype[1] = "tenex";
- settype(2, stype);
+ set_type("tenex");
}
/*
@@ -416,7 +411,7 @@ void
put(int argc, char *argv[])
{
char buf[MAXPATHLEN];
- char *cmd;
+ const char *cmd;
int loc = 0;
char *locfile;
const char *remfile;
@@ -569,14 +564,14 @@ void
reget(int argc, char *argv[])
{
- (void)getit(argc, argv, 1, "r+");
+ (void)getit(argc, argv, 1, restart_point ? "r+" : "a");
}
void
get(int argc, char *argv[])
{
- (void)getit(argc, argv, 0, restart_point ? "r+" : "w" );
+ (void)getit(argc, argv, 0, restart_point ? "r+" : "w");
}
/*
@@ -585,7 +580,7 @@ get(int argc, char *argv[])
* If restartit is -1, restart the xfer only if the remote file is newer.
*/
int
-getit(int argc, char *argv[], int restartit, const char *mode)
+getit(int argc, char *argv[], int restartit, const char *gmode)
{
int loc, rval;
char *remfile, *olocfile;
@@ -625,10 +620,14 @@ getit(int argc, char *argv[], int restartit, const char *mode)
ret = stat(locfile, &stbuf);
if (restartit == 1) {
if (ret < 0) {
- warn("Can't stat `%s'", locfile);
- goto freegetit;
+ if (errno != ENOENT) {
+ warn("Can't stat `%s'", locfile);
+ goto freegetit;
+ }
+ restart_point = 0;
}
- restart_point = stbuf.st_size;
+ else
+ restart_point = stbuf.st_size;
} else {
if (ret == 0) {
time_t mtime;
@@ -644,7 +643,7 @@ getit(int argc, char *argv[], int restartit, const char *mode)
}
}
- recvrequest("RETR", locfile, remfile, mode,
+ recvrequest("RETR", locfile, remfile, gmode,
remfile != argv[1] || locfile != argv[2], loc);
restart_point = 0;
freegetit:
@@ -694,7 +693,7 @@ mget(int argc, char *argv[])
int ointer;
char *cp;
const char *tp;
- int restartit;
+ int volatile restartit;
if (argc == 0 ||
(argc == 1 && !another(&argc, &argv, "remote-files"))) {
@@ -761,9 +760,9 @@ mget(int argc, char *argv[])
void
fget(int argc, char *argv[])
{
- char *mode;
+ const char *gmode;
FILE *fp;
- char buf[MAXPATHLEN];
+ char buf[MAXPATHLEN], cmdbuf[MAX_C_NAME];
if (argc != 2) {
UPRINTF("usage: %s localfile\n", argv[0]);
@@ -778,23 +777,24 @@ fget(int argc, char *argv[])
return;
}
- argv[0] = "get";
- mode = restart_point ? "r+" : "w";
+ (void)strlcpy(cmdbuf, "get", sizeof(cmdbuf));
+ argv[0] = cmdbuf;
+ gmode = restart_point ? "r+" : "w";
- while (getline(fp, buf, sizeof(buf), NULL) >= 0) {
+ while (get_line(fp, buf, sizeof(buf), NULL) >= 0) {
if (buf[0] == '\0')
continue;
argv[1] = buf;
- (void)getit(argc, argv, 0, mode);
+ (void)getit(argc, argv, 0, gmode);
}
fclose(fp);
}
const char *
-onoff(int bool)
+onoff(int val)
{
- return (bool ? "on" : "off");
+ return (val ? "on" : "off");
}
/*
@@ -867,6 +867,8 @@ status(int argc, char *argv[])
fprintf(ttyout, "Use of PORT cmds: %s.\n", onoff(sendport));
fprintf(ttyout, "Use of EPSV/EPRT cmds for IPv4: %s%s.\n", onoff(epsv4),
epsv4bad ? " (disabled for this connection)" : "");
+ fprintf(ttyout, "Use of EPSV/EPRT cmds for IPv6: %s%s.\n", onoff(epsv6),
+ epsv6bad ? " (disabled for this connection)" : "");
fprintf(ttyout, "Command line editing: %s.\n",
#ifdef NO_EDITCOMPLETE
"support not compiled in"
@@ -1288,18 +1290,20 @@ renamefile(int argc, char *argv[])
* mlsd MLSD
* nlist NLST
* pdir, pls LIST |$PAGER
- * mmlsd MLSD |$PAGER
+ * pmlsd MLSD |$PAGER
*/
void
ls(int argc, char *argv[])
{
const char *cmd;
- char *remdir, *locfile;
- int freelocfile, pagecmd, mlsdcmd;
+ char *remdir, *locbuf;
+ const char *locfile;
+ int pagecmd, mlsdcmd;
remdir = NULL;
+ locbuf = NULL;
locfile = "-";
- freelocfile = pagecmd = mlsdcmd = 0;
+ pagecmd = mlsdcmd = 0;
/*
* the only commands that start with `p' are
* the `pager' versions.
@@ -1340,29 +1344,29 @@ ls(int argc, char *argv[])
}
if (pagecmd) {
- char *p;
+ const char *p;
size_t len;
p = getoptionvalue("pager");
if (EMPTYSTRING(p))
p = DEFAULTPAGER;
len = strlen(p) + 2;
- locfile = ftp_malloc(len);
- locfile[0] = '|';
- (void)strlcpy(locfile + 1, p, len - 1);
- freelocfile = 1;
+ locbuf = ftp_malloc(len);
+ locbuf[0] = '|';
+ (void)strlcpy(locbuf + 1, p, len - 1);
+ locfile = locbuf;
} else if ((strcmp(locfile, "-") != 0) && *locfile != '|') {
- if ((locfile = globulize(locfile)) == NULL ||
- !confirm("output to local-file:", locfile)) {
+ if ((locbuf = globulize(locfile)) == NULL ||
+ !confirm("output to local-file:", locbuf)) {
code = -1;
goto freels;
}
- freelocfile = 1;
+ locfile = locbuf;
}
recvrequest(cmd, locfile, remdir, "w", 0, 0);
freels:
- if (freelocfile && locfile)
- (void)free(locfile);
+ if (locbuf)
+ (void)free(locbuf);
}
/*
@@ -1373,8 +1377,9 @@ mls(int argc, char *argv[])
{
sigfunc oldintr;
int ointer, i;
- int dolist;
- char *mode, *dest, *odest;
+ int volatile dolist;
+ char * volatile dest, *odest;
+ const char *lmode;
if (argc == 0)
goto usage;
@@ -1400,8 +1405,8 @@ mls(int argc, char *argv[])
if (sigsetjmp(jabort, 1))
mabort(argv[0]);
for (i = 1; mflag && i < argc-1 && connected; i++) {
- mode = (i == 1) ? "w" : "a";
- recvrequest(dolist ? "LIST" : "NLST", dest, argv[i], mode,
+ lmode = (i == 1) ? "w" : "a";
+ recvrequest(dolist ? "LIST" : "NLST", dest, argv[i], lmode,
0, 0);
if (!mflag && fromatty) {
ointer = interactive;
@@ -1427,7 +1432,8 @@ shell(int argc, char *argv[])
{
pid_t pid;
sigfunc oldintr;
- char shellnam[MAXPATHLEN], *shell, *namep;
+ char shellnam[MAXPATHLEN];
+ const char *shellp, *namep;
int wait_status;
if (argc == 0) {
@@ -1440,26 +1446,26 @@ shell(int argc, char *argv[])
for (pid = 3; pid < 20; pid++)
(void)close(pid);
(void)xsignal(SIGINT, SIG_DFL);
- shell = getenv("SHELL");
- if (shell == NULL)
- shell = _PATH_BSHELL;
- namep = strrchr(shell, '/');
+ shellp = getenv("SHELL");
+ if (shellp == NULL)
+ shellp = _PATH_BSHELL;
+ namep = strrchr(shellp, '/');
if (namep == NULL)
- namep = shell;
+ namep = shellp;
else
namep++;
(void)strlcpy(shellnam, namep, sizeof(shellnam));
if (ftp_debug) {
- fputs(shell, ttyout);
+ fputs(shellp, ttyout);
putc('\n', ttyout);
}
if (argc > 1) {
- execl(shell, shellnam, "-c", altarg, (char *)0);
+ execl(shellp, shellnam, "-c", altarg, (char *)0);
}
else {
- execl(shell, shellnam, (char *)0);
+ execl(shellp, shellnam, (char *)0);
}
- warn("Can't execute `%s'", shell);
+ warn("Can't execute `%s'", shellp);
code = -1;
exit(1);
}
@@ -1845,6 +1851,7 @@ doproxy(int argc, char *argv[])
struct cmd *c;
int cmdpos;
sigfunc oldintr;
+ char cmdbuf[MAX_C_NAME];
if (argc == 0 || (argc == 1 && !another(&argc, &argv, "command"))) {
UPRINTF("usage: %s command\n", argv[0]);
@@ -1883,7 +1890,8 @@ doproxy(int argc, char *argv[])
cmdpos = strcspn(line, " \t");
if (cmdpos > 0) /* remove leading "proxy " from input buffer */
memmove(line, line + cmdpos + 1, strlen(line) - cmdpos + 1);
- argv[1] = c->c_name;
+ (void)strlcpy(cmdbuf, c->c_name, sizeof(cmdbuf));
+ argv[1] = cmdbuf;
(*c->c_handler)(argc-1, argv+1);
if (connected) {
proxflag = 1;
@@ -1975,7 +1983,7 @@ dotrans(char *dst, size_t dlen, const char *src)
found++;
if (i < ostop) {
*cp2++ = *(ntout + i);
- if (cp2 - dst >= dlen - 1)
+ if (cp2 - dst >= (ptrdiff_t)(dlen - 1))
goto out;
}
break;
@@ -2222,16 +2230,31 @@ setpassive(int argc, char *argv[])
code = passivemode;
}
+
void
setepsv4(int argc, char *argv[])
{
-
code = togglevar(argc, argv, &epsv4,
verbose ? "EPSV/EPRT on IPv4" : NULL);
epsv4bad = 0;
}
void
+setepsv6(int argc, char *argv[])
+{
+ code = togglevar(argc, argv, &epsv6,
+ verbose ? "EPSV/EPRT on IPv6" : NULL);
+ epsv6bad = 0;
+}
+
+void
+setepsv(int argc, char*argv[])
+{
+ setepsv4(argc,argv);
+ setepsv6(argc,argv);
+}
+
+void
setsunique(int argc, char *argv[])
{
@@ -2542,7 +2565,8 @@ void
lpage(int argc, char *argv[])
{
size_t len;
- char *p, *pager, *locfile;
+ const char *p;
+ char *pager, *locfile;
if (argc == 0 || argc > 2 ||
(argc == 1 && !another(&argc, &argv, "local-file"))) {
@@ -2576,7 +2600,8 @@ page(int argc, char *argv[])
{
int ohash, orestart_point, overbose;
size_t len;
- char *p, *pager;
+ const char *p;
+ char *pager;
if (argc == 0 || argc > 2 ||
(argc == 1 && !another(&argc, &argv, "remote-file"))) {
@@ -2657,27 +2682,35 @@ setoption(int argc, char *argv[])
return;
}
-#define OPTIONINDENT ((int) sizeof("http_proxy"))
+#define OPTIONINDENT ((int) sizeof("https_proxy"))
if (argc == 1) {
for (o = optiontab; o->name != NULL; o++) {
fprintf(ttyout, "%-*s\t%s\n", OPTIONINDENT,
o->name, o->value ? o->value : "");
}
} else {
- o = getoption(argv[1]);
- if (o == NULL) {
- fprintf(ttyout, "No such option `%s'.\n", argv[1]);
- return;
- }
- FREEPTR(o->value);
- o->value = ftp_strdup(argv[2]);
- if (verbose)
- fprintf(ttyout, "Setting `%s' to `%s'.\n",
- o->name, o->value);
+ set_option(argv[1], argv[2], 1);
}
code = 0;
}
+void
+set_option(const char * option, const char * value, int doverbose)
+{
+ struct option *o;
+
+ o = getoption(option);
+ if (o == NULL) {
+ fprintf(ttyout, "No such option `%s'.\n", option);
+ return;
+ }
+ FREEPTR(o->value);
+ o->value = ftp_strdup(value);
+ if (verbose && doverbose)
+ fprintf(ttyout, "Setting `%s' to `%s'.\n",
+ o->name, o->value);
+}
+
/*
* Unset an option
*/
diff --git a/net/tnftp/files/src/fetch.c b/net/tnftp/files/src/fetch.c
index 13b5a10b820..103c261152a 100644
--- a/net/tnftp/files/src/fetch.c
+++ b/net/tnftp/files/src/fetch.c
@@ -1,8 +1,8 @@
-/* $NetBSD: fetch.c,v 1.1.1.5 2007/08/06 04:33:23 lukem Exp $ */
-/* from NetBSD: fetch.c,v 1.180 2007/06/05 00:31:20 lukem Exp */
+/* $NetBSD: fetch.c,v 1.1.1.6 2014/10/31 18:47:18 spz Exp $ */
+/* from NetBSD: fetch.c,v 1.206 2014/10/26 16:21:59 christos Exp */
/*-
- * Copyright (c) 1997-2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -19,13 +19,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID(" NetBSD: fetch.c,v 1.180 2007/06/05 00:31:20 lukem Exp ");
+__RCSID(" NetBSD: fetch.c,v 1.206 2014/10/26 16:21:59 christos Exp ");
#endif /* not lint */
/*
@@ -64,6 +57,7 @@ __RCSID(" NetBSD: fetch.c,v 1.180 2007/06/05 00:31:20 lukem Exp ");
#include <arpa/ftp.h>
#include <arpa/inet.h>
+#include <assert.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -77,18 +71,23 @@ __RCSID(" NetBSD: fetch.c,v 1.180 2007/06/05 00:31:20 lukem Exp ");
#endif /* tnftp */
+#include "ssl.h"
#include "ftp_var.h"
#include "version.h"
typedef enum {
UNKNOWN_URL_T=-1,
HTTP_URL_T,
+#ifdef WITH_SSL
+ HTTPS_URL_T,
+#endif
FTP_URL_T,
FILE_URL_T,
CLASSIC_URL_T
} url_t;
-void aborthttp(int);
+__dead static void aborthttp(int);
+__dead static void timeouthttp(int);
#ifndef NO_AUTH
static int auth_url(const char *, char **, const char *, const char *);
static void base64_encode(const unsigned char *, size_t, unsigned char *);
@@ -113,7 +112,15 @@ static int redirect_loop;
#define FILE_URL "file://" /* file URL prefix */
#define FTP_URL "ftp://" /* ftp URL prefix */
#define HTTP_URL "http://" /* http URL prefix */
+#ifdef WITH_SSL
+#define HTTPS_URL "https://" /* https URL prefix */
+#define IS_HTTP_TYPE(urltype) \
+ (((urltype) == HTTP_URL_T) || ((urltype) == HTTPS_URL_T))
+#else
+#define IS_HTTP_TYPE(urltype) \
+ ((urltype) == HTTP_URL_T)
+#endif
/*
* Determine if token is the next word in buf (case insensitive).
@@ -155,7 +162,8 @@ auth_url(const char *challenge, char **response, const char *guser,
{
const char *cp, *scheme, *errormsg;
char *ep, *clear, *realm;
- char user[BUFSIZ], *pass;
+ char uuser[BUFSIZ], *gotpass;
+ const char *upass;
int rval;
size_t len, clen, rlen;
@@ -164,6 +172,7 @@ auth_url(const char *challenge, char **response, const char *guser,
rval = -1;
cp = challenge;
scheme = "Basic"; /* only support Basic authentication */
+ gotpass = NULL;
DPRINTF("auth_url: challenge `%s'\n", challenge);
@@ -183,8 +192,7 @@ auth_url(const char *challenge, char **response, const char *guser,
}
/* XXX: need to improve quoted-string parsing to support \ quoting, etc. */
if ((ep = strchr(cp, '\"')) != NULL) {
- size_t len = ep - cp;
-
+ len = ep - cp;
realm = (char *)ftp_malloc(len + 1);
(void)strlcpy(realm, cp, len + 1);
} else {
@@ -195,32 +203,33 @@ auth_url(const char *challenge, char **response, const char *guser,
fprintf(ttyout, "Username for `%s': ", realm);
if (guser != NULL) {
- (void)strlcpy(user, guser, sizeof(user));
- fprintf(ttyout, "%s\n", user);
+ (void)strlcpy(uuser, guser, sizeof(uuser));
+ fprintf(ttyout, "%s\n", uuser);
} else {
(void)fflush(ttyout);
- if (getline(stdin, user, sizeof(user), &errormsg) < 0) {
+ if (get_line(stdin, uuser, sizeof(uuser), &errormsg) < 0) {
warnx("%s; can't authenticate", errormsg);
goto cleanup_auth_url;
}
}
if (gpass != NULL)
- pass = (char *)gpass;
+ upass = gpass;
else {
- pass = getpass("Password: ");
- if (pass == NULL) {
+ gotpass = getpass("Password: ");
+ if (gotpass == NULL) {
warnx("Can't read password");
goto cleanup_auth_url;
}
+ upass = gotpass;
}
- clen = strlen(user) + strlen(pass) + 2; /* user + ":" + pass + "\0" */
+ clen = strlen(uuser) + strlen(upass) + 2; /* user + ":" + pass + "\0" */
clear = (char *)ftp_malloc(clen);
- (void)strlcpy(clear, user, clen);
+ (void)strlcpy(clear, uuser, clen);
(void)strlcat(clear, ":", clen);
- (void)strlcat(clear, pass, clen);
- if (gpass == NULL)
- memset(pass, 0, strlen(pass));
+ (void)strlcat(clear, upass, clen);
+ if (gotpass)
+ memset(gotpass, 0, strlen(gotpass));
/* scheme + " " + enc + "\0" */
rlen = strlen(scheme) + 1 + (clen + 2) * 4 / 3 + 1;
@@ -249,7 +258,7 @@ base64_encode(const unsigned char *clear, size_t len, unsigned char *encoded)
static const unsigned char enc[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
unsigned char *cp;
- int i;
+ size_t i;
cp = encoded;
for (i = 0; i < len; i += 3) {
@@ -293,7 +302,7 @@ url_decode(char *url)
/*
- * Parse URL of form (per RFC3986):
+ * Parse URL of form (per RFC 3986):
* <type>://[<user>[:<password>]@]<host>[:<port>][/<path>]
* Returns -1 if a parse error occurred, otherwise 0.
* It's the caller's responsibility to url_decode() the returned
@@ -303,7 +312,7 @@ url_decode(char *url)
* malloc(3)ed strings of the relevant section, and port to
* the number given, or ftpport if ftp://, or httpport if http://.
*
- * XXX: this is not totally RFC3986 compliant; <path> will have the
+ * XXX: this is not totally RFC 3986 compliant; <path> will have the
* leading `/' unless it's an ftp:// URL, as this makes things easier
* for file:// and http:// URLs. ftp:// URLs have the `/' between the
* host and the URL-path removed, but any additional leading slashes
@@ -324,42 +333,50 @@ url_decode(char *url)
* "ftp://host//dir/file" "/dir/file"
*/
static int
-parse_url(const char *url, const char *desc, url_t *type,
- char **user, char **pass, char **host, char **port,
+parse_url(const char *url, const char *desc, url_t *utype,
+ char **uuser, char **pass, char **host, char **port,
in_port_t *portnum, char **path)
{
- const char *origurl;
- char *cp, *ep, *thost, *tport;
+ const char *origurl, *tport;
+ char *cp, *ep, *thost;
size_t len;
- if (url == NULL || desc == NULL || type == NULL || user == NULL
+ if (url == NULL || desc == NULL || utype == NULL || uuser == NULL
|| pass == NULL || host == NULL || port == NULL || portnum == NULL
|| path == NULL)
errx(1, "parse_url: invoked with NULL argument!");
+ DPRINTF("parse_url: %s `%s'\n", desc, url);
origurl = url;
- *type = UNKNOWN_URL_T;
- *user = *pass = *host = *port = *path = NULL;
+ *utype = UNKNOWN_URL_T;
+ *uuser = *pass = *host = *port = *path = NULL;
*portnum = 0;
tport = NULL;
if (STRNEQUAL(url, HTTP_URL)) {
url += sizeof(HTTP_URL) - 1;
- *type = HTTP_URL_T;
+ *utype = HTTP_URL_T;
*portnum = HTTP_PORT;
tport = httpport;
} else if (STRNEQUAL(url, FTP_URL)) {
url += sizeof(FTP_URL) - 1;
- *type = FTP_URL_T;
+ *utype = FTP_URL_T;
*portnum = FTP_PORT;
tport = ftpport;
} else if (STRNEQUAL(url, FILE_URL)) {
url += sizeof(FILE_URL) - 1;
- *type = FILE_URL_T;
+ *utype = FILE_URL_T;
+#ifdef WITH_SSL
+ } else if (STRNEQUAL(url, HTTPS_URL)) {
+ url += sizeof(HTTPS_URL) - 1;
+ *utype = HTTPS_URL_T;
+ *portnum = HTTPS_PORT;
+ tport = httpsport;
+#endif
} else {
warnx("Invalid %s `%s'", desc, url);
cleanup_parse_url:
- FREEPTR(*user);
+ FREEPTR(*uuser);
if (*pass != NULL)
memset(*pass, 0, strlen(*pass));
FREEPTR(*pass);
@@ -380,24 +397,24 @@ parse_url(const char *url, const char *desc, url_t *type,
len = ep - url;
thost = (char *)ftp_malloc(len + 1);
(void)strlcpy(thost, url, len + 1);
- if (*type == FTP_URL_T) /* skip first / for ftp URLs */
+ if (*utype == FTP_URL_T) /* skip first / for ftp URLs */
ep++;
*path = ftp_strdup(ep);
}
cp = strchr(thost, '@'); /* look for user[:pass]@ in URLs */
if (cp != NULL) {
- if (*type == FTP_URL_T)
+ if (*utype == FTP_URL_T)
anonftp = 0; /* disable anonftp */
- *user = thost;
+ *uuser = thost;
*cp = '\0';
thost = ftp_strdup(cp + 1);
- cp = strchr(*user, ':');
+ cp = strchr(*uuser, ':');
if (cp != NULL) {
*cp = '\0';
*pass = ftp_strdup(cp + 1);
}
- url_decode(*user);
+ url_decode(*uuser);
if (*pass)
url_decode(*pass);
}
@@ -405,7 +422,7 @@ parse_url(const char *url, const char *desc, url_t *type,
#ifdef INET6
/*
* Check if thost is an encoded IPv6 address, as per
- * RFC3986:
+ * RFC 3986:
* `[' ipv6-address ']'
*/
if (*thost == '[') {
@@ -432,15 +449,16 @@ parse_url(const char *url, const char *desc, url_t *type,
} else
#endif /* INET6 */
if ((cp = strchr(thost, ':')) != NULL)
- *cp++ = '\0';
+ *cp++ = '\0';
*host = thost;
/* look for [:port] */
if (cp != NULL) {
- long nport;
+ unsigned long nport;
- nport = parseport(cp, -1);
- if (nport == -1) {
+ nport = strtoul(cp, &ep, 10);
+ if (*cp == '\0' || *ep != '\0' ||
+ nport < 1 || nport > MAX_IN_PORT_T) {
warnx("Unknown port `%s' in %s `%s'",
cp, desc, origurl);
goto cleanup_parse_url;
@@ -453,16 +471,16 @@ parse_url(const char *url, const char *desc, url_t *type,
*port = ftp_strdup(tport);
if (*path == NULL) {
const char *emptypath = "/";
- if (*type == FTP_URL_T) /* skip first / for ftp URLs */
+ if (*utype == FTP_URL_T) /* skip first / for ftp URLs */
emptypath++;
*path = ftp_strdup(emptypath);
}
DPRINTF("parse_url: user `%s' pass `%s' host %s port %s(%d) "
"path `%s'\n",
- *user ? *user : "<null>", *pass ? *pass : "<null>",
- *host ? *host : "<null>", *port ? *port : "<null>",
- *portnum ? *portnum : -1, *path ? *path : "<null>");
+ STRorNULL(*uuser), STRorNULL(*pass),
+ STRorNULL(*host), STRorNULL(*port),
+ *portnum ? *portnum : -1, STRorNULL(*path));
return (0);
}
@@ -472,7 +490,7 @@ sigjmp_buf httpabort;
/*
* Retrieve URL, via a proxy if necessary, using HTTP.
* If proxyenv is set, use that for the proxy, otherwise try ftp_proxy or
- * http_proxy as appropriate.
+ * http_proxy/https_proxy as appropriate.
* Supports HTTP redirects.
* Returns 1 on failure, 0 on completed xfer, -1 if ftp connection
* is still open (e.g, ftp xfer with trailing /)
@@ -482,16 +500,18 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
{
struct addrinfo hints, *res, *res0 = NULL;
int error;
- char hbuf[NI_MAXHOST];
- sigfunc volatile oldintr;
- sigfunc volatile oldintp;
+ sigfunc volatile oldint;
+ sigfunc volatile oldpipe;
+ sigfunc volatile oldalrm;
+ sigfunc volatile oldquit;
int volatile s;
struct stat sb;
int volatile ischunked;
int volatile isproxy;
int volatile rval;
int volatile hcode;
- size_t len;
+ int len;
+ size_t flen;
static size_t bufsize;
static char *xferbuf;
const char *cp, *token;
@@ -502,28 +522,38 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
char *volatile auth;
char *volatile location;
char *volatile message;
- char *user, *pass, *host, *port, *path;
+ char *uuser, *pass, *host, *port, *path;
char *volatile decodedpath;
char *puser, *ppass, *useragent;
off_t hashbytes, rangestart, rangeend, entitylen;
int (*volatile closefunc)(FILE *);
- FILE *volatile fin;
+ FETCH *volatile fin;
FILE *volatile fout;
+ const char *volatile penv = proxyenv;
time_t mtime;
url_t urltype;
in_port_t portnum;
+#ifdef WITH_SSL
+ void *ssl;
+#endif
+
+ DPRINTF("%s: `%s' proxyenv `%s'\n", __func__, url, STRorNULL(penv));
- oldintr = oldintp = NULL;
+ oldquit = oldalrm = oldint = oldpipe = NULL;
closefunc = NULL;
- fin = fout = NULL;
+ fin = NULL;
+ fout = NULL;
s = -1;
savefile = NULL;
auth = location = message = NULL;
ischunked = isproxy = hcode = 0;
rval = 1;
- user = pass = host = path = decodedpath = puser = ppass = NULL;
+ uuser = pass = host = path = decodedpath = puser = ppass = NULL;
- if (parse_url(url, "URL", &urltype, &user, &pass, &host, &port,
+ if (sigsetjmp(httpabort, 1))
+ goto cleanup_fetch_url;
+
+ if (parse_url(url, "URL", &urltype, &uuser, &pass, &host, &port,
&portnum, &path) == -1)
goto cleanup_fetch_url;
@@ -538,7 +568,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
rval = fetch_ftp(url);
goto cleanup_fetch_url;
}
- if (urltype != HTTP_URL_T || outfile == NULL) {
+ if (!IS_HTTP_TYPE(urltype) || outfile == NULL) {
warnx("Invalid URL (no file after host) `%s'", url);
goto cleanup_fetch_url;
}
@@ -548,7 +578,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
url_decode(decodedpath);
if (outfile)
- savefile = ftp_strdup(outfile);
+ savefile = outfile;
else {
cp = strrchr(decodedpath, '/'); /* find savefile */
if (cp != NULL)
@@ -556,6 +586,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
else
savefile = ftp_strdup(decodedpath);
}
+ DPRINTF("%s: savefile `%s'\n", __func__, savefile);
if (EMPTYSTRING(savefile)) {
if (urltype == FTP_URL_T) {
rval = fetch_ftp(url);
@@ -564,8 +595,6 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
warnx("No file after directory (you must specify an "
"output file) `%s'", url);
goto cleanup_fetch_url;
- } else {
- DPRINTF("savefile `%s'\n", savefile);
}
restart_point = 0;
@@ -573,23 +602,22 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
rangestart = rangeend = entitylen = -1;
mtime = -1;
if (restartautofetch) {
- if (strcmp(savefile, "-") != 0 && *savefile != '|' &&
- stat(savefile, &sb) == 0)
+ if (stat(savefile, &sb) == 0)
restart_point = sb.st_size;
}
if (urltype == FILE_URL_T) { /* file:// URLs */
direction = "copied";
- fin = fopen(decodedpath, "r");
+ fin = fetch_open(decodedpath, "r");
if (fin == NULL) {
warn("Can't open `%s'", decodedpath);
goto cleanup_fetch_url;
}
- if (fstat(fileno(fin), &sb) == 0) {
+ if (fstat(fetch_fileno(fin), &sb) == 0) {
mtime = sb.st_mtime;
filesize = sb.st_size;
}
if (restart_point) {
- if (lseek(fileno(fin), restart_point, SEEK_SET) < 0) {
+ if (lseek(fetch_fileno(fin), restart_point, SEEK_SET) < 0) {
warn("Can't seek to restart `%s'",
decodedpath);
goto cleanup_fetch_url;
@@ -602,21 +630,29 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
(LLT)restart_point);
fputs("\n", ttyout);
}
+ if (0 == rcvbuf_size) {
+ rcvbuf_size = 8 * 1024; /* XXX */
+ }
} else { /* ftp:// or http:// URLs */
- char *leading;
+ const char *leading;
int hasleading;
- if (proxyenv == NULL) {
- if (urltype == HTTP_URL_T)
- proxyenv = getoptionvalue("http_proxy");
+ if (penv == NULL) {
+#ifdef WITH_SSL
+ if (urltype == HTTPS_URL_T)
+ penv = getoptionvalue("https_proxy");
+#endif
+ if (penv == NULL && IS_HTTP_TYPE(urltype))
+ penv = getoptionvalue("http_proxy");
else if (urltype == FTP_URL_T)
- proxyenv = getoptionvalue("ftp_proxy");
+ penv = getoptionvalue("ftp_proxy");
}
direction = "retrieved";
- if (! EMPTYSTRING(proxyenv)) { /* use proxy */
+ if (! EMPTYSTRING(penv)) { /* use proxy */
url_t purltype;
char *phost, *ppath;
char *pport, *no_proxy;
+ in_port_t pportnum;
isproxy = 1;
@@ -624,7 +660,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
no_proxy = getoptionvalue("no_proxy");
if (! EMPTYSTRING(no_proxy)) {
char *np, *np_copy, *np_iter;
- long np_port;
+ unsigned long np_port;
size_t hlen, plen;
np_iter = np_copy = ftp_strdup(no_proxy);
@@ -633,10 +669,9 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
if (*cp == '\0')
continue;
if ((np = strrchr(cp, ':')) != NULL) {
- *np = '\0';
- np_port =
- strtol(np + 1, &ep, 10);
- if (*ep != '\0')
+ *np++ = '\0';
+ np_port = strtoul(np, &ep, 10);
+ if (*np == '\0' || *ep != '\0')
continue;
if (np_port != portnum)
continue;
@@ -660,21 +695,20 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
if (isproxy) {
if (restart_point) {
warnx("Can't restart via proxy URL `%s'",
- proxyenv);
+ penv);
goto cleanup_fetch_url;
}
- if (parse_url(proxyenv, "proxy URL", &purltype,
- &puser, &ppass, &phost, &pport, &portnum,
+ if (parse_url(penv, "proxy URL", &purltype,
+ &puser, &ppass, &phost, &pport, &pportnum,
&ppath) == -1)
goto cleanup_fetch_url;
- if ((purltype != HTTP_URL_T
+ if ((!IS_HTTP_TYPE(purltype)
&& purltype != FTP_URL_T) ||
EMPTYSTRING(phost) ||
(! EMPTYSTRING(ppath)
&& strcmp(ppath, "/") != 0)) {
- warnx("Malformed proxy URL `%s'",
- proxyenv);
+ warnx("Malformed proxy URL `%s'", penv);
FREEPTR(phost);
FREEPTR(pport);
FREEPTR(ppath);
@@ -698,17 +732,18 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
FREEPTR(path);
path = ftp_strdup(url);
FREEPTR(ppath);
+ urltype = purltype;
}
- } /* ! EMPTYSTRING(proxyenv) */
+ } /* ! EMPTYSTRING(penv) */
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0;
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
- error = getaddrinfo(host, NULL, &hints, &res0);
+ error = getaddrinfo(host, port, &hints, &res0);
if (error) {
- warnx("Can't lookup `%s': %s", host,
+ warnx("Can't LOOKUP `%s:%s': %s", host, port,
(error == EAI_SYSTEM) ? strerror(errno)
: gai_strerror(error));
goto cleanup_fetch_url;
@@ -717,43 +752,67 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
host = res0->ai_canonname;
s = -1;
+#ifdef WITH_SSL
+ ssl = NULL;
+#endif
for (res = res0; res; res = res->ai_next) {
+ char hname[NI_MAXHOST], sname[NI_MAXSERV];
+
ai_unmapped(res);
if (getnameinfo(res->ai_addr, res->ai_addrlen,
- hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
- strlcpy(hbuf, "?", sizeof(hbuf));
+ hname, sizeof(hname), sname, sizeof(sname),
+ NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
+ strlcpy(hname, "?", sizeof(hname));
+ strlcpy(sname, "?", sizeof(sname));
+ }
if (verbose && res0->ai_next) {
- fprintf(ttyout, "Trying %s...\n", hbuf);
+ fprintf(ttyout, "Trying %s:%s ...\n",
+ hname, sname);
}
- ((struct sockaddr_in *)res->ai_addr)->sin_port =
- htons(portnum);
s = socket(res->ai_family, SOCK_STREAM,
res->ai_protocol);
if (s < 0) {
warn(
- "Can't create socket for connection to `%s'",
- hbuf);
+ "Can't create socket for connection to "
+ "`%s:%s'", hname, sname);
continue;
}
- if (ftp_connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+ if (ftp_connect(s, res->ai_addr, res->ai_addrlen,
+ verbose || !res->ai_next) < 0) {
close(s);
s = -1;
continue;
}
+#ifdef WITH_SSL
+ if (urltype == HTTPS_URL_T) {
+ if ((ssl = fetch_start_ssl(s)) == NULL) {
+ close(s);
+ s = -1;
+ continue;
+ }
+ }
+#endif
+
/* success */
break;
}
if (s < 0) {
- warnx("Can't connect to `%s'", host);
+ warnx("Can't connect to `%s:%s'", host, port);
goto cleanup_fetch_url;
}
- fin = fdopen(s, "r+");
+ oldalrm = xsignal(SIGALRM, timeouthttp);
+ alarmtimer(quit_time ? quit_time : 60);
+ fin = fetch_fdopen(s, "r+");
+ fetch_set_ssl(fin, ssl);
+ alarmtimer(0);
+
+ alarmtimer(quit_time ? quit_time : 60);
/*
* Construct and send the request.
*/
@@ -768,11 +827,11 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
leading = ", ";
hasleading++;
}
- fprintf(fin, "GET %s HTTP/1.0\r\n", path);
+ fetch_printf(fin, "GET %s HTTP/1.0\r\n", path);
if (flushcache)
- fprintf(fin, "Pragma: no-cache\r\n");
+ fetch_printf(fin, "Pragma: no-cache\r\n");
} else {
- fprintf(fin, "GET %s HTTP/1.1\r\n", path);
+ fetch_printf(fin, "GET %s HTTP/1.1\r\n", path);
if (strchr(host, ':')) {
char *h, *p;
@@ -785,18 +844,23 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
(p = strchr(h, '%')) != NULL) {
*p = '\0';
}
- fprintf(fin, "Host: [%s]", h);
+ fetch_printf(fin, "Host: [%s]", h);
free(h);
} else
- fprintf(fin, "Host: %s", host);
+ fetch_printf(fin, "Host: %s", host);
+#ifdef WITH_SSL
+ if ((urltype == HTTP_URL_T && portnum != HTTP_PORT) ||
+ (urltype == HTTPS_URL_T && portnum != HTTPS_PORT))
+#else
if (portnum != HTTP_PORT)
- fprintf(fin, ":%u", portnum);
- fprintf(fin, "\r\n");
- fprintf(fin, "Accept: */*\r\n");
- fprintf(fin, "Connection: close\r\n");
+#endif
+ fetch_printf(fin, ":%u", portnum);
+ fetch_printf(fin, "\r\n");
+ fetch_printf(fin, "Accept: */*\r\n");
+ fetch_printf(fin, "Connection: close\r\n");
if (restart_point) {
fputs(leading, ttyout);
- fprintf(fin, "Range: bytes=" LLF "-\r\n",
+ fetch_printf(fin, "Range: bytes=" LLF "-\r\n",
(LLT)restart_point);
fprintf(ttyout, "restarting at " LLF,
(LLT)restart_point);
@@ -804,12 +868,12 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
hasleading++;
}
if (flushcache)
- fprintf(fin, "Cache-Control: no-cache\r\n");
+ fetch_printf(fin, "Cache-Control: no-cache\r\n");
}
if ((useragent=getenv("FTPUSERAGENT")) != NULL) {
- fprintf(fin, "User-Agent: %s\r\n", useragent);
+ fetch_printf(fin, "User-Agent: %s\r\n", useragent);
} else {
- fprintf(fin, "User-Agent: %s/%s\r\n",
+ fetch_printf(fin, "User-Agent: %s/%s\r\n",
FTP_PRODUCT, FTP_VERSION);
}
if (wwwauth) {
@@ -819,7 +883,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
leading = ", ";
hasleading++;
}
- fprintf(fin, "Authorization: %s\r\n", wwwauth);
+ fetch_printf(fin, "Authorization: %s\r\n", wwwauth);
}
if (proxyauth) {
if (verbose) {
@@ -828,18 +892,22 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
leading = ", ";
hasleading++;
}
- fprintf(fin, "Proxy-Authorization: %s\r\n", proxyauth);
+ fetch_printf(fin, "Proxy-Authorization: %s\r\n", proxyauth);
}
if (verbose && hasleading)
fputs(")\n", ttyout);
- fprintf(fin, "\r\n");
- if (fflush(fin) == EOF) {
+ fetch_printf(fin, "\r\n");
+ if (fetch_flush(fin) == EOF) {
warn("Writing HTTP request");
+ alarmtimer(0);
goto cleanup_fetch_url;
}
+ alarmtimer(0);
/* Read the response */
- len = getline(fin, buf, sizeof(buf), &errormsg);
+ alarmtimer(quit_time ? quit_time : 60);
+ len = fetch_getline(fin, buf, sizeof(buf), &errormsg);
+ alarmtimer(0);
if (len < 0) {
if (*errormsg == '\n')
errormsg++;
@@ -848,7 +916,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
}
while (len > 0 && (ISLWS(buf[len-1])))
buf[--len] = '\0';
- DPRINTF("received `%s'\n", buf);
+ DPRINTF("%s: received `%s'\n", __func__, buf);
/* Determine HTTP response code */
cp = strchr(buf, ' ');
@@ -863,7 +931,9 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
/* Read the rest of the header. */
while (1) {
- len = getline(fin, buf, sizeof(buf), &errormsg);
+ alarmtimer(quit_time ? quit_time : 60);
+ len = fetch_getline(fin, buf, sizeof(buf), &errormsg);
+ alarmtimer(0);
if (len < 0) {
if (*errormsg == '\n')
errormsg++;
@@ -874,7 +944,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
buf[--len] = '\0';
if (len == 0)
break;
- DPRINTF("received `%s'\n", buf);
+ DPRINTF("%s: received `%s'\n", __func__, buf);
/*
* Look for some headers
@@ -886,8 +956,8 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
filesize = STRTOLL(cp, &ep, 10);
if (filesize < 0 || *ep != '\0')
goto improper;
- DPRINTF("parsed len as: " LLF "\n",
- (LLT)filesize);
+ DPRINTF("%s: parsed len as: " LLF "\n",
+ __func__, (LLT)filesize);
} else if (match_token(&cp, "Content-Range:")) {
if (! match_token(&cp, "bytes"))
@@ -939,28 +1009,18 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
} else if (match_token(&cp, "Last-Modified:")) {
struct tm parsed;
- char *t;
+ const char *t;
memset(&parsed, 0, sizeof(parsed));
- /* RFC1123 */
- if ((t = strptime(cp,
- "%a, %d %b %Y %H:%M:%S GMT",
- &parsed))
- /* RFC0850 */
- || (t = strptime(cp,
- "%a, %d-%b-%y %H:%M:%S GMT",
- &parsed))
- /* asctime */
- || (t = strptime(cp,
- "%a, %b %d %H:%M:%S %Y",
- &parsed))) {
+ t = parse_rfc2616time(&parsed, cp);
+ if (t != NULL) {
parsed.tm_isdst = -1;
if (*t == '\0')
mtime = timegm(&parsed);
#ifndef NO_DEBUG
if (ftp_debug && mtime != -1) {
fprintf(ttyout,
- "parsed date as: %s",
+ "parsed time as: %s",
rfc2822time(localtime(&mtime)));
}
#endif
@@ -968,7 +1028,8 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
} else if (match_token(&cp, "Location:")) {
location = ftp_strdup(cp);
- DPRINTF("parsed location as `%s'\n", cp);
+ DPRINTF("%s: parsed location as `%s'\n",
+ __func__, cp);
} else if (match_token(&cp, "Transfer-Encoding:")) {
if (match_token(&cp, "binary")) {
@@ -983,19 +1044,20 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
goto cleanup_fetch_url;
}
ischunked++;
- DPRINTF("using chunked encoding\n");
+ DPRINTF("%s: using chunked encoding\n",
+ __func__);
} else if (match_token(&cp, "Proxy-Authenticate:")
|| match_token(&cp, "WWW-Authenticate:")) {
if (! (token = match_token(&cp, "Basic"))) {
- DPRINTF(
- "skipping unknown auth scheme `%s'\n",
- token);
+ DPRINTF("%s: skipping unknown auth "
+ "scheme `%s'\n", __func__, token);
continue;
}
FREEPTR(auth);
auth = ftp_strdup(token);
- DPRINTF("parsed auth as `%s'\n", cp);
+ DPRINTF("%s: parsed auth as `%s'\n",
+ __func__, cp);
}
}
@@ -1047,7 +1109,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
if (hcode == 401) {
authp = &wwwauth;
- auser = user;
+ auser = uuser;
apass = pass;
} else {
authp = &proxyauth;
@@ -1067,7 +1129,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
fprintf(ttyout,
"Authorization failed. Retry (y/n)? ");
- if (getline(stdin, reply, sizeof(reply), NULL)
+ if (get_line(stdin, reply, sizeof(reply), NULL)
< 0) {
goto cleanup_fetch_url;
}
@@ -1077,7 +1139,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
apass = NULL;
}
if (auth_url(auth, authp, auser, apass) == 0) {
- rval = fetch_url(url, proxyenv,
+ rval = fetch_url(url, penv,
proxyauth, wwwauth);
memset(*authp, 0, strlen(*authp));
FREEPTR(*authp);
@@ -1094,18 +1156,26 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
}
} /* end of ftp:// or http:// specific setup */
- /* Open the output file. */
- if (strcmp(savefile, "-") == 0) {
- fout = stdout;
- } else if (*savefile == '|') {
- oldintp = xsignal(SIGPIPE, SIG_IGN);
- fout = popen(savefile + 1, "w");
- if (fout == NULL) {
- warn("Can't execute `%s'", savefile + 1);
- goto cleanup_fetch_url;
+ /* Open the output file. */
+
+ /*
+ * Only trust filenames with special meaning if they came from
+ * the command line
+ */
+ if (outfile == savefile) {
+ if (strcmp(savefile, "-") == 0) {
+ fout = stdout;
+ } else if (*savefile == '|') {
+ oldpipe = xsignal(SIGPIPE, SIG_IGN);
+ fout = popen(savefile + 1, "w");
+ if (fout == NULL) {
+ warn("Can't execute `%s'", savefile + 1);
+ goto cleanup_fetch_url;
+ }
+ closefunc = pclose;
}
- closefunc = pclose;
- } else {
+ }
+ if (fout == NULL) {
if ((rangeend != -1 && rangeend <= restart_point) ||
(rangestart == -1 && filesize != -1 && filesize <= restart_point)) {
/* already done */
@@ -1134,12 +1204,11 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
}
/* Trap signals */
- if (sigsetjmp(httpabort, 1))
- goto cleanup_fetch_url;
- (void)xsignal(SIGQUIT, psummary);
- oldintr = xsignal(SIGINT, aborthttp);
+ oldquit = xsignal(SIGQUIT, psummary);
+ oldint = xsignal(SIGINT, aborthttp);
- if (rcvbuf_size > bufsize) {
+ assert(rcvbuf_size > 0);
+ if ((size_t)rcvbuf_size > bufsize) {
if (xferbuf)
(void)free(xferbuf);
bufsize = rcvbuf_size;
@@ -1148,56 +1217,82 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
bytes = 0;
hashbytes = mark;
+ if (oldalrm) {
+ (void)xsignal(SIGALRM, oldalrm);
+ oldalrm = NULL;
+ }
progressmeter(-1);
/* Finally, suck down the file. */
do {
long chunksize;
+ short lastchunk;
chunksize = 0;
- /* read chunksize */
+ lastchunk = 0;
+ /* read chunk-size */
if (ischunked) {
- if (fgets(xferbuf, bufsize, fin) == NULL) {
- warnx("Unexpected EOF reading chunksize");
+ if (fetch_getln(xferbuf, bufsize, fin) == NULL) {
+ warnx("Unexpected EOF reading chunk-size");
goto cleanup_fetch_url;
}
+ errno = 0;
chunksize = strtol(xferbuf, &ep, 16);
+ if (ep == xferbuf) {
+ warnx("Invalid chunk-size");
+ goto cleanup_fetch_url;
+ }
+ if (errno == ERANGE || chunksize < 0) {
+ errno = ERANGE;
+ warn("Chunk-size `%.*s'",
+ (int)(ep-xferbuf), xferbuf);
+ goto cleanup_fetch_url;
+ }
/*
* XXX: Work around bug in Apache 1.3.9 and
* 1.3.11, which incorrectly put trailing
- * space after the chunksize.
+ * space after the chunk-size.
*/
while (*ep == ' ')
ep++;
+ /* skip [ chunk-ext ] */
+ if (*ep == ';') {
+ while (*ep && *ep != '\r')
+ ep++;
+ }
+
if (strcmp(ep, "\r\n") != 0) {
- warnx("Unexpected data following chunksize");
+ warnx("Unexpected data following chunk-size");
goto cleanup_fetch_url;
}
- DPRINTF("got chunksize of " LLF "\n", (LLT)chunksize);
- if (chunksize == 0)
- break;
+ DPRINTF("%s: got chunk-size of " LLF "\n", __func__,
+ (LLT)chunksize);
+ if (chunksize == 0) {
+ lastchunk = 1;
+ goto chunkdone;
+ }
}
/* transfer file or chunk */
while (1) {
struct timeval then, now, td;
- off_t bufrem;
+ volatile off_t bufrem;
if (rate_get)
(void)gettimeofday(&then, NULL);
- bufrem = rate_get ? rate_get : bufsize;
+ bufrem = rate_get ? rate_get : (off_t)bufsize;
if (ischunked)
bufrem = MIN(chunksize, bufrem);
while (bufrem > 0) {
- len = fread(xferbuf, sizeof(char),
- MIN(bufsize, bufrem), fin);
- if (len <= 0)
+ flen = fetch_read(xferbuf, sizeof(char),
+ MIN((off_t)bufsize, bufrem), fin);
+ if (flen <= 0)
goto chunkdone;
- bytes += len;
- bufrem -= len;
- if (fwrite(xferbuf, sizeof(char), len, fout)
- != len) {
+ bytes += flen;
+ bufrem -= flen;
+ if (fwrite(xferbuf, sizeof(char), flen, fout)
+ != flen) {
warn("Writing `%s'", savefile);
goto cleanup_fetch_url;
}
@@ -1209,7 +1304,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
(void)fflush(ttyout);
}
if (ischunked) {
- chunksize -= len;
+ chunksize -= flen;
if (chunksize <= 0)
break;
}
@@ -1229,20 +1324,28 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
/* read CRLF after chunk*/
chunkdone:
if (ischunked) {
- if (fgets(xferbuf, bufsize, fin) == NULL)
- break;
+ if (fetch_getln(xferbuf, bufsize, fin) == NULL) {
+ alarmtimer(0);
+ warnx("Unexpected EOF reading chunk CRLF");
+ goto cleanup_fetch_url;
+ }
if (strcmp(xferbuf, "\r\n") != 0) {
warnx("Unexpected data following chunk");
goto cleanup_fetch_url;
}
+ if (lastchunk)
+ break;
}
} while (ischunked);
+
+/* XXX: deal with optional trailer & CRLF here? */
+
if (hash && !progress && bytes > 0) {
if (bytes < mark)
(void)putc('#', ttyout);
(void)putc('\n', ttyout);
}
- if (ferror(fin)) {
+ if (fetch_error(fin)) {
warn("Reading file");
goto cleanup_fetch_url;
}
@@ -1271,23 +1374,28 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
goto cleanup_fetch_url;
improper:
- warnx("Improper response from `%s'", host);
+ warnx("Improper response from `%s:%s'", host, port);
cleanup_fetch_url:
- if (oldintr)
- (void)xsignal(SIGINT, oldintr);
- if (oldintp)
- (void)xsignal(SIGPIPE, oldintp);
+ if (oldint)
+ (void)xsignal(SIGINT, oldint);
+ if (oldpipe)
+ (void)xsignal(SIGPIPE, oldpipe);
+ if (oldalrm)
+ (void)xsignal(SIGALRM, oldalrm);
+ if (oldquit)
+ (void)xsignal(SIGQUIT, oldpipe);
if (fin != NULL)
- fclose(fin);
+ fetch_close(fin);
else if (s != -1)
close(s);
if (closefunc != NULL && fout != NULL)
(*closefunc)(fout);
if (res0)
freeaddrinfo(res0);
- FREEPTR(savefile);
- FREEPTR(user);
+ if (savefile != outfile)
+ FREEPTR(savefile);
+ FREEPTR(uuser);
if (pass != NULL)
memset(pass, 0, strlen(pass));
FREEPTR(pass);
@@ -1308,16 +1416,36 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
/*
* Abort a HTTP retrieval
*/
-void
+static void
aborthttp(int notused)
{
char msgbuf[100];
- size_t len;
+ int len;
sigint_raised = 1;
alarmtimer(0);
- len = strlcpy(msgbuf, "\nHTTP fetch aborted.\n", sizeof(msgbuf));
- write(fileno(ttyout), msgbuf, len);
+ if (fromatty) {
+ len = snprintf(msgbuf, sizeof(msgbuf),
+ "\n%s: HTTP fetch aborted.\n", getprogname());
+ if (len > 0)
+ write(fileno(ttyout), msgbuf, len);
+ }
+ siglongjmp(httpabort, 1);
+}
+
+static void
+timeouthttp(int notused)
+{
+ char msgbuf[100];
+ int len;
+
+ alarmtimer(0);
+ if (fromatty) {
+ len = snprintf(msgbuf, sizeof(msgbuf),
+ "\n%s: HTTP fetch timeout.\n", getprogname());
+ if (len > 0)
+ write(fileno(ttyout), msgbuf, len);
+ }
siglongjmp(httpabort, 1);
}
@@ -1330,22 +1458,25 @@ static int
fetch_ftp(const char *url)
{
char *cp, *xargv[5], rempath[MAXPATHLEN];
- char *host, *path, *dir, *file, *user, *pass;
+ char *host, *path, *dir, *file, *uuser, *pass;
char *port;
- int dirhasglob, filehasglob, rval, type, xargc;
+ char cmdbuf[MAXPATHLEN];
+ char dirbuf[4];
+ int dirhasglob, filehasglob, rval, transtype, xargc;
int oanonftp, oautologin;
in_port_t portnum;
url_t urltype;
- host = path = dir = file = user = pass = NULL;
+ DPRINTF("fetch_ftp: `%s'\n", url);
+ host = path = dir = file = uuser = pass = NULL;
port = NULL;
rval = 1;
- type = TYPE_I;
+ transtype = TYPE_I;
if (STRNEQUAL(url, FTP_URL)) {
- if ((parse_url(url, "URL", &urltype, &user, &pass,
+ if ((parse_url(url, "URL", &urltype, &uuser, &pass,
&host, &port, &portnum, &path) == -1) ||
- (user != NULL && *user == '\0') ||
+ (uuser != NULL && *uuser == '\0') ||
EMPTYSTRING(host)) {
warnx("Invalid URL `%s'", url);
goto cleanup_fetch_ftp;
@@ -1358,9 +1489,9 @@ fetch_ftp(const char *url)
/* check for trailing ';type=[aid]' */
if (! EMPTYSTRING(path) && (cp = strrchr(path, ';')) != NULL) {
if (strcasecmp(cp, ";type=a") == 0)
- type = TYPE_A;
+ transtype = TYPE_A;
else if (strcasecmp(cp, ";type=i") == 0)
- type = TYPE_I;
+ transtype = TYPE_I;
else if (strcasecmp(cp, ";type=d") == 0) {
warnx(
"Directory listing via a URL is not supported");
@@ -1378,7 +1509,7 @@ fetch_ftp(const char *url)
cp = strchr(host, '@');
if (cp != NULL) {
*cp = '\0';
- user = host;
+ uuser = host;
anonftp = 0; /* disable anonftp */
host = ftp_strdup(cp + 1);
}
@@ -1419,7 +1550,8 @@ fetch_ftp(const char *url)
cp = strrchr(dir, '/');
if (cp == dir && urltype == CLASSIC_URL_T) {
file = cp + 1;
- dir = "/";
+ (void)strlcpy(dirbuf, "/", sizeof(dirbuf));
+ dir = dirbuf;
} else if (cp != NULL) {
*cp++ = '\0';
file = cp;
@@ -1435,10 +1567,9 @@ fetch_ftp(const char *url)
}
DPRINTF("fetch_ftp: user `%s' pass `%s' host %s port %s "
"path `%s' dir `%s' file `%s'\n",
- user ? user : "<null>", pass ? pass : "<null>",
- host ? host : "<null>", port ? port : "<null>",
- path ? path : "<null>",
- dir ? dir : "<null>", file ? file : "<null>");
+ STRorNULL(uuser), STRorNULL(pass),
+ STRorNULL(host), STRorNULL(port),
+ STRorNULL(path), STRorNULL(dir), STRorNULL(file));
dirhasglob = filehasglob = 0;
if (doglob && urltype == CLASSIC_URL_T) {
@@ -1453,7 +1584,8 @@ fetch_ftp(const char *url)
if (connected)
disconnect(0, NULL);
anonftp = oanonftp;
- xargv[0] = (char *)getprogname(); /* XXX discards const */
+ (void)strlcpy(cmdbuf, getprogname(), sizeof(cmdbuf));
+ xargv[0] = cmdbuf;
xargv[1] = host;
xargv[2] = NULL;
xargc = 2;
@@ -1468,12 +1600,13 @@ fetch_ftp(const char *url)
setpeer(xargc, xargv);
autologin = oautologin;
if ((connected == 0) ||
- (connected == 1 && !ftp_login(host, user, pass))) {
- warnx("Can't connect or login to host `%s'", host);
+ (connected == 1 && !ftp_login(host, uuser, pass))) {
+ warnx("Can't connect or login to host `%s:%s'",
+ host, port ? port : "?");
goto cleanup_fetch_ftp;
}
- switch (type) {
+ switch (transtype) {
case TYPE_A:
setascii(1, xargv);
break;
@@ -1481,7 +1614,7 @@ fetch_ftp(const char *url)
setbinary(1, xargv);
break;
default:
- errx(1, "fetch_ftp: unknown transfer type %d", type);
+ errx(1, "fetch_ftp: unknown transfer type %d", transtype);
}
/*
@@ -1500,12 +1633,12 @@ fetch_ftp(const char *url)
* directories in one step.
*
* If we are dealing with an `ftp://host/path' URL
- * (urltype is FTP_URL_T), then RFC3986 says we need to
+ * (urltype is FTP_URL_T), then RFC 3986 says we need to
* send a separate CWD command for each unescaped "/"
* in the path, and we have to interpret %hex escaping
* *after* we find the slashes. It's possible to get
* empty components here, (from multiple adjacent
- * slashes in the path) and RFC3986 says that we should
+ * slashes in the path) and RFC 3986 says that we should
* still do `CWD ' (with a null argument) in such cases.
*
* Many ftp servers don't support `CWD ', so if there's an
@@ -1563,11 +1696,11 @@ fetch_ftp(const char *url)
url_decode(dir);
} else
nextpart = NULL;
- DPRINTF("dir `%s', nextpart `%s'\n",
- dir ? dir : "<null>",
- nextpart ? nextpart : "<null>");
+ DPRINTF("fetch_ftp: dir `%s', nextpart `%s'\n",
+ STRorNULL(dir), STRorNULL(nextpart));
if (urltype == FTP_URL_T || *dir != '\0') {
- xargv[0] = "cd";
+ (void)strlcpy(cmdbuf, "cd", sizeof(cmdbuf));
+ xargv[0] = cmdbuf;
xargv[1] = dir;
xargv[2] = NULL;
dirchange = 0;
@@ -1577,8 +1710,8 @@ fetch_ftp(const char *url)
fprintf(stderr,
"\n"
"ftp: The `CWD ' command (without a directory), which is required by\n"
-" RFC3986 to support the empty directory in the URL pathname (`//'),\n"
-" conflicts with the server's conformance to RFC0959.\n"
+" RFC 3986 to support the empty directory in the URL pathname (`//'),\n"
+" conflicts with the server's conformance to RFC 959.\n"
" Try the same URL without the `//' in the URL pathname.\n"
"\n");
goto cleanup_fetch_ftp;
@@ -1602,7 +1735,8 @@ fetch_ftp(const char *url)
/* Fetch the file(s). */
xargc = 2;
- xargv[0] = "get";
+ (void)strlcpy(cmdbuf, "get", sizeof(cmdbuf));
+ xargv[0] = cmdbuf;
xargv[1] = file;
xargv[2] = NULL;
if (dirhasglob || filehasglob) {
@@ -1611,9 +1745,10 @@ fetch_ftp(const char *url)
ointeractive = interactive;
interactive = 0;
if (restartautofetch)
- xargv[0] = "mreget";
+ (void)strlcpy(cmdbuf, "mreget", sizeof(cmdbuf));
else
- xargv[0] = "mget";
+ (void)strlcpy(cmdbuf, "mget", sizeof(cmdbuf));
+ xargv[0] = cmdbuf;
mget(xargc, xargv);
interactive = ointeractive;
} else {
@@ -1640,7 +1775,7 @@ fetch_ftp(const char *url)
FREEPTR(port);
FREEPTR(host);
FREEPTR(path);
- FREEPTR(user);
+ FREEPTR(uuser);
if (pass)
memset(pass, 0, strlen(pass));
FREEPTR(pass);
@@ -1662,7 +1797,8 @@ fetch_ftp(const char *url)
static int
go_fetch(const char *url)
{
- char *proxy;
+ char *proxyenv;
+ char *p;
#ifndef NO_ABOUT
/*
@@ -1703,16 +1839,32 @@ go_fetch(const char *url)
/*
* Check for file:// and http:// URLs.
*/
- if (STRNEQUAL(url, HTTP_URL) || STRNEQUAL(url, FILE_URL))
+ if (STRNEQUAL(url, HTTP_URL)
+#ifdef WITH_SSL
+ || STRNEQUAL(url, HTTPS_URL)
+#endif
+ || STRNEQUAL(url, FILE_URL))
return (fetch_url(url, NULL, NULL, NULL));
/*
+ * If it contains "://" but does not begin with ftp://
+ * or something that was already handled, then it's
+ * unsupported.
+ *
+ * If it contains ":" but not "://" then we assume the
+ * part before the colon is a host name, not an URL scheme,
+ * so we don't try to match that here.
+ */
+ if ((p = strstr(url, "://")) != NULL && ! STRNEQUAL(url, FTP_URL))
+ errx(1, "Unsupported URL scheme `%.*s'", (int)(p - url), url);
+
+ /*
* Try FTP URL-style and host:file arguments next.
* If ftpproxy is set with an FTP URL, use fetch_url()
* Othewise, use fetch_ftp().
*/
- proxy = getoptionvalue("ftp_proxy");
- if (!EMPTYSTRING(proxy) && STRNEQUAL(url, FTP_URL))
+ proxyenv = getoptionvalue("ftp_proxy");
+ if (!EMPTYSTRING(proxyenv) && STRNEQUAL(url, FTP_URL))
return (fetch_url(url, NULL, NULL, NULL));
return (fetch_ftp(url));
@@ -1784,10 +1936,12 @@ auto_put(int argc, char **argv, const char *uploadserver)
char *uargv[4], *path, *pathsep;
int uargc, rval, argpos;
size_t len;
+ char cmdbuf[MAX_C_NAME];
- uargc = 0;
- uargv[uargc++] = "mput";
- uargv[uargc++] = argv[0];
+ (void)strlcpy(cmdbuf, "mput", sizeof(cmdbuf));
+ uargv[0] = cmdbuf;
+ uargv[1] = argv[0];
+ uargc = 2;
uargv[2] = uargv[3] = NULL;
pathsep = NULL;
rval = 1;
@@ -1807,7 +1961,8 @@ auto_put(int argc, char **argv, const char *uploadserver)
(void)strlcpy(path, uploadserver, len);
(void)strlcat(path, "/", len);
} else { /* single file to upload */
- uargv[0] = "put";
+ (void)strlcpy(cmdbuf, "put", sizeof(cmdbuf));
+ uargv[0] = cmdbuf;
pathsep = strrchr(path, '/');
if (pathsep == NULL) {
pathsep = strrchr(path, ':');
@@ -1825,7 +1980,7 @@ auto_put(int argc, char **argv, const char *uploadserver)
}
}
DPRINTF("auto_put: URL `%s' argv[2] `%s'\n",
- path, uargv[2] ? uargv[2] : "<null>");
+ path, STRorNULL(uargv[2]));
/* connect and cwd */
rval = auto_fetch(1, &path);
diff --git a/net/tnftp/files/src/progressbar.h b/net/tnftp/files/src/progressbar.h
index d9bf1813be5..996fd01c0b2 100644
--- a/net/tnftp/files/src/progressbar.h
+++ b/net/tnftp/files/src/progressbar.h
@@ -1,8 +1,8 @@
-/* $NetBSD: progressbar.h,v 1.1.1.4 2007/08/06 04:33:24 lukem Exp $ */
-/* from NetBSD: progressbar.h,v 1.5 2005/02/10 16:00:38 jmc Exp */
+/* $NetBSD: progressbar.h,v 1.1.1.5 2014/10/31 18:47:18 spz Exp $ */
+/* from NetBSD: progressbar.h,v 1.8 2009/04/12 10:18:52 lukem Exp */
/*-
- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -16,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -67,7 +60,7 @@ GLOBAL int fromatty; /* input is from a terminal */
GLOBAL int verbose; /* print messages coming back from server */
GLOBAL int quit_time; /* maximum time to wait if stalled */
-GLOBAL char *direction; /* direction transfer is occurring */
+GLOBAL const char *direction; /* direction transfer is occurring */
GLOBAL sigjmp_buf toplevel; /* non-local goto stuff for cmd scanner */
#endif /* !STANDALONE_PROGRESS */
diff --git a/net/tnftp/files/src/version.h b/net/tnftp/files/src/version.h
index db444195f58..e8ed0104bd3 100644
--- a/net/tnftp/files/src/version.h
+++ b/net/tnftp/files/src/version.h
@@ -1,7 +1,8 @@
-/* $NetBSD: version.h,v 1.1.1.6 2007/08/06 03:42:17 lukem Exp $ */
-/* from NetBSD: version.h,v 1.69 2007/08/06 03:41:14 lukem Exp */
+/* $NetBSD: version.h,v 1.1.1.7 2014/10/31 18:47:17 spz Exp $ */
+/* from NetBSD: version.h,v 1.85 2014/10/31 03:27:18 lukem Exp */
+
/*-
- * Copyright (c) 1999-2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -15,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -41,5 +35,5 @@
#endif
#ifndef FTP_VERSION
-#define FTP_VERSION "20070722"
+#define FTP_VERSION "20141026"
#endif