aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-06-13 08:21:15 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-10-19 10:56:54 +0200
commite60d770734170e77ac2d3afd940b2ab06e48e3f5 (patch)
tree93c4835cdcf0744e34c45bbfc23e76a630f5ee06 /src
parent3538d3bd1b0f979aa607fa3b0eecfd3e5dd893ae (diff)
librc: disallow user scripts as root
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src')
-rw-r--r--src/librc/librc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index fa2df683..68d09156 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -369,6 +369,9 @@ rc_set_user(void)
{
char *path, *tmp;
+ if (getuid() == 0)
+ eerrorx("Attempted to run user scripts as root.");
+
setenv("RC_USER_SERVICES", "YES", 1);
/* Setting the sysconf path to XDG_CONFIG_HOME, or ~/.config/, so subdirectories would go: