[dm-devel] [PATCH 35/35] multipathd: uxclt: allow client mode for non-root, too

Benjamin Marzinski bmarzins at redhat.com
Thu Sep 16 04:24:30 UTC 2021


On Fri, Sep 10, 2021 at 01:41:20PM +0200, mwilck at suse.com wrote:
> From: Martin Wilck <mwilck at suse.com>
> 
> The server checks for root permissions anyway. "multipathd -k"
> should work for ordinary users as long as no priviledged commands
> are executed.
> 
Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
> Signed-off-by: Martin Wilck <mwilck at suse.com>
> ---
>  multipathd/main.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/multipathd/main.c b/multipathd/main.c
> index ec4bcc3..ff5b600 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -3329,11 +3329,6 @@ main (int argc, char *argv[])
>  
>  	logsink = LOGSINK_SYSLOG;
>  
> -	if (getuid() != 0) {
> -		fprintf(stderr, "need to be root\n");
> -		exit(1);
> -	}
> -
>  	/* make sure we don't lock any path */
>  	if (chdir("/") < 0)
>  		fprintf(stderr, "can't chdir to root directory : %s\n",
> @@ -3420,6 +3415,11 @@ main (int argc, char *argv[])
>  		return err;
>  	}
>  
> +	if (getuid() != 0) {
> +		fprintf(stderr, "need to be root\n");
> +		exit(1);
> +	}
> +
>  	if (foreground) {
>  		if (!isatty(fileno(stdout)))
>  			setbuf(stdout, NULL);
> -- 
> 2.33.0




More information about the dm-devel mailing list