tftpd.remap 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #
  2. # tftpd.remap -- TFTP Daemon Path Remapping
  3. #
  4. # This file has three fields: operation, regex, remapping
  5. #
  6. # The operation is a combination of the following letters:
  7. #
  8. # r - rewrite the matched string with the remapping pattern
  9. # i - case-insensitive matching
  10. # g - repeat until no match (used with "r")
  11. # e - exit (with success) if we match this pattern, do not process
  12. # subsequent rules
  13. # s - start over from the first rule if we match this pattern
  14. # a - abort (refuse the request) if we match this rule
  15. # G - this rule applies to TFTP GET requests only
  16. # P - this rule applies to TFTP PUT requests only
  17. #
  18. # The regex is a regular expression in the style of egrep(1).
  19. #
  20. # The remapping is a pattern, all characters are verbatim except \
  21. # \0 copies the full string that matched the regex
  22. # \1..\9 copies the 9 first (..) expressions in the regex
  23. # \\ is an escaped \
  24. #
  25. # "#" begins a comment, unless \-escaped
  26. #
  27. ri ^[a-z]: # Remove drive letters
  28. rg \\ / # Convert backslashes to slashes
  29. rg \# @ # Convert hash marks to @ signs
  30. rg /../ /..no../ # Convert /../ to /..no../
  31. e ^incoming/ # These are always ok
  32. r ^[^/] /\0 # Convert nonabsolute files
  33. a ^\. # Reject requests for hidden files