summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.def.h4
-rw-r--r--pacredir.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h
index fd31880..74b718d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -8,6 +8,10 @@
#ifndef _CONFIG_H
#define _CONFIG_H
+/* drop privileges by changing uid and gid to these */
+#define DROP_PRIV_UID 65534
+#define DROP_PRIV_GID 65534
+
/* website url */
#define WEBSITE "https://github.com/eworm-de/pacredir#pacredir"
diff --git a/pacredir.c b/pacredir.c
index e2a4b1c..0b034a8 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -666,7 +666,7 @@ int main(int argc, char ** argv) {
/* process is running as root, drop privileges */
if (verbose > 0)
write_log(stdout, "Running as root, meh! Dropping privileges.\n");
- if (setgid(65534) != 0 || setuid(65534) != 0)
+ if (setgid(DROP_PRIV_GID) != 0 || setuid(DROP_PRIV_UID) != 0)
write_log(stderr, "Unable to drop user privileges!\n");
}