MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.2k stars 350 forks source link

file input plugin #191

Closed adelias closed 5 years ago

adelias commented 6 years ago

After updating mpd from git today I can no longer add local files to the playlist. Adding a file with mpc as follows:

mpc add file:///root/Show_Bizness.wav

I get access denied in the log:

Jan 07 20:11 : client: [0] opened from local Jan 07 20:11 : client: [0] process command list Jan 07 20:11 : client: process command "add "file:///root/Show_Bizness.wav"" Jan 07 20:11 : exception: Access denied Jan 07 20:11 : client: command returned 2 Jan 07 20:11 : client: [0] process command list returned 2 Jan 07 20:11 : client: [0] closed

mpd version is:

mpd -V

Music Player Daemon 0.21 (v0.20.15-716-g34eef0ed8)

Copyright (C) 2003-2007 Warren Dukes warren.dukes@gmail.com Copyright 2008-2017 Max Kellermann max.kellermann@gmail.com This is free software; see the source for copying conditions. There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins: simple proxy

Storage plugins: local smbclient nfs curl

Neighbor plugins: smbclient

Decoders plugins: [vorbis] ogg oga [oggflac] ogg oga [flac] flac [opus] opus ogg oga [audiofile] wav au aiff aif [dsdiff] dff [dsf] dsf [faad] aac [wavpack] wv [sidplay] sid mus str prg P00 [wildmidi] mid [fluidsynth] mid [adplug] amd d00 hsc laa rad raw sa2 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve [gme] ay gbs gym hes kss nsf nsfe sap spc vgm vgz [pcm]

Filters: soxr

Tag plugins: id3tag

Output plugins: null fifo pipe alsa openal httpd recorder

Encoder plugins: null vorbis opus twolame wave flac shine

Archive plugins: [bz2] bz2 [iso] iso

Input plugins: file alsa archive curl ffmpeg smbclient nfs mms

Playlist plugins: extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols: file:// http:// https:// mms:// mmsh:// mmst:// mmsu:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps:// smb:// nfs:// alsa://

Other features: avahi epoll icu ipv6 systemd tcp un

Thanks!

MaxKellermann commented 6 years ago

What was the newest MPD version which allowed you to add this song?

MaxKellermann commented 6 years ago

Note: I don't experience this problem, this works for me. My random guess is that it's a file permission problem on your side and has nothing to do with your MPD update, but let's see.

adelias commented 6 years ago

Previous to this version I was running 0.21 (v0.20.10-468-gbd50a0d2e) and it was working fine with all supported music files. I now am getting access denied with all the supported files that I have tried.

MaxKellermann commented 6 years ago

Please downgrade to that version and confirm that this version works today (this would disprove my random guess). If it does, please bisect to find the faulty commit.

adelias commented 6 years ago

The last working commit for me is this one: https://github.com/MusicPlayerDaemon/MPD/commit/354104f9a9f6e5eb652ba771c32117431d898cf5

It breaks with this: https://github.com/MusicPlayerDaemon/MPD/commit/34eef0ed847c8555daed548a4234def7935aafbc

MaxKellermann commented 6 years ago

Thanks, but the former is in branch v0.20.x and the latter a merge commit which does not change any code. It is thus impossible for 34eef0ed847c8555daed548a4234def7935aafbc to be the faulty commit. Some commit in git master must have broken it, but your "known-good" commit is not in master.

adelias commented 6 years ago

OK, that makes sense. Release version 0.20.15 works great, so I'll stick with that for now and deal with this issue if it ever comes up again in the future. Thanks for helping out!

skidoo23 commented 6 years ago

Same issue here. Recent MPD from git master, Debian testing x_64. MP3 audio file is world readable and located in music_diretctory. mpc commands runs as root(testing only) and connects via socket. Adding files with relative path to music_directory works.

# mpc -h /run/mpd/socket add temp/test.mp3

Same file with absolute path

# mpc -h /run/mpd/socket add file:///music/temp/test.mp3 
error adding file:///music/temp/test.mp3: Access denied

Need instructions for bisect usage.

skillcoder commented 6 years ago

I confirm, Same issue on FreeBSD 11.1-RELEASE-p4

# pkg info | grep musicp
musicpc-0.29_1                 Command line client for the musicpd
musicpd-0.20.18_1              Remote-controllable music daemon
# cat /usr/local/etc/musicpd.conf | grep "^music_directory"
music_directory         "/backup/music"
# ls -la /backup/music
total 11030
drwxr-xr-x  3 ftp   wheel         4 13 мая   23:33 ./
drwxr-xr-x  9 ftp   wheel        14 12 мая   15:07 ../
-rw-r--r--  1 ftp   wheel  11201595 13 мая   23:33 MeinHerzBrennt.mp3

mpc -h passWORD@192.168.100.254 -p 6600 add MeinHerzBrennt.mp3 Works great.

But mpc -h passWORD@192.168.100.254 -p 6600 add add file:///backup/music/MeinHerzBrennt.mp3 fail with message: error adding file:///backup/music/MeinHerzBrennt.mp3: Access denied

But may be it cuz i dont use local file socket for connection, cuz i cant use it.

Stoiker commented 6 years ago

I can confirm the bug for

Music Player Daemon 0.20.16 on Fedora 28. I used a flac file inside the music directory.

However, what puzzles me is that I can reproduce the same behaviour under Mac OS 10.11.6 with Music Player Daemon 0.19.7

I did not change the mpd version for the last two years, only upgraded the OS. Since I did not use mpd for a long time on that machine I can only assume that the OS updates broke it?

Stoiker commented 6 years ago

Small update from my side after some debugging. The error occurs in: MPD/src/client/ClientFile.cxx AllowFile{} where the uid of the client will be compared against various parameters. In my case the uid of the user running the client can not be determined and so the error will thrown.

IMO the msg here is misleading since the "real" file permission check will be performed one step after the is-it-a-valid-uid one.

Why there is no valid uid still needs some digging.

adelias commented 6 years ago

I'm still having this issue with mpd git master. Release versions do not exhibit this behavior for me.

MaxKellermann commented 6 years ago

Please bisect.

adelias commented 6 years ago

Seems that these later versions didn't like the Unix Socket bind_to_address setting of "~/.mpd/socket" that I had in mpd.conf. Changing it to "/run/mpd/socket" has fixed the issue that I was having.