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?

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

Reply via email to