Hi,
I have a tftp client that sends out a tftp file request with an empty
(but null terminated) filename. IMHO this is a bug, but I still need
to be able to use TFTP with this client. Modifying the client is out
of the question at this point.
To deal with this situation I modified tftp-hpa in what I hope is an
unobtrusive manner -- I basically modified the code to map ""
filenames into the string "blank". I believe that this will allow
users to use tftp-hpa's filename remapping capability as well (but I
haven't tried this).
This modification causes one warning associated with "const" to be
emitted. I am all for making code "const-correct" and am even willing
to do this work if the maintainers of tftp-hpa want me to do this.
Before I embark on this task, can I get a feel for what people think
of this patch?
Regards,
--kevin
PS Incidently, I couldn't get tftp-hpa-0.37 to configure on my Fedora
Core 1 box. I can send the log if this is useful.
$ diff -Naur tftp-hpa-0.36/tftpd/tftpd.c tftp-hpa-0.36-kevin/tftpd/tftpd.c
--- tftp-hpa-0.36/tftpd/tftpd.c 2004-07-12 17:42:37.000000000 -0400
+++ tftp-hpa-0.36-kevin/tftpd/tftpd.c 2004-08-03 15:37:18.000000000 -0400
@@ -736,10 +736,19 @@
argn = 0;
end = (char *)tp + size;
+ /*
+ * Hack to deal with empty filenames.
+ */
+ if (origfilename < end && *origfilename == '\000') {
+ origfilename = "blank";
+ }
+
+
+ while ( cp < end ) {
+
while ( cp < end && *cp ) {
- do {
cp++;
- } while (cp < end && *cp);
+ }
if ( *cp ) {
nak(EBADOP, "Request not null-terminated");