diff options
author | Rene Ladan <rene@FreeBSD.org> | 2019-10-16 15:29:32 +0000 |
---|---|---|
committer | Rene Ladan <rene@FreeBSD.org> | 2019-10-16 15:29:32 +0000 |
commit | 13d4527a34237c3848445140a659128518ca196f (patch) | |
tree | a59de3287464c291f091b739fe407ba6df10c951 /ftp | |
parent | a12065703469e10f4f34b1e43555af92cfceaa6c (diff) |
Notes
Diffstat (limited to 'ftp')
29 files changed, 0 insertions, 1489 deletions
diff --git a/ftp/Makefile b/ftp/Makefile index e16ef9b6e802..07d6fce249c0 100644 --- a/ftp/Makefile +++ b/ftp/Makefile @@ -5,12 +5,10 @@ SUBDIR += R-cran-RCurl SUBDIR += R-cran-curl - SUBDIR += atftp SUBDIR += axel SUBDIR += bbftp SUBDIR += bftpd SUBDIR += bsdftpd-ssl - SUBDIR += cftp SUBDIR += cmdftp SUBDIR += curl SUBDIR += curlie diff --git a/ftp/atftp/Makefile b/ftp/atftp/Makefile deleted file mode 100644 index e6740142dcc3..000000000000 --- a/ftp/atftp/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -PORTNAME= atftp -PORTVERSION= 0.7 -PORTREVISION= 3 -CATEGORIES= ftp -MASTER_SITES= DEBIAN/pool/main/a/${PORTNAME} -DISTNAME= ${PORTNAME}_${PORTVERSION}.dfsg.orig - -MAINTAINER= ports@FreeBSD.org -COMMENT= Advanced TFTP server and client - -BROKEN= unfetchable -DEPRECATED= Unfetchable, unmaintained -EXPIRATION_DATE= 2019-10-16 - -WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}.dfsg - -USE_RC_SUBR= atftpd -GNU_CONFIGURE= yes - -PLIST_FILES= bin/atftp sbin/atftpd man/man1/atftp.1.gz man/man8/atftpd.8.gz - -.include <bsd.port.mk> diff --git a/ftp/atftp/distinfo b/ftp/atftp/distinfo deleted file mode 100644 index f52474019d8b..000000000000 --- a/ftp/atftp/distinfo +++ /dev/null @@ -1,4 +0,0 @@ -SHA256 (atftp_0.7.dfsg.orig.tar.gz) = 18815f5b67290fac087c6b9da28dfa5e0feb722096f5c5de52e59b46026da559 -SIZE (atftp_0.7.dfsg.orig.tar.gz) = 186849 -SHA256 (atftp_0.7.dfsg-9.diff.gz) = 9ce4654b312d19cb797d5d99b9ca3e1ff38551980430af02f9d2cd7cb87d5ca4 -SIZE (atftp_0.7.dfsg-9.diff.gz) = 52300 diff --git a/ftp/atftp/files/atftpd.in b/ftp/atftp/files/atftpd.in deleted file mode 100644 index 13f1e47b6058..000000000000 --- a/ftp/atftp/files/atftpd.in +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# PROVIDE: atftpd -# REQUIRE: NETWORKING -# KEYWORD: shutdown -# -# Add the following lines to /etc/rc.conf.local or /etc/rc.conf -# to enable this service: -# -# atftpd_enable (bool): Set to "NO" by default. -# atftpd_flags (str): Default to "--daemon". -# Extra flags passed to start command. -# - -. /etc/rc.subr - -name="atftpd" -rcvar=atftpd_enable - -command=%%PREFIX%%/sbin/${name} -pidfile=/var/run/${name}.pid -logfile=/var/log/${name}.log - -load_rc_config $name - -[ -z "$atftpd_enable" ] && atftpd_enable="NO" -[ -z "$atftpd_flags" ] && atftpd_flags="--daemon --verbose=5 --pidfile ${pidfile} --logfile ${logfile} %%PREFIX%%/tftp" - -start_precmd="start_precmd" -stop_postcmd="stop_postcmd" - -start_precmd() -{ - touch ${logfile} - chown nobody ${logfile} -} - -stop_postcmd() -{ - rm -f ${pidfile} -} - -run_rc_command "$1" diff --git a/ftp/atftp/files/patch-Makefile.in b/ftp/atftp/files/patch-Makefile.in deleted file mode 100644 index e4c216fcf9f0..000000000000 --- a/ftp/atftp/files/patch-Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ ---- Makefile.in.orig 2010-10-04 18:38:26.000000000 +0800 -+++ Makefile.in 2010-10-04 18:39:02.000000000 +0800 -@@ -789,11 +789,11 @@ - - install-data-am: install-man - @$(NORMAL_INSTALL) -- $(MAKE) $(AM_MAKEFLAGS) install-data-hook -+ $(MAKE) $(AM_MAKEFLAGS) - - install-exec-am: install-binPROGRAMS install-sbinPROGRAMS - @$(NORMAL_INSTALL) -- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook -+ $(MAKE) $(AM_MAKEFLAGS) - - install-info: install-info-recursive - -@@ -847,12 +847,6 @@ - uninstall-sbinPROGRAMS - - --install-exec-hook: -- (cd $(DESTDIR)$(sbindir) && ln -s atftpd in.tftpd) -- --install-data-hook: -- (cd $(DESTDIR)$(mandir)/man8 && ln -s atftpd.8 in.tftpd.8) -- - uninstall-local: - rm -f $(DESTDIR)$(sbindir)/in.tftpd $(DESTDIR)$(mandir)/man8/in.tftpd.8 - diff --git a/ftp/atftp/files/patch-argz.h b/ftp/atftp/files/patch-argz.h deleted file mode 100644 index 3148ffe8c4e0..000000000000 --- a/ftp/atftp/files/patch-argz.h +++ /dev/null @@ -1,155 +0,0 @@ ---- argz.h.orig 2010-10-04 18:31:14.000000000 +0800 -+++ argz.h 2010-10-04 18:32:03.000000000 +0800 -@@ -38,7 +38,9 @@ - #ifndef _ARGZ_H - #define _ARGZ_H 1 - -+#ifdef HAVE_FEATURES_H - #include <features.h> -+#endif - - #define __need_error_t - #include <errno.h> -@@ -55,109 +57,28 @@ - - __BEGIN_DECLS - --/* Make a '\0' separated arg vector from a unix argv vector, returning it in -- ARGZ, and the total length in LEN. If a memory allocation error occurs, -- ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ --extern error_t __argz_create (char *__const __argv[], char **__restrict __argz, -- size_t *__restrict __len) __THROW; --extern error_t argz_create (char *__const __argv[], char **__restrict __argz, -- size_t *__restrict __len) __THROW; -- - /* Make a '\0' separated arg vector from a SEP separated list in - STRING, returning it in ARGZ, and the total length in LEN. If a - memory allocation error occurs, ENOMEM is returned, otherwise 0. - The result can be destroyed using free. */ - extern error_t __argz_create_sep (__const char *__restrict __string, - int __sep, char **__restrict __argz, -- size_t *__restrict __len) __THROW; -+ size_t *__restrict __len); - extern error_t argz_create_sep (__const char *__restrict __string, - int __sep, char **__restrict __argz, -- size_t *__restrict __len) __THROW; -+ size_t *__restrict __len); - - /* Returns the number of strings in ARGZ. */ --extern size_t __argz_count (__const char *__argz, size_t __len) -- __THROW __attribute_pure__; --extern size_t argz_count (__const char *__argz, size_t __len) -- __THROW __attribute_pure__; -+extern size_t __argz_count (__const char *__argz, size_t __len); -+extern size_t argz_count (__const char *__argz, size_t __len); - - /* Puts pointers to each string in ARGZ into ARGV, which must be large enough - to hold them all. */ - extern void __argz_extract (__const char *__restrict __argz, size_t __len, -- char **__restrict __argv) __THROW; -+ char **__restrict __argv); - extern void argz_extract (__const char *__restrict __argz, size_t __len, -- char **__restrict __argv) __THROW; -+ char **__restrict __argv); - --/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's -- except the last into the character SEP. */ --extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; --extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; -- --/* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ --extern error_t __argz_append (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __buf, size_t _buf_len) -- __THROW; --extern error_t argz_append (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __buf, size_t __buf_len) -- __THROW; -- --/* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ --extern error_t __argz_add (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __str) __THROW; --extern error_t argz_add (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __str) __THROW; -- --/* Append SEP separated list in STRING to the argz vector in ARGZ & -- ARGZ_LEN. */ --extern error_t __argz_add_sep (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __string, int __delim) -- __THROW; --extern error_t argz_add_sep (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __string, int __delim) -- __THROW; -- --/* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ --extern void __argz_delete (char **__restrict __argz, -- size_t *__restrict __argz_len, -- char *__restrict __entry) __THROW; --extern void argz_delete (char **__restrict __argz, -- size_t *__restrict __argz_len, -- char *__restrict __entry) __THROW; -- --/* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an -- existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. -- Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, -- ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not -- in ARGZ, EINVAL is returned, else if memory can't be allocated for the new -- ARGZ, ENOMEM is returned, else 0. */ --extern error_t __argz_insert (char **__restrict __argz, -- size_t *__restrict __argz_len, -- char *__restrict __before, -- __const char *__restrict __entry) __THROW; --extern error_t argz_insert (char **__restrict __argz, -- size_t *__restrict __argz_len, -- char *__restrict __before, -- __const char *__restrict __entry) __THROW; -- --/* Replace any occurrences of the string STR in ARGZ with WITH, reallocating -- ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be -- incremented by number of replacements performed. */ --extern error_t __argz_replace (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __str, -- __const char *__restrict __with, -- unsigned int *__restrict __replace_count); --extern error_t argz_replace (char **__restrict __argz, -- size_t *__restrict __argz_len, -- __const char *__restrict __str, -- __const char *__restrict __with, -- unsigned int *__restrict __replace_count); -- - /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there - are no more. If entry is NULL, then the first entry is returned. This - behavior allows two convenient iteration styles: -@@ -173,14 +94,14 @@ - ...; - */ - extern char *__argz_next (__const char *__restrict __argz, size_t __argz_len, -- __const char *__restrict __entry) __THROW; -+ __const char *__restrict __entry); - extern char *argz_next (__const char *__restrict __argz, size_t __argz_len, -- __const char *__restrict __entry) __THROW; -+ __const char *__restrict __entry); - - #ifdef __USE_EXTERN_INLINES - extern inline char * - __argz_next (__const char *__argz, size_t __argz_len, -- __const char *__entry) __THROW -+ __const char *__entry) - { - if (__entry) - { -@@ -194,7 +115,7 @@ - } - extern inline char * - argz_next (__const char *__argz, size_t __argz_len, -- __const char *__entry) __THROW -+ __const char *__entry) - { - return __argz_next (__argz, __argz_len, __entry); - } diff --git a/ftp/atftp/files/patch-logger.c b/ftp/atftp/files/patch-logger.c deleted file mode 100644 index e04fda6b6db3..000000000000 --- a/ftp/atftp/files/patch-logger.c +++ /dev/null @@ -1,57 +0,0 @@ ---- logger.c.orig 2004-02-27 10:05:26.000000000 +0800 -+++ logger.c 2010-10-05 12:34:41.000000000 +0800 -@@ -3,7 +3,7 @@ - * logger.c - * functions for logging messages. - * -- * $Id: logger.c,v 1.12 2004/02/27 02:05:26 jp Exp $ -+ * $Id: logger.c 1769 2010-09-29 08:46:26Z kevlo $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> - * and Remi Lefebvre <remi@debian.org> -@@ -27,6 +27,7 @@ - #include <time.h> - #include <unistd.h> - #include <netdb.h> -+#include <pthread.h> - #include "logger.h" - - #define MAXLEN 128 -@@ -56,7 +57,15 @@ - log_ident = "unset"; - - if (filename) -+ { - log_filename = strdup(filename); -+ if (!strcmp(filename, "-")) -+ { -+ log_fd = STDOUT_FILENO; -+ log_fp = fdopen(log_fd, "a"); -+ return; -+ } -+ } - else - { - openlog(log_ident, LOG_PID, LOG_DAEMON); -@@ -105,15 +114,17 @@ - - if (log_fp) - { -- fprintf(log_fp, "%s %s %s[%d.%d]: %s\n", time_buf, hostname, -- log_ident, getpid(), pthread_self(), message); -+ fprintf(log_fp, "%s %s %s[%ld.%ld]: %s\n", time_buf, hostname, -+ log_ident, (long)getpid(), (long)pthread_self(), -+ message); - fflush(log_fp); - } - else if (log_syslog_is_open) - syslog(severity, "%s", message); - else -- fprintf(stderr, "%s %s %s[%d.%d]: %s\n", time_buf, hostname, -- log_ident, getpid(), pthread_self(), message); -+ fprintf(stderr, "%s %s %s[%ld.%ld]: %s\n", time_buf, hostname, -+ log_ident, (long)getpid(), (long)pthread_self(), -+ message); - } - va_end(args); - } diff --git a/ftp/atftp/files/patch-options.c b/ftp/atftp/files/patch-options.c deleted file mode 100644 index fd96417175f2..000000000000 --- a/ftp/atftp/files/patch-options.c +++ /dev/null @@ -1,15 +0,0 @@ ---- options.c.orig 2003-04-25 08:16:18.000000000 +0800 -+++ options.c 2010-10-11 10:23:20.000000000 +0800 -@@ -273,6 +273,12 @@ - return ERR; - } - -+int opt_equal(struct tftp_opt *opt1, struct tftp_opt *opt2) -+{ -+ return ((strncmp(opt1->option, opt2->option, OPT_SIZE) == 0) && -+ (strncmp(opt1->value, opt2->value, OPT_SIZE) == 0)); -+} -+ - void opt_set_tsize(int tsize, struct tftp_opt *options) - { - snprintf(options[OPT_TSIZE].value, VAL_SIZE, "%d", tsize); diff --git a/ftp/atftp/files/patch-options.h b/ftp/atftp/files/patch-options.h deleted file mode 100644 index 09e2acff81aa..000000000000 --- a/ftp/atftp/files/patch-options.h +++ /dev/null @@ -1,11 +0,0 @@ ---- options.h.orig 2001-07-07 07:35:18.000000000 +0800 -+++ options.h 2010-10-11 13:11:41.000000000 +0800 -@@ -39,6 +39,8 @@ - int opt_get_timeout(struct tftp_opt *options); - int opt_get_blksize(struct tftp_opt *options); - int opt_get_multicast(struct tftp_opt *options, char *addr, int *port, int *mc); -+int opt_equal(struct tftp_opt *opt1, struct tftp_opt *opt2); -+int opt_same_file(struct tftp_opt *opt1, struct tftp_opt *opt2); - void opt_set_tsize(int tsize, struct tftp_opt *options); - void opt_set_timeout(int timeout, struct tftp_opt *options); - void opt_set_blksize(int blksize, struct tftp_opt *options); diff --git a/ftp/atftp/files/patch-stats.c b/ftp/atftp/files/patch-stats.c deleted file mode 100644 index 9a7a5c67c0a0..000000000000 --- a/ftp/atftp/files/patch-stats.c +++ /dev/null @@ -1,13 +0,0 @@ ---- stats.c.orig 2002-03-27 11:02:12.000000000 +0800 -+++ stats.c 2010-10-05 09:56:08.000000000 +0800 -@@ -157,8 +157,8 @@ - - logger(LOG_INFO, " Load measurements:"); - logger(LOG_INFO, " User: %8.3fs Sys:%8.3fs", -- (double)(s_stats.tms.tms_utime) / CLK_TCK, -- (double)(s_stats.tms.tms_stime) / CLK_TCK); -+ (double)(s_stats.tms.tms_utime) / CLOCKS_PER_SEC, -+ (double)(s_stats.tms.tms_stime) / CLOCKS_PER_SEC); - logger(LOG_INFO, " Total:%8.3fs CPU:%8.3f%%", - (double)(tmp.tv_sec + tmp.tv_usec * 1e-6), - (double)(s_stats.tms.tms_utime + s_stats.tms.tms_stime) / diff --git a/ftp/atftp/files/patch-tftp.c b/ftp/atftp/files/patch-tftp.c deleted file mode 100644 index a66573d3d229..000000000000 --- a/ftp/atftp/files/patch-tftp.c +++ /dev/null @@ -1,150 +0,0 @@ ---- tftp.c.orig 2010-10-11 11:19:25.000000000 +0800 -+++ tftp.c 2010-10-11 11:19:12.000000000 +0800 -@@ -354,7 +354,7 @@ - void make_arg(char *string, int *argc, char ***argv) - { - static char *tmp = NULL; -- int argz_len; -+ size_t argz_len; - - /* split the string to an argz vector */ - if (argz_create_sep(string, ' ', &tmp, &argz_len) != 0) -@@ -408,8 +408,7 @@ - */ - int set_peer(int argc, char **argv) - { -- struct hostent *host; /* for host name lookup */ -- struct servent *sp; /* server entry for tftp service */ -+ int port = -1; - - /* sanity check */ - if ((argc < 2) || (argc > 3)) -@@ -418,13 +417,34 @@ - return ERR; - } - -- /* get the server entry */ -- sp = getservbyname("tftp", "udp"); -- if (sp == 0) { -- fprintf(stderr, "tftp: udp/tftp, unknown service.\n"); -- return ERR; -+ /* get the server port */ -+ if (argc == 3) -+ { -+ port = htons(atoi(argv[2])); -+ if (port < 0) -+ { -+ fprintf(stderr, "%s: bad port number.\n", argv[2]); -+ data.connected = 0; -+ return ERR; -+ } -+ data.sa_peer.sin_port = port; -+ } -+ else -+ { -+ /* get the server entry */ -+ struct servent *sp; -+ sp = getservbyname("tftp", "udp"); -+ if (sp == 0) { -+ fprintf(stderr, "tftp: udp/tftp, unknown service.\n"); -+ return ERR; -+ } -+ else -+ { -+ port = sp->s_port; -+ } - } - -+ struct hostent *host; /* for host name lookup */ - /* look up the host */ - host = gethostbyname(argv[1]); - /* if valid, update s_inn structure */ -@@ -437,7 +457,7 @@ - Strncpy(data.hostname, host->h_name, - sizeof(data.hostname)); - data.hostname[sizeof(data.hostname)-1] = 0; -- data.sa_peer.sin_port = sp->s_port; -+ data.sa_peer.sin_port = port; - } - else - { -@@ -445,20 +465,8 @@ - data.connected = 0; - return ERR; - } -- /* get the server port */ -- if (argc == 3) -- { -- sp->s_port = htons(atoi(argv[2])); -- if (sp->s_port < 0) -- { -- fprintf(stderr, "%s: bad port number.\n", argv[2]); -- data.connected = 0; -- return ERR; -- } -- data.sa_peer.sin_port = sp->s_port; -- } - /* copy port number to data structure */ -- data.port = ntohs(sp->s_port); -+ data.port = ntohs(port); - - data.connected = 1; - return OK; -@@ -608,9 +616,16 @@ - exit(ERR); - } - memset(&data.sa_local, 0, sizeof(data.sa_local)); -- bind(data.sockfd, (struct sockaddr *)&data.sa_local, -- sizeof(data.sa_local)); -- getsockname(data.sockfd, (struct sockaddr *)&data.sa_local, &len); -+ if (bind(data.sockfd, (struct sockaddr *)&data.sa_local, -+ sizeof(data.sa_local)) < 0) { -+ perror("bind"); -+ exit(ERR); -+ } -+ if (getsockname(data.sockfd, (struct sockaddr *)&data.sa_local, &len) < 0) -+ { -+ perror("getsockname"); -+ exit(ERR); -+ } - - /* do the transfer */ - gettimeofday(&data.start_time, NULL); -@@ -621,7 +636,7 @@ - fsync(data.sockfd); - close(data.sockfd); - -- return OK; -+ return tftp_result; - } - - /* -@@ -712,9 +727,16 @@ - exit(ERR); - } - memset(&data.sa_local, 0, sizeof(data.sa_local)); -- bind(data.sockfd, (struct sockaddr *)&data.sa_local, -- sizeof(data.sa_local)); -- getsockname(data.sockfd, (struct sockaddr *)&data.sa_local, &len); -+ if (bind(data.sockfd, (struct sockaddr *)&data.sa_local, -+ sizeof(data.sa_local)) < 0) { -+ perror("bind"); -+ exit(ERR); -+ } -+ if (getsockname(data.sockfd, (struct sockaddr *)&data.sa_local, &len) < 0) -+ { -+ perror("getsockname"); -+ exit(ERR); -+ } - - /* do the transfer */ - gettimeofday(&data.start_time, NULL); -@@ -731,7 +753,7 @@ - fsync(data.sockfd); - close(data.sockfd); - -- return OK; -+ return tftp_result; - } - - #ifdef HAVE_MTFTP diff --git a/ftp/atftp/files/patch-tftp_def.c b/ftp/atftp/files/patch-tftp_def.c deleted file mode 100644 index 3f10760dd94d..000000000000 --- a/ftp/atftp/files/patch-tftp_def.c +++ /dev/null @@ -1,32 +0,0 @@ ---- tftp_def.c.orig 2004-02-13 11:16:09.000000000 +0800 -+++ tftp_def.c 2013-10-30 13:34:05.000000000 +0800 -@@ -88,7 +88,7 @@ - res->tv_usec -= 1000000; - return -1; - } -- else if (res->tv_usec <= 0); -+ else - { - return -1; - } -@@ -138,13 +138,16 @@ - /* - * This is a strncpy function that take care of string NULL termination - */ --inline char *Strncpy(char *to, const char *from, size_t size) -+char *Strncpy(char *to, const char *from, size_t size) - { -- to[size-1] = '\000'; -- return strncpy(to, from, size - 1); -+ if (size > 0) -+ { -+ to[size-1] = '\000'; -+ return strncpy(to, from, size - 1); -+ } else -+ return to; - } - -- - /* - * gethostbyname replacement that is reentrant. This function is copyied - * from the libc manual. diff --git a/ftp/atftp/files/patch-tftp_def.h b/ftp/atftp/files/patch-tftp_def.h deleted file mode 100644 index c6165b089afe..000000000000 --- a/ftp/atftp/files/patch-tftp_def.h +++ /dev/null @@ -1,19 +0,0 @@ ---- tftp_def.h.orig 2004-02-13 11:16:09.000000000 +0800 -+++ tftp_def.h 2013-10-30 13:23:22.000000000 +0800 -@@ -19,6 +19,7 @@ - - #include <sys/time.h> - #include <sys/times.h> -+#include <netinet/in.h> - #include <netdb.h> - - /* standard return value */ -@@ -49,7 +50,7 @@ - - int timeval_diff(struct timeval *res, struct timeval *t1, struct timeval *t0); - int print_eng(double value, char *string, int size, char *format); --inline char *Strncpy(char *to, const char *from, size_t size); -+char *Strncpy(char *to, const char *from, size_t size); - int Gethostbyname(char *addr, struct hostent *host); - - #endif diff --git a/ftp/atftp/files/patch-tftp_file.c b/ftp/atftp/files/patch-tftp_file.c deleted file mode 100644 index 8f2e19313933..000000000000 --- a/ftp/atftp/files/patch-tftp_file.c +++ /dev/null @@ -1,42 +0,0 @@ ---- tftp_file.c.orig 2010-10-11 11:21:54.000000000 +0800 -+++ tftp_file.c 2010-10-11 11:27:01.000000000 +0800 -@@ -59,7 +59,7 @@ - unsigned int next_word; - - /* initial stuff */ -- next_hole = prev_hole + 1; -+ next_hole = 0; /*prev_hole + 1;*/ - next_word_no = next_hole / 32; - next_bit_no = next_hole % 32; - next_word = bitmap[next_word_no]; -@@ -238,9 +238,13 @@ - tftp_find_bitmap_hole(prev_bitmap_hole, file_bitmap); - block_number = prev_bitmap_hole; - } -- if (data->trace) -- fprintf(stderr, "sent ACK <block: %d>\n", block_number); -- tftp_send_ack(sockfd, &sa, block_number); -+ result = tftp_send_ack(sockfd, &sa, block_number); -+ if (result == OK) -+ { -+ if (data->trace) -+ fprintf(stderr, "sent ACK <block: %d>\n", -+ block_number); -+ } - /* if we just ACK the last block we are done */ - if (block_number == last_block_number) - state = S_END; -@@ -484,6 +488,13 @@ - sa_mcast.sin_family = AF_INET; - sa_mcast.sin_addr.s_addr = htonl(INADDR_ANY); - sa_mcast.sin_port = htons(mc_port); -+ int yes = 1; -+ if (setsockopt(mcast_sockfd, SOL_SOCKET, -+ SO_REUSEADDR, &yes, sizeof(yes)) < 0) -+ { -+ perror("setsockopt"); -+ exit(1); -+ } - - if (bind(mcast_sockfd, (struct sockaddr *)&sa_mcast, - sizeof(sa_mcast)) < 0) diff --git a/ftp/atftp/files/patch-tftp_io.c b/ftp/atftp/files/patch-tftp_io.c deleted file mode 100644 index 28bf686a7afb..000000000000 --- a/ftp/atftp/files/patch-tftp_io.c +++ /dev/null @@ -1,65 +0,0 @@ ---- tftp_io.c.orig 2004-02-19 09:30:00.000000000 +0800 -+++ tftp_io.c 2010-10-11 13:01:28.000000000 +0800 -@@ -103,7 +103,8 @@ - tftphdr.th_block = htons(block_number); - - result = sendto(socket, &tftphdr, 4, 0, (struct sockaddr *)sa, -- sizeof(*sa)); -+ sizeof(*sa)); -+ - if (result < 0) - return ERR; - return OK; -@@ -142,7 +143,8 @@ - } - /* send the buffer */ - result = sendto(socket, buffer, index, 0, (struct sockaddr *)sa, -- sizeof(*sa)); -+ sizeof(*sa)); -+ - if (result < 0) - return ERR; - return OK; -@@ -171,6 +173,7 @@ - - result = sendto(socket, tftphdr, size, 0, (struct sockaddr *)sa, - sizeof(*sa)); -+ - if (result < 0) - return ERR; - return OK; -@@ -192,7 +195,8 @@ - tftphdr->th_block = htons(block_number); - - result = sendto(socket, data, size, 0, (struct sockaddr *)sa, -- sizeof(*sa)); -+ sizeof(*sa)); -+ - if (result < 0) - return ERR; - return OK; -@@ -214,7 +218,6 @@ - - struct msghdr msg; /* used to get client's packet info */ - struct cmsghdr *cmsg; -- struct in_pktinfo *pktinfo; - struct iovec iov; - char cbuf[1024]; - -@@ -284,11 +287,12 @@ - cmsg != NULL && cmsg->cmsg_len >= sizeof(*cmsg); - cmsg = CMSG_NXTHDR(&msg, cmsg)) - { -- if (cmsg->cmsg_level == SOL_IP -- && cmsg->cmsg_type == IP_PKTINFO) -+ if (cmsg->cmsg_level == IPPROTO_IP -+ && cmsg->cmsg_type == IP_RECVDSTADDR) - { -- pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg); -- sa_to->sin_addr = pktinfo->ipi_addr; -+ struct in_addr *pktinfo; -+ pktinfo = (struct in_addr *)CMSG_DATA(cmsg); -+ sa_to->sin_addr = *pktinfo; - } - break; - } diff --git a/ftp/atftp/files/patch-tftp_mtftp.c b/ftp/atftp/files/patch-tftp_mtftp.c deleted file mode 100644 index 1a1557b67a7c..000000000000 --- a/ftp/atftp/files/patch-tftp_mtftp.c +++ /dev/null @@ -1,12 +0,0 @@ ---- tftp_mtftp.c.orig 2010-10-05 14:12:47.000000000 +0800 -+++ tftp_mtftp.c 2010-10-05 14:13:19.000000000 +0800 -@@ -138,7 +138,8 @@ - memset(&file_bitmap, 0, sizeof(file_bitmap)); - - /* make sure the socket is not connected */ -- sa.sin_family = AF_UNSPEC; -+ memset(&sa, 0, sizeof(sa)); -+ sa.sin_family = AF_INET; - connect(sockfd, (struct sockaddr *)&sa, sizeof(sa)); - - /* copy sa_peer structure */ diff --git a/ftp/atftp/files/patch-tftpd.c b/ftp/atftp/files/patch-tftpd.c deleted file mode 100644 index b8855c03899e..000000000000 --- a/ftp/atftp/files/patch-tftpd.c +++ /dev/null @@ -1,200 +0,0 @@ ---- tftpd.c.orig 2004-02-27 10:05:26.000000000 +0800 -+++ tftpd.c 2011-02-09 14:18:04.000000000 +0800 -@@ -60,6 +60,9 @@ - char directory[MAXLEN] = "/tftpboot/"; - int retry_timeout = S_TIMEOUT; - -+int on = 1; -+int listen_local = 0; -+ - int tftpd_daemon = 0; /* By default we are started by inetd */ - int tftpd_daemon_no_fork = 0; /* For who want a false daemon mode */ - short tftpd_port = 0; /* Port atftpd listen to */ -@@ -157,6 +160,7 @@ - struct servent *serv; - struct passwd *user; - struct group *group; -+ pthread_t tid; - - #ifdef HAVE_MTFTP - pthread_t mtftp_thread; -@@ -253,7 +257,7 @@ - else - sa.sin_addr.s_addr = htonl(INADDR_ANY); - /* open the socket */ -- if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == 0) -+ if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) - { - logger(LOG_ERR, "atftpd: can't open socket"); - exit(1); -@@ -301,7 +305,7 @@ - } - - /* We need to retieve some information from incomming packets */ -- if (setsockopt(0, SOL_IP, IP_PKTINFO, &one, sizeof(one)) != 0) -+ if (setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, &one, sizeof(one)) != 0) - { - logger(LOG_WARNING, "Failed to set socket option: %s", strerror(errno)); - } -@@ -387,10 +391,21 @@ - packets */ - if (!tftpd_cancel) - { -+ int rv; -+ - if ((tftpd_timeout == 0) || (tftpd_daemon)) -- select(FD_SETSIZE, &rfds, NULL, NULL, NULL); -+ rv = select(FD_SETSIZE, &rfds, NULL, NULL, NULL); - else -- select(FD_SETSIZE, &rfds, NULL, NULL, &tv); -+ rv = select(FD_SETSIZE, &rfds, NULL, NULL, &tv); -+ if (rv < 0) { -+ if (errno == EINTR) -+ continue; -+ logger(LOG_ERR, "%s: %d: select: %s", -+ __FILE__, __LINE__, strerror(errno)); -+ -+ /* Clear the bits, they are undefined! */ -+ FD_ZERO(&rfds); -+ } - } - - #ifdef RATE_CONTROL -@@ -463,10 +478,12 @@ - exit(1); - } - new->client_info->done = 0; -+ new->client_info->bytes_sent = 0; - new->client_info->next = NULL; -+ new->client_info->last_ack = -1; - - /* Start a new server thread. */ -- if (pthread_create(&new->tid, NULL, tftpd_receive_request, -+ if (pthread_create(&tid, NULL, tftpd_receive_request, - (void *)new) != 0) - { - logger(LOG_ERR, "Failed to start new thread"); -@@ -567,7 +584,8 @@ - - /* Detach ourself. That way the main thread does not have to - * wait for us with pthread_join. */ -- pthread_detach(pthread_self()); -+ data->tid = pthread_self(); -+ pthread_detach(data->tid); - - /* Read the first packet from stdin. */ - data_size = data->data_buffer_size; -@@ -615,7 +633,25 @@ - data->sockfd = socket(PF_INET, SOCK_DGRAM, 0); - to.sin_family = AF_INET; - to.sin_port = 0; -- if (data->sockfd > 0) -+ /* Force socket to listen on local address. Do not listen on broadcast address 255.255.255.255. -+ If the socket listens on the broadcast address, Linux tells the remote client the port -+ is unreachable. This happens even if SO_BROADCAST is set in setsockopt for this socket. -+ I was unable to find a kernel option or /proc/sys flag to make the kernel pay attention to -+ these requests, so the workaround is to force listening on the local address. */ -+ if (listen_local == 1) -+ { -+ to.sin_addr.s_addr = INADDR_ANY; -+ logger(LOG_INFO, "forcing socket to listen on local address"); -+ if (setsockopt(data->sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) != 0) { -+ logger(LOG_ERR, "setsockopt: %s", strerror(errno)); -+ } -+ } -+ else -+ { -+ logger(LOG_INFO, "socket may listen on any address, including broadcast"); -+ } -+ -+ if (data->sockfd >= 0) - { - /* bind the socket to the interface */ - if (bind(data->sockfd, (struct sockaddr *)&to, len) == -1) -@@ -630,17 +666,14 @@ - logger(LOG_ERR, "getsockname: %s", strerror(errno)); - retval = ABORT; - } -- /* connect the socket, faster for kernel operation */ -- if (connect(data->sockfd, -- (struct sockaddr *)&data->client_info->client, -- sizeof(data->client_info->client)) == -1) -- { -- logger(LOG_ERR, "connect: %s", strerror(errno)); -- retval = ABORT; -- } - logger(LOG_DEBUG, "Creating new socket: %s:%d", - inet_ntoa(to.sin_addr), ntohs(to.sin_port)); - -+ /* save the dest ip address to bind multicast to correct -+ * interface -+ */ -+ data->mcastaddr.imr_interface.s_addr = to.sin_addr.s_addr; -+ - /* read options from request */ - opt_parse_request(data->data_buffer, data_size, - data->tftp_options); -@@ -732,8 +765,8 @@ - tftpd_clientlist_free(data); - - /* free the thread structure */ -- free(data); -- -+ free(data); -+ - logger(LOG_INFO, "Server thread exiting"); - pthread_exit(NULL); - } -@@ -811,6 +844,7 @@ - { "no-multicast", 0, NULL, 'M' }, - { "logfile", 1, NULL, 'L' }, - { "pidfile", 1, NULL, 'I'}, -+ { "listen-local", 0, NULL, 'F'}, - { "daemon", 0, NULL, 'D' }, - { "no-fork", 0, NULL, 'N'}, - { "user", 1, NULL, 'U'}, -@@ -888,6 +922,9 @@ - case 'I': - pidfile = strdup(optarg); - break; -+ case 'F': -+ listen_local = 1; -+ break; - case 'D': - tftpd_daemon = 1; - break; -@@ -1015,6 +1052,10 @@ - logger(LOG_INFO, " log file: %s", (log_file==NULL) ? "syslog":log_file); - if (pidfile) - logger(LOG_INFO, " pid file: %s", pidfile); -+ if (listen_local == 1) -+ logger(LOG_INFO, " forcing to listen on local interfaces: on."); -+ else -+ logger(LOG_INFO, " not forcing to listen on local interfaces."); - if (tftpd_daemon == 1) - logger(LOG_INFO, " server timeout: Not used"); - else -@@ -1085,8 +1126,7 @@ - else - { - /* unlink the pid file */ -- if (unlink(file) == -1) -- logger(LOG_ERR, "unlink: %s", strerror(errno)); -+ unlink(file); - return OK; - } - } -@@ -1111,11 +1151,12 @@ - " output messages\n" - " --trace : log all sent and received packets\n" - " --no-timeout : disable 'timeout' from RFC2349\n" -- " --no-tisize : disable 'tsize' from RFC2349\n" -+ " --no-tsize : disable 'tsize' from RFC2349\n" - " --no-blksize : disable 'blksize' from RFC2348\n" - " --no-multicast : disable 'multicast' from RFC2090\n" - " --logfile <file> : logfile to log logs to ;-)\n" - " --pidfile <file> : write PID to this file\n" -+ " --listen-local : force listen on local network address\n" - " --daemon : run atftpd standalone (no inetd)\n" - " --no-fork : run as a daemon, don't fork\n" - " --user <user[.group]> : default is nobody\n" diff --git a/ftp/atftp/files/patch-tftpd.h b/ftp/atftp/files/patch-tftpd.h deleted file mode 100644 index 214a7d43fc49..000000000000 --- a/ftp/atftp/files/patch-tftpd.h +++ /dev/null @@ -1,23 +0,0 @@ ---- tftpd.h.orig 2004-02-27 10:05:26.000000000 +0800 -+++ tftpd.h 2013-10-30 13:25:35.000000000 +0800 -@@ -71,6 +71,11 @@ - struct client_info { - struct sockaddr_in client; - int done; /* that client as receive it's file */ -+ int bytes_sent; -+ int number_of_timeout; /* number of timeouts while sending to -+ * this client -+ */ -+ int last_ack; /* last ACK received from this client */ - struct client_info *next; - }; - -@@ -93,7 +98,7 @@ - /* - * Defined in tftpd_list.c, operation on client structure list. - */ --inline void tftpd_clientlist_ready(struct thread_data *thread); -+void tftpd_clientlist_ready(struct thread_data *thread); - void tftpd_clientlist_remove(struct thread_data *thread, - struct client_info *client); - void tftpd_clientlist_free(struct thread_data *thread); diff --git a/ftp/atftp/files/patch-tftpd_file.c b/ftp/atftp/files/patch-tftpd_file.c deleted file mode 100644 index 7f81c6935a4c..000000000000 --- a/ftp/atftp/files/patch-tftpd_file.c +++ /dev/null @@ -1,386 +0,0 @@ ---- tftpd_file.c.orig 2004-02-18 10:21:47.000000000 +0800 -+++ tftpd_file.c 2010-10-11 13:22:54.000000000 +0800 -@@ -89,6 +89,28 @@ - return OK; - } - -+int opt_same_file(struct tftp_opt *opt1, struct tftp_opt *opt2) -+{ -+ if ((strncmp(opt1->option, "filename", OPT_SIZE) == 0) && -+ (strncmp(opt2->option, "filename", OPT_SIZE) == 0)) -+ { -+ char tofilename[MAXLEN]; -+ char fromfilename[MAXLEN]; -+ struct stat tostat; -+ struct stat fromstat; -+ -+ Strncpy(tofilename, opt1->value, MAXLEN); -+ tftpd_rules_check(tofilename); -+ Strncpy(fromfilename, opt2->value, MAXLEN); -+ tftpd_rules_check(fromfilename); -+ if (stat(tofilename, &tostat) || stat(fromfilename, &fromstat)) -+ return 0; -+ -+ return (tostat.st_ino == fromstat.st_ino); -+ } -+ return 0; -+} -+ - /* - * Receive a file. It is implemented as a state machine using a while loop - * and a switch statement. Function flow is as follow: -@@ -117,7 +139,6 @@ - char filename[MAXLEN]; - char string[MAXLEN]; - int timeout = data->timeout; -- int number_of_timeout = 0; - int all_blocks_received = 0; /* temporary kludge */ - int convert = 0; /* if true, do netascii convertion */ - -@@ -240,9 +261,13 @@ - break; - case S_SEND_ACK: - timeout_state = state; -- tftp_send_ack(sockfd, sa, block_number); -- if (data->trace) -- logger(LOG_DEBUG, "sent ACK <block: %d>", block_number); -+ result = tftp_send_ack(sockfd, sa, block_number); -+ if (result == OK) -+ { -+ if (data->trace) -+ logger(LOG_DEBUG, "sent ACK <block: %d>", -+ block_number); -+ } - if (all_blocks_received) - state = S_END; - else -@@ -265,8 +290,8 @@ - switch (result) - { - case GET_TIMEOUT: -- number_of_timeout++; -- if (number_of_timeout > NB_OF_RETRY) -+ data->client_info->number_of_timeout++; -+ if (data->client_info->number_of_timeout > NB_OF_RETRY) - { - logger(LOG_INFO, "client (%s) not responding", - inet_ntoa(data->client_info->client.sin_addr)); -@@ -322,7 +347,7 @@ - else - logger(LOG_WARNING, "source port mismatch, check bypassed"); - } -- number_of_timeout = 0; -+ data->client_info->number_of_timeout = 0; - state = S_DATA_RECEIVED; - break; - case GET_DISCARD: -@@ -413,13 +438,13 @@ - char filename[MAXLEN]; - char string[MAXLEN]; - int timeout = data->timeout; -- int number_of_timeout = 0; - int mcast_switch = data->mcast_switch_client; - struct stat file_stat; - int convert = 0; /* if true, do netascii conversion */ - struct thread_data *thread = NULL; /* used when looking for a multicast - thread */ - int multicast = 0; /* set to 1 if multicast */ -+ time_t last_send_time = -1; - - struct client_info *client_info = data->client_info; - struct client_info *client_old = NULL; -@@ -428,6 +453,8 @@ - int prev_block_number = 0; /* needed to support netascii convertion */ - int prev_file_pos = 0; - int temp = 0; -+ int total_bytes_sent = 0; -+ int clients_served = 0; - - /* look for mode option */ - if (strcasecmp(data->tftp_options[OPT_MODE].value, "netascii") == 0) -@@ -535,6 +562,34 @@ - return ERR; - } - -+ /* make sure that the oack packet will fit in the buffer */ -+ int oacklen = 2; -+ int i; -+ for (i = 2; i < OPT_NUMBER; i++) -+ { -+ if (data->tftp_options[i].enabled && -+ data->tftp_options[i].specified) -+ { -+ oacklen += strlen(data->tftp_options[i].option); -+ oacklen++; -+ oacklen += strlen(data->tftp_options[i].value); -+ oacklen++; -+ } -+ } -+ -+ if (oacklen > result) -+ { -+ logger(LOG_NOTICE, "OACK will not fit in buffer of size %d.", -+ " Options rejected.", result); -+ tftp_send_error(sockfd, sa, EOPTNEG, data->data_buffer, -+ data->data_buffer_size); -+ if (data->trace) -+ logger(LOG_DEBUG, "sent ERROR <code: %d, msg: %s>", -+ EOPTNEG, tftp_errmsg[EOPTNEG]); -+ fclose(fp); -+ return ERR; -+ } -+ - data->data_buffer_size = result + 4; - data->data_buffer = realloc(data->data_buffer, data->data_buffer_size); - -@@ -559,11 +614,16 @@ - logger(LOG_INFO, "blksize option -> %d", result); - } - -+ /* multicast option */ -+ if (data->tftp_options[OPT_MULTICAST].specified && -+ data->tftp_options[OPT_MULTICAST].enabled && !convert) -+ { - /* Verify that the file can be sent in 2^16 block of BLKSIZE octets */ - if ((file_stat.st_size / (data->data_buffer_size - 4)) > 65535) - { - tftp_send_error(sockfd, sa, EUNDEF, data->data_buffer, data->data_buffer_size); -- logger(LOG_NOTICE, "Requested file to big, increase BLKSIZE"); -+ logger(LOG_NOTICE, "Requested file too big, increase BLKSIZE, ", -+ "cannot rollover in multicast transfer"); - if (data->trace) - logger(LOG_DEBUG, "sent ERROR <code: %d, msg: %s>", EUNDEF, - tftp_errmsg[EUNDEF]); -@@ -571,10 +631,6 @@ - return ERR; - } - -- /* multicast option */ -- if (data->tftp_options[OPT_MULTICAST].specified && -- data->tftp_options[OPT_MULTICAST].enabled && !convert) -- { - /* - * Find a server with the same options to give up the client. - */ -@@ -649,10 +705,16 @@ - /* initialise multicast address structure */ - data->mcastaddr.imr_multiaddr.s_addr = - data->sa_mcast.sin_addr.s_addr; -- data->mcastaddr.imr_interface.s_addr = htonl(INADDR_ANY); -+ - setsockopt(data->sockfd, IPPROTO_IP, IP_MULTICAST_TTL, - &data->mcast_ttl, sizeof(data->mcast_ttl)); - -+ logger(LOG_DEBUG, "Multicast interface = %s", -+ inet_ntoa(data->mcastaddr.imr_interface)); -+ setsockopt(data->sockfd, IPPROTO_IP, IP_MULTICAST_IF, -+ &(data->mcastaddr.imr_interface.s_addr), -+ sizeof(data->mcastaddr.imr_interface.s_addr)); -+ - /* set options data for OACK */ - opt_set_multicast(data->tftp_options, data->mc_addr, - data->mc_port, 1); -@@ -661,7 +723,7 @@ - - /* the socket must be unconnected for multicast */ - sa->sin_family = AF_UNSPEC; -- connect(sockfd, (struct sockaddr *)sa, sizeof(sa)); -+ connect(sockfd, (struct sockaddr *)sa, sizeof(*sa)); - - /* set multicast flag */ - multicast = 1; -@@ -669,6 +731,11 @@ - tftpd_clientlist_ready(data); - } - } -+ if ((file_stat.st_size / (data->data_buffer_size - 4)) > 65535) -+ { -+ logger(LOG_NOTICE, "Requested file bigger than tftp is designed to ", -+ "handle, attempting rollover, but not officially in a tftp spec"); -+ } - - /* copy options to local structure, used when falling back a client to slave */ - memcpy(options, data->tftp_options, sizeof(options)); -@@ -706,10 +773,14 @@ - case S_SEND_OACK: - timeout_state = state; - opt_options_to_string(data->tftp_options, string, MAXLEN); -- if (data->trace) -- logger(LOG_DEBUG, "sent OACK <%s>", string); -- tftp_send_oack(sockfd, sa, data->tftp_options, -- data->data_buffer, data->data_buffer_size); -+ result = tftp_send_oack(sockfd, sa, data->tftp_options, -+ data->data_buffer, -+ data->data_buffer_size); -+ if (result == OK) -+ { -+ if (data->trace) -+ logger(LOG_DEBUG, "sent OACK <%s>", string); -+ } - state = S_WAIT_PACKET; - break; - case S_SEND_DATA: -@@ -725,18 +796,24 @@ - - if (multicast) - { -- tftp_send_data(sockfd, &data->sa_mcast, -- block_number + 1, data_size, -- data->data_buffer); -+ result = tftp_send_data(sockfd, &data->sa_mcast, -+ block_number + 1, data_size, -+ data->data_buffer); -+ client_info->bytes_sent += data_size-4; - } - else - { -- tftp_send_data(sockfd, sa, block_number + 1, -- data_size, data->data_buffer); -+ result = tftp_send_data(sockfd, sa, block_number + 1, -+ data_size, data->data_buffer); - } -- if (data->trace) -- logger(LOG_DEBUG, "sent DATA <block: %d, size %d>", -- block_number + 1, data_size - 4); -+ -+ if (result == OK) -+ { -+ if (data->trace) -+ logger(LOG_DEBUG, "sent DATA <block: %d, size %d>", -+ block_number + 1, data_size - 4); -+ } -+ time(&last_send_time); - state = S_WAIT_PACKET; - break; - case S_WAIT_PACKET: -@@ -746,12 +823,14 @@ - switch (result) - { - case GET_TIMEOUT: -- number_of_timeout++; -+ client_info->number_of_timeout++; - -- if (number_of_timeout > NB_OF_RETRY) -+ if (client_info->number_of_timeout > NB_OF_RETRY) - { -- logger(LOG_INFO, "client (%s) not responding", -- inet_ntoa(client_info->client.sin_addr)); -+ logger(LOG_INFO, "client (%s) not responding.", -+ " state=%d block_number=%d", -+ inet_ntoa(client_info->client.sin_addr), -+ timeout_state,block_number); - state = S_END; - } - else -@@ -779,7 +858,8 @@ - /* Proceed normally with the next client, - going to OACK state */ - logger(LOG_INFO, -- "Serving next client: %s:%d", -+ "Serving next client after timeout: state=%d, block_number=%d: %s:%d", -+ timeout_state,block_number, - inet_ntoa(client_info->client.sin_addr), - ntohs(client_info->client.sin_port)); - sa = &client_info->client; -@@ -796,7 +876,9 @@ - break; - } - } -- logger(LOG_WARNING, "timeout: retrying..."); -+ logger(LOG_WARNING, "timeout: retrying... state=%d,", -+ " block_number=%d", timeout_state, -+ block_number); - state = timeout_state; - } - break; -@@ -811,7 +893,13 @@ - * If this is an ACK for the last block, mark this client as - * done - */ -- if ((last_block != -1) && (block_number > last_block)) -+ logger(LOG_DEBUG, -+ "received ACK <block: %d> from wrong client: %s:%d", -+ ntohs(tftphdr->th_block), -+ inet_ntoa(from.sin_addr), -+ ntohs(from.sin_port)); -+ -+ if ((last_block != -1) && (ntohs(tftphdr->th_block) > last_block)) - { - if (tftpd_clientlist_done(data, NULL, &from) == 1) - logger(LOG_DEBUG, "client done <%s>", -@@ -851,8 +939,33 @@ - } - } - /* The ACK is from the current client */ -- number_of_timeout = 0; -- block_number = ntohs(tftphdr->th_block); -+ client_info->number_of_timeout = 0; -+ int ACK_block_number = ntohs(tftphdr->th_block); -+ if (ACK_block_number == client_info->last_ack) -+ { -+ /* duplicate ACK, ignore */ -+ time_t now; -+ time(&now); -+ /* if a timeout has occurred, resend last block */ -+ if ((now-last_send_time) > timeout) -+ { -+ state = S_SEND_DATA; -+ logger(LOG_DEBUG, "Duplicate ACK packet discarded <%d>, timeout. Resend last block.", ACK_block_number); -+ } -+ else -+ { -+ logger(LOG_DEBUG, "Duplicate ACK packet discarded <%d>.", ACK_block_number); -+ } -+ break; -+ } -+ -+ client_info->last_ack = ACK_block_number; -+ -+ if (block_number < 65534) -+ block_number = ACK_block_number; -+ else -+ block_number++; -+ - if (data->trace) - logger(LOG_DEBUG, "received ACK <block: %d>", - block_number); -@@ -932,10 +1045,16 @@ - } - break; - case S_END: -+ total_bytes_sent += client_info->bytes_sent; - if (multicast) - { - logger(LOG_DEBUG, "End of multicast transfer"); -+ logger(LOG_INFO, -+ "Bytes sent while this client was master: %d", -+ client_info->bytes_sent); -+ - /* mark the current client done */ -+ clients_served++; - tftpd_clientlist_done(data, client_info, NULL); - /* Look if there is another client to serve. We lock list of - client to make sure no other thread try to add clients in -@@ -948,13 +1067,20 @@ - ntohs(client_info->client.sin_port)); - /* client is a new client structure */ - sa = &client_info->client; -- /* nedd to send an oack to that client */ -+ /* send an oack to that client */ - state = S_SEND_OACK; - fseek(fp, 0, SEEK_SET); - } - else - { -- logger(LOG_INFO, "No more client, end of tranfers"); -+ int fs = file_stat.st_size; -+ int blksze = (data->data_buffer_size - 4); -+ int ttlblks = fs / blksze; -+ int blksretry = (total_bytes_sent-file_stat.st_size) / blksze; -+ logger(LOG_INFO, "No more client, end of tranfers. %d clients served", clients_served); -+ logger(LOG_INFO, "Bytes saved over unicast: %ld", (clients_served*file_stat.st_size) - total_bytes_sent); -+ logger(LOG_INFO, "File size: %d, total data bytes sent %d", file_stat.st_size, total_bytes_sent); -+ logger(LOG_INFO, "Block re-sent: %d of %d = %f percent", blksretry, ttlblks, ((float)blksretry/(float)ttlblks) * 100); - fclose(fp); - return OK; - } diff --git a/ftp/atftp/files/patch-tftpd_list.c b/ftp/atftp/files/patch-tftpd_list.c deleted file mode 100644 index aa729f8b8407..000000000000 --- a/ftp/atftp/files/patch-tftpd_list.c +++ /dev/null @@ -1,51 +0,0 @@ ---- tftpd_list.c.orig 2004-02-27 10:05:26.000000000 +0800 -+++ tftpd_list.c 2013-10-30 13:25:57.000000000 +0800 -@@ -137,23 +137,17 @@ - struct thread_data *data, - struct client_info *client) - { -- struct thread_data *current = thread_data; /* head of the list */ -+ struct thread_data *current; - struct tftp_opt *tftp_options = data->tftp_options; - struct client_info *tmp; -- char options[MAXLEN]; -- char string[MAXLEN]; -- char *index; -- int len; - - *thread = NULL; - -- opt_request_to_string(tftp_options, options, MAXLEN); -- index = strstr(options, "multicast"); -- len = (int)index - (int)options; -- - /* lock the whole list before walking it */ - pthread_mutex_lock(&thread_list_mutex); - -+ current = thread_data; /* head of the list */ -+ - while (current) - { - if (current != data) -@@ -162,9 +156,9 @@ - pthread_mutex_lock(¤t->client_mutex); - if (current->client_ready == 1) - { -- opt_request_to_string(current->tftp_options, string, MAXLEN); -- /* must have exact same option string */ -- if (strncmp(string, options, len) == 0) -+ /* must have exact same mode and refer to the same file */ -+ if (opt_same_file(current->tftp_options,tftp_options) && -+ opt_equal(&(current->tftp_options[OPT_MODE]), &(tftp_options[OPT_MODE]))) - { - *thread = current; - /* insert the new client at the end. If the client is already -@@ -202,7 +196,7 @@ - return 0; - } - --inline void tftpd_clientlist_ready(struct thread_data *thread) -+void tftpd_clientlist_ready(struct thread_data *thread) - { - pthread_mutex_lock(&thread->client_mutex); - thread->client_ready = 1; diff --git a/ftp/atftp/files/patch-tftpd_mtftp.c b/ftp/atftp/files/patch-tftpd_mtftp.c deleted file mode 100644 index 29dc26de7c03..000000000000 --- a/ftp/atftp/files/patch-tftpd_mtftp.c +++ /dev/null @@ -1,40 +0,0 @@ ---- tftpd_mtftp.c.orig 2010-10-11 12:45:36.000000000 +0800 -+++ tftpd_mtftp.c 2010-10-11 12:46:29.000000000 +0800 -@@ -369,6 +369,13 @@ - logger(LOG_ERR, "mtftp: can't open socket"); - pthread_exit(NULL); - } -+ -+ int one = 1; -+ if (setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &one, sizeof(one)) != 0) -+ { -+ logger(LOG_WARNING, "Failed to set socket option: %s", -+ strerror(errno)); -+ } - /* bind the socket to the tftp port */ - if (bind(sockfd, (struct sockaddr*)&sa, sizeof(sa)) < 0) - { -@@ -389,7 +396,8 @@ - that file name */ - memset(&sa, 0, sizeof(sa)); /* this will hold the client info */ - data_size = data->data_buffer_size; -- retval = tftp_get_packet(sockfd, -1, NULL, &sa, NULL, NULL, -+ struct sockaddr_in toaddr; -+ retval = tftp_get_packet(sockfd, -1, NULL, &sa, NULL, &toaddr, - data->timeout, - &data_size, data->data_buffer); - -@@ -472,8 +480,11 @@ - getsockname(thread->sockfd, (struct sockaddr *)&(sa), &len); - - /* configure multicast socket */ -- thread->mcastaddr.imr_multiaddr.s_addr = thread->sa_mcast.sin_addr.s_addr; -- thread->mcastaddr.imr_interface.s_addr = htonl(INADDR_ANY); -+ thread->mcastaddr.imr_interface.s_addr = toaddr.sin_addr.s_addr; -+ setsockopt(thread->sockfd, IPPROTO_IP, IP_MULTICAST_IF, -+ &(thread->mcastaddr.imr_interface.s_addr), -+ sizeof(thread->mcastaddr.imr_interface.s_addr)); -+ - setsockopt(thread->sockfd, IPPROTO_IP, IP_MULTICAST_TTL, - &data->mcast_ttl, sizeof(data->mcast_ttl)); - diff --git a/ftp/atftp/files/patch-tftpd_pcre.c b/ftp/atftp/files/patch-tftpd_pcre.c deleted file mode 100644 index e50626e7cb1c..000000000000 --- a/ftp/atftp/files/patch-tftpd_pcre.c +++ /dev/null @@ -1,14 +0,0 @@ ---- tftpd_pcre.c.orig 2010-10-04 18:24:43.000000000 +0800 -+++ tftpd_pcre.c 2010-10-04 18:25:23.000000000 +0800 -@@ -211,9 +211,9 @@ - chp++; /* point to value indicating substring */ - rc = pcre_get_substring(str, ovector, matches, *chp - 0x30, &tmpstr); - /* found string */ -- if (rc > 0) -+ if (rc > 0 && outchp - outstr + rc+1 < outsize) - { -- Strncpy(outchp, tmpstr, rc); -+ Strncpy(outchp, tmpstr, rc+1); - outchp += rc; - pcre_free_substring(tmpstr); - continue; diff --git a/ftp/atftp/pkg-descr b/ftp/atftp/pkg-descr deleted file mode 100644 index 8c22f466cb53..000000000000 --- a/ftp/atftp/pkg-descr +++ /dev/null @@ -1,4 +0,0 @@ -Atftp is a client/server implementation of the TFTP protocol that -implements RFCs 1350, 2090, 2347, 2348, and 2349. The server is -multi-threaded and the client presents a friendly interface using -libreadline. The current server implementation lacks IPv6 support. diff --git a/ftp/cftp/Makefile b/ftp/cftp/Makefile deleted file mode 100644 index dc12756898fc..000000000000 --- a/ftp/cftp/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Created by: Andrey Zakhvatov -# $FreeBSD$ - -PORTNAME= cftp -PORTVERSION= 0.12 -PORTREVISION= 4 -CATEGORIES= ftp -MASTER_SITES= ftp://ftp.giga.or.at/pub/nih/cftp/ \ - ftp://sunsite.univie.ac.at/pub/nih/cftp/ - -MAINTAINER= ports@FreeBSD.org -COMMENT= Comfortable, full screen (S)FTP client - -LICENSE= GPLv2+ -LICENSE_FILE= ${WRKSRC}/COPYING - -BROKEN= unfetchable -DEPRECATED= Unfetchable, unmaintained -EXPIRATION_DATE= 2019-10-16 - -USES= ncurses -GNU_CONFIGURE= yes -CONFIGURE_ARGS= --enable-sftp - -PLIST_FILES= bin/cftp -INFO= cftp - -.include <bsd.port.mk> diff --git a/ftp/cftp/distinfo b/ftp/cftp/distinfo deleted file mode 100644 index a8dd3963827b..000000000000 --- a/ftp/cftp/distinfo +++ /dev/null @@ -1,2 +0,0 @@ -SHA256 (cftp-0.12.tar.gz) = 70a353cfd5a912350405e2ea8c1c1925931c07e58103ae64c589b05b642b8881 -SIZE (cftp-0.12.tar.gz) = 182043 diff --git a/ftp/cftp/files/patch-ftp.c b/ftp/cftp/files/patch-ftp.c deleted file mode 100644 index 50ea56189aa7..000000000000 --- a/ftp/cftp/files/patch-ftp.c +++ /dev/null @@ -1,38 +0,0 @@ ---- ftp.c.orig 2002-09-17 14:58:18 UTC -+++ ftp.c -@@ -311,7 +311,7 @@ directory * - rftp_list(char *path) - { - directory *dir; -- int fd; -+ int fd, resp; - FILE *f; - - if (ftp_mode('a') == -1 || ftp_cwd(path) == -1) -@@ -321,7 +321,7 @@ rftp_list(char *path) - return NULL; - - ftp_put("list"); -- if (ftp_resp() != 150) { -+ if ((resp=ftp_resp()) != 150 && resp != 125) { - close(fd); - dir = (directory *)malloc(sizeof(directory)); - dir->line = (direntry *)malloc(sizeof(direntry)); -@@ -379,7 +379,7 @@ ftp_cd(char *wd, int force) - void * - rftp_retr(char *file, int mode, long *startp, long *sizep) - { -- int fd; -+ int fd, resp; - char *dir, *name, *can, *p; - FILE *fin; - -@@ -400,7 +400,7 @@ rftp_retr(char *file, int mode, long *st - } - - ftp_put("retr %s", name); -- if (ftp_resp() != 150) { -+ if ((resp=ftp_resp()) != 150 && resp != 125) { - close(fd); - return NULL; - } diff --git a/ftp/cftp/files/patch-mkbind.c b/ftp/cftp/files/patch-mkbind.c deleted file mode 100644 index 77376a1908a1..000000000000 --- a/ftp/cftp/files/patch-mkbind.c +++ /dev/null @@ -1,12 +0,0 @@ -$OpenBSD: patch-mkbind_c,v 1.1 2003/04/15 15:50:11 avsm Exp $ ---- mkbind.c.orig 2002-09-17 11:46:23 UTC -+++ mkbind.c -@@ -86,7 +86,7 @@ int - main(int argc, char **argv) - { - FILE *fin, *fout; -- char line[4069], *p, *tok, **args; -+ char line[4096], *p, *tok, **args; - char tmp[128]; - struct binding *b; - int i, j, off, argoff, len; diff --git a/ftp/cftp/files/patch-readrc.c b/ftp/cftp/files/patch-readrc.c deleted file mode 100644 index d1a2577fac46..000000000000 --- a/ftp/cftp/files/patch-readrc.c +++ /dev/null @@ -1,11 +0,0 @@ ---- readrc.c.orig 2002-09-16 12:42:41 UTC -+++ readrc.c -@@ -46,7 +46,7 @@ readrc(char **userp, char **passp, char - char b[8192], *p, *tok, *q, *home; - char *user, *pass, *host, *port, *wdir; - -- if ((home=getenv("HOME")) == NULL) -+ if ((home=getenv("HOME")) == NULL || strlen(home) > sizeof(b)-9) - home = ""; - sprintf(b, "%s/.cftprc", home); - diff --git a/ftp/cftp/pkg-descr b/ftp/cftp/pkg-descr deleted file mode 100644 index 59697498b4b1..000000000000 --- a/ftp/cftp/pkg-descr +++ /dev/null @@ -1,7 +0,0 @@ - CFTP is used to transfer files from a remote computer to -your local computer via the FTP protocol. - Its advantages over most standard ftp-clients is its -fullscreen representation of the remote directory so you -can easily choose what to get or where to go. - -WWW: https://nih.at/cftp/ |