Hello Andreas,
Andreas Gruenbacher wrote:> Hi,
>
> On 01/17/2015 12:57 AM, Sebastian Herbszt wrote:
> >> On 01/16/2015 12:19 AM, Sebastian Herbszt wrote:
> >>> Andreas Gruenbacher wrote:
> >>>> "Loading <FILE>... failed: No such file or
directory" when the TFTP
> >>>> server replies with "Permission denied" for the
kernel or initrd.
> >>> [...]
> >>>
> >>> The (almost untested) patch below should fix this.
> >>
> >> hmm, probably close but I still get the same "No such file or
directory"
> >> error message.
> >
> > which tftp server are you using? It seems to send error code 0 on
EACCES
> > instead of 2.
>
> The last version I have tries was tftp-server-5.2-15.fc21.x86_64; it
> replies with an ErrorCode of 0 and "Permission denied" as ErrMsg.
fortunately this is also the list for tftp-hpa.
> Is it important to get this fixed?
With this issue fixed my previous patch should work as expected.
Patch for tftp-hpa below.
> Do other tftp server get this right?
atftpd sends error code 1 ("File not found") on EACCES.
Just sent a patch to the developer.
> >> Also, should error codes other than 1 (File not found)
> >> and 2 (Access violation) not be mapped to something like EIO and
not ENOENT?
>
> I think it makes sense to distinguish between error codes 1, 2, and
> everything else here:
>
> 1 "File not found" -> ENOENT
> 2 "Access Violation" -> EACCES
> Everything else -> EIO (or similar)
>
> If the server provides an ErrMsg, reporting that seems to make sense as
> well; at least it would have helped me in this case.
Will take a look at this.
Sebastian
--- tftp-hpa-5.2/tftpd/tftpd.c.orig 2015-01-16 21:45:30.790798281 +0100
+++ tftp-hpa-5.2/tftpd/tftpd.c 2015-01-18 23:44:28.031177383 +0100
@@ -1504,6 +1504,8 @@ static int validate_access(char *filenam
return ENOSPACE;
case EEXIST:
return EEXISTS;
+ case EACCES:
+ return EACCESS;
default:
return errno + 100;
}