aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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)
{