[SCM] forked-daapd/master: Fix compatibility with iTunes 12.1 and fix two segfaults with upstream patches
rbalint at users.alioth.debian.org
rbalint at users.alioth.debian.org
Mon Feb 23 11:23:19 UTC 2015
The following commit has been merged in the master branch:
commit bf2070df02eb9d833b6342adacc4ecf7447e2fd0
Author: Balint Reczey <balint at balintreczey.hu>
Date: Sun Feb 22 19:00:29 2015 +0100
Fix compatibility with iTunes 12.1 and fix two segfaults with upstream patches
diff --git a/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch b/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch
new file mode 100644
index 0000000..0dd4c87
--- /dev/null
+++ b/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch
@@ -0,0 +1,39 @@
+From 01e6d56f7eef841d96c874f64206aacc09640dd6 Mon Sep 17 00:00:00 2001
+From: Justin Maggard <jmaggard10 at gmail.com>
+Date: Tue, 16 Dec 2014 15:32:21 -0800
+Subject: [PATCH 1/3] Fix bad free when encountering an error fetching query
+ results.
+
+---
+ src/httpd_daap.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/httpd_daap.c b/src/httpd_daap.c
+index 9506b6f..50fe3de 100644
+--- a/src/httpd_daap.c
++++ b/src/httpd_daap.c
+@@ -1913,7 +1913,10 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
+ evbuffer_free(group);
+
+ if (qp.filter)
+- free(qp.filter);
++ {
++ free(qp.filter);
++ qp.filter = NULL;
++ }
+
+ if (ret < 0)
+ {
+@@ -1993,8 +1996,7 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
+ evbuffer_free(grouplist);
+
+ out_qfilter_free:
+- if (qp.filter)
+- free(qp.filter);
++ free(qp.filter);
+
+ return -1;
+ }
+--
+2.1.4
+
diff --git a/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch b/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch
new file mode 100644
index 0000000..17dcdc6
--- /dev/null
+++ b/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch
@@ -0,0 +1,25 @@
+From 90c38f639d415b0748520cdb35ea3f23f02e56fb Mon Sep 17 00:00:00 2001
+From: Justin Maggard <jmaggard10 at gmail.com>
+Date: Tue, 16 Dec 2014 15:30:45 -0800
+Subject: [PATCH 2/3] Fix invalid read on empty string queries.
+
+---
+ src/DAAP2SQL.g | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/DAAP2SQL.g b/src/DAAP2SQL.g
+index 93e9a42..1fcbf12 100644
+--- a/src/DAAP2SQL.g
++++ b/src/DAAP2SQL.g
+@@ -252,7 +252,7 @@ expr returns [ pANTLR3_STRING result, int valid ]
+ val[0] = '\%';
+ }
+
+- if (val[strlen((char *)val) - 1] == '*')
++ if (val[0] && val[1] && val[strlen((char *)val) - 1] == '*')
+ {
+ op = '\%';
+ val[strlen((char *)val) - 1] = '\%';
+--
+2.1.4
+
diff --git a/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch b/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch
new file mode 100644
index 0000000..5050ed2
--- /dev/null
+++ b/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch
@@ -0,0 +1,120 @@
+From daebb1f671c9a38002c8c84911f6bbc93dede769 Mon Sep 17 00:00:00 2001
+From: ejurgensen <espenjurgensen at gmail.com>
+Date: Fri, 6 Feb 2015 22:14:26 +0100
+Subject: [PATCH 3/3] Fix problems with iTunes 12.1, see issue #100 - don't
+ announce group support to iTunes - support for absolute http url
+ streaming requests
+
+---
+ src/httpd_daap.c | 59 +++++++++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 39 insertions(+), 20 deletions(-)
+
+diff --git a/src/httpd_daap.c b/src/httpd_daap.c
+index 50fe3de..4a7bb41 100644
+--- a/src/httpd_daap.c
++++ b/src/httpd_daap.c
+@@ -813,7 +813,15 @@ daap_reply_server_info(struct evhttp_request *req, struct evbuffer *evbuf, char
+ dmap_add_int(content, "aeSV", apro); // com.apple.itunes.music-sharing-version (determines if itunes shows share types)
+
+ dmap_add_short(content, "ated", 7); // daap.supportsextradata
+- dmap_add_short(content, "asgr", 3); // daap.supportsgroups
++
++ /* Sub-optimal user-agent sniffing to solve the problem that iTunes 12.1
++ * does not work if we announce support for groups.
++ */
++ ua = evhttp_find_header(headers, "User-Agent");
++ if (ua && (strncmp(ua, "iTunes", strlen("iTunes")) == 0))
++ dmap_add_short(content, "asgr", 0); // daap.supportsgroups (1=artists, 2=albums, 3=both)
++ else
++ dmap_add_short(content, "asgr", 3); // daap.supportsgroups (1=artists, 2=albums, 3=both)
+
+ // dmap_add_long(content, "asse", 0x80000); // unknown - used by iTunes
+
+@@ -848,6 +856,9 @@ daap_reply_server_info(struct evhttp_request *req, struct evbuffer *evbuf, char
+
+ dmap_add_int(content, "msdc", 1); // dmap.databasescount
+
++// dmap_add_int(content, "mstc", ); // dmap.utctime
++// dmap_add_int(content, "msto", ); // dmap.utcoffset
++
+ // Create container
+ dmap_add_container(evbuf, "msrv", EVBUFFER_LENGTH(content));
+ evbuffer_add_buffer(evbuf, content);
+@@ -2296,14 +2307,9 @@ daap_reply_extra_data(struct evhttp_request *req, struct evbuffer *evbuf, char *
+ static int
+ daap_stream(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query, const char *ua)
+ {
+- struct daap_session *s;
+ int id;
+ int ret;
+
+- s = daap_session_find(req, query, evbuf);
+- if (!s)
+- return -1;
+-
+ ret = safe_atoi32(uri[3], &id);
+ if (ret < 0)
+ evhttp_send_error(req, HTTP_BADREQUEST, "Bad Request");
+@@ -2313,6 +2319,23 @@ daap_stream(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, stru
+ return ret;
+ }
+
++static char *
++uri_relative(char *uri, const char *protocol)
++{
++ char *ret;
++
++ if (strncmp(uri, protocol, strlen(protocol)) != 0)
++ return NULL;
++
++ ret = strchr(uri + strlen(protocol), '/');
++ if (!ret)
++ {
++ DPRINTF(E_LOG, L_DAAP, "Malformed DAAP Request URI '%s'\n", uri);
++ return NULL;
++ }
++
++ return ret;
++}
+
+ static char *
+ daap_fix_request_uri(struct evhttp_request *req, char *uri)
+@@ -2321,25 +2344,21 @@ daap_fix_request_uri(struct evhttp_request *req, char *uri)
+
+ /* iTunes 9 gives us an absolute request-uri like
+ * daap://10.1.1.20:3689/server-info
++ * iTunes 12.1 gives us an absolute request-uri for streaming like
++ * http://10.1.1.20:3689/databases/1/items/1.mp3
+ */
+
+- if (strncmp(uri, "daap://", strlen("daap://")) != 0)
+- return uri;
+-
+- /* Clear the proxy request flag set by evhttp
+- * due to the request URI being absolute.
+- * It has side-effects on Connection: keep-alive
+- */
+- req->flags &= ~EVHTTP_PROXY_REQUEST;
+-
+- ret = strchr(uri + strlen("daap://"), '/');
+- if (!ret)
++ if ( (ret = uri_relative(uri, "daap://")) || (ret = uri_relative(uri, "http://")) )
+ {
+- DPRINTF(E_LOG, L_DAAP, "Malformed DAAP Request URI '%s'\n", uri);
+- return NULL;
++ /* Clear the proxy request flag set by evhttp
++ * due to the request URI being absolute.
++ * It has side-effects on Connection: keep-alive
++ */
++ req->flags &= ~EVHTTP_PROXY_REQUEST;
++ return ret;
+ }
+
+- return ret;
++ return uri;
+ }
+
+
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index e69de29..2b4ca3e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch
+0002-Fix-invalid-read-on-empty-string-queries.patch
+0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch
--
forked-daapd packaging
More information about the pkg-multimedia-commits
mailing list