X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ccbf965e6b875c9cfa2ef681c85a224439928a69..3e9a6a7d4fa237d488f8570b28dbe88d5277c1ae:/IkiWiki/Wrapper.pm diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 7d27abd06..0f64a59f4 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -47,10 +47,6 @@ EOF EOF } - # This is only set by plugins, which append to it on startup, so - # avoid storing it in the wrapper. - $config{headercontent}=""; - $Data::Dumper::Indent=0; # no newlines my $configstring=Data::Dumper->Dump([\%config], ['*config']); $configstring=~s/\\/\\\\/g; @@ -62,6 +58,7 @@ EOF /* A wrapper for ikiwiki, can be safely made suid. */ #define _GNU_SOURCE #include +#include #include #include #include @@ -79,6 +76,11 @@ $envsave newenviron[i]=NULL; environ=newenviron; + if (setregid(getegid(), -1) != 0 || setreuid(geteuid(), -1) != 0) { + perror("failed to drop real uid/gid"); + exit(1); + } + execl("$this", "$this", NULL); perror("failed to run $this"); exit(1);