summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Siegl <stesie@brokenpipe.de>2005-12-09 15:50:04 +0000
committerStefan Siegl <stesie@brokenpipe.de>2005-12-09 15:50:04 +0000
commit9f7ab1f09243659e8c66ecdbbca52d7d532c9d72 (patch)
tree86fb8481614c3df0cbf7dbe4750f8b53bf1cb794
parent5c19e74a8abe64017f2b55429dd88536a523a713 (diff)
set O_RDONLY bit, in case O_EXEC is set, else we won't be able to execute binaries from the fuse'd filesystem
-rw-r--r--netfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/netfs.c b/netfs.c
index a724a22f3..a22b9dec1 100644
--- a/netfs.c
+++ b/netfs.c
@@ -367,7 +367,8 @@ netfs_check_open_permissions (struct iouser *user, struct node *node,
{
(void) newnode;
- FUNC_PROLOGUE_NODE("netfs_check_open_permissions", node);
+ FUNC_PROLOGUE_FMT("netfs_check_open_permissions", "node=%s, flags=%d",
+ node->nn->path, flags);
error_t err = 0;
if((err = netfs_validate_stat(node, user)))
@@ -382,9 +383,14 @@ netfs_check_open_permissions (struct iouser *user, struct node *node,
if (!err && (flags & O_EXEC))
err = fshelp_access (&node->nn_stat, S_IEXEC, user);
- /* store provided flags for later open/read/write/release operation call */
+ /* store provided flags for later open/read/write/release operation call.
+ *
+ * If O_EXEC is set, make sure O_RDONLY is set, this is, if you want to
+ * execute a binary, only O_EXEC is set, but we want to read the binary
+ * into memory. */
node->nn->info.flags = flags;
-
+ if(flags & O_EXEC) node->nn->info.flags |= O_RDONLY;
+
out:
FUNC_EPILOGUE(err);
}