diff options
author | 2011-03-26 09:05:43 +0000 | |
---|---|---|
committer | 2011-03-26 09:05:43 +0000 | |
commit | 932917377f831d80ae30dc0acea5f35d54bf41ab (patch) | |
tree | 129c62990482c090dc85bd655152c941f2d66e12 /net-ftp/atftp/files | |
parent | Disable global survey by default in example conf file wrt #360483 by robbat2 (diff) | |
download | gentoo-2-932917377f831d80ae30dc0acea5f35d54bf41ab.tar.gz gentoo-2-932917377f831d80ae30dc0acea5f35d54bf41ab.tar.bz2 gentoo-2-932917377f831d80ae30dc0acea5f35d54bf41ab.zip |
Integrate patches from bugs 321705, 322601 and 323883
(Portage version: 2.1.9.44/cvs/Linux x86_64)
Diffstat (limited to 'net-ftp/atftp/files')
-rw-r--r-- | net-ftp/atftp/files/atftp-0.7-blockno.patch | 136 | ||||
-rw-r--r-- | net-ftp/atftp/files/atftp-0.7-illreply.patch | 12 | ||||
-rw-r--r-- | net-ftp/atftp/files/atftp-0.7-spaced_filename.patch | 96 |
3 files changed, 244 insertions, 0 deletions
diff --git a/net-ftp/atftp/files/atftp-0.7-blockno.patch b/net-ftp/atftp/files/atftp-0.7-blockno.patch new file mode 100644 index 000000000000..6a3184f98bec --- /dev/null +++ b/net-ftp/atftp/files/atftp-0.7-blockno.patch @@ -0,0 +1,136 @@ +--- atftp-0.7/tftp_file.c~ 2010-05-27 13:05:12.000000000 -0500 ++++ atftp-0.7/tftp_file.c 2010-05-27 12:50:05.000000000 -0500 +@@ -133,19 +133,21 @@ + int mcast_sockfd = 0; + struct sockaddr_in sa_mcast; + struct ip_mreq mreq; + struct hostent *host; + int master_client = 0; + unsigned int file_bitmap[NB_BLOCK]; + int prev_bitmap_hole = -1; /* the previous hole found in the bitmap */ + char string[MAXLEN]; ++ int rx_block_number; + + int prev_block_number = 0; /* needed to support netascii convertion */ + int temp = 0; ++ size_t ignore; + + data->file_size = 0; + tftp_cancel = 0; + from.sin_addr.s_addr = 0; + + memset(&sa_mcast, 0, sizeof(struct sockaddr_in)); + memset(&file_bitmap, 0, sizeof(file_bitmap)); + +@@ -300,17 +302,17 @@ + { + connect(sockfd, (struct sockaddr *)&sa, sizeof(sa)); + connected = 1; + } + state = S_OACK_RECEIVED; + break; + case GET_ERROR: + fprintf(stderr, "tftp: error received from server <"); +- fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr); ++ ignore = fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr); + fprintf(stderr, ">\n"); + state = S_ABORT; + break; + case GET_DATA: + number_of_timeout = 0; + /* if the socket if not connected, connect it */ + if (!connected) + { +@@ -513,21 +515,24 @@ + state = S_WAIT_PACKET; + break; + case S_DATA_RECEIVED: + if ((multicast && master_client) || (!multicast)) + timeout_state = S_SEND_ACK; + else + timeout_state = S_WAIT_PACKET; + +- block_number = ntohs(tftphdr->th_block); ++ rx_block_number = ntohs(tftphdr->th_block); + if (data->trace) + fprintf(stderr, "received DATA <block: %d, size: %d>\n", + ntohs(tftphdr->th_block), data_size - 4); + ++ if ((uint16_t)rx_block_number == (uint16_t)(block_number+1)) ++ ++block_number; ++ + if (tftp_file_write(fp, tftphdr->th_data, data->data_buffer_size - 4, block_number, + data_size - 4, convert, &prev_block_number, &temp) + != data_size - 4) + { + + fprintf(stderr, "tftp: error writing to file %s\n", + data->local_file); + tftp_send_error(sockfd, &sa, ENOSPACE, data->data_buffer, +@@ -613,19 +618,21 @@ + int connected; /* 1 when sockfd is connected */ + struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer; + FILE *fp; /* the local file pointer */ + int number_of_timeout = 0; + struct stat file_stat; + int convert = 0; /* if true, do netascii convertion */ + char string[MAXLEN]; + ++ int ack_block_number; + int prev_block_number = 0; /* needed to support netascii convertion */ + int prev_file_pos = 0; + int temp = 0; ++ size_t ignore; + + data->file_size = 0; + tftp_cancel = 0; + from.sin_addr.s_addr = 0; + + /* make sure the socket is not connected */ + sa.sin_family = AF_UNSPEC; + connect(sockfd, (struct sockaddr *)&sa, sizeof(sa)); +@@ -759,20 +766,23 @@ + case GET_ACK: + number_of_timeout = 0; + /* if the socket if not connected, connect it */ + if (!connected) + { + //connect(sockfd, (struct sockaddr *)&sa, sizeof(sa)); + connected = 1; + } +- block_number = ntohs(tftphdr->th_block); ++ ack_block_number = ntohs(tftphdr->th_block); ++ if ((uint16_t)(block_number+1) == ack_block_number) ++ ++block_number; + if (data->trace) + fprintf(stderr, "received ACK <block: %d>\n", +- block_number); ++ ack_block_number); ++ + if ((last_block != -1) && (block_number > last_block)) + { + state = S_END; + break; + } + state = S_SEND_DATA; + break; + case GET_OACK: +@@ -782,17 +792,17 @@ + { + //connect(sockfd, (struct sockaddr *)&sa, sizeof(sa)); + connected = 1; + } + state = S_OACK_RECEIVED; + break; + case GET_ERROR: + fprintf(stderr, "tftp: error received from server <"); +- fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr); ++ ignore = fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr); + fprintf(stderr, ">\n"); + state = S_ABORT; + break; + case GET_DISCARD: + /* consider discarded packet as timeout to make sure when don't lock up + if routing is broken */ + number_of_timeout++; + fprintf(stderr, "tftp: packet discard <%s:%d>.\n", diff --git a/net-ftp/atftp/files/atftp-0.7-illreply.patch b/net-ftp/atftp/files/atftp-0.7-illreply.patch new file mode 100644 index 000000000000..e18bbd99c9e9 --- /dev/null +++ b/net-ftp/atftp/files/atftp-0.7-illreply.patch @@ -0,0 +1,12 @@ +*** tftp_def.old.c 2009-02-28 17:56:12.000000000 +0100 +--- tftp_def.c 2009-02-28 17:57:02.000000000 +0100 +*************** +*** 141,146 **** +--- 141,147 ---- + */ + inline char *Strncpy(char *to, const char *from, size_t size) + { ++ if (size <= 0) { *to = '\000'; return to; } + to[size-1] = '\000'; + return strncpy(to, from, size - 1); + } diff --git a/net-ftp/atftp/files/atftp-0.7-spaced_filename.patch b/net-ftp/atftp/files/atftp-0.7-spaced_filename.patch new file mode 100644 index 000000000000..da96d9f6b820 --- /dev/null +++ b/net-ftp/atftp/files/atftp-0.7-spaced_filename.patch @@ -0,0 +1,96 @@ +--- atftp-0.7/tftp.c~ 2010-06-03 08:51:14.000000000 -0500 ++++ atftp-0.7/tftp.c 2010-06-03 09:40:56.000000000 -0500 +@@ -18,16 +18,17 @@ + #include "config.h" + + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <unistd.h> + #include <getopt.h> + #include <string.h> ++#include <stdarg.h> + + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <netdb.h> + + #include <signal.h> +@@ -344,16 +345,41 @@ + + /* If no names matched, then return NULL. */ + return NULL; + } + # endif + #endif + + /* ++ * set argc/argv from variadic string arguments ++*/ ++void make_arg_vector(int *argc, char***argv, ...) ++{ ++ char **p; ++ char *s; ++ va_list argp; ++ ++ // how many args? ++ *argc = 0; ++ va_start(argp, argv); ++ while ( (s=va_arg(argp, char*)) ) ++ ++*argc; ++ ++ // allocate storage ++ *argv = malloc(*argc * sizeof (char*)); ++ ++ // store args ++ p = *argv; ++ va_start(argp, argv); ++ while ( (s=va_arg(argp, char*)) ) ++ *p++ = s; ++} ++ ++/* + * Split a string into args. + */ + void make_arg(char *string, int *argc, char ***argv) + { + static char *tmp = NULL; + size_t argz_len; + + /* split the string to an argz vector */ +@@ -1142,30 +1168,26 @@ + argv[optind+1]); + make_arg(string, &ac, &av); + process_cmd(ac, av); + } + + if (!interactive) + { + if (action == PUT) +- snprintf(string, sizeof(string), "put %s %s", local_file, +- remote_file); ++ make_arg_vector(&ac,&av,"put",local_file,remote_file,NULL); + else if (action == GET) +- snprintf(string, sizeof(string), "get %s %s", remote_file, +- local_file); ++ make_arg_vector(&ac,&av,"get",remote_file,local_file,NULL); + else if (action == MGET) +- snprintf(string, sizeof(string), "mget %s %s", remote_file, +- local_file); ++ make_arg_vector(&ac,&av,"mget",remote_file,local_file,NULL); + else + { + fprintf(stderr, "No action specified in batch mode!\n"); + exit(ERR); + } +- make_arg(string, &ac, &av); + if (process_cmd(ac, av) == ERR) + exit(ERR); + } + return OK; + } + + void tftp_usage(void) + { |