aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_song.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-12-22 19:46:41 +0100
committerMax Kellermann <max@duempel.org>2010-12-23 16:24:00 +0100
commit5274fee8a71cc5901649b984bc4488c9677feadf (patch)
treee15bcc3fe1df966fc855ec1dbd22087b7a856a2b /src/playlist_song.c
parent5462f34ed037111d2d57638352b2f1a65a322579 (diff)
downloadmpd-5274fee8a71cc5901649b984bc4488c9677feadf.tar.gz
mpd-5274fee8a71cc5901649b984bc4488c9677feadf.tar.xz
mpd-5274fee8a71cc5901649b984bc4488c9677feadf.zip
playlist_song: add flag "secure"
Optionally allow all local files. "Insecure" mode is used for printing playlists.
Diffstat (limited to 'src/playlist_song.c')
-rw-r--r--src/playlist_song.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/playlist_song.c b/src/playlist_song.c
index 1e8e98795..572672bca 100644
--- a/src/playlist_song.c
+++ b/src/playlist_song.c
@@ -84,7 +84,8 @@ apply_song_metadata(struct song *dest, const struct song *src)
}
struct song *
-playlist_check_translate_song(struct song *song, const char *base_uri)
+playlist_check_translate_song(struct song *song, const char *base_uri,
+ bool secure)
{
struct song *dest;
@@ -111,16 +112,17 @@ playlist_check_translate_song(struct song *song, const char *base_uri)
? map_uri_fs(base_uri)
: map_directory_fs(db_get_root());
- if (prefix == NULL || !g_str_has_prefix(uri, prefix) ||
- uri[strlen(prefix)] != '/') {
+ if (prefix != NULL && g_str_has_prefix(uri, prefix) &&
+ uri[strlen(prefix)] == '/')
+ uri += strlen(prefix) + 1;
+ else if (!secure) {
/* local files must be relative to the music
- directory */
+ directory when "secure" is enabled */
g_free(prefix);
song_free(song);
return NULL;
}
- uri += strlen(prefix) + 1;
g_free(prefix);
}