diff options
author | Christian Hesse <mail@eworm.de> | 2017-10-20 08:31:48 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2017-10-20 08:31:48 +0200 |
commit | 8b747acc27922a790f740c7e25ffa23939c35c91 (patch) | |
tree | 1c2147c39bf3fca5786cb4801bbdea57663265e8 | |
parent | 29fe863ea50740a191e8ccd9ddabcf4ea5199ac6 (diff) | |
download | pacredir-8b747acc27922a790f740c7e25ffa23939c35c91.tar.gz pacredir-8b747acc27922a790f740c7e25ffa23939c35c91.tar.zst |
allow to specify uid and gid in config.h
-rw-r--r-- | config.def.h | 4 | ||||
-rw-r--r-- | pacredir.c | 2 |
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" @@ -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"); } |