mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
. Implement chroot.
This commit is contained in:
parent
45ac8883e0
commit
6312e230fb
@ -17,7 +17,7 @@
|
|||||||
* x If-Modified-Since.
|
* x If-Modified-Since.
|
||||||
* x Test If-Mod-Since with IE, Phoenix, lynx, links, Opera
|
* x Test If-Mod-Since with IE, Phoenix, lynx, links, Opera
|
||||||
* x Keep-alive connections.
|
* x Keep-alive connections.
|
||||||
* . Chroot
|
* x Chroot
|
||||||
* x Set{uid|gid}.
|
* x Set{uid|gid}.
|
||||||
* . Port to Win32.
|
* . Port to Win32.
|
||||||
* x Detect Content-Type from a list of content types.
|
* x Detect Content-Type from a list of content types.
|
||||||
@ -2083,6 +2083,12 @@ int main(int argc, char *argv[])
|
|||||||
err(1, "signal(SIGQUIT)");
|
err(1, "signal(SIGQUIT)");
|
||||||
|
|
||||||
/* security */
|
/* security */
|
||||||
|
if (want_chroot)
|
||||||
|
{
|
||||||
|
if (chroot(wwwroot) == -1) err(1, "chroot(\"%s\")", wwwroot);
|
||||||
|
debugf("chrooted to `%s'\n", wwwroot);
|
||||||
|
wwwroot[0] = '\0'; /* empty string */
|
||||||
|
}
|
||||||
if (drop_gid != INVALID_GID)
|
if (drop_gid != INVALID_GID)
|
||||||
{
|
{
|
||||||
if (setgid(drop_gid) == -1) err(1, "setgid(%d)", drop_gid);
|
if (setgid(drop_gid) == -1) err(1, "setgid(%d)", drop_gid);
|
||||||
|
Loading…
Reference in New Issue
Block a user