quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 21115d4a1befb0b9fd139aaa47a2f22efb0f6ba4
parent d7f5c6029e4dab604bd8fc82f747544ac4e4dc67
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu, 13 Jul 2017 19:05:21 +0200

Fix logic error in vhost chrooting (from e592bbc)

Thanks Hiltjo for having spotted it!

Diffstat:
quark.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/quark.c b/quark.c @@ -568,9 +568,12 @@ sendresponse(int fd, struct request *r) for (i = 0; i < LEN(vhost); i++) { /* switch to vhost directory if there is a match */ if (!regexec(&vhost[i].re, r->field[REQ_HOST], 0, - NULL, 0) && chdir(vhost[i].dir) < 0) { - return sendstatus(fd, (errno == EACCES) ? - S_FORBIDDEN : S_NOT_FOUND); + NULL, 0) { + if (chdir(vhost[i].dir) < 0) { + return sendstatus(fd, (errno == EACCES) + ? S_FORBIDDEN : S_NOT_FOUND); + } + break; } } }