[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] tftp: introduce CONFIG_FEATURE_TFTP_UMASK
From:       Markus Mayer <mmayer () broadcom ! com>
Date:       2019-04-30 18:07:03
Message-ID: CAGt4E5u8hzhWLr50ARu9yikYyOktvE8F64nEb6E_41WrWZq2sw () mail ! gmail ! com
[Download RAW message or body]

On Tue, 30 Apr 2019 at 10:22, Markus Mayer <mmayer@broadcom.com> 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 <mmayer@broadcom.com>
> ---
>  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
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic