summaryrefslogtreecommitdiff
path: root/lib/libfuse
diff options
context:
space:
mode:
authorhelg <helg@cvs.openbsd.org>2018-06-19 13:01:35 +0000
committerhelg <helg@cvs.openbsd.org>2018-06-19 13:01:35 +0000
commite1988567feb2b90bc2aa8bce70b2547033a7c1c9 (patch)
treeea2d50ac060d28ba16aed341e9c985edb0377d5e /lib/libfuse
parenta175a801354e4e0d28551a9058a0c863119ec755 (diff)
Changes the default mount behaviour so only the user that mounts the
file system can access it unless the allow_other mount options is specified. The allow_other mount option makes the file system available to other users just like any other mounted file system. ok mpi@
Diffstat (limited to 'lib/libfuse')
-rw-r--r--lib/libfuse/fuse.c9
-rw-r--r--lib/libfuse/fuse_private.h3
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c
index 9ed4079c5ba..db0fdfa94f0 100644
--- a/lib/libfuse/fuse.c
+++ b/lib/libfuse/fuse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse.c,v 1.46 2018/06/19 11:27:54 helg Exp $ */
+/* $OpenBSD: fuse.c,v 1.47 2018/06/19 13:01:34 helg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -64,8 +64,6 @@ static struct fuse_opt fuse_core_opts[] = {
#define FUSE_LIB_OPT(o, m) {o, offsetof(struct fuse_config, m), 1}
static struct fuse_opt fuse_lib_opts[] = {
FUSE_OPT_KEY("ac_attr_timeout=", KEY_STUB),
- FUSE_OPT_KEY("allow_other", KEY_STUB),
- FUSE_OPT_KEY("allow_root", KEY_STUB),
FUSE_OPT_KEY("attr_timeout=", KEY_STUB),
FUSE_OPT_KEY("auto_cache", KEY_STUB),
FUSE_OPT_KEY("noauto_cache", KEY_STUB),
@@ -97,6 +95,8 @@ static struct fuse_opt fuse_lib_opts[] = {
/* options supported by fuse_mount */
#define FUSE_MOUNT_OPT(o, m) {o, offsetof(struct fuse_mount_opts, m), 1}
static struct fuse_opt fuse_mount_opts[] = {
+ FUSE_MOUNT_OPT("allow_other", allow_other),
+ FUSE_OPT_KEY("allow_root", KEY_STUB),
FUSE_OPT_KEY("async_read", KEY_STUB),
FUSE_OPT_KEY("blkdev", KEY_STUB),
FUSE_OPT_KEY("blksize=", KEY_STUB),
@@ -253,6 +253,7 @@ fuse_loop(struct fuse *fuse)
ioexch.fbxch_data = fbuf.fb_dat;
if (ioctl(fuse->fc->fd, FIOCSETFBDAT, &ioexch)) {
+printf("libfuse: FIOCSETFBDAT error\n");
free(fbuf.fb_dat);
return (-1);
}
@@ -261,6 +262,7 @@ fuse_loop(struct fuse *fuse)
ictx = NULL;
if (n != FUSEBUFSIZE) {
+printf("libfuse: write error: %s\n", strerror(errno));
errno = EINVAL;
return (-1);
}
@@ -315,6 +317,7 @@ fuse_mount(const char *dir, struct fuse_args *args)
memset(&fargs, 0, sizeof(fargs));
fargs.fd = fc->fd;
fargs.max_read = opts.max_read;
+ fargs.allow_other = opts.allow_other;
if (mount(MOUNT_FUSEFS, fc->dir, mnt_flags, &fargs)) {
switch (errno) {
diff --git a/lib/libfuse/fuse_private.h b/lib/libfuse/fuse_private.h
index 5dc163abcba..c3f1f659dfb 100644
--- a/lib/libfuse/fuse_private.h
+++ b/lib/libfuse/fuse_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_private.h,v 1.20 2018/06/07 22:28:11 helg Exp $ */
+/* $OpenBSD: fuse_private.h,v 1.21 2018/06/19 13:01:34 helg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -90,6 +90,7 @@ struct fuse_core_opts {
struct fuse_mount_opts {
char *fsname;
+ int allow_other;
int def_perms;
int max_read;
int noatime;