[httpd] Dereference web root directory to allow symlinks

This commit is contained in:
chme 2021-07-04 11:41:39 +02:00
parent 6583157596
commit 93b9740233

View File

@ -121,7 +121,7 @@ static const struct content_type_map ext2ctype[] =
static const char *http_reply_401 = "<html><head><title>401 Unauthorized</title></head><body>Authorization required</body></html>";
static const char *webroot_directory;
static char webroot_directory[PATH_MAX];
struct event_base *evbase_httpd;
#ifdef HAVE_EVENTFD
@ -1649,7 +1649,12 @@ httpd_init(const char *webroot)
return -1;
}
webroot_directory = webroot;
if (!realpath(webroot, webroot_directory))
{
DPRINTF(E_LOG, L_HTTPD, "Web root directory '%s' could not be dereferenced: %s\n", webroot, strerror(errno));
return -1;
}
evbase_httpd = event_base_new();
if (!evbase_httpd)