minor features
authorMiklos Szeredi <miklos@szeredi.hu>
Fri, 2 Jul 2004 16:20:45 +0000 (16:20 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Fri, 2 Jul 2004 16:20:45 +0000 (16:20 +0000)
ChangeLog
kernel/inode.c
lib/helper.c
util/fusermount.c

index 14ce894b5ac5d0af5614cd21d40f7cf90db9476b..fe3bfdbc560080f1bc60609b2e98a8f2e04ac843 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,10 +7,21 @@
 
        * Fix revalidate time setting for newly created inodes
 
+       * Remove uid==0 check for '-x' option in fusermount (kernel checks
+       this)
+
+       * fuse_main() only installs handlers for signals (out of INT, HUP,
+       TERM, PIPE), for which no handler has yet been installed
+
+       * Add module option 'user_allow_other' which if set to non-zero
+       will allow non root user to specify the 'allow_other' mount option
+       ('-x' option of fusermount)
+
 2004-07-01  Miklos Szeredi <mszeredi@inf.bme.hu>
 
        * Change passing fuse include dir to 2.6 kernel make system more
-       robust (hopefully fixes problems seen on SuSE 9.1)
+       robust (fixes compile problems seen on SuSE 9.1 with updated 2.6
+       kernel)
 
 2004-06-30  Miklos Szeredi <mszeredi@inf.bme.hu>
 
index d94b3b2336f79cc0ce81076cd8d997b5a1b61691..f0ad932f335716b362411e504d4abf48bb70a25c 100644 (file)
 #include "compat/parser.h"
 #endif
 
+
+static int user_allow_other;
+
+#ifdef KERNEL_2_6
+#include <linux/moduleparam.h>
+module_param(user_allow_other, int, 0);
+#else
+MODULE_PARM(user_allow_other, "i");
+#endif
+
+MODULE_PARM_DESC(user_allow_other, "Allow non root user to specify the \"allow_other\" mount option");
+
+
 #define FUSE_SUPER_MAGIC 0x65735546
 
 #ifndef KERNEL_2_6
@@ -309,7 +322,8 @@ static int fuse_read_super(struct super_block *sb, void *data, int silent)
        if (!parse_fuse_opt((char *) data, &d))
                return -EINVAL;
 
-       if ((d.flags & FUSE_ALLOW_OTHER) && !capable(CAP_SYS_ADMIN))
+       if (!user_allow_other && (d.flags & FUSE_ALLOW_OTHER) &&
+           current->uid != 0)
                return -EPERM;
 
        sb->s_blocksize = PAGE_CACHE_SIZE;
index cd3cfeab5e7b89f52b37d5dace43aaa553421130..526fadd6866719b2d8f15ec09321fd9b34e5f044 100644 (file)
@@ -50,30 +50,35 @@ static void exit_handler()
         fuse_exit(fuse);
 }
 
-static void set_signal_handlers()
+static void set_one_signal_handler(int signal, void (*handler)(int))
 {
     struct sigaction sa;
+    struct sigaction old_sa;
 
-    sa.sa_handler = exit_handler;
+    sa.sa_handler = handler;
     sigemptyset(&(sa.sa_mask));
     sa.sa_flags = 0;
 
-    if (sigaction(SIGHUP, &sa, NULL) == -1 || 
-       sigaction(SIGINT, &sa, NULL) == -1 || 
-       sigaction(SIGTERM, &sa, NULL) == -1) {
-       
-       perror("Cannot set exit signal handlers");
+    if (sigaction(signal, NULL, &old_sa) == -1) {
+        perror("FUSE: cannot get old signal handler");
         exit(1);
     }
-
-    sa.sa_handler = SIG_IGN;
-    
-    if (sigaction(SIGPIPE, &sa, NULL) == -1) {
-       perror("Cannot set ignored signals");
+        
+    if (old_sa.sa_handler == SIG_DFL &&
+        sigaction(signal, &sa, NULL) == -1) {
+        perror("Cannot set signal handler");
         exit(1);
     }
 }
 
+static void set_signal_handlers()
+{
+    set_one_signal_handler(SIGHUP, exit_handler);
+    set_one_signal_handler(SIGINT, exit_handler);
+    set_one_signal_handler(SIGTERM, exit_handler);
+    set_one_signal_handler(SIGPIPE, SIG_IGN);
+}
+
 static int fuse_start(int fuse_fd, int flags, int multithreaded,
                       int background, const struct fuse_operations *op)
 {
index e837eb2ca6694808fc385ab04b342e0d862103ac..93d9f5238efb78bfb712dfefb12afa35d5bc5fba 100644 (file)
@@ -551,11 +551,6 @@ int main(int argc, char *argv[])
             break;
             
         case 'x':
-            if(getuid() != 0) {
-                fprintf(stderr, "%s: option %s is allowed only for root\n",
-                        progname, argv[a]);
-                exit(1);
-            }
             opts.allow_other = 1;
             break;