X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/12422e98901cef2774b15ec0e6468e88d4d0a6c6..ea95624e2d22fc1142d9a96acfcc9c6134395b4d:/IkiWiki/Wrapper.pm diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index ee547cefb..deba58d28 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -51,6 +51,7 @@ EOF my $configstring=Data::Dumper->Dump([\%config], ['*config']); $configstring=~s/\\/\\\\/g; $configstring=~s/"/\\"/g; + $configstring=~s/\n/\\\n/g; open(OUT, ">$wrapper.c") || error("failed to write $wrapper.c: $!");; print OUT <<"EOF"; @@ -74,6 +75,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);