--- mt-daapd-0.2.4+r1376.orig/config.guess
+++ mt-daapd-0.2.4+r1376/config.guess
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2005-12-13'
+timestamp='2006-07-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -106,7 +107,7 @@
 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
 : ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@@ -206,8 +207,11 @@
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
     macppc:MirBSD:*:*)
-	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
@@ -764,7 +768,14 @@
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -779,8 +790,11 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[345]*)
-	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+    x86:Interix*:[3456]*)
+	echo i586-pc-interix${UNAME_RELEASE}
+	exit ;;
+    EM64T:Interix*:[3456]*)
+	echo x86_64-unknown-interix${UNAME_RELEASE}
 	exit ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -817,6 +831,9 @@
     arm*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     cris:Linux:*:*)
 	echo cris-axis-linux-gnu
 	exit ;;
@@ -851,7 +868,11 @@
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     mips64:Linux:*:*)
@@ -870,7 +891,11 @@
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
@@ -967,7 +992,7 @@
 	LIBC=gnulibc1
 	# endif
 	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI)
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 	LIBC=gnu
 	#else
 	LIBC=gnuaout
@@ -977,7 +1002,11 @@
 	LIBC=dietlibc
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
 	test x"${LIBC}" != x && {
 		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
 		exit
--- mt-daapd-0.2.4+r1376.orig/config.sub
+++ mt-daapd-0.2.4+r1376/config.sub
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2005-12-11'
+timestamp='2006-07-02'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -240,7 +241,7 @@
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
@@ -248,7 +249,8 @@
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -268,16 +270,17 @@
 	| mn10200 | mn10300 \
 	| mt \
 	| msp430 \
+	| nios | nios2 \
 	| ns16k | ns32k \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b \
-	| strongarm \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
@@ -285,9 +288,6 @@
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
-	m32c)
-		basic_machine=$basic_machine-unknown
-		;;
 	m6811 | m68hc11 | m6812 | m68hc12)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
@@ -317,7 +317,7 @@
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* \
+	| avr-* | avr32-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -328,7 +328,7 @@
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
-	| m32r-* | m32rle-* \
+	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | maxq-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -350,17 +350,18 @@
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
+	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
@@ -371,8 +372,6 @@
 	| ymp-* \
 	| z8k-*)
 		;;
-	m32c-*)
-		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -818,6 +817,12 @@
 	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
@@ -1120,7 +1125,7 @@
 	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b)
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1193,7 +1198,8 @@
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
@@ -1208,7 +1214,7 @@
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos*)
+	      | -skyos* | -haiku* | -rdos* | -toppers*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1360,6 +1366,9 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        spu-*)
+		os=-elf
+		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1369,9 +1378,9 @@
 	arm*-semi)
 		os=-aout
 		;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
