diff options
author | Mattias Nissler <mnissler@chromium.org> | 2018-08-31 09:44:04 +0200 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2018-10-09 20:36:22 +0100 |
commit | da7c9b228aaf31f37684e106b75262055ca440de (patch) | |
tree | 548cb7e54d87af7c2cfdcde3dcb01d0f184f0315 /lib | |
parent | 64e11073b9347fcf9c6d1eea143763ba9e946f70 (diff) | |
download | libfuse-da7c9b228aaf31f37684e106b75262055ca440de.tar.gz |
Add unprivileged option in `mount.fuse3`
The unprivileged option allows to run the FUSE file system process
without privileges by dropping capabilities and preventing them from
being re-acquired via setuid / fscaps etc. To accomplish this,
mount.fuse sets up the `/dev/fuse` file descriptor and mount itself
and passes the file descriptor via the `/dev/fd/%u` mountpoint syntax
to the FUSE file system.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse_versionscript | 5 | ||||
-rw-r--r-- | lib/helper.c | 18 | ||||
-rw-r--r-- | lib/meson.build | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index e52dd86..2802bb4 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -148,6 +148,11 @@ FUSE_3.2 { fuse_loop_mt_31; } FUSE_3.1; +FUSE_3.3 { + global: + fuse_open_channel; +} FUSE_3.2; + # Local Variables: # indent-tabs-mode: t # End: diff --git a/lib/helper.c b/lib/helper.c index e1de362..5b80c6e 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -420,3 +420,21 @@ struct fuse_conn_info_opts* fuse_parse_conn_info_opts(struct fuse_args *args) } return opts; } + +int fuse_open_channel(const char *mountpoint, const char* options) +{ + struct mount_opts *opts = NULL; + int fd = -1; + const char *argv[] = { "", "-o", options }; + int argc = sizeof(argv) / sizeof(argv[0]); + struct fuse_args args = FUSE_ARGS_INIT(argc, (char**) argv); + + opts = parse_mount_opts(&args); + if (opts == NULL) + return -1; + + fd = fuse_kern_mount(mountpoint, opts); + destroy_mount_opts(opts); + + return fd; +} diff --git a/lib/meson.build b/lib/meson.build index 5dd8450..492abf7 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -32,7 +32,7 @@ libfuse = library('fuse3', libfuse_sources, version: meson.project_version(), soversion: '3', include_directories: include_dirs, dependencies: deps, install: true, link_depends: 'fuse_versionscript', - c_args: [ '-DFUSE_USE_VERSION=32', + c_args: [ '-DFUSE_USE_VERSION=33', '-DFUSERMOUNT_DIR="@0@"'.format(fusermount_path) ], link_args: ['-Wl,--version-script,' + meson.current_source_dir() + '/fuse_versionscript' ]) |