From c64ad78c7bfa83585775617c692367e247966330 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 7 Nov 2014 19:22:26 +0100 Subject: decoder/ffmpeg: support opus --- src/decoder/FfmpegDecoderPlugin.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx index 104129ad9..69e7a6c8b 100644 --- a/src/decoder/FfmpegDecoderPlugin.cxx +++ b/src/decoder/FfmpegDecoderPlugin.cxx @@ -620,7 +620,7 @@ static const char *const ffmpeg_suffixes[] = { "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", "psp", "pva", "qcp", "qt", "r3d", "ra", + "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", "tgi", "tgq", "tgv", "thp", "ts", "tsp", "tta", "xa", "xvid", "uv", "uv2", "vb", "vid", "vob", "voc", @@ -654,6 +654,7 @@ static const char *const ffmpeg_mime_types[] = { "audio/mpeg", "audio/musepack", "audio/ogg", + "audio/opus", "audio/qcelp", "audio/vorbis", "audio/vorbis+ogg", -- cgit v1.2.3 From 7e7b403043b55c2e1bb9227fce725ad87626ae97 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 11 Nov 2014 17:03:29 +0100 Subject: Construct a Null AllocatedPath if the filename conversion into UTF8 failed --- src/fs/AllocatedPath.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx index 37b79a685..4651ea625 100644 --- a/src/fs/AllocatedPath.cxx +++ b/src/fs/AllocatedPath.cxx @@ -46,7 +46,11 @@ AllocatedPath::Build(const_pointer a, const_pointer b) AllocatedPath AllocatedPath::FromUTF8(const char *path_utf8) { - return AllocatedPath(Donate(), ::PathFromUTF8(path_utf8)); + char *path = ::PathFromUTF8(path_utf8); + if (path == nullptr) + return AllocatedPath::Null(); + + return AllocatedPath(Donate(), path); } AllocatedPath -- cgit v1.2.3 From 7c6b991de7824d79dc3d71587db8139c485deb86 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 12 Nov 2014 15:14:34 +0100 Subject: decoder/opus: add MIME types audio/ogg and application/ogg --- src/decoder/plugins/OpusDecoderPlugin.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx index b6b2e0465..25497fe8a 100644 --- a/src/decoder/plugins/OpusDecoderPlugin.cxx +++ b/src/decoder/plugins/OpusDecoderPlugin.cxx @@ -510,6 +510,13 @@ static const char *const opus_suffixes[] = { }; static const char *const opus_mime_types[] = { + /* the official MIME type (RFC 5334) */ + "audio/ogg", + + /* deprecated (RFC 5334) */ + "application/ogg", + + /* deprecated; from an early draft */ "audio/opus", nullptr }; -- cgit v1.2.3 From 3f5f96ac91f570a6aa8b73d20f406410d8a79ed4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Nov 2014 20:53:59 +0100 Subject: event/ServerSocket: fix get_remote_uid() error value Must return -1 on error, not 0. 0 is root. --- src/event/ServerSocket.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 781d29181..361aba886 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -141,7 +141,7 @@ get_remote_uid(int fd) socklen_t len = sizeof (cred); if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0) - return 0; + return -1; return cred.uid; #else -- cgit v1.2.3 From c8b93d6573550ec3735b070245769970db62a312 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Nov 2014 20:56:27 +0100 Subject: Client: assume uid==0 is local socket A negative uid value means it's not a "local socket" (PF_LOCAL). uid==0 means user "root" connected. --- src/Client.hxx | 2 +- src/ClientFile.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Client.hxx b/src/Client.hxx index f0bc6b0f7..fd81b59e0 100644 --- a/src/Client.hxx +++ b/src/Client.hxx @@ -109,7 +109,7 @@ public: * a local (UNIX domain) socket? */ bool IsLocal() const { - return uid > 0; + return uid >= 0; } unsigned GetPermission() const { diff --git a/src/ClientFile.cxx b/src/ClientFile.cxx index 382b76083..7a5dd37a6 100644 --- a/src/ClientFile.cxx +++ b/src/ClientFile.cxx @@ -47,7 +47,7 @@ client_allow_file(const Client &client, Path path_fs, Error &error) instance */ return true; - if (uid <= 0) { + if (uid < 0) { /* unauthenticated client */ error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied"); return false; -- cgit v1.2.3 From 460cfba6ff76ed58e6f6778cfeb9dd424d7fe75a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Nov 2014 21:26:31 +0100 Subject: QueueCommands: workaround for buggy clients that send "add /" --- src/command/QueueCommands.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index 36c8ac84f..d0b789eb1 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -61,7 +61,16 @@ translate_uri(Client &client, const char *uri) CommandResult handle_add(Client &client, gcc_unused unsigned argc, char *argv[]) { - const char *const uri = translate_uri(client, argv[1]); + const char *uri = argv[1]; + if (memcmp(uri, "/", 2) == 0) + /* this URI is malformed, but some clients are buggy + and use "add /" to add the whole database, which + was never intended to work, but once did; in order + to retain backwards compatibility, work around this + here */ + uri = ""; + + uri = translate_uri(client, uri); if (uri == nullptr) return CommandResult::ERROR; -- cgit v1.2.3