Closed mayurikini closed 1 day ago
http://etherboot.org/dokuwiki-2017-02-19b/tftp_backslash/tftpd-hpa
Title of that webpage: Supporting broken TFTP clients with tftpd-hpa
Text from that webpage: tftpd-hpa can easily be configured to support broken TFTP clients by using a remap file.
@mayurikini How important is supporting both the usual forward slash (/) and a backslash (\) as a path separator to you?
@stappersg I won't be able to use this crate without that functionality. Could we just format file_path file_path.to_string().replace("\\", "/");
if remap option (-m) is used?
Hey @mayurikini, thank you for your interest in this project.
Can you give me some example on how you are trying to use this and which errors do you get? Do you use another client which sends with "\" instead of "/", or other way around? Do you have the error text? I'm looking for more information really.
Thanks!
I have updated the code a bit, can you try again and see if it works now? You shouldn't need a flag to use it, it should be automatic.
Sorry about late reply. I tested the code changes; it doesn't work for me. Here is my scenario: tftp client is on windows and the tftp server is on linux machine. I need a way to convert the \ to / so that they are able to transfer files. Hence a "remap" flag would be better in this case. I don't see any errors on console, after "Sending", I expected either file not found or some error but I don't see any error.
What I have observed with latest change is that it doesn't join "send directory" to file_path.
let file_path = &self.send_directory.join(file_path);
Could you verify?
https://github.com/altugbakan/rs-tftpd/commit/de85ed59f059e3dff3c12a9c931314872f7e146c#diff-48d27698cc708c7efe770fd897e4885efaa0a15cae30d54936068603ba03bbd9R139
Also here is a rough code that works for me:
let final_file_path;
let file_path = &self.send_directory.join(filename.clone());
println!("file_path {}", file_path.display());
println!("filename {filename}");
if self.remap {
let formatted = file_path.to_string_lossy().to_string().replace("\\", "/");
final_file_path = PathBuf::from(formatted);
} else {
final_file_path = PathBuf::from(file_path);
}
Yes, the send_directory is not joined, since the folder to upload might not be the same for the server when we upload a file within a directory.
Got it. I think issue is with client asking for sending "\test.txt", instead of "test.txt". That's why it works with my code to send file with full directory path (formatted). I'll look into it, thanks. Also thank you for working on the above code changes so promptly.
We can close this issue; I need to ensure client asks for "test.txt" instead of "\test.txt". Thanks.
Add support such that the TFTP server could accept paths using either the usual forward slash (/) or a backslash () as a path separator.
http://etherboot.org/dokuwiki-2017-02-19b/tftp_backslash/tftpd-hpa