diff -Nru forked-daapd-22.0/debian/changelog forked-daapd-22.0/debian/changelog --- forked-daapd-22.0/debian/changelog 2014-10-18 00:40:23.000000000 +0200 +++ forked-daapd-22.0/debian/changelog 2015-02-23 11:55:41.000000000 +0100 @@ -1,3 +1,11 @@ +forked-daapd (22.0-2) unstable; urgency=medium + + * Fix compatibility with iTunes 12.1 (Closes: #778995) + * Fix two segfaults with upstream patches (Closes: #778996) + * Fix playing audio locally (Closes: #779011) + + -- Balint Reczey Mon, 23 Feb 2015 11:54:01 +0100 + forked-daapd (22.0-1) unstable; urgency=medium * Revert using pkg-config to determine FFmpeg linker flags diff -Nru forked-daapd-22.0/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch forked-daapd-22.0/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch --- forked-daapd-22.0/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch 1970-01-01 01:00:00.000000000 +0100 +++ forked-daapd-22.0/debian/patches/0001-Fix-bad-free-when-encountering-an-error-fetching-que.patch 2015-02-23 11:55:41.000000000 +0100 @@ -0,0 +1,39 @@ +From 4efca3660f7c944071c76cfeca91dc836bd9c8c2 Mon Sep 17 00:00:00 2001 +From: Justin Maggard +Date: Tue, 16 Dec 2014 15:32:21 -0800 +Subject: [PATCH 1/2] 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 b4261ca..42c37b5 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 -Nru forked-daapd-22.0/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch forked-daapd-22.0/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch --- forked-daapd-22.0/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch 1970-01-01 01:00:00.000000000 +0100 +++ forked-daapd-22.0/debian/patches/0002-Fix-invalid-read-on-empty-string-queries.patch 2015-02-23 11:55:41.000000000 +0100 @@ -0,0 +1,25 @@ +From cdb004808272cd331f09334fff618a8976e4fb25 Mon Sep 17 00:00:00 2001 +From: Justin Maggard +Date: Tue, 16 Dec 2014 15:30:45 -0800 +Subject: [PATCH 2/2] 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 -Nru forked-daapd-22.0/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch forked-daapd-22.0/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch --- forked-daapd-22.0/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch 1970-01-01 01:00:00.000000000 +0100 +++ forked-daapd-22.0/debian/patches/0003-Fix-problems-with-iTunes-12.1-see-issue-100.patch 2015-02-23 11:55:41.000000000 +0100 @@ -0,0 +1,120 @@ +From ebfff85afad856812d9857a5df0fab876ffbc41e Mon Sep 17 00:00:00 2001 +From: ejurgensen +Date: Fri, 6 Feb 2015 22:14:26 +0100 +Subject: [PATCH] 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 daf6320..0e6065a 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 -Nru forked-daapd-22.0/debian/patches/0004-Fix-laudio-buffer-underrun-issue-87.patch forked-daapd-22.0/debian/patches/0004-Fix-laudio-buffer-underrun-issue-87.patch --- forked-daapd-22.0/debian/patches/0004-Fix-laudio-buffer-underrun-issue-87.patch 1970-01-01 01:00:00.000000000 +0100 +++ forked-daapd-22.0/debian/patches/0004-Fix-laudio-buffer-underrun-issue-87.patch 2015-02-23 11:55:41.000000000 +0100 @@ -0,0 +1,28 @@ +From f1a59a3482b74d93436425bc788cf06a1ddd9121 Mon Sep 17 00:00:00 2001 +From: ejurgensen +Date: Sat, 17 Jan 2015 14:31:41 +0100 +Subject: [PATCH] Fix laudio buffer underrun (issue #87) + +--- + src/laudio_alsa.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/laudio_alsa.c b/src/laudio_alsa.c +index c56d7b2..6234805 100644 +--- a/src/laudio_alsa.c ++++ b/src/laudio_alsa.c +@@ -281,8 +281,9 @@ laudio_write(uint8_t *buf, uint64_t rtptime) + } + + /* Don't let ALSA fill up the buffer too much */ +- if (nsamp == AIRTUNES_V2_PACKET_SAMPLES) +- return; ++// Disabled - seems to cause buffer underruns ++// if (nsamp == AIRTUNES_V2_PACKET_SAMPLES) ++// return; + } + } + +-- +2.1.4 + diff -Nru forked-daapd-22.0/debian/patches/series forked-daapd-22.0/debian/patches/series --- forked-daapd-22.0/debian/patches/series 2014-10-18 00:40:23.000000000 +0200 +++ forked-daapd-22.0/debian/patches/series 2015-02-23 11:55:41.000000000 +0100 @@ -0,0 +1,4 @@ +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 +0004-Fix-laudio-buffer-underrun-issue-87.patch