--- mt-daapd-0.2.4+r1376.orig/debian/rules
+++ mt-daapd-0.2.4+r1376/debian/rules
@@ -0,0 +1,82 @@
+#!/usr/bin/make -f
+
+include /usr/share/dpatch/dpatch.make
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+config.status: configure
+	dh_testdir
+	CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-sqlite3 --enable-howl --enable-oggvorbis --enable-flac --enable-musepack --enable-ffmpeg --with-ffmpeg-includes=/usr/include/ffmpeg --with-howl-includes=/usr/include/avahi-compat-howl
+
+build: patch build-stamp
+build-stamp: config.status
+	dh_testdir
+	$(MAKE)
+	touch $@
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp 
+
+	# god, automake sucks
+	rm -f contrib/init.d/mt-daapd-fedora contrib/init.d/mt-daapd-gentoo contrib/init.d/mtdaapd-bsd contrib/mt-daapd.conf
+	# Add here commands to clean up after the build process.
+	-$(MAKE) distclean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+	cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+	cp -f /usr/share/misc/config.guess config.guess
+endif
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/mt-daapd
+	install -m 600 -o 0 -g 0 contrib/mt-daapd.conf $(CURDIR)/debian/mt-daapd/etc/mt-daapd.conf
+	rm -f $(CURDIR)/debian/mt-daapd/usr/bin/wavstreamer $(CURDIR)/debian/mt-daapd/usr/bin/mt-daapd-ssc.sh
+	rm -f $(CURDIR)/debian/mt-daapd/usr/share/mt-daapd/admin-root/{gpl,aspl}-license.*
+
+binary-indep:
+# Ye olde no-op.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installinit
+	dh_installman
+	dh_compress
+	dh_link
+	dh_strip
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install 
--- mt-daapd-0.2.4+r1376.orig/debian/docs
+++ mt-daapd-0.2.4+r1376/debian/docs
@@ -0,0 +1,4 @@
+CREDITS
+NEWS
+README
+TODO
--- mt-daapd-0.2.4+r1376.orig/debian/changelog
+++ mt-daapd-0.2.4+r1376/debian/changelog
@@ -0,0 +1,23 @@
+mt-daapd (0.2.4+r1376-1.1+etch1) stable-security; urgency=high
+
+  * Non-maintainer upload by the security team
+  * Apply backport of upstream fixes for two related
+    vulnerabilities (Closes: #459961):
+    + CVE-2007-5824: Remote denial-of-service through a null pointer
+      dereference in src/webserver.c's authorization header handling
+    + CVE-2007-5825: Remote arbitrary code execution through a format
+      string vulnerability in authorization header of an /xml-rpc request
+  * Apply fix from Nico Golde <nion@debian.org> for CVE-2008-1771, an
+    integer overflow vulnerability also in src/webserver.c, potentilly
+    enabling execution of arbitrary code (Closes: #476241)
+
+ -- Devin Carraway <devin@debian.org>  Mon,  9 Jun 2008 06:36:18 +0000
+
+mt-daapd (0.2.4+r1376-1) unstable; urgency=low
+
+  * Initial release. (closes: #357244, #294922, #285789)
+  * Note that this release does not contain the source files that are under
+    APSL license. mt-daapd gets built using Avahi (howl compatibility layer.)
+
+ -- Joshua Kwan <joshk@triplehelix.org>  Tue,  5 Sep 2006 18:09:38 -0700
+
--- mt-daapd-0.2.4+r1376.orig/debian/compat
+++ mt-daapd-0.2.4+r1376/debian/compat
@@ -0,0 +1 @@
+5
--- mt-daapd-0.2.4+r1376.orig/debian/copyright
+++ mt-daapd-0.2.4+r1376/debian/copyright
@@ -0,0 +1,28 @@
+This package was initially Debianized by Aubin Paul <debian@outlyer.org>
+on Tue,  6 Jan 2004 08:16:53 -0500. The packaging was beaten into shape,
+and the source tarball cleaned by Joshua Kwan <joshk@triplehelix.org>
+on Tue, 05 Sep 2006 18:23:21 -0700, for Debian release.
+
+It was downloaded from: http://www.mt-daapd.org/
+
+Upstream Author: Ron Pedde <ron@pedde.com>
+
+(C) 2004-2006 Ron Pedde
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 dated June, 1991.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in `/usr/share/common-licenses/GPL'.
+
--- mt-daapd-0.2.4+r1376.orig/debian/dirs
+++ mt-daapd-0.2.4+r1376/debian/dirs
@@ -0,0 +1,4 @@
+usr/bin
+usr/sbin
+etc
+var/cache/mt-daapd
--- mt-daapd-0.2.4+r1376.orig/debian/postinst
+++ mt-daapd-0.2.4+r1376/debian/postinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+#DEBHELPER#
+
+if ! getent passwd mt-daapd >/dev/null; then
+	adduser --quiet --system --no-create-home --home /var/cache/mt-daapd --shell /bin/true mt-daapd
+	dpkg-statoverride --update --add mt-daapd root 0775 /var/cache/mt-daapd
+	dpkg-statoverride --update --add mt-daapd root 0664 /etc/mt-daapd.conf
+fi
--- mt-daapd-0.2.4+r1376.orig/debian/mt-daapd.init
+++ mt-daapd-0.2.4+r1376/debian/mt-daapd.init
@@ -0,0 +1,46 @@
+#! /bin/sh
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/mt-daapd
+NAME=mt-daapd
+DESC=mt-daapd
+
+test -x $DAEMON || exit 0
+
+# Include mt-daapd defaults if available
+if [ -f /etc/default/mt-daapd ] ; then
+	. /etc/default/mt-daapd
+fi
+
+set -e
+
+case "$1" in
+  start)
+	echo -n "Starting $DESC: "
+	start-stop-daemon --start --quiet -m --pidfile /var/run/$NAME.pid \
+		--exec $DAEMON -- $DAEMON_OPTS 2>/dev/null
+	echo "$NAME."
+	;;
+  stop)
+	echo -n "Stopping $DESC: "
+	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
+	    --signal 2 --exec $DAEMON --oknodo
+	echo "$NAME."
+	;;
+  restart|force-reload)
+	echo -n "Restarting $DESC: "
+	start-stop-daemon --stop --quiet --exec $DAEMON --pidfile \
+		/var/run/$NAME.pid --oknodo
+	sleep 1
+	start-stop-daemon --start --quiet --pidfile \
+		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+	echo "$NAME."
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0
--- mt-daapd-0.2.4+r1376.orig/debian/control
+++ mt-daapd-0.2.4+r1376/debian/control
@@ -0,0 +1,23 @@
+Source: mt-daapd
+Section: sound
+Priority: optional
+Maintainer: Joshua Kwan <joshk@triplehelix.org>
+Build-Depends: debhelper (>= 5), libid3tag0-dev, zlib1g-dev, libsqlite3-dev, libavahi-compat-howl-dev, libflac-dev, libvorbis-dev, libmpcdec-dev, libavcodec-dev, libavformat-dev, libtagc0-dev, dpatch
+Standards-Version: 3.7.2
+
+Package: mt-daapd
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, avahi-daemon, adduser
+Description: iTunes-compatible DAAP server
+ mt-daapd is a DAAP server that works with most POSIX compatible operating
+ systems. It allows you to share your music collection over the local network
+ using the same protocol iTunes uses, so real iTunes users may peruse your
+ music.
+ .
+ Moreover, if your music is in more esoteric formats like FLAC, Ogg Vorbis,
+ or Musepack, these can be converted on the fly to different formats (usually
+ WAV), so that your entire music collection can be listened to by normal iTunes 
+ clients.
+ .
+ It also features a web interface that can be used to control components of the
+ server, trigger database updates, and create playlists.
--- mt-daapd-0.2.4+r1376.orig/debian/patches/04_upstream_CVE-2007-5824_CVE-2007-5825.dpatch
+++ mt-daapd-0.2.4+r1376/debian/patches/04_upstream_CVE-2007-5824_CVE-2007-5825.dpatch
@@ -0,0 +1,84 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 04_upstream_CVE-2007-5824_CVE-2007-5825_CVE-2008-1771.dpatch by Devin Carraway <devin@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Upstream patch for CVE-2007-5824, CVE-2007-5825, CVE-2008-1771,
+## DP: backported to 0.2.4
+
+@DPATCH@
+diff -aruN mt-daapd-0.2.4+r1376.orig/src/webserver.c mt-daapd-0.2.4+r1376/src/webserver.c
+--- mt-daapd-0.2.4+r1376.orig/src/webserver.c	2006-05-27 23:16:25.000000000 -0700
++++ mt-daapd-0.2.4+r1376/src/webserver.c	2008-06-08 23:30:38.000000000 -0700
+@@ -670,7 +670,7 @@
+             last=first;
+             strsep(&last,":");
+ 
+-            if(last==first) {
++            if(!last) {
+                 DPRINTF(E_WARN,L_WS,"Thread %d: Invalid header: %s\n",
+                         pwsc->threadno,first);
+             } else {
+@@ -961,12 +961,11 @@
+             if((auth_handler) && (auth_handler(pwsc,NULL,NULL)==0)) {
+                 /* do the auth thing */
+                 auth=ws_getarg(&pwsc->request_headers,"Authorization");
+-                if(auth) {
+-                    ws_decodepassword(auth,&username,&password);
++                if((auth) && (ws_decodepassword(auth,&username, &password))) {
+                     if(auth_handler(pwsc,username,password))
+                         can_dispatch=1;
+-                    ws_addarg(&pwsc->request_vars,"HTTP_USER",username);
+-                    ws_addarg(&pwsc->request_vars,"HTTP_PASSWD",password);
++                    ws_addarg(&pwsc->request_vars,"HTTP_USER","%s",username);
++                    ws_addarg(&pwsc->request_vars,"HTTP_PASSWD","%s",password);
+                     free(username); /* this frees password too */
+                 } 
+ 
+@@ -1433,6 +1432,7 @@
+     int pads=0;
+     unsigned char *decodebuffer;
+     unsigned char *pin, *pout;
++    char *type,*base64;
+     int lookup;
+ 
+     *username=NULL;
+@@ -1461,21 +1461,33 @@
+         return -1;
+ 
+     /* xlat table is initialized */
+-    while(*header != ' ')
++
++    // Trim leading spaces
++    while((*header) && *header != ' ')
+         header++;
+ 
+-    header++;
++     // Should be in the form "Basic <base-64 enc username/pw>"
++    type=header;
++    base64 = strchr(header,' ');
++    if(!base64) {
++        // invalid auth header
++        DPRINTF(E_DBG,L_WS,"Bad authentication header: %s\n",header);
++        return -1;
++    }
++
++    *base64 = '\0';
++    base64++;
+ 
+-    decodebuffer=(unsigned char *)malloc(strlen(header));
++    decodebuffer=(unsigned char *)malloc(strlen(base64));
+     if(!decodebuffer)
+         return -1;
+ 
+-    DPRINTF(E_DBG,L_WS,"Preparing to decode %s\n",header);
++    DPRINTF(E_DBG,L_WS,"Preparing to decode %s\n",base64);
+ 
+-    memset(decodebuffer,0,strlen(header));
++    memset(decodebuffer,0,strlen(base64));
+     len=0;
+     pout=decodebuffer;
+-    pin=(unsigned char *)header;
++    pin=base64;
+ 
+     /* this is more than a little sloppy */
+     while(pin[rack]) {
--- mt-daapd-0.2.4+r1376.orig/debian/patches/03_plugins_in_libdir.dpatch
+++ mt-daapd-0.2.4+r1376/debian/patches/03_plugins_in_libdir.dpatch
@@ -0,0 +1,38 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_plugins_in_libdir.dpatch by Joshua Kwan <joshk@triplehelix.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -ur orig/mt-daapd-0.2.4+r1376/src/plugins/Makefile.am mt-daapd-0.2.4+r1376/src/plugins/Makefile.am
+--- orig/mt-daapd-0.2.4+r1376/src/plugins/Makefile.am	2006-05-29 04:57:32.000000000 -0700
++++ mt-daapd-0.2.4+r1376/src/plugins/Makefile.am	2006-09-29 16:18:23.000000000 -0700
+@@ -1,8 +1,8 @@
+ # $Id: $
+ #
+-rspdir = ${pkgdatadir}/plugins
+-ssc_ffmpegdir = ${pkgdatadir}/plugins
+-ssc_scriptdir = ${pkgdatadir}/plugins
++rspdir = ${libdir}/mt-daapd/plugins
++ssc_ffmpegdir = ${libdir}/mt-daapd/plugins
++ssc_scriptdir = ${libdir}/mt-daapd/plugins
+ 
+ rsp_LTLIBRARIES=rsp.la
+ rsp_la_LDFLAGS=-module -avoid-version
+diff -ur orig/mt-daapd-0.2.4+r1376/src/plugins/Makefile.in mt-daapd-0.2.4+r1376/src/plugins/Makefile.in
+--- orig/mt-daapd-0.2.4+r1376/src/plugins/Makefile.in	2006-09-04 12:19:17.000000000 -0700
++++ mt-daapd-0.2.4+r1376/src/plugins/Makefile.in	2006-09-29 16:18:28.000000000 -0700
+@@ -160,9 +160,9 @@
+ 
+ # $Id: $
+ #
+-rspdir = ${pkgdatadir}/plugins
+-ssc_ffmpegdir = ${pkgdatadir}/plugins
+-ssc_scriptdir = ${pkgdatadir}/plugins
++rspdir = ${libdir}/mt-daapd/plugins
++ssc_ffmpegdir = ${libdir}/mt-daapd/plugins
++ssc_scriptdir = ${libdir}/mt-daapd/plugins
+ 
+ rsp_LTLIBRARIES = rsp.la
+ rsp_la_LDFLAGS = -module -avoid-version
--- mt-daapd-0.2.4+r1376.orig/debian/patches/05_debian_CVE-2008-1771.dpatch
+++ mt-daapd-0.2.4+r1376/debian/patches/05_debian_CVE-2008-1771.dpatch
@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_CVE-2008-1771.dpatch by Nico Golde <nion@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -aruN mt-daapd-0.2.4+r1376/src/webserver.c mt-daapd-0.2.4+r1376.bug476241/src/webserver.c
+--- mt-daapd-0.2.4+r1376/src/webserver.c	2008-06-08 23:30:38.000000000 -0700
++++ mt-daapd-0.2.4+r1376.bug476241/src/webserver.c	2008-06-09 00:13:59.000000000 -0700
+@@ -597,7 +597,12 @@
+         return -1;
+     }
+ 
+-    length=atoi(content_length);
++    length=strtol(content_length, NULL, 10);
++    if(EINVAL == errno || UINT_MAX - 1 <= length){
++        DPRINTF(E_INF,L_WS, "Thread %d: Suspicious Content-Length value, ignoring request\n", pwsc->threadno);
++	return FALSE;
++    }
++
+     DPRINTF(E_DBG,L_WS,"Thread %d: Post var length: %d\n",
+             pwsc->threadno,length);
+ 
--- mt-daapd-0.2.4+r1376.orig/debian/patches/01_configuration.dpatch
+++ mt-daapd-0.2.4+r1376/debian/patches/01_configuration.dpatch
@@ -0,0 +1,80 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_configuration.dpatch by Joshua Kwan <joshk@triplehelix.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: update configuration template for mt-daapd.conf
+
+--- mt-daapd-0.2.4+r1376.orig/contrib/mt-daapd.conf.templ
++++ mt-daapd-0.2.4+r1376/contrib/mt-daapd.conf.templ
+@@ -51,7 +51,7 @@
+ # info in.  Valid choices are "sqlite" and "sqlite3".
+ #
+ 
+-db_type = sqlite
++db_type = sqlite3
+ 
+ #
+ # db_parms
+@@ -75,7 +75,7 @@
+ # in the same physical filesystem.
+ #
+ 
+-mp3_dir = /mnt/mp3
++mp3_dir = /home/media/music
+ 
+ #
+ # servername (required)
+@@ -99,7 +99,7 @@
+ # This is also ignored on Windows.
+ #
+ 
+-runas = nobody
++runas = mt-daapd
+ 
+ #
+ # playlist (optional)
+@@ -114,7 +114,7 @@
+ # below.
+ #
+ 
+-playlist = @prefix@/etc/mt-daapd.playlist
++# playlist = /etc/mt-daapd.playlist
+ 
+ #
+ # password (optional)
+@@ -145,7 +145,7 @@
+ # --enable-musepack.
+ #
+ 
+-extensions = .mp3,.m4a,.m4p
++extensions = .mp3,.m4a,.m4p,.ogg,.flac,.mpc
+ 
+ #
+ # ssc_codectypes (optional)
+@@ -169,7 +169,8 @@
+ # alac for alac (.m4a)
+ #
+ 
+-ssc_codectypes = ogg,flac,alac
++# Not needed because ffmpeg is enabled. -joshk
++# ssc_codectypes = ogg,flac,alac
+ 
+ #
+ # ssc_prog (optional)
+@@ -189,7 +190,7 @@
+ # handling different formats.
+ #
+ 
+-ssc_prog = @prefix@/bin/mt-daapd-ssc.sh
++# ssc_prog = @prefix@/bin/mt-daapd-ssc.sh
+ 
+ #
+ # logfile (optional)
+@@ -311,5 +312,5 @@
+ 
+ [plugins]
+-plugin_dir = @prefix@/share/mt-daapd/plugins
++plugin_dir = @prefix@/lib/mt-daapd/plugins
+-plugins = rsp.so,ssc-script.so
++plugins = rsp.so,ssc-ffmpeg.so
+ 
--- mt-daapd-0.2.4+r1376.orig/debian/patches/02_no_extra_licenses.dpatch
+++ mt-daapd-0.2.4+r1376/debian/patches/02_no_extra_licenses.dpatch
@@ -0,0 +1,23 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_no_extra_licenses.dpatch by Joshua Kwan <joshk@triplehelix.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+diff -u mt-daapd-0.2.4+r1376/admin-root.orig/hdr.html mt-daapd-0.2.4+r1376/admin-root/hdr.html
+--- mt-daapd-0.2.4+r1376/admin-root.orig/hdr.html	2006-07-05 21:42:30.000000000 -0700
++++ mt-daapd-0.2.4+r1376/admin-root/hdr.html	2006-09-12 14:59:23.000000000 -0700
+@@ -52,10 +52,10 @@
+  <li></li>
+ </ul>
+ 
+-<div class="links">
++<!-- <div class="links">
+ <a class="@ispage gpl-license.html:naviselected:navi@" href="gpl-license.html">GPL license</a><br />
+ <a class="@ispage aspl-license.html:naviselected:navi@" href="aspl-license.html">ASPL license</a><br />
+-</div>
++</div> -->
+ 
+ <div class="links">
+ <b>Links</b><br />
+Common subdirectories: mt-daapd-0.2.4+r1376/admin-root.orig/lib-js and mt-daapd-0.2.4+r1376/admin-root/lib-js
--- mt-daapd-0.2.4+r1376.orig/debian/patches/00list
+++ mt-daapd-0.2.4+r1376/debian/patches/00list
@@ -0,0 +1,5 @@
+01_configuration
+02_no_extra_licenses
+03_plugins_in_libdir
+04_upstream_CVE-2007-5824_CVE-2007-5825
+05_debian_CVE-2008-1771
--- mt-daapd-0.2.4+r1376.orig/debian/postrm
+++ mt-daapd-0.2.4+r1376/debian/postrm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+#DEBHELPER#
+
+if [ "$1" = purge ]; then
+	dpkg-statoverride --remove /var/cache/mt-daapd
+	dpkg-statoverride --remove /etc/mt-daapd.conf
+	deluser --quiet mt-daapd > /dev/null || true
+fi
