Jump to content











Photo
- - - - -

How to set BaseDirectory to handle 'C:\' Drive letter in file request?

tftpd32 tftpd64 basedirectory

  • Please log in to reply
15 replies to this topic

#1 StivBaskin8937

StivBaskin8937
  • Members
  • 2 posts
  •  
    United States

Posted 18 December 2017 - 05:32 PM

Hello,

I have a system that has a hard-coded drive letter in the TFTP file request:
  C:\boot\recovery.bin

As a result I keep getting 'File Not Found' errors. I have not been able
to configure my tftpd32.ini file to handle this path.  

I've tried setting BaseDirectory to various things, but I can't seem to set
it "above" the C: drive, so tftpd32 can't handle the request.

Unfortunately the 'C:\' part of the file request is required.  I don't even know

if it's valid TFTP to have a drive letter, but it's what I have to deal with.

Any suggestions?


Thank you for your time.

Stiv



 



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 18 December 2017 - 06:21 PM

On tftpd (the Linux version) there is a -m (remap) option, with a separate configuration file, *like*:

https://kernel.googl...pd/sample.rules

 

ri    ^[a-z]:                # Remove "drive letters"

 

I don't think that tftpd32 (or tftpd64 as now it seems like only 64 bit builds are provided :w00t: :ph34r: ) has a similar provision. :dubbio:

 

Semi-random thought (and not necessarily a good answer to your question), but have you tried erwan.l's project:

http://reboot.pro/fo...iny-pxe-server/

http://reboot.pro/to...iny-pxe-server/

http://mistyrebootfi...xesrv_about.htm

 

If it does (apart from the hardcoded C:\ issue) what you need, then maybe he (erwan.l is an active member on the forum) might add the feature (if it is not already there, I think it isn't but maybe it is already available :unsure:)

 

:duff:

Wonko



#3 StivBaskin8937

StivBaskin8937
  • Members
  • 2 posts
  •  
    United States

Posted 18 December 2017 - 07:55 PM

Thanks for the prompt reply Wonko.  I have to use tftpd32 to match a legacy system, so PXE won't work for me.  Looks like an interesing project though!

 

I will look for remap on the Windows version.

 

Regards,

 

Stiv



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 18 December 2017 - 08:38 PM

At least unitl 2011 there wasn't any remapping function, as this user:

http://reboot.pro/to...name-remapping/

 

added a small part of it (the part that he needed) modifying the source.

And I don't think it was added later :(.

 

:duff:

Wonko



#5 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 09 January 2018 - 12:43 AM

If there is a request/need for this i can probably add this feature.
Lets see if the op comes back.

About pxe and legacy system, TPS supports the old BOOTP as well.

#6 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 04 February 2018 - 05:07 PM

See post here to map one incoming TFTP request tp another path/filename.



#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 February 2018 - 05:25 PM

See post here to map one incoming TFTP request tp another path/filename.

Well, no. :(

 

Or maybe you could spend a few lines explaining how that would work in the OP scenario (or more generally how to use the new feature as a replacement for the Linux tftpd "ri" function).

 

I mean, is:

[map]
C:\boot\recovery.bin=\boot\recovery.bin

doing what the OP was asking? :unsure:

 

:duff:

Wonko



#8 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 04 February 2018 - 05:32 PM

When Tiny PXE Server receives an incoming TFTP read request, it will use the [map] section in config.ini (if any) to replace a string (or substring) by another one.

 

It may change the full path\filename or just a part of it.

 

I believe it does address the OP's question:

I have a system that has a hard-coded drive letter in the TFTP file request:C:\boot\recovery.bin
As a result I keep getting 'File Not Found' errors. I have not been able to configure my tftpd32.ini file to handle this path.  

 

 

Some examples.

[map]
some.thing=some.thing.else.existing.in.the.root.directory
c:\boot\recovery.bin=\boot\recovery.bin
bootx64.efi=x64\bootx64.efi
bootmgr=bootmgr.exe


#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2018 - 09:45 AM

Good :)

 

I wanted to be sure that the "alias" had to begin with the backslash, re:

 

 

 

Some examples.



[map]
some.thing=some.thing.else.existing.in.the.root.directory
c:\boot\recovery.bin=\boot\recovery.bin
bootx64.efi=x64\bootx64.efi
bootmgr=bootmgr.exe

 

This:

c:\boot\recovery.bin=\boot\recovery.bin

is like my attempt, this one is not (no leading backslash):

bootx64.efi=x64\bootx64.efi

 

Which one is the correct syntax? :unsure:

 

 

:duff:

Wonko



#10 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 05 February 2018 - 10:33 AM

Good :)

 

I wanted to be sure that the "alias" had to begin with the backslash, re:

 

 

 

This:

c:\boot\recovery.bin=\boot\recovery.bin

is like my attempt, this one is not (no leading backslash):

bootx64.efi=x64\bootx64.efi

 

Which one is the correct syntax? :unsure:

 

 

:duff:

Wonko

 

Actually there is no syntax :)

 

This is a simple text search and replace function just like you would do in a text editor.

Whether it contains a slash, or backslash, or any other special character is irrelevant here.

[map]
some.string.or.substring.with.whatever.character=some.thing.else.existing.in.the.root.directory


#11 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2018 - 01:43 PM

I will try again. :unsure:

If I want the stupid program - before and outside mapping or remapping - to serve a file, does the path need to be prepended by a backlash, yes or no.

AGAIN, in YOUR examples one:
\boot\recovery.bin
begins with the backslash, WHILE ANOTHER ONE:
x64\bootx64.efi
begins NOT with one.

WHICH one is correct/working?
Or BOTH are correct/working?

:duff:
Wonko

#12 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 05 February 2018 - 02:55 PM

Tiny PXE Server, independently of the new mapping feature, will handle a backslash OR a lack of backslash (so answer to your question is BOTH).

All paths internally are checked and a backlashe is added (or removed) where needed.

You can enter root=c:\temp or root=c:\temp\ just like you can enter filename=\my.filename or filename=my.filename.

 

Now, in the mapping context, backlashes are not relevant as strings there are considered as strings (to be searched and replaced), not as paths or filenames (hence me not understanding your question at first).

 

Hope this clarifies it :)



#13 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2018 - 04:52 PM

Hope this clarifies it  :)

 

Yep, now it is clear. :)

 

Now a new question:

What happens if the program has *somewhere* a 

filename=\my.filename

and then a mapping like:

 

[map]
some.thing=some.thing.else.existing.in.the.root.directory
my.filename=\my.other.filename

 

The result (if the substitution is "plain") would be that an attempt to serve:

\\my.other.filename

would be made, are double backslashes "normalized" to single? :unsure:

 

:duff:

Wonko



#14 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 05 February 2018 - 07:05 PM

Well, my "normalize" function is rather light so dont push it too hard :)



#15 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14263 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2018 - 09:00 PM

Well, my "normalize" function is rather light so dont push it too hard :)

 

Sure, pushing hard *like* adding as last line of the [map] section:

\\=\

:whistling:

 

 

:duff:

Wonko



#16 erwan.l

erwan.l

    Gold Member

  • Developer
  • 2286 posts
  • Location:Nantes - France
  •  
    France

Posted 06 February 2018 - 06:42 PM

Sure, pushing hard *like* adding as last line of the [map] section:

\\=\

:whistling:

 

 

:duff:

Wonko

 

I tried it and my computer did not explode :)

Nor did TPS crash.

So far so good.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users