summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-07-16 10:51:21 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-07-20 17:52:52 +0200
commit641249f6b143c4e22825e18e0dbe22bb04d21138 (patch)
tree5a58963f268df6fe984ca43ca72b3556515fbfaf
parentb1a3f96a8139c5ed3aac7b8a77b06ba4c0a877c7 (diff)
Fix default file ownership
Formerly all nodes were created so that they were owned by root:root by default. This causes problems if the procfs translator is running as unprivileged user and serves passive translator records, because the file ownership is being used as credentials for starting translators. This obviously fails if the procfs translator is not root but is trying to acquire credentials including uid/gid 0. Fix this by using the uid/gid of the procfs translator by default. procfs.c (procfs_make_node): Fix default node ownership.
-rw-r--r--procfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/procfs.c b/procfs.c
index aa785d3..44e4f7e 100644
--- a/procfs.c
+++ b/procfs.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <fcntl.h>
#include <mach.h>
#include <hurd/netfs.h>
@@ -76,6 +77,9 @@ struct node *procfs_make_node (const struct procfs_node_ops *ops, void *hook)
else
np->nn_stat.st_mode = S_IFREG | 0444;
+ np->nn_stat.st_uid = getuid ();
+ np->nn_stat.st_gid = getgid ();
+
return np;
fail: