minor features
diff --git a/ChangeLog b/ChangeLog
index 14ce894..fe3bfdb 100644
--- 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>
diff --git a/kernel/inode.c b/kernel/inode.c
index d94b3b2..f0ad932 100644
--- a/kernel/inode.c
+++ b/kernel/inode.c
@@ -22,6 +22,19 @@
#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 @@
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;
diff --git a/lib/helper.c b/lib/helper.c
index cd3cfea..526fadd 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -50,28 +50,33 @@
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);
}
+
+ if (old_sa.sa_handler == SIG_DFL &&
+ sigaction(signal, &sa, NULL) == -1) {
+ perror("Cannot set signal handler");
+ exit(1);
+ }
+}
- sa.sa_handler = SIG_IGN;
-
- if (sigaction(SIGPIPE, &sa, NULL) == -1) {
- perror("Cannot set ignored signals");
- 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,
diff --git a/util/fusermount.c b/util/fusermount.c
index e837eb2..93d9f52 100644
--- a/util/fusermount.c
+++ b/util/fusermount.c
@@ -551,11 +551,6 @@
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;