From e186bf3c3ee4d2eb91a22b6921726eac9b815130 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 25 Feb 2018 21:39:49 +0100 Subject: lib: Fix FUSE access for non-root users This fixes the access to the RIB for non-root users. Thanks to Sitri and Dagger from the ##fuse channel for their assistance. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- CMakeLists.txt | 2 +- src/lib/rib.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bbddd1d..42fbc0d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(GNUInstallDirs) set(PACKAGE_VERSION_MAJOR 0) set(PACKAGE_VERSION_MINOR 10) -set(PACKAGE_VERSION_PATCH 3) +set(PACKAGE_VERSION_PATCH 4) set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") diff --git a/src/lib/rib.c b/src/lib/rib.c index 947226a9..909d217f 100644 --- a/src/lib/rib.c +++ b/src/lib/rib.c @@ -260,20 +260,19 @@ static void * fuse_thr(void * o) } #endif /* HAVE_FUSE */ + int rib_init(const char * prefix) { #ifdef HAVE_FUSE struct stat st; - char * argv[] = {"ignored", - NULL, - "-f", + char * argv[] = {"-f", "-o", - "ro,", - "allow_other,", - "default_permissions,", + "ro," + "default_permissions," + "allow_other," "fsname=rib", NULL}; - struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + struct fuse_args args = FUSE_ARGS_INIT(3, argv); if (stat(FUSE_PREFIX, &st) == -1) return -1; @@ -283,9 +282,7 @@ int rib_init(const char * prefix) if (stat(rib.mnt, &st) == -1) mkdir(rib.mnt, 0777); - argv[1] = rib.mnt; - - fuse_opt_parse(&args, argv, NULL, NULL); + fuse_opt_parse(&args, NULL, NULL, NULL); list_head_init(&rib.reg_comps); -- cgit v1.2.3