Re: [PATCH] tftpd: strip leading slashes from the requested file name
Ali Ahmet Memis via busybox <[email protected]>
| Newsgroups | gmane.linux.busybox |
|---|---|
| Message-ID | <[email protected]> |
That's intentional. Without DIR tftpd doesn't chroot. So an absolute request like /etc/shadow is currently taken as an absolute path. TFTP only gives us a filename. There is no separate root on the TFTP side. The CWD or chroot is what decides where that filename is resolved. With DIR nothing really changes. xchroot() puts the process in that directory. So /foo and foo already refer to the same file there. The change matters in the no-DIR case. /pxelinux.0 can escape the directory the server was started in. After stripping the leading slash it stays relative to CWD. That's also what is needed for the PXE case in bug 4874. Another option would be to reject leading / when DIR is not set. That would be reasonable too. But then no-DIR PXE setups would have to pass DIR explicitly. If that's the behavior you prefer then I think that's a different fix. Otherwise I think stripping the slash is fine here. Ali