aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbigbrotherwei <1965867461@qq.com>2024-01-17 23:58:27 +0800
committerNikolaus Rath <Nikolaus@rath.org>2024-01-20 14:08:07 +0000
commit0c12204145d43ad4683136379a130385ef16d166 (patch)
tree8220389cf0f0c45bb98c788c2728f5d01ec5e734
parent2c736f516f28dfb5c58aff345c668a5ea6386295 (diff)
downloadlibfuse-0c12204145d43ad4683136379a130385ef16d166.tar.gz
Add processing for FUSE_CAP_HANDLE_KILLPRIV and disable it by default
'FUSE_CAP_HANDLE_KILLPRIV' is not enabled by default anymore, as that would be a sudden security issue introduced by a new ABI and API compatible libfuse version.
-rw-r--r--include/fuse_common.h2
-rw-r--r--lib/fuse_lowlevel.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h
index fedbaa9..bdbd7cb 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -363,7 +363,7 @@ struct fuse_loop_config_v1 {
* setuid and setgid bits when a file is written, truncated, or
* its owner is changed.
*
- * This feature is enabled by default when supported by the kernel.
+ * This feature is disabled by default.
*/
#define FUSE_CAP_HANDLE_KILLPRIV (1 << 20)
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index d8f5466..def1918 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -2054,7 +2054,6 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
se->conn.want |= (cap)
LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_READ);
LL_SET_DEFAULT(1, FUSE_CAP_AUTO_INVAL_DATA);
- LL_SET_DEFAULT(1, FUSE_CAP_HANDLE_KILLPRIV);
LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_DIO);
LL_SET_DEFAULT(1, FUSE_CAP_IOCTL_DIR);
LL_SET_DEFAULT(1, FUSE_CAP_ATOMIC_O_TRUNC);
@@ -2146,6 +2145,8 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outargflags |= FUSE_PARALLEL_DIROPS;
if (se->conn.want & FUSE_CAP_POSIX_ACL)
outargflags |= FUSE_POSIX_ACL;
+ if (se->conn.want & FUSE_CAP_HANDLE_KILLPRIV)
+ outargflags |= FUSE_HANDLE_KILLPRIV;
if (se->conn.want & FUSE_CAP_CACHE_SYMLINKS)
outargflags |= FUSE_CACHE_SYMLINKS;
if (se->conn.want & FUSE_CAP_EXPLICIT_INVAL_DATA)