From 866e0e1670f79653203a3da65096841ab37fc903 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 31 Aug 2014 19:49:39 +0200 Subject: player: always load playlists Until now, you had to use --load-unsafe-playlists or --playlist to get playlists loaded. Change this and always load playlists by default. This still attempts to reject unsafe URLs. For example, trying to invoke libavdevice pseudo-demuxer is explicitly prevented. Local paths and any http links (and some more) are always allowed. --- player/loadfile.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index 3833a80231..e685c15b80 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1084,7 +1084,10 @@ static void play_current_file(struct MPContext *mpctx) } stream_filename = mpctx->resolve_result->url; } - mpctx->stream = stream_open(stream_filename, mpctx->global); + int stream_flags = STREAM_READ; + if (mpctx->playlist->current->unsafe_origin && !opts->load_unsafe_playlists) + stream_flags |= STREAM_SAFE_ONLY; + mpctx->stream = stream_create(stream_filename, stream_flags, mpctx->global); if (!mpctx->stream) { // error... demux_was_interrupted(mpctx); goto terminate_playback; @@ -1127,16 +1130,10 @@ goto_reopen_demuxer: ; mpctx->initialized_flags |= INITIALIZED_DEMUXER; if (mpctx->demuxer->playlist) { - if (mpctx->demuxer->stream->safe_origin || opts->load_unsafe_playlists) { - transfer_playlist(mpctx, mpctx->demuxer->playlist); - } else { - MP_ERR(mpctx, "\nThis looks like a playlist, but playlist support " - "will not be used automatically.\nThe main problem with " - "playlist safety is that playlist entries can be arbitrary,\n" - "and an attacker could make mpv poke around in your local " - "filesystem or network.\nUse --playlist=file or the " - "--load-unsafe-playlists option to load them anyway.\n"); - } + struct playlist *pl = mpctx->demuxer->playlist; + for (struct playlist_entry *e = pl->first; e; e = e->next) + e->unsafe_origin |= !mpctx->demuxer->stream->safe_origin; + transfer_playlist(mpctx, pl); goto terminate_playback; } -- cgit v1.2.3