aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-21 03:50:45 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-21 03:50:45 +0200
commit427da8c37016b9f7543a24144b9ad1bca9b08736 (patch)
tree2ada75e52faf4e1478c280815883c3ac835aae4a /src/mds-server.c
parentm misc + create directory for temporary data (diff)
downloadmds-427da8c37016b9f7543a24144b9ad1bca9b08736.tar.gz
mds-427da8c37016b9f7543a24144b9ad1bca9b08736.tar.bz2
mds-427da8c37016b9f7543a24144b9ad1bca9b08736.tar.xz
master server also drops priliveges
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-server.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mds-server.c b/src/mds-server.c
index e532c72..9fd4d7a 100644
--- a/src/mds-server.c
+++ b/src/mds-server.c
@@ -56,6 +56,15 @@ int main(int argc_, char** argv_)
argv = argv_;
+ /* Drop privileges like it's hot. */
+ if ((geteuid() == getuid() ? 0 : seteuid(getuid())) ||
+ (getegid() == getgid() ? 0 : setegid(getgid())))
+ {
+ perror(*argv);
+ return 1;
+ }
+
+
/* Sanity check the number of command line arguments. */
if (argc > ARGC_LIMIT + LIBEXEC_ARGC_EXTRA_LIMIT)
{