diff options
author | lukem <lukem@pkgsrc.org> | 2005-01-04 23:44:24 +0000 |
---|---|---|
committer | lukem <lukem@pkgsrc.org> | 2005-01-04 23:44:24 +0000 |
commit | f154363cf11ad02b77386559f54bf4b75d295b28 (patch) | |
tree | 3248951aba87b81900fab91ff4cc78c62b559703 /net | |
parent | eefadddf423cb7c87c2adeb990c089b02dcf5e02 (diff) | |
download | pkgsrc-f154363cf11ad02b77386559f54bf4b75d295b28.tar.gz |
Merge changes between tnftp-20030825 & tnftp-20050103
Diffstat (limited to 'net')
-rw-r--r-- | net/tnftp/files/COPYING | 2 | ||||
-rw-r--r-- | net/tnftp/files/ChangeLog | 2 | ||||
-rw-r--r-- | net/tnftp/files/README | 4 | ||||
-rwxr-xr-x | net/tnftp/files/configure | 297 | ||||
-rw-r--r-- | net/tnftp/files/configure.in | 137 | ||||
-rw-r--r-- | net/tnftp/files/src/cmds.c | 90 | ||||
-rw-r--r-- | net/tnftp/files/src/cmdtab.c | 2 | ||||
-rw-r--r-- | net/tnftp/files/src/domacro.c | 2 | ||||
-rw-r--r-- | net/tnftp/files/src/extern.h | 2 | ||||
-rw-r--r-- | net/tnftp/files/src/fetch.c | 233 | ||||
-rw-r--r-- | net/tnftp/files/src/ftp.1 | 2 | ||||
-rw-r--r-- | net/tnftp/files/src/ftp.c | 43 | ||||
-rw-r--r-- | net/tnftp/files/src/ftp_var.h | 27 | ||||
-rw-r--r-- | net/tnftp/files/src/main.c | 23 | ||||
-rw-r--r-- | net/tnftp/files/src/progressbar.c | 8 | ||||
-rw-r--r-- | net/tnftp/files/src/progressbar.h | 2 | ||||
-rw-r--r-- | net/tnftp/files/src/ruserpass.c | 2 | ||||
-rw-r--r-- | net/tnftp/files/src/util.c | 97 | ||||
-rw-r--r-- | net/tnftp/files/src/version.h | 2 | ||||
-rw-r--r-- | net/tnftp/files/tnftp.h | 4 | ||||
-rw-r--r-- | net/tnftp/files/todo | 2 |
21 files changed, 559 insertions, 424 deletions
diff --git a/net/tnftp/files/COPYING b/net/tnftp/files/COPYING index 20097f572ea..0168f7cb036 100644 --- a/net/tnftp/files/COPYING +++ b/net/tnftp/files/COPYING @@ -1,4 +1,4 @@ -$Id: COPYING,v 1.1.1.2 2005/01/03 10:30:34 lukem Exp $ +$Id: COPYING,v 1.2 2005/01/04 23:44:24 lukem Exp $ Copyright (c) 2001-2005 The NetBSD Foundation, Inc. All rights reserved. diff --git a/net/tnftp/files/ChangeLog b/net/tnftp/files/ChangeLog index afb6939099b..7de88bb7abc 100644 --- a/net/tnftp/files/ChangeLog +++ b/net/tnftp/files/ChangeLog @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1.1.2 2005/01/03 10:23:21 lukem Exp $ +$Id: ChangeLog,v 1.2 2005/01/04 23:44:24 lukem Exp $ Mon Jan 3 10:21:57 UTC 2005 lukem diff --git a/net/tnftp/files/README b/net/tnftp/files/README index 74e67c9794d..84294e3f857 100644 --- a/net/tnftp/files/README +++ b/net/tnftp/files/README @@ -4,8 +4,8 @@ WHAT IS TNFTP? `tnftp' is a `port' of the NetBSD FTP client to other systems. See http://www.NetBSD.org/ for more details about NetBSD. -tnftp was formerly known as `lukemftp' and was renamed by Luke Mewburn -in February 2003. +tnftp was formerly known as `lukemftp' +It was renamed to `tnftp' by Luke Mewburn in February 2003. The enhancements over the standard ftp client in 4.4BSD (and derivatives) include: diff --git a/net/tnftp/files/configure b/net/tnftp/files/configure index 427c2228e13..7385519dad3 100755 --- a/net/tnftp/files/configure +++ b/net/tnftp/files/configure @@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.2 +# From configure.in Revision: 1.6 @@ -2547,14 +2547,16 @@ else #line 2548 "configure" #include "confdefs.h" -#include <sys/types.h> +#include <sys/types.h> + int main() { -long long X = 2, Y = 1, Z; -Z = X / Y; ; + long long X = 2, Y = 1, Z; + Z = X / Y; + ; ; return 0; } EOF -if { (eval echo configure:2558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ftp_cv_HAVE_LONG_LONG=yes else @@ -2570,11 +2572,12 @@ fi echo "$ac_t""$ftp_cv_HAVE_LONG_LONG" 1>&6 if test "x$ftp_cv_HAVE_LONG_LONG" = "xyes"; then -cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define HAVE_LONG_LONG 1 EOF -have_long_long=yes + have_long_long=yes + else have_long_long=no : @@ -2583,22 +2586,23 @@ have_long_long=yes echo $ac_n "checking for in_port_t""... $ac_c" 1>&6 -echo "configure:2587: checking for in_port_t" >&5 +echo "configure:2590: checking for in_port_t" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_IN_PORT_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2593 "configure" +#line 2596 "configure" #include "confdefs.h" #include <sys/types.h> -#include <netinet/in.h> +#include <netinet/in.h> + int main() { in_port_t X ; ; return 0; } EOF -if { (eval echo configure:2602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_IN_PORT_T=yes else @@ -2625,22 +2629,23 @@ EOF echo $ac_n "checking for sa_family_t""... $ac_c" 1>&6 -echo "configure:2629: checking for sa_family_t" >&5 +echo "configure:2633: checking for sa_family_t" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_SA_FAMILY_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2635 "configure" +#line 2639 "configure" #include "confdefs.h" #include <sys/types.h> -#include <sys/socket.h> +#include <sys/socket.h> + int main() { sa_family_t X ; ; return 0; } EOF -if { (eval echo configure:2644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_SA_FAMILY_T=yes else @@ -2667,25 +2672,27 @@ EOF echo $ac_n "checking for sockaddr_in.sin_len""... $ac_c" 1>&6 -echo "configure:2671: checking for sockaddr_in.sin_len" >&5 +echo "configure:2676: checking for sockaddr_in.sin_len" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_SOCKADDR_SA_LEN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2677 "configure" +#line 2682 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> +#include <netinet/in.h> + int main() { struct sockaddr_in sin; - int X = sin.sin_len ; + int X = sin.sin_len + ; ; return 0; } EOF -if { (eval echo configure:2689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_SOCKADDR_SA_LEN=yes else @@ -2712,22 +2719,23 @@ EOF echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 -echo "configure:2716: checking for socklen_t" >&5 +echo "configure:2723: checking for socklen_t" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_SOCKLEN_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2722 "configure" +#line 2729 "configure" #include "confdefs.h" #include <sys/types.h> -#include <sys/socket.h> +#include <sys/socket.h> + int main() { socklen_t X ; ; return 0; } EOF -if { (eval echo configure:2731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_SOCKLEN_T=yes else @@ -2756,22 +2764,23 @@ if test $opt_ipv6 = yes; then echo $ac_n "checking for AF_INET6""... $ac_c" 1>&6 -echo "configure:2760: checking for AF_INET6" >&5 +echo "configure:2768: checking for AF_INET6" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_AF_INET6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2766 "configure" +#line 2774 "configure" #include "confdefs.h" #include <sys/types.h> -#include <sys/socket.h> +#include <sys/socket.h> + int main() { int X = AF_INET6 ; ; return 0; } EOF -if { (eval echo configure:2775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_AF_INET6=yes else @@ -2798,24 +2807,26 @@ EOF echo $ac_n "checking for struct sockaddr_in6""... $ac_c" 1>&6 -echo "configure:2802: checking for struct sockaddr_in6" >&5 +echo "configure:2811: checking for struct sockaddr_in6" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_SOCKADDR_IN6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2808 "configure" +#line 2817 "configure" #include "confdefs.h" #include <sys/types.h> -#include <netinet/in.h> +#include <netinet/in.h> + int main() { - struct sockaddr_in6 X; - int Y = X.sin6_scope_id ; + struct sockaddr_in6 X; + int Y = X.sin6_scope_id + ; ; return 0; } EOF -if { (eval echo configure:2819: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_SOCKADDR_IN6=yes else @@ -2843,20 +2854,23 @@ EOF if test $ac_cv_header_arpa_nameser_h = yes; then echo $ac_n "checking for IN6ADDRSZ in arpa/nameser.h""... $ac_c" 1>&6 -echo "configure:2847: checking for IN6ADDRSZ in arpa/nameser.h" >&5 +echo "configure:2858: checking for IN6ADDRSZ in arpa/nameser.h" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_IN6ADDRSZ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2853 "configure" +#line 2864 "configure" #include "confdefs.h" - #include <arpa/nameser.h> + +#include <sys/types.h> +#include <arpa/nameser.h> + int main() { int X = IN6ADDRSZ ; ; return 0; } EOF -if { (eval echo configure:2860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_IN6ADDRSZ=yes else @@ -2886,23 +2900,24 @@ fi echo $ac_n "checking for struct addrinfo""... $ac_c" 1>&6 -echo "configure:2890: checking for struct addrinfo" >&5 +echo "configure:2904: checking for struct addrinfo" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_ADDRINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2896 "configure" +#line 2910 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> -#include <netdb.h> +#include <netdb.h> + int main() { struct addrinfo X ; ; return 0; } EOF -if { (eval echo configure:2906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_ADDRINFO=yes else @@ -2929,13 +2944,13 @@ EOF echo $ac_n "checking for d_namlen in struct dirent""... $ac_c" 1>&6 -echo "configure:2933: checking for d_namlen in struct dirent" >&5 +echo "configure:2948: checking for d_namlen in struct dirent" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_D_NAMLEN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2939 "configure" +#line 2954 "configure" #include "confdefs.h" #if HAVE_DIRENT_H @@ -2951,14 +2966,16 @@ else # if HAVE_NDIR_H # include <ndir.h> # endif -#endif +#endif + int main() { struct dirent dp; - int X = dp.d_namlen; ; + int X = dp.d_namlen; + ; ; return 0; } EOF -if { (eval echo configure:2962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_D_NAMLEN=yes else @@ -2985,21 +3002,22 @@ EOF echo $ac_n "checking for h_errno declaration""... $ac_c" 1>&6 -echo "configure:2989: checking for h_errno declaration" >&5 +echo "configure:3006: checking for h_errno declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_H_ERRNO_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2995 "configure" +#line 3012 "configure" #include "confdefs.h" -#include <netdb.h> +#include <netdb.h> + int main() { int X = h_errno ; ; return 0; } EOF -if { (eval echo configure:3003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_H_ERRNO_D=yes else @@ -3026,21 +3044,22 @@ EOF echo $ac_n "checking for fclose() declaration""... $ac_c" 1>&6 -echo "configure:3030: checking for fclose() declaration" >&5 +echo "configure:3048: checking for fclose() declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_FCLOSE_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3036 "configure" +#line 3054 "configure" #include "confdefs.h" -#include <stdio.h> +#include <stdio.h> + int main() { int (*X)() = fclose ; ; return 0; } EOF -if { (eval echo configure:3044: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_FCLOSE_D=yes else @@ -3067,22 +3086,23 @@ EOF echo $ac_n "checking for getpass() declaration""... $ac_c" 1>&6 -echo "configure:3071: checking for getpass() declaration" >&5 +echo "configure:3090: checking for getpass() declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_GETPASS_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3077 "configure" +#line 3096 "configure" #include "confdefs.h" #include <stdlib.h> -#include <unistd.h> +#include <unistd.h> + int main() { char *(*X)() = getpass ; ; return 0; } EOF -if { (eval echo configure:3086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_GETPASS_D=yes else @@ -3097,8 +3117,7 @@ fi echo "$ac_t""$ftp_cv_HAVE_GETPASS_D" 1>&6 if test "x$ftp_cv_HAVE_GETPASS_D" = "xyes"; then - - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define HAVE_GETPASS_D 1 EOF @@ -3110,22 +3129,23 @@ EOF echo $ac_n "checking for optarg declaration""... $ac_c" 1>&6 -echo "configure:3114: checking for optarg declaration" >&5 +echo "configure:3133: checking for optarg declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_OPTARG_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3120 "configure" +#line 3139 "configure" #include "confdefs.h" #include <stdlib.h> -#include <unistd.h> +#include <unistd.h> + int main() { char *X = optarg ; ; return 0; } EOF -if { (eval echo configure:3129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_OPTARG_D=yes else @@ -3152,22 +3172,23 @@ EOF echo $ac_n "checking for optind declaration""... $ac_c" 1>&6 -echo "configure:3156: checking for optind declaration" >&5 +echo "configure:3176: checking for optind declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_OPTIND_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3162 "configure" +#line 3182 "configure" #include "confdefs.h" #include <stdlib.h> -#include <unistd.h> +#include <unistd.h> + int main() { int X = optind ; ; return 0; } EOF -if { (eval echo configure:3171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_OPTIND_D=yes else @@ -3194,21 +3215,22 @@ EOF echo $ac_n "checking for pclose() declaration""... $ac_c" 1>&6 -echo "configure:3198: checking for pclose() declaration" >&5 +echo "configure:3219: checking for pclose() declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_PCLOSE_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3204 "configure" +#line 3225 "configure" #include "confdefs.h" -#include <stdio.h> +#include <stdio.h> + int main() { int (*X)() = pclose ; ; return 0; } EOF -if { (eval echo configure:3212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_PCLOSE_D=yes else @@ -3239,12 +3261,12 @@ for ac_func in err fgetln fseeko getaddrinfo getnameinfo inet_ntop inet_pton \ strlcpy strptime strsep strunvis strvis timegm usleep utimes do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3243: checking for $ac_func" >&5 +echo "configure:3265: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3248 "configure" +#line 3270 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3267,7 +3289,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3296,12 +3318,12 @@ done for ac_func in gethostbyname2 getpassphrase getpgrp memmove select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3300: checking for $ac_func" >&5 +echo "configure:3322: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3305 "configure" +#line 3327 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3324,7 +3346,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3350,7 +3372,7 @@ done if test $ac_cv_func_getpgrp = yes; then echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3354: checking whether getpgrp takes no argument" >&5 +echo "configure:3376: checking whether getpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3358,7 +3380,7 @@ else { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3362 "configure" +#line 3384 "configure" #include "confdefs.h" /* @@ -3413,7 +3435,7 @@ main() } EOF -if { (eval echo configure:3417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_getpgrp_void=yes else @@ -3441,12 +3463,12 @@ if test $ac_cv_lib_util_fparseln != yes; then for ac_func in fparseln do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3445: checking for $ac_func" >&5 +echo "configure:3467: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3450 "configure" +#line 3472 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3469,7 +3491,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3502,21 +3524,24 @@ LIBOBJS="$LIBOBJS glob.o" if test $ac_cv_func_strptime = yes; then echo $ac_n "checking for strptime() declaration""... $ac_c" 1>&6 -echo "configure:3506: checking for strptime() declaration" >&5 +echo "configure:3528: checking for strptime() declaration" >&5 if eval "test \"`echo '$''{'ftp_cv_HAVE_STRPTIME_D'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3512 "configure" +#line 3534 "configure" #include "confdefs.h" - #include <time.h> +#include <time.h> + int main() { - char *X = strptime("", "", NULL) ; + + char *X = strptime("", "", NULL) + ; ; return 0; } EOF -if { (eval echo configure:3520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_HAVE_STRPTIME_D=yes else @@ -3546,24 +3571,24 @@ if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then echo $ac_n "checking *printf() support for %lld""... $ac_c" 1>&6 -echo "configure:3550: checking *printf() support for %lld" >&5 +echo "configure:3575: checking *printf() support for %lld" >&5 can_printf_longlong=no if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 3556 "configure" +#line 3581 "configure" #include "confdefs.h" - #include <stdio.h> - int main() { - char buf[100]; - sprintf(buf, "%lld", 4294967300LL); - return (strcmp(buf, "4294967300")); - } +#include <stdio.h> +int main() { + char buf[100]; + sprintf(buf, "%lld", 4294967300LL); + return (strcmp(buf, "4294967300")); +} EOF -if { (eval echo configure:3567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 @@ -3583,23 +3608,23 @@ fi if test $can_printf_longlong != yes; then echo $ac_n "checking *printf() support for %qd""... $ac_c" 1>&6 -echo "configure:3587: checking *printf() support for %qd" >&5 +echo "configure:3612: checking *printf() support for %qd" >&5 if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 3592 "configure" +#line 3617 "configure" #include "confdefs.h" - #include <stdio.h> - int main() { - char buf[100]; - sprintf(buf, "%qd", 4294967300LL); - return (strcmp(buf, "4294967300")); - } +#include <stdio.h> +int main() { + char buf[100]; + sprintf(buf, "%qd", 4294967300LL); + return (strcmp(buf, "4294967300")); +} EOF -if { (eval echo configure:3603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 @@ -3630,12 +3655,12 @@ EOF for ac_func in strtoll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3634: checking for $ac_func" >&5 +echo "configure:3659: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3639 "configure" +#line 3664 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3658,7 +3683,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3835,21 +3860,22 @@ if test $opt_editcomplete = yes; then if test $have_libedit = yes; then echo $ac_n "checking for EL_RPROMPT in libedit""... $ac_c" 1>&6 -echo "configure:3839: checking for EL_RPROMPT in libedit" >&5 +echo "configure:3722: checking for EL_RPROMPT in libedit" >&5 if eval "test \"`echo '$''{'ftp_cv_have_libedit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3845 "configure" +#line 3728 "configure" #include "confdefs.h" - #include <histedit.h> +#include <histedit.h> + int main() { int X = EL_RPROMPT ; ; return 0; } EOF -if { (eval echo configure:3853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_have_libedit=yes else @@ -3873,7 +3899,7 @@ echo "$ac_t""$ftp_cv_have_libedit" 1>&6 fi echo $ac_n "checking for working libedit""... $ac_c" 1>&6 -echo "configure:3877: checking for working libedit" >&5 +echo "configure:3761: checking for working libedit" >&5 if test $have_libedit = no; then echo "$ac_t""no - using my own" 1>&6 INCLUDES="-I\${srcdir}/../libedit $INCLUDES" @@ -3891,21 +3917,24 @@ fi if test $ac_cv_func_sl_init = yes; then echo $ac_n "checking if sl_add() returns int""... $ac_c" 1>&6 -echo "configure:3895: checking if sl_add() returns int" >&5 +echo "configure:3779: checking if sl_add() returns int" >&5 if eval "test \"`echo '$''{'ftp_cv_INT_SL_ADD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3901 "configure" +#line 3785 "configure" #include "confdefs.h" - #include <stringlist.h> +#include <stringlist.h> + int main() { - int f = sl_add((StringList *)0, "foo") ; + + int f = sl_add((StringList *)0, "foo") + ; ; return 0; } EOF -if { (eval echo configure:3909: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_INT_SL_ADD=yes else @@ -3933,23 +3962,24 @@ have_rfc2553_netdb=no if test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then echo $ac_n "checking for AI_NUMERICHOST""... $ac_c" 1>&6 -echo "configure:3937: checking for AI_NUMERICHOST" >&5 +echo "configure:3824: checking for AI_NUMERICHOST" >&5 if eval "test \"`echo '$''{'ftp_cv_have_ai_numerichost'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3943 "configure" +#line 3830 "configure" #include "confdefs.h" - #include <sys/types.h> - #include <sys/socket.h> - #include <netdb.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> + int main() { int X = AI_NUMERICHOST ; ; return 0; } EOF -if { (eval echo configure:3953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_have_ai_numerichost=yes else @@ -3972,7 +4002,7 @@ echo "$ac_t""$ftp_cv_have_ai_numerichost" 1>&6 fi echo $ac_n "checking for working getaddrinfo()""... $ac_c" 1>&6 -echo "configure:3976: checking for working getaddrinfo()" >&5 +echo "configure:3864: checking for working getaddrinfo()" >&5 if test $have_rfc2553_netdb = yes; then cat >> confdefs.h <<\EOF #define HAVE_RFC2553_NETDB 1 @@ -3992,22 +4022,23 @@ fi if test $ac_cv_header_vis_h = yes; then echo $ac_n "checking for VIS_WHITE in vis.h""... $ac_c" 1>&6 -echo "configure:3996: checking for VIS_WHITE in vis.h" >&5 +echo "configure:3884: checking for VIS_WHITE in vis.h" >&5 if eval "test \"`echo '$''{'ftp_cv_have_vis_white'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4002 "configure" +#line 3890 "configure" #include "confdefs.h" - #include <sys/types.h> - #include <vis.h> +#include <sys/types.h> +#include <vis.h> + int main() { int X = VIS_WHITE ; ; return 0; } EOF -if { (eval echo configure:4011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ftp_cv_have_vis_white=yes else diff --git a/net/tnftp/files/configure.in b/net/tnftp/files/configure.in index 05fdce29e9a..725afa866ae 100644 --- a/net/tnftp/files/configure.in +++ b/net/tnftp/files/configure.in @@ -1,10 +1,10 @@ -dnl $Id: configure.in,v 1.3 2004/04/25 02:48:12 grant Exp $ +dnl $Id: configure.in,v 1.4 2005/01/04 23:44:24 lukem Exp $ dnl dnl configure.in -- dnl process this file with autoconf to produce a configure script. dnl -AC_REVISION($Revision: 1.3 $)dnl +AC_REVISION($Revision: 1.4 $)dnl AC_INIT(tnftp.h) @@ -70,49 +70,60 @@ AC_HEADER_TIME AC_TYPE_OFF_T AC_CHECK_SIZEOF(off_t, 0) AC_MSG_TRY_LINK(for long long, ftp_cv_HAVE_LONG_LONG, [ -#include <sys/types.h>] , [ -long long X = 2, Y = 1, Z; -Z = X / Y; ], [ -AC_DEFINE(HAVE_LONG_LONG, 1) -have_long_long=yes], [have_long_long=no]) +#include <sys/types.h> + ] , [ + long long X = 2, Y = 1, Z; + Z = X / Y; + ], [ + AC_DEFINE(HAVE_LONG_LONG, 1) + have_long_long=yes + ], [have_long_long=no]) AC_MSG_TRY_COMPILE(for in_port_t, ftp_cv_HAVE_IN_PORT_T, [ #include <sys/types.h> -#include <netinet/in.h> ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)]) +#include <netinet/in.h> + ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)]) AC_MSG_TRY_COMPILE(for sa_family_t, ftp_cv_HAVE_SA_FAMILY_T, [ #include <sys/types.h> -#include <sys/socket.h> ], [ sa_family_t X ], [AC_DEFINE(HAVE_SA_FAMILY_T, 1)]) +#include <sys/socket.h> + ], [ sa_family_t X ], [AC_DEFINE(HAVE_SA_FAMILY_T, 1)]) AC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ftp_cv_HAVE_SOCKADDR_SA_LEN, [ #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> ], [ +#include <netinet/in.h> + ], [ struct sockaddr_in sin; - int X = sin.sin_len ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)]) + int X = sin.sin_len + ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)]) AC_MSG_TRY_COMPILE(for socklen_t, ftp_cv_HAVE_SOCKLEN_T, [ #include <sys/types.h> -#include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)]) +#include <sys/socket.h> + ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)]) if test $opt_ipv6 = yes; then AC_MSG_TRY_COMPILE(for AF_INET6, ftp_cv_HAVE_AF_INET6, [ #include <sys/types.h> -#include <sys/socket.h> ], - [ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)]) +#include <sys/socket.h> + ], [ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)]) AC_MSG_TRY_COMPILE(for struct sockaddr_in6, ftp_cv_HAVE_SOCKADDR_IN6, [ #include <sys/types.h> -#include <netinet/in.h> ], [ - struct sockaddr_in6 X; - int Y = X.sin6_scope_id ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)]) +#include <netinet/in.h> + ], [ + struct sockaddr_in6 X; + int Y = X.sin6_scope_id + ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)]) if test $ac_cv_header_arpa_nameser_h = yes; then AC_MSG_TRY_COMPILE(for IN6ADDRSZ in arpa/nameser.h, - ftp_cv_HAVE_IN6ADDRSZ, - [ #include <arpa/nameser.h> ], - [ int X = IN6ADDRSZ ], [AC_DEFINE(HAVE_IN6ADDRSZ, 1)]) + ftp_cv_HAVE_IN6ADDRSZ, [ +#include <sys/types.h> +#include <arpa/nameser.h> + ], [ int X = IN6ADDRSZ ], [AC_DEFINE(HAVE_IN6ADDRSZ, 1)]) fi fi @@ -120,8 +131,8 @@ fi AC_MSG_TRY_COMPILE(for struct addrinfo, ftp_cv_HAVE_ADDRINFO, [ #include <sys/types.h> #include <sys/socket.h> -#include <netdb.h> ], - [ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)]) +#include <netdb.h> + ], [ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)]) AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [ #if HAVE_DIRENT_H @@ -137,31 +148,38 @@ AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [ # if HAVE_NDIR_H # include <ndir.h> # endif -#endif ], [ +#endif + ], [ struct dirent dp; - int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)]) + int X = dp.d_namlen; + ], [AC_DEFINE(HAVE_D_NAMLEN, 1)]) AC_MSG_TRY_COMPILE(for h_errno declaration, ftp_cv_HAVE_H_ERRNO_D, [ -#include <netdb.h> ], [ int X = h_errno ], [AC_DEFINE(HAVE_H_ERRNO_D, 1)]) +#include <netdb.h> + ], [ int X = h_errno ], [AC_DEFINE(HAVE_H_ERRNO_D, 1)]) AC_MSG_TRY_COMPILE(for fclose() declaration, ftp_cv_HAVE_FCLOSE_D, [ -#include <stdio.h> ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)]) +#include <stdio.h> + ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)]) AC_MSG_TRY_COMPILE(for getpass() declaration, ftp_cv_HAVE_GETPASS_D, [ #include <stdlib.h> -#include <unistd.h> ], [ char *(*X)() = getpass ], [ - AC_DEFINE(HAVE_GETPASS_D, 1)]) +#include <unistd.h> + ], [ char *(*X)() = getpass ], [ AC_DEFINE(HAVE_GETPASS_D, 1)]) AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [ #include <stdlib.h> -#include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)]) +#include <unistd.h> + ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)]) AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [ #include <stdlib.h> -#include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)]) +#include <unistd.h> + ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)]) AC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [ -#include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)]) +#include <stdio.h> + ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)]) dnl Checks for library functions. @@ -181,8 +199,10 @@ LIBOBJS="$LIBOBJS glob.o" if test $ac_cv_func_strptime = yes; then AC_MSG_TRY_COMPILE(for strptime() declaration, ftp_cv_HAVE_STRPTIME_D, [ - #include <time.h> ], [ char *X = strptime("", "", NULL) ], - [AC_DEFINE(HAVE_STRPTIME_D, 1)]) +#include <time.h> + ], [ + char *X = strptime("", "", NULL) + ], [AC_DEFINE(HAVE_STRPTIME_D, 1)]) fi if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then @@ -194,12 +214,12 @@ dnl support because we don't know how to display it. AC_MSG_CHECKING(*printf() support for %lld) can_printf_longlong=no AC_TRY_RUN([ - #include <stdio.h> - int main() { - char buf[100]; - sprintf(buf, "%lld", 4294967300LL); - return (strcmp(buf, "4294967300")); - } +#include <stdio.h> +int main() { + char buf[100]; + sprintf(buf, "%lld", 4294967300LL); + return (strcmp(buf, "4294967300")); +} ], [ AC_MSG_RESULT(yes) can_printf_longlong=yes @@ -210,12 +230,12 @@ dnl support because we don't know how to display it. if test $can_printf_longlong != yes; then AC_MSG_CHECKING(*printf() support for %qd) AC_TRY_RUN([ - #include <stdio.h> - int main() { - char buf[100]; - sprintf(buf, "%qd", 4294967300LL); - return (strcmp(buf, "4294967300")); - } +#include <stdio.h> +int main() { + char buf[100]; + sprintf(buf, "%qd", 4294967300LL); + return (strcmp(buf, "4294967300")); +} ], [ AC_MSG_RESULT(yes) can_printf_longlong=yes @@ -259,8 +279,9 @@ fi if test $opt_editcomplete = yes; then if test $have_libedit = yes; then AC_MSG_TRY_COMPILE(for EL_RPROMPT in libedit, - ftp_cv_have_libedit, [ - #include <histedit.h> ], [ int X = EL_RPROMPT ], [:], + ftp_cv_have_libedit, [ +#include <histedit.h> + ], [ int X = EL_RPROMPT ], [:], have_libedit=no ) fi @@ -281,8 +302,10 @@ fi if test $ac_cv_func_sl_init = yes; then AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [ - #include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ], - [:] , [LIBOBJS="$LIBOBJS sl_init.o"]) +#include <stringlist.h> + ], [ + int f = sl_add((StringList *)0, "foo") + ], [:] , [LIBOBJS="$LIBOBJS sl_init.o"]) fi @@ -290,10 +313,10 @@ have_rfc2553_netdb=no if test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then AC_MSG_TRY_COMPILE(for AI_NUMERICHOST, ftp_cv_have_ai_numerichost, [ - #include <sys/types.h> - #include <sys/socket.h> - #include <netdb.h> ], - [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ]) +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> + ], [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ]) fi AC_MSG_CHECKING(for working getaddrinfo()) if test $have_rfc2553_netdb = yes; then @@ -311,10 +334,10 @@ fi if test $ac_cv_header_vis_h = yes; then AC_MSG_TRY_COMPILE(for VIS_WHITE in vis.h, - ftp_cv_have_vis_white, [ - #include <sys/types.h> - #include <vis.h> ], [ int X = VIS_WHITE ], [:], - ac_cv_header_vis_h=no ) + ftp_cv_have_vis_white, [ +#include <sys/types.h> +#include <vis.h> + ], [ int X = VIS_WHITE ], [:], ac_cv_header_vis_h=no ) fi diff --git a/net/tnftp/files/src/cmds.c b/net/tnftp/files/src/cmds.c index d2571e146e0..104966639f0 100644 --- a/net/tnftp/files/src/cmds.c +++ b/net/tnftp/files/src/cmds.c @@ -1,7 +1,7 @@ -/* $NetBSD: cmds.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */ +/* $NetBSD: cmds.c,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- - * Copyright (c) 1996-2004 The NetBSD Foundation, Inc. + * Copyright (c) 1996-2005 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -52,11 +52,7 @@ * 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 University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -108,7 +104,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -__RCSID("$NetBSD: cmds.c,v 1.2 2004/07/27 10:25:09 grant Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.3 2005/01/04 23:44:24 lukem Exp $"); #endif #endif /* not lint */ #endif @@ -137,7 +133,7 @@ struct types { }; sigjmp_buf jabort; -char *mname; +const char *mname; static int confirm(const char *, const char *); @@ -157,7 +153,7 @@ confirm(const char *cmd, const char *file) clearerr(stdin); return (0); } - switch (tolower(*line)) { + switch (tolower((unsigned char)*line)) { case 'a': confirmrest = 1; fprintf(ttyout, @@ -682,7 +678,14 @@ mget(int argc, char *argv[]) mflag = 0; continue; } - if (! mflag || !confirm(argv[0], cp)) + if (! mflag) + continue; + if (! fileindir(cp, localcwd)) { + fprintf(ttyout, "Skipping non-relative filename `%s'\n", + cp); + continue; + } + if (!confirm(argv[0], cp)) continue; tp = cp; if (mcase) @@ -764,13 +767,13 @@ onoff(int bool) void status(int argc, char *argv[]) { - int i; if (argc == 0) { fprintf(ttyout, "usage: %s\n", argv[0]); code = -1; return; } +#ifndef NO_STATUS if (connected) fprintf(ttyout, "Connected %sto %s.\n", connected == -1 ? "and logged in" : "", hostname); @@ -834,13 +837,16 @@ status(int argc, char *argv[]) onoff(editing) #endif /* !def NO_EDITCOMPLETE */ ); - fprintf(ttyout, "Version: %s %s\n", FTP_PRODUCT, FTP_VERSION); if (macnum > 0) { + int i; + fputs("Macros:\n", ttyout); for (i=0; i<macnum; i++) { fprintf(ttyout, "\t%s\n", macros[i].mac_name); } } +#endif /* !def NO_STATUS */ + fprintf(ttyout, "Version: %s %s\n", FTP_PRODUCT, FTP_VERSION); code = 0; } @@ -1121,7 +1127,7 @@ cd(int argc, char *argv[]) } if (r == COMPLETE) { dirchange = 1; - updateremotepwd(); + updateremotecwd(); } } @@ -1131,7 +1137,6 @@ cd(int argc, char *argv[]) void lcd(int argc, char *argv[]) { - char buf[MAXPATHLEN]; char *locdir; code = -1; @@ -1145,14 +1150,16 @@ lcd(int argc, char *argv[]) } if ((locdir = globulize(argv[1])) == NULL) return; - if (chdir(locdir) < 0) - warn("local: %s", locdir); + if (chdir(locdir) == -1) + warn("lcd %s", locdir); else { - if (getcwd(buf, sizeof(buf)) != NULL) { - fprintf(ttyout, "Local directory now %s\n", buf); + updatelocalcwd(); + if (localcwd[0]) { + fprintf(ttyout, "Local directory now: %s\n", localcwd); code = 0; - } else - warn("getcwd: %s", locdir); + } else { + fprintf(ttyout, "Unable to determine local directory\n"); + } } (void)free(locdir); } @@ -1164,7 +1171,6 @@ void delete(int argc, char *argv[]) { - if (argc == 0 || argc > 2 || (argc == 1 && !another(&argc, &argv, "remote-file"))) { fprintf(ttyout, "usage: %s remote-file\n", argv[0]); @@ -1313,6 +1319,7 @@ ls(int argc, char *argv[]) (void)strlcpy(locfile + 1, p, len - 1); freelocfile = 1; } else if ((strcmp(locfile, "-") != 0) && *locfile != '|') { + mname = argv[0]; if ((locfile = globulize(locfile)) == NULL || !confirm("output to local-file:", locfile)) { code = -1; @@ -1349,6 +1356,7 @@ mls(int argc, char *argv[]) } odest = dest = argv[argc - 1]; argv[argc - 1] = NULL; + mname = argv[0]; if (strcmp(dest, "-") && *dest != '|') if (((dest = globulize(dest)) == NULL) || !confirm("output to local-file:", dest)) { @@ -1356,7 +1364,6 @@ mls(int argc, char *argv[]) return; } dolist = strcmp(argv[0], "mls"); - mname = argv[0]; mflag = 1; oldintr = xsignal(SIGINT, mintr); if (sigsetjmp(jabort, 1)) @@ -1499,19 +1506,20 @@ user(int argc, char *argv[]) void pwd(int argc, char *argv[]) { - int oldverbose = verbose; - if (argc == 0) { + code = -1; + if (argc != 1) { fprintf(ttyout, "usage: %s\n", argv[0]); - code = -1; return; } - verbose = 1; /* If we aren't verbose, this doesn't do anything! */ - if (command("PWD") == ERROR && code == 500) { - fputs("PWD command not recognized, trying XPWD.\n", ttyout); - (void)command("XPWD"); + if (! remotecwd[0]) + updateremotecwd(); + if (! remotecwd[0]) + fprintf(ttyout, "Unable to determine remote directory\n"); + else { + fprintf(ttyout, "Remote directory: %s\n", remotecwd); + code = 0; } - verbose = oldverbose; } /* @@ -1520,19 +1528,19 @@ pwd(int argc, char *argv[]) void lpwd(int argc, char *argv[]) { - char buf[MAXPATHLEN]; - if (argc == 0) { + code = -1; + if (argc != 1) { fprintf(ttyout, "usage: %s\n", argv[0]); - code = -1; return; } - if (getcwd(buf, sizeof(buf)) != NULL) { - fprintf(ttyout, "Local directory %s\n", buf); + if (! localcwd[0]) + updatelocalcwd(); + if (! localcwd[0]) + fprintf(ttyout, "Unable to determine local directory\n"); + else { + fprintf(ttyout, "Local directory: %s\n", localcwd); code = 0; - } else { - warn("getcwd"); - code = -1; } } @@ -1877,7 +1885,7 @@ docase(char *name) if (dochange) { for (i = 0; new[i] != '\0'; i++) if (isupper((unsigned char)new[i])) - new[i] = tolower(new[i]); + new[i] = tolower((unsigned char)new[i]); } return (new); } @@ -2298,7 +2306,7 @@ cdup(int argc, char *argv[]) } if (r == COMPLETE) { dirchange = 1; - updateremotepwd(); + updateremotecwd(); } } diff --git a/net/tnftp/files/src/cmdtab.c b/net/tnftp/files/src/cmdtab.c index b072ee3b36a..4b0aaa3ad93 100644 --- a/net/tnftp/files/src/cmdtab.c +++ b/net/tnftp/files/src/cmdtab.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdtab.c,v 1.1.1.2 2005/01/03 10:08:40 lukem Exp $ */ +/* $NetBSD: cmdtab.c,v 1.2 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1996-2000 The NetBSD Foundation, Inc. diff --git a/net/tnftp/files/src/domacro.c b/net/tnftp/files/src/domacro.c index 1fc8f25a33e..b35156435d6 100644 --- a/net/tnftp/files/src/domacro.c +++ b/net/tnftp/files/src/domacro.c @@ -1,4 +1,4 @@ -/* $NetBSD: domacro.c,v 1.1.1.2 2005/01/03 10:08:40 lukem Exp $ */ +/* $NetBSD: domacro.c,v 1.2 2005/01/04 23:44:24 lukem Exp $ */ /* * Copyright (c) 1985, 1993, 1994 diff --git a/net/tnftp/files/src/extern.h b/net/tnftp/files/src/extern.h index 7f47a0b38d9..de9b36a0df7 100644 --- a/net/tnftp/files/src/extern.h +++ b/net/tnftp/files/src/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.1.1.2 2005/01/03 10:08:40 lukem Exp $ */ +/* $NetBSD: extern.h,v 1.2 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1996-2005 The NetBSD Foundation, Inc. diff --git a/net/tnftp/files/src/fetch.c b/net/tnftp/files/src/fetch.c index 45025d836cd..08cb08ca72d 100644 --- a/net/tnftp/files/src/fetch.c +++ b/net/tnftp/files/src/fetch.c @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */ +/* $NetBSD: fetch.c,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ #if 0 #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: fetch.c,v 1.2 2004/07/27 10:25:09 grant Exp $"); +__RCSID("$NetBSD: fetch.c,v 1.3 2005/01/04 23:44:24 lukem Exp $"); #endif /* not lint */ #endif @@ -64,11 +64,14 @@ typedef enum { } url_t; void aborthttp(int); +#ifndef NO_AUTH static int auth_url(const char *, char **, const char *, const char *); -static void base64_encode(const u_char *, size_t, u_char *); +static void base64_encode(const unsigned char *, size_t, unsigned char *); +#endif static int go_fetch(const char *); static int fetch_ftp(const char *); static int fetch_url(const char *, const char *, char *, char *); +static const char *match_token(const char **, const char *); static int parse_url(const char *, const char *, url_t *, char **, char **, char **, char **, in_port_t *, char **); static void url_decode(char *); @@ -76,6 +79,11 @@ static void url_decode(char *); static int redirect_loop; +#define STRNEQUAL(a,b) (strncasecmp((a), (b), sizeof((b))-1) == 0) +#define ISLWS(x) ((x)=='\r' || (x)=='\n' || (x)==' ' || (x)=='\t') +#define SKIPLWS(x) do { while (ISLWS((*x))) x++; } while (0) + + #define ABOUT_URL "about:" /* propaganda */ #define FILE_URL "file://" /* file URL prefix */ #define FTP_URL "ftp://" /* ftp URL prefix */ @@ -83,6 +91,35 @@ static int redirect_loop; /* + * Determine if token is the next word in buf (case insensitive). + * If so, advance buf past the token and any trailing LWS, and + * return a pointer to the token (in buf). Otherwise, return NULL. + * token may be preceeded by LWS. + * token must be followed by LWS or NUL. (I.e, don't partial match). + */ +static const char * +match_token(const char **buf, const char *token) +{ + const char *p, *orig; + size_t tlen; + + tlen = strlen(token); + p = *buf; + SKIPLWS(p); + orig = p; + if (strncasecmp(p, token, tlen) != 0) + return NULL; + p += tlen; + if (*p != '\0' && !ISLWS(*p)) + return NULL; + SKIPLWS(p); + orig = *buf; + *buf = p; + return orig; +} + +#ifndef NO_AUTH +/* * Generate authorization response based on given authentication challenge. * Returns -1 if an error occurred, otherwise 0. * Sets response to a malloc(3)ed string; caller should free. @@ -91,52 +128,52 @@ static int auth_url(const char *challenge, char **response, const char *guser, const char *gpass) { - char *cp, *ep, *clear, *line, *realm, *scheme; + const char *cp, *scheme; + char *ep, *clear, *realm; char user[BUFSIZ], *pass; int rval; size_t len, clen, rlen; *response = NULL; - clear = realm = scheme = NULL; + clear = realm = NULL; rval = -1; - line = xstrdup(challenge); - cp = line; + cp = challenge; + scheme = "Basic"; /* only support Basic authentication */ if (debug) fprintf(ttyout, "auth_url: challenge `%s'\n", challenge); - scheme = strsep(&cp, " "); -#define SCHEME_BASIC "Basic" - if (strncasecmp(scheme, SCHEME_BASIC, sizeof(SCHEME_BASIC) - 1) != 0) { - warnx("Unsupported WWW Authentication challenge - `%s'", + if (! match_token(&cp, scheme)) { + warnx("Unsupported authentication challenge - `%s'", challenge); goto cleanup_auth_url; } - cp += strspn(cp, " "); #define REALM "realm=\"" - if (strncasecmp(cp, REALM, sizeof(REALM) - 1) == 0) + if (STRNEQUAL(cp, REALM)) cp += sizeof(REALM) - 1; else { - warnx("Unsupported WWW Authentication challenge - `%s'", + warnx("Unsupported authentication challenge - `%s'", challenge); goto cleanup_auth_url; } +/* XXX: need to improve quoted-string parsing to support \ quoting, etc. */ if ((ep = strchr(cp, '\"')) != NULL) { size_t len = ep - cp; realm = (char *)xmalloc(len + 1); (void)strlcpy(realm, cp, len + 1); } else { - warnx("Unsupported WWW Authentication challenge - `%s'", + warnx("Unsupported authentication challenge - `%s'", challenge); goto cleanup_auth_url; } - if (guser != NULL) + fprintf(ttyout, "Username for `%s': ", realm); + if (guser != NULL) { (void)strlcpy(user, guser, sizeof(user)); - else { - fprintf(ttyout, "Username for `%s': ", realm); + fprintf(ttyout, "%s\n", user); + } else { (void)fflush(ttyout); if (fgets(user, sizeof(user) - 1, stdin) == NULL) { clearerr(stdin); @@ -162,13 +199,13 @@ auth_url(const char *challenge, char **response, const char *guser, *response = (char *)xmalloc(rlen); (void)strlcpy(*response, scheme, rlen); len = strlcat(*response, " ", rlen); - base64_encode(clear, clen, (u_char *)*response + len); + /* use `clen - 1' to not encode the trailing NUL */ + base64_encode(clear, clen - 1, (unsigned char *)*response + len); memset(clear, 0, clen); rval = 0; cleanup_auth_url: FREEPTR(clear); - FREEPTR(line); FREEPTR(realm); return (rval); } @@ -178,11 +215,11 @@ auth_url(const char *challenge, char **response, const char *guser, * which should be at least ((len + 2) * 4 / 3 + 1) in size. */ static void -base64_encode(const u_char *clear, size_t len, u_char *encoded) +base64_encode(const unsigned char *clear, size_t len, unsigned char *encoded) { - static const u_char enc[] = + static const unsigned char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - u_char *cp; + unsigned char *cp; int i; cp = encoded; @@ -198,6 +235,7 @@ base64_encode(const u_char *clear, size_t len, u_char *encoded) while (i-- > len) *(--cp) = '='; } +#endif /* * Decode %xx escapes in given string, `in-place'. @@ -227,7 +265,7 @@ url_decode(char *url) /* * Parse URL of form: - * <type>://[<user>[:<password>@]]<host>[:<port>][/<path>] + * <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 * user, pass and path. @@ -276,17 +314,17 @@ parse_url(const char *url, const char *desc, url_t *type, *portnum = 0; tport = NULL; - if (strncasecmp(url, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) { + if (STRNEQUAL(url, HTTP_URL)) { url += sizeof(HTTP_URL) - 1; *type = HTTP_URL_T; *portnum = HTTP_PORT; tport = httpport; - } else if (strncasecmp(url, FTP_URL, sizeof(FTP_URL) - 1) == 0) { + } else if (STRNEQUAL(url, FTP_URL)) { url += sizeof(FTP_URL) - 1; *type = FTP_URL_T; *portnum = FTP_PORT; tport = ftpport; - } else if (strncasecmp(url, FILE_URL, sizeof(FILE_URL) - 1) == 0) { + } else if (STRNEQUAL(url, FILE_URL)) { url += sizeof(FILE_URL) - 1; *type = FILE_URL_T; } else { @@ -328,6 +366,9 @@ parse_url(const char *url, const char *desc, url_t *type, *cp = '\0'; *pass = xstrdup(cp + 1); } + url_decode(*user); + if (*pass) + url_decode(*pass); } #ifdef INET6 @@ -416,7 +457,8 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) size_t len; static size_t bufsize; static char *xferbuf; - char *cp, *ep, *buf, *savefile; + const char *cp, *token; + char *ep, *buf, *savefile; char *auth, *location, *message; char *user, *pass, *host, *port, *path, *decodedpath; char *puser, *ppass, *useragent; @@ -496,7 +538,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) goto cleanup_fetch_url; } else { if (debug) - fprintf(ttyout, "got savefile as `%s'\n", savefile); + fprintf(ttyout, "savefile `%s'\n", savefile); } restart_point = 0; @@ -769,7 +811,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) warn("Receiving HTTP reply"); goto cleanup_fetch_url; } - while (len > 0 && (buf[len-1] == '\r' || buf[len-1] == '\n')) + while (len > 0 && (ISLWS(buf[len-1]))) buf[--len] = '\0'; if (debug) fprintf(ttyout, "received `%s'\n", buf); @@ -786,28 +828,27 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) message = xstrdup(cp); /* Read the rest of the header. */ - FREEPTR(buf); while (1) { + FREEPTR(buf); if ((buf = fparseln(fin, &len, NULL, "\0\0\0", 0)) == NULL) { warn("Receiving HTTP reply"); goto cleanup_fetch_url; } - while (len > 0 && - (buf[len-1] == '\r' || buf[len-1] == '\n')) + while (len > 0 && (ISLWS(buf[len-1]))) buf[--len] = '\0'; if (len == 0) break; if (debug) fprintf(ttyout, "received `%s'\n", buf); - /* Look for some headers */ + /* + * Look for some headers + */ + cp = buf; -#define CONTENTLEN "Content-Length: " - if (strncasecmp(cp, CONTENTLEN, - sizeof(CONTENTLEN) - 1) == 0) { - cp += sizeof(CONTENTLEN) - 1; + if (match_token(&cp, "Content-Length:")) { filesize = STRTOLL(cp, &ep, 10); if (filesize < 0 || *ep != '\0') goto improper; @@ -816,13 +857,12 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) "parsed len as: " LLF "\n", (LLT)filesize); -#define CONTENTRANGE "Content-Range: bytes " - } else if (strncasecmp(cp, CONTENTRANGE, - sizeof(CONTENTRANGE) - 1) == 0) { - cp += sizeof(CONTENTRANGE) - 1; - if (*cp == '*') { - ep = cp + 1; - } + } else if (match_token(&cp, "Content-Range:")) { + if (! match_token(&cp, "bytes")) + goto improper; + + if (*cp == '*') + cp++; else { rangestart = STRTOLL(cp, &ep, 10); if (rangestart < 0 || *ep != '-') @@ -831,19 +871,20 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) rangeend = STRTOLL(cp, &ep, 10); if (rangeend < 0 || rangeend < rangestart) goto improper; + cp = ep; } - if (*ep != '/') + if (*cp != '/') goto improper; - cp = ep + 1; - if (*cp == '*') { - ep = cp + 1; - } + cp++; + if (*cp == '*') + cp++; else { entitylen = STRTOLL(cp, &ep, 10); if (entitylen < 0) goto improper; + cp = ep; } - if (*ep != '\0') + if (*cp != '\0') goto improper; if (debug) { @@ -862,13 +903,10 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) goto cleanup_fetch_url; } -#define LASTMOD "Last-Modified: " - } else if (strncasecmp(cp, LASTMOD, - sizeof(LASTMOD) - 1) == 0) { + } else if (match_token(&cp, "Last-Modified:")) { struct tm parsed; char *t; - cp += sizeof(LASTMOD) - 1; /* RFC 1123 */ if ((t = strptime(cp, "%a, %d %b %Y %H:%M:%S GMT", @@ -891,29 +929,22 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) } } -#define LOCATION "Location: " - } else if (strncasecmp(cp, LOCATION, - sizeof(LOCATION) - 1) == 0) { - cp += sizeof(LOCATION) - 1; + } else if (match_token(&cp, "Location:")) { location = xstrdup(cp); if (debug) fprintf(ttyout, - "parsed location as: %s\n", cp); + "parsed location as `%s'\n", cp); -#define TRANSENC "Transfer-Encoding: " - } else if (strncasecmp(cp, TRANSENC, - sizeof(TRANSENC) - 1) == 0) { - cp += sizeof(TRANSENC) - 1; - if (strcasecmp(cp, "binary") == 0) { + } else if (match_token(&cp, "Transfer-Encoding:")) { + if (match_token(&cp, "binary")) { warnx( - "Bogus transfer encoding - `%s' (fetching anyway)", - cp); + "Bogus transfer encoding - `binary' (fetching anyway)"); continue; } - if (strcasecmp(cp, "chunked") != 0) { + if (! (token = match_token(&cp, "chunked"))) { warnx( "Unsupported transfer encoding - `%s'", - cp); + token); goto cleanup_fetch_url; } ischunked++; @@ -921,26 +952,20 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) fprintf(ttyout, "using chunked encoding\n"); -#define PROXYAUTH "Proxy-Authenticate: " - } else if (strncasecmp(cp, PROXYAUTH, - sizeof(PROXYAUTH) - 1) == 0) { - cp += sizeof(PROXYAUTH) - 1; - FREEPTR(auth); - auth = xstrdup(cp); - if (debug) - fprintf(ttyout, - "parsed proxy-auth as: %s\n", cp); - -#define WWWAUTH "WWW-Authenticate: " - } else if (strncasecmp(cp, WWWAUTH, - sizeof(WWWAUTH) - 1) == 0) { - cp += sizeof(WWWAUTH) - 1; + } else if (match_token(&cp, "Proxy-Authenticate:") + || match_token(&cp, "WWW-Authenticate:")) { + if (! (token = match_token(&cp, "Basic"))) { + if (debug) + fprintf(ttyout, + "skipping unknown auth scheme `%s'\n", + token); + continue; + } FREEPTR(auth); - auth = xstrdup(cp); + auth = xstrdup(token); if (debug) fprintf(ttyout, - "parsed www-auth as: %s\n", cp); - + "parsed auth as `%s'\n", cp); } } @@ -983,18 +1008,13 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) rval = go_fetch(location); } goto cleanup_fetch_url; +#ifndef NO_AUTH case 401: case 407: { char **authp; char *auser, *apass; - fprintf(ttyout, "%s\n", message); - if (EMPTYSTRING(auth)) { - warnx( - "No authentication challenge provided by server"); - goto cleanup_fetch_url; - } if (hcode == 401) { authp = &wwwauth; auser = user; @@ -1004,6 +1024,14 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) auser = puser; apass = ppass; } + if (verbose || *authp == NULL || + auser == NULL || apass == NULL) + fprintf(ttyout, "%s\n", message); + if (EMPTYSTRING(auth)) { + warnx( + "No authentication challenge provided by server"); + goto cleanup_fetch_url; + } if (*authp != NULL) { char reply[10]; @@ -1013,10 +1041,9 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) == NULL) { clearerr(stdin); goto cleanup_fetch_url; - } else { - if (tolower(reply[0]) != 'y') - goto cleanup_fetch_url; } + if (tolower((unsigned char)reply[0]) != 'y') + goto cleanup_fetch_url; auser = NULL; apass = NULL; } @@ -1028,6 +1055,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) } goto cleanup_fetch_url; } +#endif default: if (message) warnx("Error retrieving file - `%s'", message); @@ -1281,17 +1309,14 @@ fetch_ftp(const char *url) rval = 1; type = TYPE_I; - if (strncasecmp(url, FTP_URL, sizeof(FTP_URL) - 1) == 0) { + if (STRNEQUAL(url, FTP_URL)) { if ((parse_url(url, "URL", &urltype, &user, &pass, &host, &port, &portnum, &path) == -1) || (user != NULL && *user == '\0') || - (pass != NULL && *pass == '\0') || EMPTYSTRING(host)) { warnx("Invalid URL `%s'", url); goto cleanup_fetch_ftp; } - url_decode(user); - url_decode(pass); /* * Note: Don't url_decode(path) here. We need to keep the * distinction between "/" and "%2F" until later. @@ -1601,10 +1626,11 @@ go_fetch(const char *url) { char *proxy; +#ifndef NO_ABOUT /* * Check for about:* */ - if (strncasecmp(url, ABOUT_URL, sizeof(ABOUT_URL) - 1) == 0) { + if (STRNEQUAL(url, ABOUT_URL)) { url += sizeof(ABOUT_URL) -1; if (strcasecmp(url, "ftp") == 0 || strcasecmp(url, "tnftp") == 0) { @@ -1634,12 +1660,12 @@ go_fetch(const char *url) fputs("\n", ttyout); return (0); } +#endif /* * Check for file:// and http:// URLs. */ - if (strncasecmp(url, HTTP_URL, sizeof(HTTP_URL) - 1) == 0 || - strncasecmp(url, FILE_URL, sizeof(FILE_URL) - 1) == 0) + if (STRNEQUAL(url, HTTP_URL) || STRNEQUAL(url, FILE_URL)) return (fetch_url(url, NULL, NULL, NULL)); /* @@ -1648,8 +1674,7 @@ go_fetch(const char *url) * Othewise, use fetch_ftp(). */ proxy = getoptionvalue("ftp_proxy"); - if (!EMPTYSTRING(proxy) && - strncasecmp(url, FTP_URL, sizeof(FTP_URL) - 1) == 0) + if (!EMPTYSTRING(proxy) && STRNEQUAL(url, FTP_URL)) return (fetch_url(url, NULL, NULL, NULL)); return (fetch_ftp(url)); diff --git a/net/tnftp/files/src/ftp.1 b/net/tnftp/files/src/ftp.1 index bfb1cc97ee4..7e1b567253c 100644 --- a/net/tnftp/files/src/ftp.1 +++ b/net/tnftp/files/src/ftp.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: ftp.1,v 1.1.1.2 2005/01/03 10:08:40 lukem Exp $ +.\" $NetBSD: ftp.1,v 1.2 2005/01/04 23:44:24 lukem Exp $ .\" .\" Copyright (c) 1996-2003 The NetBSD Foundation, Inc. .\" All rights reserved. diff --git a/net/tnftp/files/src/ftp.c b/net/tnftp/files/src/ftp.c index 68e80560c5d..f76cb2e3400 100644 --- a/net/tnftp/files/src/ftp.c +++ b/net/tnftp/files/src/ftp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftp.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */ +/* $NetBSD: ftp.c,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1996-2004 The NetBSD Foundation, Inc. @@ -48,11 +48,7 @@ * 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 University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -106,7 +102,7 @@ #if 0 static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94"; #else -__RCSID("$NetBSD: ftp.c,v 1.2 2004/07/27 10:25:09 grant Exp $"); +__RCSID("$NetBSD: ftp.c,v 1.3 2005/01/04 23:44:24 lukem Exp $"); #endif #endif /* not lint */ #endif @@ -215,10 +211,7 @@ hookup(char *host, char *port) cause = "socket"; continue; } - while ((error = xconnect(s, res->ai_addr, res->ai_addrlen)) < 0 - && errno == EINTR) { - ; - } + error = xconnect(s, res->ai_addr, res->ai_addrlen); if (error) { /* this "if" clause is to prevent print warning twice */ if (res->ai_next) { @@ -261,7 +254,8 @@ hookup(char *host, char *port) int tos = IPTOS_LOWDELAY; if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0) - warn("setsockopt TOS (ignored)"); + if (debug) + warn("setsockopt TOS (ignored)"); } #endif cin = fdopen(s, "r"); @@ -559,13 +553,13 @@ empty(FILE *cin, FILE *din, int sec) struct pollfd pfd[2]; if (cin) { - pfd[nfd].fd = fileno(cin); - pfd[nfd++].events = POLLIN; + pfd[nfd].fd = fileno(cin); + pfd[nfd++].events = POLLIN; } if (din) { - pfd[nfd].fd = fileno(din); - pfd[nfd++].events = POLLIN; + pfd[nfd].fd = fileno(din); + pfd[nfd++].events = POLLIN; } if ((nr = poll(pfd, nfd, sec * 1000)) <= 0) @@ -1312,7 +1306,8 @@ initconn(void) if ((options & SO_DEBUG) && setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof(on)) < 0) - warn("setsockopt (ignored)"); + if (debug) + warn("setsockopt (ignored)"); result = COMPLETE + 1; switch (data_addr.su_family) { case AF_INET: @@ -1531,8 +1526,6 @@ initconn(void) while (xconnect(data, (struct sockaddr *)&data_addr.si_su, data_addr.su_len) < 0) { - if (errno == EINTR) - continue; if (activefallback) { (void)close(data); data = -1; @@ -1550,7 +1543,8 @@ initconn(void) on = IPTOS_THROUGHPUT; if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on, sizeof(int)) < 0) - warn("setsockopt TOS (ignored)"); + if (debug) + warn("setsockopt TOS (ignored)"); } #endif return (0); @@ -1583,7 +1577,8 @@ initconn(void) if (options & SO_DEBUG && setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof(on)) < 0) - warn("setsockopt (ignored)"); + if (debug) + warn("setsockopt (ignored)"); len = sizeof(data_addr.si_su); memset((char *)&data_addr, 0, sizeof (data_addr)); if (getsockname(data, (struct sockaddr *)&data_addr.si_su, &len) < 0) { @@ -1683,7 +1678,8 @@ initconn(void) on = IPTOS_THROUGHPUT; if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on, sizeof(int)) < 0) - warn("setsockopt TOS (ignored)"); + if (debug) + warn("setsockopt TOS (ignored)"); } #endif return (0); @@ -1716,7 +1712,8 @@ dataconn(const char *lmode) int tos = IPTOS_THROUGHPUT; if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0) { - warn("setsockopt TOS (ignored)"); + if (debug) + warn("setsockopt TOS (ignored)"); } } #endif diff --git a/net/tnftp/files/src/ftp_var.h b/net/tnftp/files/src/ftp_var.h index 11fd03caa41..3beb9046525 100644 --- a/net/tnftp/files/src/ftp_var.h +++ b/net/tnftp/files/src/ftp_var.h @@ -1,7 +1,7 @@ -/* $NetBSD: ftp_var.h,v 1.2 2004/07/27 10:25:09 grant Exp $ */ +/* $NetBSD: ftp_var.h,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- - * Copyright (c) 1996-2004 The NetBSD Foundation, Inc. + * Copyright (c) 1996-2005 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -48,11 +48,7 @@ * 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 University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -122,15 +118,15 @@ * Format of command table. */ struct cmd { - char *c_name; /* name of command */ - char *c_help; /* help string */ - char c_bell; /* give bell when command completes */ - char c_conn; /* must be connected to use command */ - char c_proxy; /* proxy server may execute */ + char *c_name; /* name of command */ + const char *c_help; /* help string */ + char c_bell; /* give bell when command completes */ + char c_conn; /* must be connected to use command */ + char c_proxy; /* proxy server may execute */ #ifndef NO_EDITCOMPLETE - char *c_complete; /* context sensitive completion list */ + const char *c_complete; /* context sensitive completion list */ #endif /* !NO_EDITCOMPLETE */ - void (*c_handler)(int, char **); /* function to call */ + void (*c_handler)(int, char **); /* function to call */ }; /* @@ -265,7 +261,8 @@ GLOBAL char *direction; /* direction transfer is occurring */ GLOBAL char *hostname; /* name of host connected to */ GLOBAL int unix_server; /* server is unix, can use binary for ascii */ GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */ -GLOBAL char remotepwd[MAXPATHLEN]; /* remote dir */ +GLOBAL char localcwd[MAXPATHLEN]; /* local dir */ +GLOBAL char remotecwd[MAXPATHLEN]; /* remote dir */ GLOBAL char *username; /* name of user logged in as. (dynamic) */ GLOBAL sa_family_t family; /* address family to use for connections */ diff --git a/net/tnftp/files/src/main.c b/net/tnftp/files/src/main.c index 49d5a44b7bf..5812933d43a 100644 --- a/net/tnftp/files/src/main.c +++ b/net/tnftp/files/src/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */ +/* $NetBSD: main.c,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1996-2004 The NetBSD Foundation, Inc. @@ -48,11 +48,7 @@ * 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 University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -109,7 +105,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; #else -__RCSID("$NetBSD: main.c,v 1.2 2004/07/27 10:25:09 grant Exp $"); +__RCSID("$NetBSD: main.c,v 1.3 2005/01/04 23:44:24 lukem Exp $"); #endif #endif /* not lint */ #endif @@ -213,9 +209,14 @@ main(int argc, char *argv[]) (void)close(s); /* sanity check returned buffer sizes */ if (rcvbuf_size <= 0) - rcvbuf_size = 8192; + rcvbuf_size = 8 * 1024; if (sndbuf_size <= 0) - sndbuf_size = 8192; + sndbuf_size = 8 * 1024; + + if (sndbuf_size > 8 * 1024 * 1024) + sndbuf_size = 8 * 1024 * 1024; + if (rcvbuf_size > 8 * 1024 * 1024) + rcvbuf_size = 8 * 1024 * 1024; marg_sl = xsl_init(); if ((tmpdir = getenv("TMPDIR")) == NULL) @@ -1028,8 +1029,8 @@ usage(void) const char *progname = getprogname(); (void)fprintf(stderr, -"usage: %s [-46AadefginpRtvV] [-N netrc] [-o outfile] [-P port] [-r retry]\n" -" [-T dir,max[,inc][[user@]host [port]]] [host:path[/]]\n" +"usage: %s [-46AadefginpRtvV] [-N netrc] [-o outfile] [-P port] [-q quittime]\n" +" [-r retry] [-T dir,max[,inc][[user@]host [port]]] [host:path[/]]\n" " [file:///file] [ftp://[user[:pass]@]host[:port]/path[/]]\n" " [http://[user[:pass]@]host[:port]/path] [...]\n" " %s -u URL file [...]\n", progname, progname); diff --git a/net/tnftp/files/src/progressbar.c b/net/tnftp/files/src/progressbar.c index 7742a4569c0..911f0b13c53 100644 --- a/net/tnftp/files/src/progressbar.c +++ b/net/tnftp/files/src/progressbar.c @@ -1,4 +1,4 @@ -/* $NetBSD: progressbar.c,v 1.2 2004/03/11 13:47:35 grant Exp $ */ +/* $NetBSD: progressbar.c,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1997-2003 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #if 0 #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: progressbar.c,v 1.2 2004/03/11 13:47:35 grant Exp $"); +__RCSID("$NetBSD: progressbar.c,v 1.3 2005/01/04 23:44:24 lukem Exp $"); #endif /* not lint */ #endif @@ -197,6 +197,8 @@ progressmeter(int flag) return; len += snprintf(buf + len, BUFLEFT, "\r"); + if (prefix) + len += snprintf(buf + len, BUFLEFT, "%s", prefix); if (filesize > 0) { ratio = (int)((double)cursize * 100.0 / (double)filesize); ratio = MAX(ratio, 0); @@ -208,6 +210,8 @@ progressmeter(int flag) * the number of stars won't exceed the buffer size */ barlength = MIN(sizeof(buf) - 1, ttywidth) - BAROVERHEAD; + if (prefix) + barlength -= strlen(prefix); if (barlength > 0) { i = barlength * ratio / 100; len += snprintf(buf + len, BUFLEFT, diff --git a/net/tnftp/files/src/progressbar.h b/net/tnftp/files/src/progressbar.h index 9aa14147ec1..6fa94e4ef80 100644 --- a/net/tnftp/files/src/progressbar.h +++ b/net/tnftp/files/src/progressbar.h @@ -1,4 +1,4 @@ -/* $NetBSD: progressbar.h,v 1.1.1.2 2005/01/03 10:08:40 lukem Exp $ */ +/* $NetBSD: progressbar.h,v 1.2 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc. diff --git a/net/tnftp/files/src/ruserpass.c b/net/tnftp/files/src/ruserpass.c index 188c9be86d1..07c3df9c737 100644 --- a/net/tnftp/files/src/ruserpass.c +++ b/net/tnftp/files/src/ruserpass.c @@ -1,4 +1,4 @@ -/* $NetBSD: ruserpass.c,v 1.1.1.2 2005/01/03 10:08:40 lukem Exp $ */ +/* $NetBSD: ruserpass.c,v 1.2 2005/01/04 23:44:24 lukem Exp $ */ /* * Copyright (c) 1985, 1993, 1994 diff --git a/net/tnftp/files/src/util.c b/net/tnftp/files/src/util.c index f51f23e1792..ba66f4cd2aa 100644 --- a/net/tnftp/files/src/util.c +++ b/net/tnftp/files/src/util.c @@ -1,7 +1,7 @@ -/* $NetBSD: util.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */ +/* $NetBSD: util.c,v 1.3 2005/01/04 23:44:24 lukem Exp $ */ /*- - * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. + * Copyright (c) 1997-2005 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -52,11 +52,7 @@ * 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 University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -76,7 +72,7 @@ #if 0 #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: util.c,v 1.2 2004/07/27 10:25:09 grant Exp $"); +__RCSID("$NetBSD: util.c,v 1.3 2005/01/04 23:44:24 lukem Exp $"); #endif /* not lint */ #endif @@ -464,7 +460,8 @@ ftp_login(const char *host, const char *user, const char *pass) break; } } - updateremotepwd(); + updatelocalcwd(); + updateremotecwd(); cleanup_ftp_login: if (user != NULL && freeuser) @@ -759,10 +756,23 @@ remotemodtime(const char *file, int noisy) } /* - * update global `remotepwd', which contains the state of the remote cwd + * Update global `localcwd', which contains the state of the local cwd */ void -updateremotepwd(void) +updatelocalcwd(void) +{ + + if (getcwd(localcwd, sizeof(localcwd)) == NULL) + localcwd[0] = '\0'; + if (debug) + fprintf(ttyout, "got localcwd as `%s'\n", localcwd); +} + +/* + * Update global `remotecwd', which contains the state of the remote cwd + */ +void +updateremotecwd(void) { int overbose, ocode, i; char *cp; @@ -772,31 +782,55 @@ updateremotepwd(void) if (debug == 0) verbose = -1; if (command("PWD") != COMPLETE) - goto badremotepwd; + goto badremotecwd; cp = strchr(reply_string, ' '); if (cp == NULL || cp[0] == '\0' || cp[1] != '"') - goto badremotepwd; + goto badremotecwd; cp += 2; - for (i = 0; *cp && i < sizeof(remotepwd) - 1; i++, cp++) { + for (i = 0; *cp && i < sizeof(remotecwd) - 1; i++, cp++) { if (cp[0] == '"') { if (cp[1] == '"') cp++; else break; } - remotepwd[i] = *cp; + remotecwd[i] = *cp; } - remotepwd[i] = '\0'; + remotecwd[i] = '\0'; if (debug) - fprintf(ttyout, "got remotepwd as `%s'\n", remotepwd); - goto cleanupremotepwd; - badremotepwd: - remotepwd[0]='\0'; - cleanupremotepwd: + fprintf(ttyout, "got remotecwd as `%s'\n", remotecwd); + goto cleanupremotecwd; + badremotecwd: + remotecwd[0]='\0'; + cleanupremotecwd: verbose = overbose; code = ocode; } +/* + * Ensure file is in or under dir. + * Returns 1 if so, 0 if not (or an error occurred). + */ +int +fileindir(const char *file, const char *dir) +{ + char realfile[PATH_MAX+1]; + size_t dirlen; + + if (realpath(file, realfile) == NULL) { + warn("Unable to determine real path of `%s'", file); + return 0; + } + if (realfile[0] != '/') /* relative result */ + return 1; + dirlen = strlen(dir); +#if 0 +printf("file %s realfile %s dir %s [%d]\n", file, realfile, dir, dirlen); +#endif + if (strncmp(realfile, dir, dirlen) == 0 && realfile[dirlen] == '/') + return 1; + return 0; +} /* * List words in stringlist, vertically arranged @@ -1043,7 +1077,7 @@ formatbuf(char *buf, size_t len, const char *src) case '/': case '.': case 'c': - p2 = connected ? remotepwd : ""; + p2 = connected ? remotecwd : ""; updirs = pdirs = 0; /* option to determine fixed # of dirs from path */ @@ -1190,14 +1224,29 @@ isipv6addr(const char *addr) /* - * Internal version of connect(2); sets socket buffer sizes first. + * Internal version of connect(2); sets socket buffer sizes first and + * handles the syscall being interrupted. + * Returns -1 upon failure (with errno set to the problem), or 0 on success. */ int xconnect(int sock, const struct sockaddr *name, int namelen) { + int rv; setupsockbufsize(sock); - return (connect(sock, name, namelen)); + rv = connect(sock, name, namelen); + if (rv == -1 && errno == EINTR) { + fd_set connfd; + + FD_ZERO(&connfd); + FD_SET(sock, &connfd); + do { + rv = select(sock + 1, NULL, &connfd, NULL, NULL); + } while (rv == -1 && errno == EINTR); + if (rv > 0) + rv = 0; + } + return (rv); } /* diff --git a/net/tnftp/files/src/version.h b/net/tnftp/files/src/version.h index 273fb39d6e2..c9f141db3f3 100644 --- a/net/tnftp/files/src/version.h +++ b/net/tnftp/files/src/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.1.1.2 2005/01/03 09:50:10 lukem Exp $ */ +/* $NetBSD: version.h,v 1.2 2005/01/04 23:44:24 lukem Exp $ */ /*- * Copyright (c) 1999-2005 The NetBSD Foundation, Inc. * All rights reserved. diff --git a/net/tnftp/files/tnftp.h b/net/tnftp/files/tnftp.h index 712b06c94e1..6c5100644a8 100644 --- a/net/tnftp/files/tnftp.h +++ b/net/tnftp/files/tnftp.h @@ -1,7 +1,7 @@ -/* $Id: tnftp.h,v 1.3 2004/05/16 23:14:17 heinz Exp $ */ +/* $Id: tnftp.h,v 1.4 2005/01/04 23:44:24 lukem Exp $ */ #define FTP_PRODUCT "tnftp" -#define FTP_VERSION "20030825" +#define FTP_VERSION "20050103" #include "config.h" diff --git a/net/tnftp/files/todo b/net/tnftp/files/todo index 2a79f98b426..5de6fcf4d8b 100644 --- a/net/tnftp/files/todo +++ b/net/tnftp/files/todo @@ -1,4 +1,4 @@ -$Id: todo,v 1.1.1.2 2004/04/15 03:15:15 lukem Exp $ +$Id: todo,v 1.2 2005/01/04 23:44:24 lukem Exp $ Current Items ------------- |