2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-23 18:10:03 +00:00
xcat-dep/atftp/dfsg-3-bigfiles.diff

70 lines
3.2 KiB
Diff
Raw Normal View History

diff -ur atftp-0.7.dfsg/tftpd_pcre.c atftp-0.7.dfsg-bigfiles/tftpd_pcre.c
--- atftp-0.7.dfsg/tftpd_pcre.c 2003-04-24 20:16:19.000000000 -0400
+++ atftp-0.7.dfsg-bigfiles/tftpd_pcre.c 2008-06-09 15:37:51.000000000 -0400
@@ -213,7 +213,7 @@
/* found string */
if (rc > 0)
{
- Strncpy(outchp, tmpstr, rc);
+ Strncpy(outchp, tmpstr, rc+1); // atftp's Strncpy seems to have a bug, since rest of codebase seems contented, not changing that..
outchp += rc;
pcre_free_substring(tmpstr);
continue;
diff -ur atftp-0.7.dfsg/tftpd_file.c atftp-0.7.dfsg-bigfiles/tftpd_file.c
--- atftp-0.7.dfsg/tftpd_file.c 2008-06-09 14:18:29.000000000 -0400
+++ atftp-0.7.dfsg-bigfiles/tftpd_file.c 2008-06-09 14:23:17.000000000 -0400
@@ -608,22 +608,23 @@
logger(LOG_INFO, "blksize option -> %d", result);
}
+
+ /* multicast option */
+ if (data->tftp_options[OPT_MULTICAST].specified &&
+ data->tftp_options[OPT_MULTICAST].enabled && !convert)
+ {
+ /* Relax the restriction of number of packets to only complian when multicast is attempted */
/* 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]);
fclose(fp);
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.
*/
@@ -723,6 +724,10 @@
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));
@@ -934,7 +939,11 @@
client_info->last_ack = ACK_block_number;
- block_number = ACK_block_number;
+ if (block_number < 65534) { // If getting over 65534 packets, switch to rollover, this would have before been a case to give up
+ block_number = ACK_block_number;
+ } else { // At this point, the sanity should be checked such that it is a relatively low risk assumption
+ block_number++;
+ }
if (data->trace)
logger(LOG_DEBUG, "received ACK <block: %d>",