mirror of
https://github.com/troglobit/finit.git
synced 2026-11-29 21:08:21 +00:00
Return EX_NOPERM for non-root users calling init/telinit
See issue #301 for future per-user support. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
c679b0a93d
commit
1e5ce38928
1 file changed
+11
-7
+11
-7
@@ -700,12 +700,6 @@ static int telinit(int argc, char *argv[])
|
|||||||
return systemf("initctl -b runlevel %c", req);
|
return systemf("initctl -b runlevel %c", req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: add non-pid1 process monitor here
|
|
||||||
*
|
|
||||||
* finit -f ~/.config/finit.conf &
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,9 +716,19 @@ int main(int argc, char *argv[])
|
|||||||
uev_ctx_t loop;
|
uev_ctx_t loop;
|
||||||
|
|
||||||
/* user calling telinit or init */
|
/* user calling telinit or init */
|
||||||
if (getpid() != 1)
|
if (getpid() != 1) {
|
||||||
|
if (geteuid() == 0)
|
||||||
return telinit(argc, argv);
|
return telinit(argc, argv);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Issue #301: add non-pid1 process monitor here.
|
||||||
|
* Default to read ~/.config/finit.conf with the
|
||||||
|
* API socket in /run/user/$UID/. Lot of things
|
||||||
|
* to refactor before then though.
|
||||||
|
*/
|
||||||
|
return EX_NOPERM;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need /dev, /proc, and /sys for console=, remount and cgroups
|
* Need /dev, /proc, and /sys for console=, remount and cgroups
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user