[pve-devel] applied: [PATCH cluster] fix file permission check in chmod

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Apr 18 14:13:42 CEST 2017


applied to master & stable-4

On Fri, Apr 14, 2017 at 05:07:46PM +0200, Dominik Csapak wrote:
> since mode_t has additional bits set for file mode (see stat(2) ),
> we have to ignore those, or we never can set the mode
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  data/src/pmxcfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/data/src/pmxcfs.c b/data/src/pmxcfs.c
> index 0f09937..8fa3bcc 100644
> --- a/data/src/pmxcfs.c
> +++ b/data/src/pmxcfs.c
> @@ -197,7 +197,8 @@ static int cfs_fuse_chmod(const char *path, mode_t mode)
>  		allowed_mode |= (S_IRGRP);
>  
>  	// allow only setting our supported modes (0600 for priv, 0640 for rest)
> -	if (mode == allowed_mode)
> +	// mode has additional bits set, which we ignore; see stat(2)
> +	if ((mode & ALLPERMS) == allowed_mode)
>  		ret = 0;
>  
>  	cfs_debug("leave cfs_fuse_chmod %s (%d) mode: %o", path, ret, (int)mode);
> -- 
> 2.11.0




More information about the pve-devel mailing list