--- peercast-0.1218+svn20080104.orig/debian/control
+++ peercast-0.1218+svn20080104/debian/control
@@ -0,0 +1,38 @@
+Source: peercast
+Section: sound
+Priority: optional
+Maintainer: Romain Beauxis <toots@rastageeks.org>
+Build-Depends: debhelper (>= 4.2.0), quilt, patchutils (>= 0.2.25), cdbs (>= 0.4.27), gconf2
+Standards-Version: 3.7.3
+
+Package: peercast-servent
+Architecture: all
+Depends: peercast (>= 0.1217.toots.20060314-6)
+Description: P2P audio and video streaming servent (dummy package)
+ PeerCast is a P2P streaming server. It can stream music
+ and video from a broad variety of formats.
+ .
+ This package is a dummy transitional package, you can remove
+ it safetly
+
+Package: peercast
+Architecture: any
+Depends: ${shlibs:Depends}, logrotate, adduser
+Recommends: peercast-handlers
+Conflicts: gnome-peercast, peercast-servent (<< 0.1217.toots.20060314-5)
+Replaces: peercast-servent
+Description: P2P audio and video streaming servent
+ PeerCast is a P2P streaming server. It can stream music
+ and video from a broad variety of formats.
+
+Package: peercast-handlers
+Architecture: all
+Depends: ${misc:Depends}, xdialog | zenity | kdebase-bin, dialog
+Suggests: konqueror, epiphany-browser, iceweasel, audacious, xmms, vlc, totem
+Description: P2P audio and video streaming handlers
+ PeerCast is a P2P streaming server. It can stream music
+ and video from a broad variety of formats.
+ .
+ This package installs handlers for common browsers like
+ Firefox, Konqueror, Epiphany.
+ 
--- peercast-0.1218+svn20080104.orig/debian/peercast.debhelper.log
+++ peercast-0.1218+svn20080104/debian/peercast.debhelper.log
@@ -0,0 +1 @@
+dh_listpackages
--- peercast-0.1218+svn20080104.orig/debian/peercast.install
+++ peercast-0.1218+svn20080104/debian/peercast.install
@@ -0,0 +1,4 @@
+ui/linux/peercast usr/sbin
+debian/config/* usr/share/peercast
+ui/html usr/share/peercast
+debian/custom/peercast.8 usr/share/man/man8
--- peercast-0.1218+svn20080104.orig/debian/peercast-handlers.links
+++ peercast-0.1218+svn20080104/debian/peercast-handlers.links
@@ -0,0 +1,6 @@
+etc/peercast/firefox-handler.js etc/mozilla-firefox/pref/peercast.js
+etc/peercast/firefox-handler.js usr/lib/mozilla/defaults/pref/peercast.js
+usr/share/man/man8/peercast-handlers.8.gz usr/share/man/man8/peercast_handler.sh.8.gz
+usr/share/man/man8/peercast-handlers.8.gz usr/share/man/man8/peercast-parser.pl.8.gz
+usr/share/peercast/scripts/peercast-parser.pl usr/bin/peercast-parser.pl
+usr/share/peercast/scripts/peercast_handler.sh usr/bin/peercast_handler.sh
--- peercast-0.1218+svn20080104.orig/debian/rules
+++ peercast-0.1218+svn20080104/debian/rules
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/makefile.mk
+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+
+# In order to regenerate 'debian/control' :
+#    DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean
+# Then check manually if everything's ok
+
+
+DEB_BUILDDIR := ui/linux
+CPPFLAGS = -DENABLE_BINRELOC -pthread  -D__cplusplus -D_UNIX -D_REENTRANT -g -Wall -O2
+LDFLAGS = -pthread
+
+binary-install/peercast-handlers::
+	dh_gconf -ppeercast-handlers
+	chmod +x $(CURDIR)/debian/peercast-handlers/usr/share/peercast/scripts/peercast-parser.pl
+	chmod +x $(CURDIR)/debian/peercast-handlers/usr/share/peercast/scripts/peercast_handler.sh
+	
+
--- peercast-0.1218+svn20080104.orig/debian/peercast.links
+++ peercast-0.1218+svn20080104/debian/peercast.links
@@ -0,0 +1 @@
+usr/share/peercast/peercast.ini.defaults etc/peercast/peercast.ini.default
--- peercast-0.1218+svn20080104.orig/debian/changelog
+++ peercast-0.1218+svn20080104/debian/changelog
@@ -0,0 +1,169 @@
+peercast (0.1218+svn20080104-1.1~bpo40+1) etch-backports; urgency=low
+
+  * Rebuild for etch-backports.
+
+ -- Romain Beauxis <toots@rastageeks.org>  Wed, 14 May 2008 02:12:28 +0200
+
+peercast (0.1218+svn20080104-1.1) unstable; urgency=high
+
+  * Non-maintainer upload by the Security Team.
+  * This update addresses the following security issue:
+    - CVE-2008-2040: stack-based buffer overfow in the
+      HTTP::getAuthUserPass function leading to remote DoS
+      or arbitrary code execution if peercast is configured
+      to use http-basic authentication (Closes: #478573).
+
+ -- Nico Golde <nion@debian.org>  Fri, 02 May 2008 12:44:34 +0200
+
+peercast (0.1218+svn20080104-1) unstable; urgency=low
+
+  * New upstream release
+  * Removed custom configure support, switched back to upstream
+    build system
+  * Removed XMMS from the list of proposed audio players, added audacious
+    instead.
+  Closes: #468402
+  * Fixed zenity call
+  Closes: #471306
+  * Fixed Xdialog call
+  Closes: #473757
+  * Added --oknodo to stop target in init script
+  Closes: #456734, #461596
+
+ -- Romain Beauxis <toots@rastageeks.org>  Tue, 01 Apr 2008 12:42:09 +0100
+
+peercast (0.1218+svn20071220+2-1) unstable; urgency=low
+
+  * Regenerated tarball, previous one was broken.. 
+
+ -- Romain Beauxis <toots@rastageeks.org>  Thu, 20 Dec 2007 17:17:49 +0100
+
+peercast (0.1218+svn20071220-1) unstable; urgency=low
+
+  * New upstream release.
+  * Backported custom autoconf support, 
+    added README.Debian-source, as well as 
+    corresponding patch
+
+ -- Romain Beauxis <toots@rastageeks.org>  Thu, 20 Dec 2007 15:50:12 +0100
+
+peercast (0.1217.toots.20060314-8) unstable; urgency=low
+
+  * Really add back kdelibs as build-dep.. 
+
+ -- Romain Beauxis <toots@rastageeks.org>  Thu, 20 Dec 2007 15:01:04 +0100
+
+peercast (0.1217.toots.20060314-7) unstable; urgency=low
+
+  * Added back build-dep on kdelibs. 
+
+ -- Romain Beauxis <toots@rastageeks.org>  Thu, 20 Dec 2007 14:27:52 +0100
+
+peercast (0.1217.toots.20060314-6) unstable; urgency=low
+
+  * Changed package names, and updated dependencies.
+    Now main package is peercast, recommending peercast-handlers
+    (Closes: #456964)
+  * Moved patch handling to quilt
+  * Fixed man pages typos
+
+ -- Romain Beauxis <toots@rastageeks.org>  Thu, 20 Dec 2007 03:00:52 +0100
+
+peercast (0.1217.toots.20060314-5) unstable; urgency=low
+
+  * added postrm script to purge remaining configuration files
+    for peercast-servent (Closes: #455118)
+  * Updated standards to 3.7.3 (no changes)
+  * Removed library, was meant for gnome-peercast, 
+    seems like they will never link to it, and leads to dangerous undefined
+    symbols...
+
+ -- Romain Beauxis <toots@rastageeks.org>  Sun, 16 Dec 2007 03:44:32 +0100
+
+peercast (0.1217.toots.20060314-4) unstable; urgency=low
+
+  * Updated build-dep (Closes: #438403)
+
+ -- Romain Beauxis <toots@rastageeks.org>  Fri, 17 Aug 2007 15:50:27 +0200
+
+peercast (0.1217.toots.20060314-3) unstable; urgency=low
+
+  * Corrected ${Source-Version}
+  * Corrected description.
+
+ -- Romain Beauxis <toots@rastageeks.org>  Sat, 28 Jul 2007 22:43:18 +0200
+
+peercast (0.1217.toots.20060314-2) unstable; urgency=low
+
+  * Fixed init script: needed lsb headers
+  * Fixed maintainer scripts: needed to fail when init failed.
+  * Updated standards version
+
+ -- Romain Beauxis <toots@rastageeks.org>  Mon, 23 Apr 2007 13:53:30 +0200
+
+peercast (0.1217.toots.20060314-1) unstable; urgency=high
+
+  * New upstream release
+  * Last upstream was not up to date, this one
+  really fixes the security issue.
+
+ -- Romain Beauxis <toots@rastageeks.org>  Tue, 14 Mar 2006 02:55:08 +0200
+
+peercast (0.1217-1) unstable; urgency=high
+
+  * New upstream release, fixes security issue
+  * Corrected gconf schemas installation
+  * Improved handlers package
+
+ -- Romain Beauxis <toots@rastageeks.org>  Sat, 11 Mar 2006 18:59:18 +0200
+
+peercast (0.1216-1) unstable; urgency=high
+
+  * New upstream Release, fixes a security issue
+  * Added handler for the new gnome interface: geekast
+  * Changed schemas and schemas install
+  * Backported patch from BTS (Closes: #345203)
+
+ -- Romain Beauxis <toots@rastageeks.org>  Sat,  4 Mar 2006 13:57:48 +0200
+
+peercast (0.1214.toots.svn20051112-1) unstable; urgency=low
+
+  * New upstream release
+  * Handler improved
+  * Dependencies improved for peercast-handlers
+
+ -- Romain Beauxis <toots@rastageeks.org>  Thu, 17 Nov 2005 04:19:08 +0200
+
+peercast (0.1214.toots.svn20051028-1) unstable; urgency=low
+
+  * New upstream release
+  * Better handling scripts and dependencies
+  * Added conflicts with gnome-peercast - see bug #335960
+
+ -- Romain Beauxis <toots@rastageeks.org>  Fri, 28 Oct 2005 19:36:35 +0200
+
+peercast (0.1214-4) unstable; urgency=low
+
+  * Fix FTBFS for x86_64 
+  * First upload to sid (Closes: #295728)
+
+ -- Romain Beauxis <toots@rastageeks.org>  Tue, 27 Sep 2005 22:11:32 +0200
+
+peercast (0.1214-3) unstable; urgency=low
+
+  * Splited peercast binary package in servent and handlers 
+
+ -- Romain Beauxis <toots@rastageeks.org>  Tue, 27 Sep 2005 12:49:48 +0200
+
+peercast (0.1214-2) unstable; urgency=low
+
+  * Added gnome and firefox support for peercast:// links 
+
+ -- Romain Beauxis <toots@rastageeks.org>  Sat, 24 Sep 2005 16:43:42 +0200
+
+peercast (0.1214-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Romain Beauxis <toots@rastageeks.org>  Mon, 20 Jun 2005 12:14:02 +0200
+
--- peercast-0.1218+svn20080104.orig/debian/peercast-handlers.install
+++ peercast-0.1218+svn20080104/debian/peercast-handlers.install
@@ -0,0 +1,5 @@
+debian/custom/firefox/firefox-handler.js etc/peercast
+debian/custom/gnome/peercast.schemas usr/share/gconf/schemas
+debian/custom/kde/peercast.protocol usr/share/services
+debian/custom/scripts/peercast-parser.pl debian/custom/scripts/peercast_handler.sh usr/share/peercast/scripts
+debian/custom/scripts/peercast-handlers.8 usr/share/man/man8
--- peercast-0.1218+svn20080104.orig/debian/peercast.postinst
+++ peercast-0.1218+svn20080104/debian/peercast.postinst
@@ -0,0 +1,73 @@
+#!/bin/sh -e
+
+if ! ([ "$1" = "configure" ] || [ "$1" = "reconfigure" ]); then
+  exit 0
+fi
+
+
+# set some useful variables
+PEERCAST="peercast"
+CHOWN="/bin/chown"
+ADDUSER="/usr/sbin/adduser"
+USERDEL="/usr/sbin/userdel"
+USERADD="/usr/sbin/useradd"
+GROUPDEL="/usr/sbin/groupdel"
+GROUPMOD="/usr/sbin/groupmod"
+ID="/usr/bin/id"
+
+
+###
+# 1. get current peercast uid and gid if user exists.
+set -e
+if $ID $PEERCAST > /dev/null 2>&1; then
+   IUID=`$ID --user $PEERCAST`
+   IGID=`$ID --group $PEERCAST`
+else
+   IUID="NONE"
+   IGID="NONE"
+fi
+
+
+###
+# 2. Ensure that no standard account or group will remain before adding the
+#    new user
+if [ "$IUID" = "NONE" ] || [ $IUID -ge 1000 ]; then # we must do sth :)
+  if ! [ "$IUID" = "NONE" ] && [ $IUID -ge 1000 ]; then
+      # peercast user exists but isn't a system user... delete it.
+      $USERDEL $PEERCAST
+      $GROUPDEL $PEERCAST
+  fi
+
+###
+# 3. Add the system account.
+#    Issue a debconf warning if it fails. 
+  if $GROUPMOD $PEERCAST > /dev/null 2>&1; then 
+    # peercast group already exists, use --ingroup
+    if ! $ADDUSER --system --disabled-password --disabled-login --home /usr/share/peercast --no-create-home --ingroup $PEERCAST $PEERCAST; then
+      echo "The adduser command failed."
+    fi
+  else
+    if ! $ADDUSER --system --disabled-password --disabled-login --home /usr/share/peercast --no-create-home --group $PEERCAST; then
+      echo "The adduser command failed."
+    fi
+  fi
+fi
+set +e
+
+###
+# 4. Add default config file if not any:
+if ! [ -f /etc/peercast/peercast.ini ]; then
+	cp /usr/share/peercast/peercast.ini.default /etc/peercast/peercast.ini
+fi
+
+###
+# 5. change ownership of directory
+$CHOWN -R $PEERCAST:$PEERCAST /usr/share/peercast/
+$CHOWN -R $PEERCAST:$PEERCAST /var/log/peercast/
+$CHOWN -R $PEERCAST:$PEERCAST /etc/peercast/
+$CHOWN -R $PEERCAST:$PEERCAST /var/run/peercast/
+
+
+
+
+#DEBHELPER#
--- peercast-0.1218+svn20080104.orig/debian/peercast-handlers.debhelper.log
+++ peercast-0.1218+svn20080104/debian/peercast-handlers.debhelper.log
@@ -0,0 +1 @@
+dh_listpackages
--- peercast-0.1218+svn20080104.orig/debian/compat
+++ peercast-0.1218+svn20080104/debian/compat
@@ -0,0 +1 @@
+4
--- peercast-0.1218+svn20080104.orig/debian/config/peercast.ini.default
+++ peercast-0.1218+svn20080104/debian/config/peercast.ini.default
@@ -0,0 +1,81 @@
+
+[Server]
+serverPort = 7144
+autoServe = Yes
+forceIP = 
+isRoot = No
+maxBitrateOut = 0
+maxRelays = 1
+maxDirect = 0
+maxRelaysPerChannel = 0
+firewallTimeout = 30
+forceNormal = No
+rootMsg = 
+authType = cookie
+cookiesExpire = session
+htmlPath = html/en
+minPGNUIncoming = 10
+maxPGNUIncoming = 20
+maxServIn = 50
+chanLog = 
+networkID = 00000000000000000000000000000000
+
+[Broadcast]
+broadcastMsgInterval = 10
+broadcastMsg = 
+icyMetaInterval = 8192
+broadcastID = 898145B5C0427118B595AF7D9E110000
+hostUpdateInterval = 180
+maxControlConnections = 3
+rootHost = yp.peercast.org
+
+[Client]
+refreshHTML = 5
+relayBroadcast = 30
+minBroadcastTTL = 1
+maxBroadcastTTL = 7
+pushTries = 5
+pushTimeout = 60
+maxPushHops = 8
+autoQuery = 0
+queryTTL = 7
+
+[Privacy]
+password = 
+maxUptime = 0
+
+[Filter]
+ip = 255.255.255.255
+private = No
+ban = No
+network = Yes
+direct = Yes
+[End]
+
+[Notify]
+PeerCast = Yes
+Broadcasters = Yes
+TrackInfo = Yes
+[End]
+
+[Server1]
+allowHTML = Yes
+allowBroadcast = Yes
+allowNetwork = Yes
+allowDirect = Yes
+[End]
+
+[Server2]
+allowHTML = No
+allowBroadcast = Yes
+allowNetwork = No
+allowDirect = No
+[End]
+
+[Debug]
+logDebug = No
+logErrors = No
+logNetwork = No
+logChannel = No
+pauseLog = No
+idleSleepTime = 10
--- peercast-0.1218+svn20080104.orig/debian/custom/kde/peercast.protocol
+++ peercast-0.1218+svn20080104/debian/custom/kde/peercast.protocol
@@ -0,0 +1,11 @@
+[Protocol]
+exec=peercast_handler.sh "%u"
+protocol=peercast
+input=none
+output=none
+helper=true
+listing=false
+reading=false
+writing=false
+makedir=false
+deleting=false
--- peercast-0.1218+svn20080104.orig/debian/custom/gnome/peercast.schemas
+++ peercast-0.1218+svn20080104/debian/custom/gnome/peercast.schemas
@@ -0,0 +1,40 @@
+<gconfschemafile>
+ <schemalist>
+	<schema>
+	<key>/schemas/desktop/gnome/url-handlers/peercast/needs_terminal</key>
+	<applyto>/desktop/gnome/url-handlers/peercast/needs_terminal</applyto>
+	<owner>gnome</owner>
+	<type>bool</type>
+	<default>false</default>
+        <locale name="C">
+		 <short>Run the command in a terminal</short>
+                <long>True if the command used to handle this type of URL should be run in a terminal.</long>
+	</locale>
+        </schema>
+
+	<schema>
+	<key>/schemas/desktop/gnome/url-handlers/peercast/command</key>
+	<applyto>/desktop/gnome/url-handlers/peercast/command</applyto>
+	<owner>gnome</owner>
+	<type>string</type>
+	<default>peercast_handler.sh %s</default>
+        <locale name="C">
+		 <short>The handler for &quot;peercast&quot; URLs</short>
+                <long>The command used to handle &quot;peercast&quot; URLs, if enabled.</long>
+	</locale>
+        </schema>
+
+	<schema>
+	<key>/schemas/desktop/gnome/url-handlers/peercast/enabled</key>
+	<applyto>/desktop/gnome/url-handlers/peercast/enabled</applyto>
+	<owner>gnome</owner>
+	<type>bool</type>
+	<default>true</default>
+        <locale name="C">
+		 <short>Whether the specified command should handle &quot;peercast&quot; URLs</short>
+                <long>True if the command specified in the &quot;command&quot; key should handle &quot;peercast&quot; URLs.</long>
+	</locale>
+        </schema>
+
+</schemalist>
+</gconfschemafile>
--- peercast-0.1218+svn20080104.orig/debian/custom/scripts/peercast-parser.pl
+++ peercast-0.1218+svn20080104/debian/custom/scripts/peercast-parser.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -s
+
+# Peercact URL handler for xmms.
+# By Romain Beauxis <toots@rastageeks.org>
+
+# Usage: peercast-enqueue-in-xmms.pl -h=<server.address:port> -b=<binary commad> <peercast://foo>
+# This script search for a string in the following mask: peercast://pls/HASHNUMBER
+# And then call the required binary to enqueue the URL: http://127.0.0.1:7144/stream/HASHNUMBER
+# WARNING: this does not handle any parameter like ?foo after the HASH, 
+# But xmms seems to accept it.
+
+my $link = shift;
+my $host = $h;
+my $binary = $b;
+
+if (!$host) { $host = "127.0.0.1:7144"; }
+ 
+$link =~ /peercast:\/\/pls\/(\w*)/;
+my $regex = $1;
+$binary =~ s/\%u/http:\/\/$host\/stream\/$regex/;
+
+exec("$binary")
+
--- peercast-0.1218+svn20080104.orig/debian/custom/scripts/peercast-handlers.8
+++ peercast-0.1218+svn20080104/debian/custom/scripts/peercast-handlers.8
@@ -0,0 +1,47 @@
+.\"  -*- nroff -*-
+.\"
+.\" Author: Romain Beauxis <toots@rastageeks.org>
+.TH PEERCAST-HANDLERS 8 "February 16, 2005" "" ""
+.ad
+.fi
+.SH NAME
+\fBpeercast_handler.sh\fP \- Handler for peercast:// URIs
+
+\fBpeercast-parser.pl\fP \- Translate and play a peercast link with the given command
+
+.SH SYNOPSIS
+.na
+.nf
+.fi
+.B peercast_handler 
+[\fIpeercast://foo\fR]
+
+.B peercast-parser.pl 
+\-h=[\fIhost:port\fR] \-b="[\fImy_command \-\-play %u\fR]" [\fIpeercast://...\fR]
+
+.SH DESCRIPTION
+.ad
+.fi
+\fBpeercast\fP is a free server for P2P streaming of audio and video.
+Those commands are used to handle and parse peercast:// links.
+
+.SH OPTIONS
+A summary of options for \fBpeercast-parser.pl\fP is included below.
+
+.TP
+Options:
+.TP
+.B   \-h
+Specify server host
+.TP
+.B \-b
+Specify command line, %u for the translated url
+.TP
+
+.SH AUTHORS
+.ad
+.fi
+Peercast was originally written by PeerCast.org <code@peercast.org>.
+
+This manual page was written by Romain Beauxis <toots@rastageeks.org>
+for the Debian GNU/Linux system, and may be used freely by other. 
--- peercast-0.1218+svn20080104.orig/debian/custom/scripts/peercast_handler.sh
+++ peercast-0.1218+svn20080104/debian/custom/scripts/peercast_handler.sh
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+# Peercast kmenu for peercast:// links
+# By Romain Beauxis <toots@rastageeks.org>
+
+# You can add your own services.
+# Just have a look to those for xmms, you'll see how it works.
+# Then add yours to the same directory, and add it to the list below.
+
+SERVICES="Geekast Audacious-Enqueue Audacious-Play Totem VLC Other"
+MENU_SERVICES="Geekast Open-with-Geekast Audacious-Enqueue Enqueue-in-audacious Audacious-Play Play-in-audacious Totem Play-with-Totem VLC Play-with-VLC Other Use-your-own-command"
+
+# Set default options:
+host="127.0.0.1:7144"
+
+# Check for pref file:
+if ! [ -f ~/.peercast_handlerrc ]; then
+	echo "host=\"$host\"" >| ~/.peercast_handlerrc;
+fi;
+
+# Then source it
+. ~/.peercast_handlerrc
+
+#
+# support different types of dialog
+#
+
+# Determine which dialog to use in which situation:
+if [ "$DISPLAY" != "" ] ; then
+	if [ -x "`which kdialog`" ] ; then
+		binary=$(kdialog --title "Peercast Handler" --menu Service $MENU_SERVICES 2> /dev/null)
+		if [ "$binary" = "" ]; then
+			exit 1;
+		elif [ "$binary" = "Other" ]; then
+			binary=$(kdialog --title "Custom command" --inputbox "Enter your command, %u for url:" "my_command --play %u" 2> /dev/null)
+			if [ "$binary" = "" ]; then
+			exit 1;
+			fi;
+		fi;
+		if [ "$binary" != "Geekast" ]; then
+			host=$(kdialog --title "PeerCast server" --inputbox "What is the adress of you server?" "$host" 2> /dev/null)
+			if [ "$host" = "" ]; then
+			exit 1;
+			fi;
+		fi;
+	elif [ -x "`which zenity`" ] ; then
+		binary=$(zenity --list --title="Peercast Handler" --text=Service --column="Multimedia player" $SERVICES 2> /dev/null)
+		if [ "$binary" = "" ]; then
+		exit 1;
+		elif [ "$binary" = "Other" ]; then
+			binary=$(zenity --entry --title="Custom command" --text="Enter your command, %u for url:" --entry-text="my_command --play %u" 2> /dev/null)
+			if [ "$binary" = "" ]; then
+			exit 1;
+			fi;
+		fi;
+		if [ "$binary" != "Geekast" ]; then
+			host=$(zenity --entry --title="PeerCast server" --text="What is the adress of you server?" --entry-text="$host" 2> /dev/null)
+			if [ "$host" = "" ]; then
+			exit 1;
+			fi;
+		fi;
+	elif [ -x "`which Xdialog`" ] ; then
+		binary=$(Xdialog --stdout --menubox "Peercast Handler" 13 40 5 $MENU_SERVICES 2> /dev/null)
+		if [ "$binary" = "" ]; then
+		exit 1;
+		elif [ "$binary" = "Other" ]; then
+			binary=$(Xdialog --stdout --title "Custom command" --inputbox "Enter your command, %u for url:" 8 30 "my_command --play %u" 2> /dev/null)
+			if [ "$binary" = "" ]; then
+			exit 1;
+			fi;
+		fi;
+		if [ "$binary" != "Geekast" ]; then
+			host=$(Xdialog --stdout --title "PeerCast server" --inputbox "What is the adress of you server?" 8 30 "$host" 2> /dev/null)
+			if [ "$host" = "" ]; then
+			exit 1;
+			fi;
+		fi;
+	fi;
+elif [ -x "`which dialog`" ] && [ -e $(tty) ] ; then 
+	# This intented for an execution within a concole.. Dunno if this will ever occur except for dbaelde ;) .. !
+	binary=$(dialog --stdout --menu "Peercast Handler" 13 40 5 $MENU_SERVICES 2> /dev/null)
+	if [ "$binary" = "" ]; then
+		echo "Cancel!";
+		exit 1;
+	elif [ "$binary" = "Other" ]; then
+		binary=$(dialog --stdout --title "Custom command" --inputbox "Enter your command, %u for url:" 8 30 "my_command --play %u" 2> /dev/null)
+		if [ "$binary" = "" ]; then
+		echo "Cancel!";
+		exit 1;
+		fi;
+	fi;
+	if [ "$binary" != "Geekast" ]; then
+		host=$(dialog --stdout --title "PeerCast server" --inputbox "What is the adress of you server?" 8 30 "$host" 2> /dev/null)
+		if [ "$host" = "" ]; then
+			echo "Cancel!";
+			exit 1;
+		fi;
+	fi;
+else
+	echo "Could not find a suitable dialog binary..."
+fi;
+
+# Choose command:
+if [ "$binary" = "Audacious-Enqueue" ] ; then
+	binary="audacious --enqueue %u"
+elif [ "$binary" = "Audacious-Play" ] ; then
+	binary="audacious --play %u"
+elif [ "$binary" = "Totem" ] ; then
+	binary="totem %u"
+elif [ "$binary" = "VLC" ] ; then
+	binary="vlc %u"
+fi;
+
+# Save prefs:
+
+echo "host=\"$host\"" >| ~/.peercast_handlerrc;
+
+# Launch the parser or Geekast..
+
+if [ "$binary" = "Geekast" ] ; then
+	geekast $binary
+else
+	peercast-parser.pl -h=$host -b="$binary" $1
+fi;
+
--- peercast-0.1218+svn20080104.orig/debian/custom/peercast.8
+++ peercast-0.1218+svn20080104/debian/custom/peercast.8
@@ -0,0 +1,81 @@
+.\"  -*- nroff -*-
+.\"
+.\" Author: Romain Beauxis <toots@rastageeks.org>
+.TH PEERCAST 8 "February 16, 2005" "" ""
+.ad
+.fi
+.SH NAME
+\fBpeercast\fP \- P2P Streaming Server
+
+\fBpeercast_khandler.sh\fP \- KDE handler for peercast:// URIs
+
+\fBpeercast-play-in-xmms.pl\fP \- Translate and play a peercast link under xmms
+
+\fBpeercast-enqueue-in-xmms.pl\fP \- Translate and enqueue a peercast link under xmms
+.SH SYNOPSIS
+.na
+.nf
+.fi
+.B peercast 
+[\fIoptions\fR] 
+
+.B peercast_khandler 
+[\fIpeercast://foo\fR]
+
+.B peercast-play-in-xmms.pl 
+[\fIpeercast://foo~server:port\fR]
+
+.B peercast-enqueue-in-xmms.pl 
+[\fIpeercast://foo~server:port\fR]
+
+.SH DESCRIPTION
+.ad
+.fi
+\fBpeercast\fP is a free server for P2P streaming of audio and video.
+When installed, please browse the address \fIhttp://127.0.0.1:7144/\fR to properly configure your server.
+
+.SH OPTIONS
+A summary of options for \fBpeercast\fP is included below.
+
+.TP
+Generic options:
+.TP
+.B   \-h, \-\-help
+Show help about options
+.TP
+.B   \-i, \-\-inifile <inifile>      
+specify ini file
+.TP
+.B   \-l, \-\-logfile <logfile>      
+specify log file
+This file is created only if this option is set.
+.TP
+.B   \-P, \-\-path <path>            
+set path to html files.
+.TP
+.B   \-p, \-\-pidfile <pidfile>      
+specify pid file.
+This file is created only if this option is set.
+.TP
+.B   \-d, \-\-daemon
+Fork in the background
+.TP
+
+
+.SH FILES
+.ad
+.fi
+.IP \fIpeercast.ini\fR
+Contains configuration data for \fBpeercast\fR. 
+.IP \fIpeercast.log\fR
+Contains log data for \fBpeercast\fR. 
+.IP \fIpeercast.pid\fR
+Contains pid number of current running \fBpeercast\fR. 
+
+.SH AUTHORS
+.ad
+.fi
+Peercast was originally written by PeerCast.org <code@peercast.org>.
+
+This manual page was written by Romain Beauxis <toots@rastageeks.org>
+for the Debian GNU/Linux system, and may be used freely by other. 
--- peercast-0.1218+svn20080104.orig/debian/custom/firefox/firefox-handler.js
+++ peercast-0.1218+svn20080104/debian/custom/firefox/firefox-handler.js
@@ -0,0 +1,3 @@
+pref("network.protocol-handler.app.peercast", "peercast_handler.sh");
+pref("network.protocol-handler.warn-external.peercast","false");
+
--- peercast-0.1218+svn20080104.orig/debian/peercast.postrm
+++ peercast-0.1218+svn20080104/debian/peercast.postrm
@@ -0,0 +1,23 @@
+#! /bin/sh
+# postrm script for peercast-servent
+#
+# see: dh_installdeb(1)
+
+set -e
+
+if [ -f /usr/share/debconf/confmodule ]; then
+. /usr/share/debconf/confmodule
+fi
+
+case "$1" in
+    purge)
+        rm -rf /etc/peercast
+    ;;
+    *)
+    ;;
+esac
+
+
+#DEBHELPER#
+
+exit 0
--- peercast-0.1218+svn20080104.orig/debian/peercast.dirs
+++ peercast-0.1218+svn20080104/debian/peercast.dirs
@@ -0,0 +1,7 @@
+usr/sbin
+usr/share/peercast
+usr/share/man/man8
+etc/peercast
+etc/init.d
+var/log/peercast
+var/run/peercast
--- peercast-0.1218+svn20080104.orig/debian/peercast.init
+++ peercast-0.1218+svn20080104/debian/peercast.init
@@ -0,0 +1,81 @@
+#! /bin/sh
+#
+# Peercast init start/stop script.
+#
+# Based on debian skeleton init script
+#
+### BEGIN INIT INFO
+# Provides:          peercast
+# Required-Start:    $syslog
+# Required-Stop:     $syslog
+# Should-Start:      $local_fs
+# Should-Stop:       $local_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Starts peercast servent daemon
+# Description:       Peercast is a P2P streaming system,
+#                    this daemon listens, serves and relays live streams.
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/peercast
+NAME=peercast
+DESC="Peercast peer to peer broadcasting"
+USERID=peercast
+PIDDIR=/var/run/peercast
+PIDFILE=$PIDDIR/peercast.pid
+LOGDIR=/var/log/peercast
+CONFDIR=/etc/peercast
+HTMLPATH=/usr/share/peercast
+OPTIONS="--inifile $CONFDIR/peercast.ini --pidfile $PIDFILE --logfile $LOGDIR/peercast.log --path $HTMLPATH --daemon"
+
+# Check for log dir
+if [ ! -d $LOGDIR ] ; then
+	mkdir $LOGDIR
+	chown $USERID:$USERID $LOGDIR
+fi
+
+# Check for pid dir
+if [ ! -d $PIDDIR ] ; then
+	mkdir $PIDDIR
+	chown $USERID:$USERID $PIDDIR
+fi
+
+# Check for conf dir
+if [ ! -d $CONFDIR ] ; then
+	mkdir $CONFDIR
+	chown $USERID:$USERID $LOGDIR
+fi
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+set -e
+
+case "$1" in
+  start)
+        echo -n "Starting $DESC: "
+        start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USERID:$USERID       \
+        --exec $DAEMON -- $OPTIONS
+	echo "$NAME."
+        ;;
+  stop)
+        echo -n "Stopping $DESC: "
+        start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --chuid $USERID:$USERID       \
+        --exec $DAEMON
+	echo "Stopped."
+        ;;
+  restart|force-reload|reload)
+        $0 stop
+	sleep 1
+        $0 start
+        ;;
+  *)
+        N=/etc/init.d/$NAME
+        echo "Usage: $N {start|stop|restart}" >&2
+        exit 1
+        ;;
+esac
+
+
+exit 0 
--- peercast-0.1218+svn20080104.orig/debian/control.in
+++ peercast-0.1218+svn20080104/debian/control.in
@@ -0,0 +1,38 @@
+Source: peercast
+Section: sound
+Priority: optional
+Maintainer: Romain Beauxis <toots@rastageeks.org>
+Build-Depends: @cdbs@, gconf2
+Standards-Version: 3.7.3
+
+Package: peercast-servent
+Architecture: all
+Depends: peercast (>= 0.1217.toots.20060314-6), 
+Description: P2P audio and video streaming servent (dummy package)
+ PeerCast is a P2P streaming server. It can stream music
+ and video from a broad variety of formats.
+ .
+ This package is a dummy transitional package, you can remove
+ it safetly
+
+Package: peercast
+Architecture: any
+Depends: ${shlibs:Depends}, logrotate, adduser
+Recommends: peercast-handlers
+Conflicts: gnome-peercast, peercast-servent (<< 0.1217.toots.20060314-5)
+Replaces: peercast-servent
+Description: P2P audio and video streaming servent
+ PeerCast is a P2P streaming server. It can stream music
+ and video from a broad variety of formats.
+
+Package: peercast-handlers
+Architecture: all
+Depends: ${misc:Depends}, xdialog | zenity | kdebase-bin, dialog
+Suggests: konqueror, epiphany-browser, iceweasel, audacious, xmms, vlc, totem
+Description: P2P audio and video streaming handlers
+ PeerCast is a P2P streaming server. It can stream music
+ and video from a broad variety of formats.
+ .
+ This package installs handlers for common browsers like
+ Firefox, Konqueror, Epiphany.
+ 
--- peercast-0.1218+svn20080104.orig/debian/peercast-servent.init
+++ peercast-0.1218+svn20080104/debian/peercast-servent.init
@@ -0,0 +1,32 @@
+#! /bin/sh
+# This script is a transitional dummy init script for the new
+# peercast package. You can remove it safetly
+#
+# If you made modifications to it, please move them to
+# /etc/init.d/peercast
+#
+### BEGIN INIT INFO
+# Provides:          peercast-dummy
+# Required-Start:    
+# Required-Stop:     
+# Should-Start:      
+# Should-Stop:       
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: 
+# Description:      Dummy init script for easy upgrade with new peercast package.
+#                   You can remove this script safetly
+### END INIT INFO
+
+
+case "$1" in
+  start|stop|restart|force-reload|reload)
+  	exit 0
+        ;;
+  *)
+        exit 0
+        ;;
+esac
+
+
+exit 0 
--- peercast-0.1218+svn20080104.orig/debian/peercast.logrotate
+++ peercast-0.1218+svn20080104/debian/peercast.logrotate
@@ -0,0 +1,11 @@
+/var/log/peercast/*.log {
+  weekly
+  missingok
+  rotate 7
+  compress
+  delaycompress
+  copy
+  postrotate
+        /usr/bin/killall -HUP peercast
+  endscript
+} 
--- peercast-0.1218+svn20080104.orig/debian/patches/01-fix-for-FTBFS-on-kfreeBSD.patch
+++ peercast-0.1218+svn20080104/debian/patches/01-fix-for-FTBFS-on-kfreeBSD.patch
@@ -0,0 +1,24 @@
+Index: peercast-0.1218+svn20080104.orig/core/unix/usocket.cpp
+===================================================================
+--- peercast-0.1218+svn20080104.orig.orig/core/unix/usocket.cpp	2008-04-01 13:06:19.000000000 +0100
++++ peercast-0.1218+svn20080104.orig/core/unix/usocket.cpp	2008-04-01 13:06:52.000000000 +0100
+@@ -31,7 +31,6 @@
+ 
+ #ifdef __APPLE__ 
+ #include <netinet/in_systm.h> // for n_long definition
+-#define MSG_NOSIGNAL 0        // doesn't seem to be defined under OS X
+ #endif
+ 
+ #include <netinet/ip.h>
+@@ -40,6 +39,11 @@
+ #define INVALID_SOCKET -1
+ #define SOCKET_ERROR -1
+ 
++#ifndef MSG_NOSIGNAL
++#define MSG_NOSIGNAL 0
++#endif
++
++
+ // --------------------------------------------------
+ void UClientSocket::init()
+ {
--- peercast-0.1218+svn20080104.orig/debian/patches/fix_int64.patch
+++ peercast-0.1218+svn20080104/debian/patches/fix_int64.patch
@@ -0,0 +1,25 @@
+Index: peercast-0.1218+svn20080104.orig/core/common/sys.h
+===================================================================
+--- peercast-0.1218+svn20080104.orig.orig/core/common/sys.h	2008-04-01 13:10:14.000000000 +0100
++++ peercast-0.1218+svn20080104.orig/core/common/sys.h	2008-04-01 13:11:46.000000000 +0100
+@@ -325,7 +325,6 @@
+ #define _BIG_ENDIAN 1
+ #endif
+ 
+-typedef long long int64_t;
+ 
+ typedef int (*THREAD_FUNC)(ThreadInfo *);
+ #define THREAD_PROC int 
+Index: peercast-0.1218+svn20080104.orig/core/common/ogg.h
+===================================================================
+--- peercast-0.1218+svn20080104.orig.orig/core/common/ogg.h	2008-04-01 13:10:14.000000000 +0100
++++ peercast-0.1218+svn20080104.orig/core/common/ogg.h	2008-04-01 13:11:46.000000000 +0100
+@@ -19,7 +19,7 @@
+ #ifndef _OGG_H
+ #define _OGG_H
+ 
+-
++#include <sys/types.h>
+ #include "channel.h"
+ // ----------------------------------------------
+ class OggPage;
--- peercast-0.1218+svn20080104.orig/debian/patches/series
+++ peercast-0.1218+svn20080104/debian/patches/series
@@ -0,0 +1,3 @@
+01-fix-for-FTBFS-on-kfreeBSD.patch
+fix_int64.patch
+CVE-2008-2040.patch
--- peercast-0.1218+svn20080104.orig/debian/patches/CVE-2008-2040.patch
+++ peercast-0.1218+svn20080104/debian/patches/CVE-2008-2040.patch
@@ -0,0 +1,122 @@
+diff -Nurad peercast-0.1218+svn20080104/core/common/channel.cpp peercast-0.1218+svn20080104.new/core/common/channel.cpp
+--- peercast-0.1218+svn20080104/core/common/channel.cpp	2008-04-01 13:59:52.000000000 +0200
++++ peercast-0.1218+svn20080104.new/core/common/channel.cpp	2008-04-30 17:45:28.000000000 +0200
+@@ -440,7 +440,7 @@
+ 		if (http.isHeader(PCX_HS_POS))
+ 			streamPos = atoi(arg);
+ 		else
+-			Servent::readICYHeader(http, info, NULL);
++			Servent::readICYHeader(http, info, NULL, 0);
+ 
+ 		LOG_CHANNEL("Channel fetch: %s",http.cmdLine);
+ 	}
+diff -Nurad peercast-0.1218+svn20080104/core/common/http.cpp peercast-0.1218+svn20080104.new/core/common/http.cpp
+--- peercast-0.1218+svn20080104/core/common/http.cpp	2008-04-01 13:59:52.000000000 +0200
++++ peercast-0.1218+svn20080104.new/core/common/http.cpp	2008-04-30 17:45:28.000000000 +0200
+@@ -102,7 +102,7 @@
+ 		return 0;
+ }
+ //-----------------------------------------
+-void HTTP::getAuthUserPass(char *user, char *pass)
++void HTTP::getAuthUserPass(char *user, char *pass, size_t ulen, size_t plen)
+ {
+ 	if (arg)
+ 	{
+@@ -119,10 +119,14 @@
+ 			if (s)
+ 			{
+ 				*s = 0;
+-				if (user)
+-					strcpy(user,str.cstr());
+-				if (pass)
+-					strcpy(pass,s+1);
++				if (user){
++					strncpy(user,str.cstr(), ulen);
++					user[ulen - 1] = 0;
++				}
++				if (pass){
++					strncpy(pass,s+1, plen);
++					pass[plen - 1] = 0;
++				}
+ 			}			
+ 		}
+ 	}
+diff -Nurad peercast-0.1218+svn20080104/core/common/http.h peercast-0.1218+svn20080104.new/core/common/http.h
+--- peercast-0.1218+svn20080104/core/common/http.h	2008-04-01 13:59:52.000000000 +0200
++++ peercast-0.1218+svn20080104.new/core/common/http.h	2008-04-30 17:45:28.000000000 +0200
+@@ -176,7 +176,7 @@
+ 	char	*getArgStr();
+ 	int		getArgInt();
+ 
+-	void	getAuthUserPass(char *, char *);
++	void	getAuthUserPass(char *, char *, size_t, size_t);
+ 
+ 	char	cmdLine[8192],*arg;
+ 
+diff -Nurad peercast-0.1218+svn20080104/core/common/servent.h peercast-0.1218+svn20080104.new/core/common/servent.h
+--- peercast-0.1218+svn20080104/core/common/servent.h	2008-04-01 13:59:52.000000000 +0200
++++ peercast-0.1218+svn20080104.new/core/common/servent.h	2008-04-30 17:45:28.000000000 +0200
+@@ -206,7 +206,7 @@
+ 	void	sendPCPChannel();
+ 	void	checkPCPComms(Channel *, AtomStream &);
+ 
+-	static void	readICYHeader(HTTP &, ChanInfo &, char *);
++	static void	readICYHeader(HTTP &, ChanInfo &, char *, size_t);
+ 	bool	canStream(Channel *);
+ 
+ 	bool	isConnected() {return status == S_CONNECTED;}
+diff -Nurad peercast-0.1218+svn20080104/core/common/servhs.cpp peercast-0.1218+svn20080104.new/core/common/servhs.cpp
+--- peercast-0.1218+svn20080104/core/common/servhs.cpp	2008-04-01 13:59:52.000000000 +0200
++++ peercast-0.1218+svn20080104.new/core/common/servhs.cpp	2008-04-30 17:45:28.000000000 +0200
+@@ -587,7 +587,7 @@
+ 		{
+ 			case ServMgr::AUTH_HTTPBASIC:
+ 				if (http.isHeader("Authorization"))
+-					http.getAuthUserPass(user,pass);
++					http.getAuthUserPass(user,pass, sizeof(user), sizeof(pass));
+ 				break;
+ 			case ServMgr::AUTH_COOKIE:
+ 				if (http.isHeader("Cookie"))
+@@ -1405,7 +1405,7 @@
+ 
+ }
+ // -----------------------------------
+-void Servent::readICYHeader(HTTP &http, ChanInfo &info, char *pwd)
++void Servent::readICYHeader(HTTP &http, ChanInfo &info, char *pwd, size_t plen)
+ {
+ 	char *arg = http.getArgStr();
+ 	if (!arg) return;
+@@ -1429,8 +1429,10 @@
+ 		info.desc.set(arg,String::T_ASCII);
+ 		info.desc.convertTo(String::T_UNICODE);
+ 
+-	}else if (http.isHeader("Authorization"))
+-		http.getAuthUserPass(NULL,pwd);
++	}else if (http.isHeader("Authorization")){
++		if(pwd)
++			http.getAuthUserPass(NULL,pwd, 0, plen);
++    }
+ 	else if (http.isHeader(PCX_HS_CHANNELID))
+ 		info.id.fromStr(arg);
+ 	else if (http.isHeader("ice-password"))
+@@ -1501,7 +1503,7 @@
+ 	while (http.nextHeader())
+ 	{
+ 		LOG_DEBUG("ICY %s",http.cmdLine);
+-		readICYHeader(http,info,loginPassword.cstr());
++		readICYHeader(http,info,loginPassword.cstr(), String::MAX_LEN);
+ 	}
+ 
+ 
+diff -Nurad peercast-0.1218+svn20080104/core/common/url.cpp peercast-0.1218+svn20080104.new/core/common/url.cpp
+--- peercast-0.1218+svn20080104/core/common/url.cpp	2008-04-01 13:59:52.000000000 +0200
++++ peercast-0.1218+svn20080104.new/core/common/url.cpp	2008-04-30 17:45:28.000000000 +0200
+@@ -171,7 +171,7 @@
+ 				LOG_CHANNEL("Fetch HTTP: %s",http.cmdLine);
+ 
+ 				ChanInfo tmpInfo = ch->info;
+-				Servent::readICYHeader(http,ch->info,NULL);
++				Servent::readICYHeader(http,ch->info,NULL, 0);
+ 
+ 				if (!tmpInfo.name.isEmpty())
+ 					ch->info.name = tmpInfo.name;
--- peercast-0.1218+svn20080104.orig/debian/copyright
+++ peercast-0.1218+svn20080104/debian/copyright
@@ -0,0 +1,15 @@
+This package was debianized by Romain Beauxis <toots@rastageeks.org> on
+Fri, 13 May 2005 12:01:24 +0100.
+
+It was downloaded from http://www.peercast.org/code/
+
+Copyright:
+
+(c) 2002-2005 PeerCast.org <code@peercast.org>
+
+License:
+
+You are free to distribute this software under the terms of
+the GNU General Public License.
+On Debian systems, the complete text of the GNU General Public
+License can be found in the file `/usr/share/common-licenses/GPL'.
--- peercast-0.1218+svn20080104.orig/debian/README.Debian-source
+++ peercast-0.1218+svn20080104/debian/README.Debian-source
@@ -0,0 +1,4 @@
+This package has been extracted from 
+  svn://peercast.org/peercast/trunk
+
+
--- peercast-0.1218+svn20080104.orig/debian/peercast-handlers.dirs
+++ peercast-0.1218+svn20080104/debian/peercast-handlers.dirs
@@ -0,0 +1,8 @@
+usr/bin
+usr/share/peercast/scripts 
+usr/share/man/man8
+usr/share/gconf/schemas
+usr/lib/mozilla/defaults/pref
+etc/mozilla-firefox/pref
+etc/peercast
+etc
--- peercast-0.1218+svn20080104.orig/debian/peercast-servent.debhelper.log
+++ peercast-0.1218+svn20080104/debian/peercast-servent.debhelper.log
@@ -0,0 +1 @@
+dh_listpackages
