[dm-devel] [PATCH 26/35] multipathd: uxlsnr: check root on connection startup

Benjamin Marzinski bmarzins at redhat.com
Thu Sep 16 02:23:33 UTC 2021


On Fri, Sep 10, 2021 at 01:41:11PM +0200, mwilck at suse.com wrote:
> From: Martin Wilck <mwilck at suse.com>
> 
> The SO_PEERCRED socket option returns "the credentials that were
> in effect at the time of the call to connect(2)" (see unix(7)).
> So we might as well fetch these credentials at that time.
> 
Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
> Signed-off-by: Martin Wilck <mwilck at suse.com>
> ---
>  multipathd/uxlsnr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
> index 9a945ea..9cf6964 100644
> --- a/multipathd/uxlsnr.c
> +++ b/multipathd/uxlsnr.c
> @@ -92,8 +92,6 @@ static struct pollfd *polls;
>  static int notify_fd = -1;
>  static char *watch_config_dir;
>  
> -static bool _socket_client_is_root(int fd);
> -
>  static bool _socket_client_is_root(int fd)
>  {
>  	socklen_t len = 0;
> @@ -132,6 +130,7 @@ static void new_client(int ux_sock)
>  	INIT_LIST_HEAD(&c->node);
>  	c->fd = fd;
>  	c->state = CLT_RECV;
> +	c->is_root = _socket_client_is_root(c->fd);
>  
>  	/* put it in our linked list */
>  	pthread_mutex_lock(&client_lock);
> -- 
> 2.33.0




More information about the dm-devel mailing list