[systemd-devel] [PATCH] util: do not execute files without exec permission

Lennart Poettering lennart at poettering.net
Mon Aug 18 06:51:21 PDT 2014


On Sat, 16.08.14 14:24, Ronny Chevalier (chevalier.ronny at gmail.com) wrote:

What's the rationale here? I think it makes a lot of sense to output an
error if people drop non-executable files in such a directory...

> ---
>  src/shared/util.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/shared/util.c b/src/shared/util.c
> index 18d40f3..3a03470 100644
> --- a/src/shared/util.c
> +++ b/src/shared/util.c
> @@ -3921,6 +3921,10 @@ void execute_directory(const char *directory, DIR *d, usec_t timeout, char *argv
>                                  _exit(EXIT_FAILURE);
>                          }
>  
> +                        if (access(path, X_OK) < 0) {
> +                                continue;
> +                        }
> +
>                          pid = fork();
>                          if (pid < 0) {
>                                  log_error("Failed to fork: %m");


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list