I think you answer yourself there if I get it right, in media res, your hack
works without it.
It is neither a standard behavior not something that cannot be fixed the most
obviously way to fix it; the filesystem.
There are from many perspectives nothing that justify the end here.
However it would be nice to have a "bloat" option in busybox for rarely used
code that still might have a use case, pretty much alike the "full desktop"
option.
//M
Sent from my BlackBerry — the most secure mobile device
Original Message
From: [email protected]
Sent: 10 June 2019 21:42
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH] tftp: introduce CONFIG_FEATURE_TFTP_UMASK
On Sun, 9 Jun 2019 at 00:54, Denys Vlasenko <[email protected]> wrote:
>
> Imagining myself in the situation where I need to download
> executables over tftp, the first solution which comes to mind
> is to just chmod them after download.
>
> Why that does not work for you?
I am working on a reference root file system that is used internally
and possibly also by customers. Unbeknownst to me, for years we had an
internal hack to TFTP that caused the TFTP client to apply execute
permissions to transferred files. Presumably this was a user request
at some point.
A recent root file system modernization did away with this TFTP
customization, which promptly triggered a regression being filed
against TFTP. Since I had to come up with a new way to apply our old
patch, I figured I'd share it with the community in case it is useful
to others.
To answer the question why running "chmod" doesn't work in this case,
our users would say, "It used to work without. It should continue to
work without."
Regards,
-Markus
> On Tue, Apr 30, 2019 at 8:07 PM Markus Mayer <[email protected]> wrote:
> >
> > On Tue, 30 Apr 2019 at 10:22, Markus Mayer <[email protected]> wrote:
> > >
> > > We allow the umask being used by TFTP to be configurable. This way it is
> > > easy to make files transferred via TFTP executable by default if that is
> > > desired by the user.
> > >
> > > Signed-off-by: Markus Mayer <[email protected]>
> > > ---
> > > networking/tftp.c | 15 +++++++++++++--
> > > 1 file changed, 13 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/networking/tftp.c b/networking/tftp.c
> > > index d20d4ca4bd3c..c13683251a2c 100644
> > > --- a/networking/tftp.c
> > > +++ b/networking/tftp.c
> > > @@ -70,6 +70,17 @@
> > > //config: Allow tftp to specify block size, and tftpd to understand
> > > //config: "blksize" and "tsize" options.
> > > //config:
> > > +//config:config FEATURE_TFTP_UMASK
> > > +//config: hex "UMASK for TFTP client and server to use"
> > > +//config: default 0x1b6
> > > +//config: depends on TFTP || TFTPD
> > > +//config: help
> > > +//config: Specify the UMASK to be used for new being files
> > > transferred
> >
> > That should be "...new files being...", of course.
> >
> > > +//config: via TFTP. Defaults to 0x1b6 (0666). Use 0x1ff (0777) if
> > > you
> > > +//config: want execute permissions on transferred files.
> > > +//config: (Must be specified in hex, since Kconfig doesn't support
> > > octal
> > > +//config: fields.)
> > > +//config:
> > > //config:config TFTP_DEBUG
> > > //config: bool "Enable debug"
> > > //config: default n
> > > @@ -394,7 +405,7 @@ static int tftp_protocol(
> > >
> > > if (!ENABLE_TFTP || our_lsa) { /* tftpd */
> > > /* Open file (must be after changing user) */
> > > - local_fd = open(local_file, open_mode, 0666);
> > > + local_fd = open(local_file, open_mode,
> > > CONFIG_FEATURE_TFTP_UMASK);
> > > if (local_fd < 0) {
> > > G_error_pkt_reason = ERR_NOFILE;
> > > strcpy(G_error_pkt_str, "can't open file");
> > > @@ -421,7 +432,7 @@ static int tftp_protocol(
> > > /* Open file (must be after changing user) */
> > > local_fd = CMD_GET(option_mask32) ? STDOUT_FILENO :
> > >STDIN_FILENO;
> > > if (NOT_LONE_DASH(local_file))
> > > - local_fd = xopen(local_file, open_mode);
> > > + local_fd = xopen3(local_file, open_mode,
> > > CONFIG_FEATURE_TFTP_UMASK);
> > > /* Removing #if, or using if() statement instead of #if may lead to
> > > * "warning: null argument where non-null required": */
> > > #if ENABLE_TFTP
> > > --
> > > 2.17.1
> > >
> > _______________________________________________
> > busybox mailing list
> > [email protected]
> > http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox