[pve-devel] [PATCH cluster] fix file permission check in chmod
Dominik Csapak
d.csapak at proxmox.com
Fri Apr 14 17:07:46 CEST 2017
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