summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-31 19:49:39 +0200
committerwm4 <wm4@nowhere>2014-08-31 19:49:39 +0200
commit866e0e1670f79653203a3da65096841ab37fc903 (patch)
tree2c01331832dc0be8d77954936f1e590a6d2728a4 /player/loadfile.c
parentfc0fa9a221882647da563acc2d22eac0f27b1120 (diff)
downloadmpv-866e0e1670f79653203a3da65096841ab37fc903.tar.bz2
mpv-866e0e1670f79653203a3da65096841ab37fc903.tar.xz
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.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c19
1 files changed, 8 insertions, 11 deletions
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;
}