diff --git a/minidlna.c b/minidlna.c index 724f8ea..b0c88c4 100644 --- a/minidlna.c +++ b/minidlna.c @@ -750,6 +750,10 @@ init(int argc, char **argv) if (strtobool(ary_options[i].value)) SETFLAG(MERGE_MEDIA_DIRS_MASK); break; + case WIDE_LINKS: + if (strtobool(ary_options[i].value)) + SETFLAG(WIDE_LINKS_MASK); + break; default: DPRINTF(E_ERROR, L_GENERAL, "Unknown option in file %s\n", optionsfile); diff --git a/minidlna.conf b/minidlna.conf index 7e00e89..446ed3e 100644 --- a/minidlna.conf +++ b/minidlna.conf @@ -81,3 +81,6 @@ model_number=1 # maximum number of simultaneous connections # note: many clients open several simultaneous connections while streaming #max_connections=50 + +# set this to yes to allow symlinks that point outside user-defined media_dirs. +#wide_links=no diff --git a/minidlna.conf.5 b/minidlna.conf.5 index ce4b3fd..f5ecb97 100644 --- a/minidlna.conf.5 +++ b/minidlna.conf.5 @@ -163,6 +163,10 @@ force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title .fi +.IP "\fBwide_links\fP" +Set to 'yes' to allow symlinks that point outside user-defined media_dirs. +By default, wide symlinks are not followed. + .SH VERSION diff --git a/options.c b/options.c index 2fa8c06..15e05ee 100644 --- a/options.c +++ b/options.c @@ -64,7 +64,8 @@ static const struct { { USER_ACCOUNT, "user" }, { FORCE_SORT_CRITERIA, "force_sort_criteria" }, { MAX_CONNECTIONS, "max_connections" }, - { MERGE_MEDIA_DIRS, "merge_media_dirs" } + { MERGE_MEDIA_DIRS, "merge_media_dirs" }, + { WIDE_LINKS, "wide_links" } }; int diff --git a/options.h b/options.h index 159255f..e9ef921 100644 --- a/options.h +++ b/options.h @@ -57,7 +57,8 @@ enum upnpconfigoptions { USER_ACCOUNT, /* user account to run as */ FORCE_SORT_CRITERIA, /* force sorting by a given sort criteria */ MAX_CONNECTIONS, /* maximum number of simultaneous connections */ - MERGE_MEDIA_DIRS /* don't add an extra directory level when there are multiple media dirs */ + MERGE_MEDIA_DIRS, /* don't add an extra directory level when there are multiple media dirs */ + WIDE_LINKS /* allow following symlinks outside the defined media_dirs */ }; /* readoptionsfile() diff --git a/upnpglobalvars.h b/upnpglobalvars.h index c729a1e..c4b9158 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -191,6 +191,7 @@ extern uint32_t runtime_flags; #define NO_PLAYLIST_MASK 0x0008 #define SYSTEMD_MASK 0x0010 #define MERGE_MEDIA_DIRS_MASK 0x0020 +#define WIDE_LINKS_MASK 0x0040 #define SETFLAG(mask) runtime_flags |= mask #define GETFLAG(mask) (runtime_flags & mask) diff --git a/upnphttp.c b/upnphttp.c index 418cde4..4184bb2 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -477,6 +477,21 @@ Send400(struct upnphttp * h) CloseSocket_upnphttp(h); } +/* very minimalistic 403 error message */ +static void +Send403(struct upnphttp * h) +{ + static const char body403[] = + "