From 641249f6b143c4e22825e18e0dbe22bb04d21138 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 16 Jul 2013 10:51:21 +0200 Subject: 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. --- procfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/procfs.c b/procfs.c index aa785d3..44e4f7e 100644 --- a/procfs.c +++ b/procfs.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -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: -- cgit v1.2.3