mirror of
https://github.com/xcat2/xcat-dep.git
synced 2024-11-23 01:51:54 +00:00
-Allow atftp to rollover block numbers if 16-bit value exceeded, needed for Windows PE boot
-Fix one aspect of atftp PCRE engine, can do a tad more now, but still very limited
This commit is contained in:
parent
0150d616e7
commit
91263bef63
@ -2,13 +2,14 @@ Name: atftp
|
||||
Summary: Advanced Trivial File Transfer Protocol (ATFTP) - TFTP server
|
||||
Group: System Environment/Daemons
|
||||
Version: 0.7
|
||||
Release: 4
|
||||
Release: 5
|
||||
License: GPL
|
||||
Vendor: Linux Networx Inc.
|
||||
Source: atftp_0.7.dfsg.orig.tar.gz
|
||||
Source1: tftpd
|
||||
Patch: atftp_0.7.dfsg-3.diff
|
||||
Patch1: dfsg-3-to-multicast.diff
|
||||
Patch2: dfsg-3-bigfiles.diff
|
||||
Buildroot: /var/tmp/atftp-buildroot
|
||||
Packager: Allen Reese <areese@lnxi.com>
|
||||
Conflicts: tftp-server
|
||||
@ -36,6 +37,7 @@ files using the TFTP protocol.
|
||||
%setup -n atftp-0.7.dfsg
|
||||
%patch -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
|
||||
%build
|
||||
|
69
atftp/dfsg-3-bigfiles.diff
Normal file
69
atftp/dfsg-3-bigfiles.diff
Normal file
@ -0,0 +1,69 @@
|
||||
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>",
|
Loading…
Reference in New Issue
Block a user