--- pptpd-1.3.4.orig/README
+++ pptpd-1.3.4/README
@@ -19,7 +19,7 @@
 
 Type: 'pptpd -h' for options you may specify on the command line.
 
-A sample config file is in samples/
+Sample config files are in examples/
 
 For more help look in html/
 or visit the Poptop web site at: http://poptop.sourceforge.net/
--- pptpd-1.3.4.orig/pptpd.c
+++ pptpd-1.3.4/pptpd.c
@@ -735,6 +735,16 @@
 				continue;
 			}
 
+			if (upper < lower) {
+			/* if upper < lower segmantation fault in pptpctrl happens
+			 * due to enabling pppLocal parameter without providing its value.
+			 *
+			 * we can safely use ipstr because it is not modified except
+			 * of truncating.
+			 */
+				syslog(LOG_ERR, "MGR: Bad %s IP range: %s", (type == LOCAL)?"local":"remote", ipstr);
+				exit(1);
+			}
 			for (n = lower; n <= upper; n++) {
 				sprintf(tmpstr5, "%s%d%s", ip_pre, n, ip_post);
 				/* Check if the ip address is valid */
--- pptpd-1.3.4.orig/pptpgre.c
+++ pptpd-1.3.4/pptpgre.c
@@ -403,15 +403,20 @@
 			stats.rx_truncated++;
 			return 0;
 		}
-		/* check for out-of-order sequence number */
-		if (seq == gre.seq_recv + 1) {
+		/* check for out-of-order sequence number
+		 * N.B.: some client implementations violate RFC 2637
+		 * and start their sequence numbers at 1 instead of 0,
+		 * so we have to introduce a kludge to deal with it. 
+		 * on wrap we may allow an out of order packet to pass
+		*/
+		if (seq == gre.seq_recv + 1 || seq == 1) {
 			if (pptpctrl_debug)
 				syslog(LOG_DEBUG, "GRE: accepting packet #%d", 
 				       seq);
 			stats.rx_accepted++;
 			gre.seq_recv = seq;
 			return cb(cl, buffer + ip_len + headersize, payload_len);
-		} else if (seq == gre.seq_recv) {
+		} else if (!seq_greater(seq, gre.seq_recv)) {
 			if (pptpctrl_debug)
 				syslog(LOG_DEBUG,
 				       "GRE: discarding duplicate or old packet #%d (expecting #%d)", 
@@ -438,6 +443,7 @@
 		unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)];
 	} u;
 	unsigned header_len;
+	ssize_t status;
 #ifdef HAVE_WRITEV
 	struct iovec iovec[2];
 #endif
@@ -488,12 +494,18 @@
 	iovec[0].iov_len = header_len;
 	iovec[1].iov_base = pack;
 	iovec[1].iov_len = len;
-	return writev(fd, iovec, 2);
+	status = writev(fd, iovec, 2); 
 #else
 	/* copy payload into buffer */
 	memcpy(u.buffer + header_len, pack, len);
 	/* record and increment sequence numbers */
 	/* write this baby out to the net */
-	return write(fd, u.buffer, header_len + len);
+	status = write(fd, u.buffer, header_len + len);
 #endif
+	if ((status >= 0) || (errno != ENOBUFS)) {
+		return status;
+	}
+	// if ENOBUFS, do not close the connection
+	gre.seq_sent--;
+	return 0;
 }
--- pptpd-1.3.4.orig/pptpctrl.c
+++ pptpd-1.3.4/pptpctrl.c
@@ -657,9 +657,10 @@
  */
 static void launch_pppd(char **pppaddrs, struct in_addr *inetaddrs)
 {
-	char *pppd_argv[14];
+	char *pppd_argv[16];
 	int an = 0;
 	sigset_t sigs;
+	char pppInterfaceIPs[33];
 
 	pppd_argv[an++] = ppp_binary;
 
@@ -760,7 +761,6 @@
 	}
 	
 	if (*pppaddrs[0] || *pppaddrs[1]) {
-		char pppInterfaceIPs[33];
 		sprintf(pppInterfaceIPs, "%s:%s", pppaddrs[0], pppaddrs[1]);
 		pppd_argv[an++] = pppInterfaceIPs;
 	}
@@ -777,6 +777,9 @@
                  pppd_argv[an++] = "pptpd-original-ip";
                  pppd_argv[an++] = inet_ntoa(inetaddrs[1]);
         }
+        
+        pppd_argv[an++] = "remotenumber";
+        pppd_argv[an++] = inet_ntoa(inetaddrs[1]);
 
 	/* argv arrays must always be NULL terminated */
 	pppd_argv[an++] = NULL;
--- pptpd-1.3.4.orig/.directory
+++ pptpd-1.3.4/.directory
@@ -0,0 +1,4 @@
+[Desktop Entry]
+BgImage=
+Icon=
+MiniIcon=
--- pptpd-1.3.4.orig/debian/watch
+++ pptpd-1.3.4/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://heanet.dl.sourceforge.net/sourceforge/poptop/pptpd-([\d.]+)\.tar\.gz
--- pptpd-1.3.4.orig/debian/bcrelay.docs
+++ pptpd-1.3.4/debian/bcrelay.docs
@@ -0,0 +1 @@
+README.bcrelay
--- pptpd-1.3.4.orig/debian/copyright
+++ pptpd-1.3.4/debian/copyright
@@ -1,7 +1,7 @@
 This package was debianized by Rene Mayrhofer rene.mayrhofer@gibraltar.at on
 Mon, 16 Aug 1999 11:27:43 +0200.
 
-It was downloaded from 'http://www.moretonbay.com/vpn/pptp.html'
+It was downloaded from <http://poptop.sourceforge.net/>
 
 Upstream Authors: Please look at file AUTHORS
 
--- pptpd-1.3.4.orig/debian/changelog
+++ pptpd-1.3.4/debian/changelog
@@ -1,19 +1,209 @@
-pptpd (1.3.4-0) unstable; urgency=low
+pptpd (1.3.4-5.2.5.201403270323) ucs4-0-0-0; urgency=low
 
-  * Package built from upstream sources, not a Debian project package
-    (Debian Developer expected to adjust this entry)
+  * UCS auto build. No patches were applied to the original source package
 
- -- James Cameron <quozl@us.netrek.org>  Mon, 16 Apr 2007 10:51:43 +1000
+ -- Univention builddaemon <buildd@univention.de>  Thu, 27 Mar 2014 03:23:04 +0100
 
-pptpd (1.2.0-0) unstable; urgency=low
+pptpd (1.3.4-5.2) unstable; urgency=low
 
-  * Package built from upstream sources, not a Debian project package
-    (Debian Developer expected to adjust this entry)
+  * Non-maintainer upload.
+  * Handle ENOBUFS gracefully.
+    Closes: #692129: pptpd: PPTP Connections Drop
+  * Programming error, reference to a stack variable used out of scope in
+    arguments to execvp call.
+    Closes: #693136: pptpd: Binary trash when launching ppp
+
+ -- Maximiliano Curia <maxy@debian.org>  Wed, 28 Nov 2012 16:21:01 +0100
+
+pptpd (1.3.4-5.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Remove debian/conffiles, avoids debsum mismatches regarding conffiles
+    (Closes: #689779)
+
+ -- Reinhard Tartler <siretart@tauware.de>  Sun, 28 Oct 2012 17:19:04 +0100
+
+pptpd (1.3.4-5) unstable; urgency=medium
+
+  Urgency medium because 1.3.4-4 broke connections for some settings.
+  * Fix bug introduced by last change adding the remotenumber parameter
+    to pppd. Thanks to Michael Poetters for the patch!
+    Closes: #625459: pppctrl fixup
+    Closes: #622258: pptpd: Impossible to establish connection
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Sat, 07 May 2011 22:39:57 +0200
+
+pptpd (1.3.4-4) unstable; urgency=low
+
+  * Apply patch provided by Sergey Naumov to fix a segmentation fault
+    when invalid IP ranges are specified in the config file (upper <
+    lower)
+  * Apply patch provided by Igor A Tarasov to pass the remotenumber
+    command line option to pppd, which is then used for th radius
+    plugin.
+    Closes: #610375: remotenumber support
+  * Report that the init script also supports a "status" option.
+    Closes: #536424: init.d script error message does not mention 
+                     "status" action
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Tue, 29 Mar 2011 11:03:36 +0200
+
+pptpd (1.3.4-3) unstable; urgency=low
+
+  * Add build-dependency to ppp-dev >=2.4.5-3 and depend on ppp >=2.4.5-3 
+    to make logwtmp plugin work again.
+    Closes: #593278: ppp 2.4.5 implies a recompilation pf pptpd
+  * Fixed a typo in the README file.
+  * Acknowledge NMU. (Closes: #458476)
+  * Update debian policy version to 3.9.1, no notable changes to packaging.
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Sat, 25 Sep 2010 22:13:16 +0200
+
+pptpd (1.3.4-2.1) unstable; urgency=low
+
+  * Non-maintainer upload to solve release goal.
+  * Add LSB dependency header to init.d scripts (Closes: #458476)
+
+ -- Petter Reinholdtsen <pere@debian.org>  Sun, 16 Mar 2008 10:33:35 +0100
+
+pptpd (1.3.4-2) unstable; urgency=low
+
+  * Applied additional patch to fix regression in GRE re-ordering fix in
+    version 1.3.4 (with non-RFC-compliant clients.
+    Closes: #416404: pptpd freeze
+  * Use the new configure option for bcrelay support.
+    Closes: #421999: No bcrelay support in pptpd
+    Closes: #424764: pptpd: bcrelay support missing 
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Mon, 21 May 2007 23:31:53 +0100
+
+pptpd (1.3.4-1) unstable; urgency=low
+
+  * New upstream release.
+    Closes: #416404: pptpd freeze
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Tue, 17 Apr 2007 15:36:30 +0100
+
+pptpd (1.3.0-2) unstable; urgency=high
+
+  Urgency high because of fixes to RC bugs.
+  * Fix syslog flooding. Thanks to Timo van Roermund for the patch.
+    Closes: #369539: PPTPD flooding syslog
+    Closes: #396187 pptpd: Patch to disable unnecessary lines in syslog
+  * Update to work with pppd 2.4.4b1. Thanks to Stu Teasdalefor the
+    patch.
+    Closes: #369714: pptpd-logwtmp.so does not work with ppp 2.4.4b1 
+    Closes: #387538: pptpd-logwtmp.so does not work with ppp 2.4.4rel-2
+  * Add a comment to the default config file that points to a Windows
+    bug. Thanks to St辿phane Rosi for the patch.
+    Closes: #384523: pptpd: Warn about a bug in Microsoft Windows VPN
+                     client 
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Mon,  6 Nov 2006 18:35:28 +0000
+
+pptpd (1.3.0-1) unstable; urgency=low
+
+  * New upstream release.
+    Closes: #366395: pptpd: New Upstream version - fixes reordering and 
+                     loopback bugs
+    This release also includes the patches contributed by Ilguiz Latypov to
+    allow multiple control connections from the same client IP (e.g. for 
+    multiple clients behind the same NAT connecting to the same pptpd server).
+    This seems to have been fixed with upstream 1.2.1, but I missed it then.
+    Closes: #171831: pptpd allocates call ID 0 for every new TCP link 
+  * Acknowledge NMU. Thanks to Luk for helping out.
+    Closes: #356104: diff for 1.2.3-1.1 NMU of pptpd
+    Closes: #350456: bcrelay: Should "Conflicts: pptpd (<< 1.2.3-1)"
+  * Manually updated plugins/pppd.h again with header from ppp-dev 2.4.4b1-1.
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Sun, 15 Jan 2006 17:09:31 +0000
+
+pptpd (1.2.3-1.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Let bcrelay replace files from the old pptpd (Closes: #350456).
+
+ -- Luk Claes <luk@debian.org>  Thu,  9 Mar 2006 18:59:06 +0100
+
+pptpd (1.2.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Added watch file.
+  * Manually updated the pppd headers for the logwtmp plugin again. 
+    This release should work with ppp 2.4.4b1 now, so depend on this version.
+    Closes: #343150: pptpd-logwtmp.so does not work with ppp 2.4.4b1
+  * Split off the bcrelay binary into its own package. pptpd now depends on 
+    it (it does not necessarily depend on bcrelay, but most people will want 
+    to use it and recommends are still handled rather poorly).
+    Closes: #347414: pptpd: Splitting bcrelay as a separate package
+  * Update dh_compat to level 4 now.
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Sat, 14 Jan 2006 15:01:12 +0000
+
+pptpd (1.2.1-5) unstable; urgency=low
+
+  * Depend on debconf | debconf-2.0. Thanks to Joey for the reminder....
+  * While I am at it, also use dh_compat level 3 now.
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Mon, 26 Sep 2005 19:18:57 +0200
+
+pptpd (1.2.1-4) unstable; urgency=low
+
+  * Updated depends on ppp to 2.4.3-20041231 to prevent automatic
+    upgrades of pptpd in sarge. In fact, the only change to the version
+    presently in sarge is the update of headers for the new ppp, so
+    reflect this in the depends.
+    Thanks to Norman Rasmussen for actually suggesting this simple fix for
+    this bug report.
+    Closes: #305012: logwtmp plugin is for pppd version 2.4.3, but version 
+                     is 2.4.2 
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Tue, 19 Apr 2005 14:33:55 +0200
+
+pptpd (1.2.1-3) unstable; urgency=low
+
+  * Updated the ppp headers for the pppd plugin to ppp 2.4.3.
+    Closes: #297508: new pppd 2.4.3 in sid failed to start with 
+                     /usr/lib/pptpd/pptpd-logwtmp.so
+
+ -- Rene Mayrhofer <rmayr@debian.org>  Mon,  4 Apr 2005 14:48:16 +0200
+
+pptpd (1.2.1-2) unstable; urgency=low
+
+  * All of the changes in this upload have been made by Faidon Liambotis, many
+    thanks for the patch !
+  * Removed dependency on perl-base (Policy Manual, section 3.5).
+    Closes: #262430: pptpd: needless dependency on an essential package
+  * Removed build-dependency from the binary (Policy Manual, section 5.2).
+  * Fixed upstream URL in the copyright file.
+    Closes: #261240: pptpd: Wrong upstream url
+  * Patched logwtmp to work with ppp 2.4.2 instead of 2.4.3 (patch provided by upstream).
+    Closes: #259487: pptpd: Issue with logwtmp being for verison 2.4.3 in 
+                     pptpd 1.2.1-1
+  * Removed (not implemented) "reload" target from init.d script, upstream does not provide a reload mechanism.
+  * Changed Standards-Version to 3.6.1.0. 
+
+ -- Rene Mayrhofer <rene@mayrhofer.eu.org>  Sun,  5 Sep 2004 17:05:35 +0200
+
+pptpd (1.2.1-1) unstable; urgency=low
+
+  * New upstream version.
+    Closes: #248123: ip-up zombie problem: diagnosed and fixed
+  * Applied Japanese debconf translations.
+    Closes: #239211: pptpd: Japanese po-debconf template translation (ja.po)
+  * Additionally install README.logwtmp and README.portslave under
+    /usr/share/doc/pptpd now.
+    
+ -- Rene Mayrhofer <rmayr@debian.org>  Wed, 30 Jun 2004 10:24:51 +0200
+
+pptpd (1.2.0-1) unstable; urgency=low
+
+  * New upstream version.
     Closes: #107933: pptpd: pptpd segfaults if called without arguments 
     Closes: #126486: pptpd: wish it had better integration support with 
-                     Portslave 
+    		     Portslave 
 
- -- James Cameron <james.cameron@hp.com>  Fri, 21 May 2004 20:13:51 +1000
+ -- Rene Mayrhofer <rmayr@debian.org>  Tue,  4 May 2004 09:54:01 +0200
 
 pptpd (1.1.4.0b4-1) unstable; urgency=low
 
--- pptpd-1.3.4.orig/debian/bcrelay.dirs
+++ pptpd-1.3.4/debian/bcrelay.dirs
@@ -0,0 +1 @@
+/usr/sbin
--- pptpd-1.3.4.orig/debian/pptpd.examples
+++ pptpd-1.3.4/debian/pptpd.examples
@@ -0,0 +1,3 @@
+samples/chap-secrets
+samples/options.pptpd
+samples/pptpd.conf
--- pptpd-1.3.4.orig/debian/svn-deblayout
+++ pptpd-1.3.4/debian/svn-deblayout
@@ -0,0 +1,8 @@
+buildArea=/home/rene/amw/src/packages/build-area
+origDir=/home/rene/amw/src/packages/tarballs
+origUrl=svn+ssh://svn.gibraltar.at/svn/debian-packages/trunk/debian/tarballs
+tagsUrl=svn+ssh://svn.gibraltar.at/svn/debian-packages/tags/pptpd
+trunkDir=/home/rene/amw/src/packages/pptpd
+trunkUrl=svn+ssh://svn.gibraltar.at/svn/debian-packages/trunk/debian/pptpd
+upsCurrentUrl=svn+ssh://svn.gibraltar.at/svn/debian-packages/branches/source-dist/debian/pptpd
+upsTagUrl=svn+ssh://svn.gibraltar.at/svn/debian-packages/tags/pptpd
--- pptpd-1.3.4.orig/debian/pptpd.docs
+++ pptpd-1.3.4/debian/pptpd.docs
@@ -0,0 +1,8 @@
+AUTHORS
+README
+README.inetd
+README.slirp
+README.logwtmp
+README.portslave
+TODO
+html/poptop_ads_howto
--- pptpd-1.3.4.orig/debian/control
+++ pptpd-1.3.4/debian/control
@@ -2,14 +2,21 @@
 Section: net
 Priority: optional
 Maintainer: Rene Mayrhofer <rmayr@debian.org>
-Standards-Version: 3.0.1.0
-Build-Depends: libwrap0-dev, debhelper (>= 4.1.16)
+Standards-Version: 3.9.1
+Build-Depends: libwrap0-dev, debhelper (>= 4.1.16), ppp-dev (>=2.4.5-3)
 
 Package: pptpd
 Architecture: any
-Depends: ${shlibs:Depends}, ppp (>=2.4.2+20030811-1), netbase, debconf, perl-base
-Build-Depends: debhelper
+Depends: ${shlibs:Depends}, ppp (>=2.4.5-3), netbase, debconf | debconf-2.0, bcrelay
 Description: PoPToP Point to Point Tunneling Server
  This implements a Virtual Private Networking Server (VPN) that is compatible
  with Microsoft VPN clients. It allows windows users to connect to an
  internal firewalled network using their dialup.
+
+Package: bcrelay
+Architecture: any
+Replaces: pptpd (<<1.2.3-1)
+Depends: ${shlibs:Depends}
+Description: Broadcast relay daemon
+ The bcrelay daemon relays broadcasts between two interfaces. It is shipped
+ with the pptpd package, but can be used for other purposes.
--- pptpd-1.3.4.orig/debian/pptpd.config
+++ pptpd-1.3.4/debian/pptpd.config
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+# Rene Mayrhofer <rmayr@vianova.at>, Oct. 1999
+# I hereby put this script under the Artistic License.
+
+. /usr/share/debconf/confmodule.sh
+
+db_input high pptpd/localip
+db_input high pptpd/remoteip
+
+# ask if mppe encryption should be used
+db_input pptpd/mppe
+db_go
+
+# check the answer(s)
+db_get pptpd/mppe
+if [ "$RET" = "false" ]; then
+	# display a warning
+	db_input high pptpd/no-mppe
+	db_go
+fi
+
+
--- pptpd-1.3.4.orig/debian/pptpd.dirs
+++ pptpd-1.3.4/debian/pptpd.dirs
@@ -0,0 +1,4 @@
+/usr/sbin
+/etc
+/etc/ppp
+/etc/init.d
--- pptpd-1.3.4.orig/debian/pptpd.templates
+++ pptpd-1.3.4/debian/pptpd.templates
@@ -0,0 +1,75 @@
+Template: pptpd/localip
+Type: string
+_Description: Local IP address of the virtual connections
+ Specify the local IP address for the virtual connections.
+ .
+ Please note that any address works as long as the local machine takes care
+ of the routing. But if you want to use MS-Windows networking, you should
+ use an IP address out of the LAN address space.
+ .
+ You can give only one address or you can give multiple addresses if you
+ want to, although they are really not needed. Multiple addresses can be
+ given as either "10.0.0.1,10.0.0.2,10.0.0.3" or "10.0.0.1-3". No spaces
+ should be used between commas or within addresses.
+
+Template: pptpd/remoteip
+Type: string
+_Description: A list of remote IP addresses for the virtual connections.
+ Specify the remote IP addresses for the virtual connections.
+ .
+ Please note that any addresses work as long as the local machine takes
+ care of the routing. But if you want to use MS-Windows networking, you
+ should use IP addresses out of the LAN address space.
+ .
+ You have to give one address for every concurrent connection. This will
+ depend on how many clients you expect to be online at the same time.
+ Multiple addresses can be given as either "10.0.0.1,10.0.0.2,10.0.0.3" or
+ "10.0.0.1-3". No spaces should be used between commas or within addresses.
+
+Template: pptpd/netmask
+Type: string
+_Description: Netmask used for virtual connections.
+ If you use IP addresses from the LAN address space, please use the same
+ netmask as on your LAN.
+
+Template: pptpd/wins
+Type: string
+_Description: IP address of your WINS server.
+ A WINS server is used for browsing available Computers in MS-Windows
+ networking. This address is transmitted to the clients,
+
+Template: pptpd/dns
+Type: string
+_Description: IP address of your DNS server.
+ This address is transmitted to the clients.
+
+Template: pptpd/mppe
+Type: boolean
+Default: true
+_Description: Do you want to use MPPE data encryption ?
+ The recommended way is to use the data encryption as it is one of the main
+ benefits of a VPN. When you want to use MPPE (Microsoft Point-to-Point
+ Encryption), you also  have to use CHAPMSv2 for authentication. . Note
+ that you have to install the modified ppp packages if you want to use this
+ data encryption.
+
+Template: pptpd/no-mppe
+Type: note
+_Description: Warning: data encryption is disabled.
+ All data transferred between the local network and the client will be
+ transmitted without encryption ! This is a security hole.
+ .
+ You have been warned. Now you loose your product warranty :)
+
+Template: pptpd/authentication
+Type: select
+_Choices: pap, chap, chapms, chapms-v2
+Default: chap
+_Description: Which authentication method do you want to use ?
+ Possible authentication methods are: - PAP - CHAP - CHAP with Microsoft
+ extensions - CHAP with Microsoft extensions v2
+ .
+ The recommended authentication method is one of the CHAP methods. However,
+ you have to use a separate database (/etc/ppp/chap-secrets) if you want to
+ use these. If you use PAP, you can use the standard system passwords when
+ the ppp-pam package is installed.
--- pptpd-1.3.4.orig/debian/pptpd.init
+++ pptpd-1.3.4/debian/pptpd.init
@@ -1,5 +1,12 @@
 #!/bin/sh
-# Copyright Rene Mayrhofer, ViaNova, 1999
+### BEGIN INIT INFO
+# Provides:          pptpd
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+### END INIT INFO
+# Copyright Rene Mayrhofer, Gibraltar, 1999
 # This script is distibuted under the GPL
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
@@ -19,9 +26,6 @@
     start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
     echo "pptpd."
     ;;
-  reload)
-    echo "Not implemented."
-    ;;
   force-reload|restart)
     echo "Restarting PPTP: "
     sh $0 stop
@@ -48,7 +52,7 @@
         fi
         ;;
   *)
-    echo "Usage: /etc/init.d/pptpd {start|stop|restart|force-reload|reload}"
+    echo "Usage: /etc/init.d/pptpd {start|stop|restart|force-reload|status}"
     exit 1
     ;;
 esac
--- pptpd-1.3.4.orig/debian/pptpd.conf
+++ pptpd-1.3.4/debian/pptpd.conf
@@ -1,5 +1,5 @@
 ###############################################################################
-# $Id: pptpd.conf,v 1.1 2004/05/17 02:16:35 quozl Exp $
+# $Id$
 #
 # Sample Poptop configuration file /etc/pptpd.conf
 #
--- pptpd-1.3.4.orig/debian/pptpd-options
+++ pptpd-1.3.4/debian/pptpd-options
@@ -1,5 +1,5 @@
 ###############################################################################
-# $Id: pptpd-options,v 1.1 2004/05/17 02:16:35 quozl Exp $
+# $Id$
 #
 # Sample Poptop PPP options file /etc/ppp/pptpd-options
 # Options used by PPP when a connection arrives from a client.
@@ -50,6 +50,8 @@
 # addresses to the clients.  The first instance of this option
 # specifies the primary DNS address; the second instance (if given)
 # specifies the secondary DNS address.
+# Attention! This information may not be taken into account by a Windows
+# client. See KB311218 in Microsoft's knowledge base for more information.
 #ms-dns 10.0.0.1
 #ms-dns 10.0.0.2
 
--- pptpd-1.3.4.orig/debian/rules
+++ pptpd-1.3.4/debian/rules
@@ -6,12 +6,14 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+export DH_COMPAT=4
+
 build: build-stamp
 build-stamp:
 	dh_testdir
 
 	./configure --prefix=/usr --mandir=/usr/share/man \
-		    --with-libwrap --with-bcrelay
+		    --with-libwrap --enable-bcrelay
 	# Add here commands to compile the package.
 	$(MAKE) 
 
@@ -21,6 +23,7 @@
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp install-stamp
+	rm -f debian/conffiles
 
 	# Add here commands to clean up after the build process.
 	-$(MAKE) distclean
@@ -35,10 +38,13 @@
 	dh_installdirs
 
 	# Add here commands to install the package into debian/tmp.
-	$(MAKE) install prefix=`pwd`/debian/tmp/usr mandir=`pwd`/debian/tmp/usr/share/man 	
-	cp debian/pptpd.conf `pwd`/debian/tmp/etc 
-	cp debian/pptpd-options `pwd`/debian/tmp/etc/ppp
+	$(MAKE) install prefix=`pwd`/debian/pptpd/usr mandir=`pwd`/debian/pptpd/usr/share/man 	
+	cp debian/pptpd.conf `pwd`/debian/pptpd/etc
+	cp debian/pptpd-options `pwd`/debian/pptpd/etc/ppp
 	#cp debian/pptpdconfig.pl `pwd`/debian/tmp/usr/sbin
+	# split bcrelay into its own package
+	mv debian/pptpd/usr/sbin/bcrelay debian/bcrelay/usr/sbin
+	
 	touch install-stamp
 
 # Build architecture-independent files here.
@@ -51,13 +57,12 @@
 	dh_testdir
 	dh_testroot
 	dh_installdocs
-#	mv `pwd`/debian/tmp/usr/share/doc/pptpd/html/*.txt `pwd`/debian/tmp/usr/share/doc/pptpd/
-	dh_installexamples
+	dh_installexamples -ppptpd
 #	dh_installmenu
 #	dh_installemacsen
-	dh_installinit
+	dh_installinit -ppptpd
 #	dh_installcron
-	dh_installmanpages
+	dh_installman -ppptpd
 #	dh_installdebconf
 #	dh_undocumented
 	dh_installchangelogs -k ChangeLog
--- pptpd-1.3.4.orig/debian/po/ja.po
+++ pptpd-1.3.4/debian/po/ja.po
@@ -0,0 +1,223 @@
+#
+#    Translators, if you are not familiar with the PO format, gettext
+#    documentation is worth reading, especially sections dedicated to
+#    this format, e.g. by running:
+#         info -n '(gettext)PO Files'
+#         info -n '(gettext)Header Entry'
+#
+#    Some information specific to po-debconf are available at
+#            /usr/share/doc/po-debconf/README-trans
+#         or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+#    Developers do not need to manually edit POT or PO files.
+#
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: pptpd 1.1.4.0b4-1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2004-03-03 05:24+0900\n"
+"PO-Revision-Date: 2004-03-02 18:02+0900\n"
+"Last-Translator: Hideki Yamane <henrich@samba.gr.jp>\n"
+"Language-Team: Japanese <debian-japanese@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=EUC-JP\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:3
+msgid "Local IP address of the virtual connections"
+msgstr "仮想接続用のローカル IP アドレス"
+
+#. Type: string
+#. Description
+#: ../templates:3
+msgid "Specify the local IP address for the virtual connections."
+msgstr "仮想接続用のローカル IP アドレスを指定してください。"
+
+#. Type: string
+#. Description
+#: ../templates:3
+msgid ""
+"Please note that any address works as long as the local machine takes care "
+"of the routing. But if you want to use MS-Windows networking, you should use "
+"an IP address out of the LAN address space."
+msgstr ""
+"ローカルマシンはルーティングに注意していれば、どんなアドレスでも動作すること"
+"に留意してください。しかしながら、MS-Windows ネットワークを利用したい場合は "
+"LAN で使用しているアドレス空間外の IP アドレスを使用する必要があります。"
+
+#. Type: string
+#. Description
+#: ../templates:3
+msgid ""
+"You can give only one address or you can give multiple addresses if you want "
+"to, although they are really not needed. Multiple addresses can be given as "
+"either \"10.0.0.1,10.0.0.2,10.0.0.3\" or \"10.0.0.1-3\". No spaces should be "
+"used between commas or within addresses."
+msgstr ""
+"1アドレスのみ、または望めば実際は必要ない場合であっても、複数のアドレスも指定"
+"可能です。複数のアドレスの指定は \"10.0.0.1,10.0.0.2,10.0.0.3\" でも "
+"\"10.0.0.1-3\" でも構いません。コンマやアドレスの間にスペースは使用してはいけ"
+"ません。"
+
+#. Type: string
+#. Description
+#: ../templates:17
+msgid "A list of remote IP addresses for the virtual connections."
+msgstr "仮想接続用のリモート IP アドレスリスト"
+
+#. Type: string
+#. Description
+#: ../templates:17
+msgid "Specify the remote IP addresses for the virtual connections."
+msgstr "仮想接続用のリモート IP アドレスを指定してください。"
+
+#. Type: string
+#. Description
+#: ../templates:17
+msgid ""
+"Please note that any addresses work as long as the local machine takes care "
+"of the routing. But if you want to use MS-Windows networking, you should use "
+"IP addresses out of the LAN address space."
+msgstr ""
+"ローカルマシンはルーティングに注意していれば、どんなアドレスでも動作すること"
+"に留意してください。しかしながら、MS-Windows ネットワークを利用したい場合は "
+"LAN で使用しているアドレス空間外の IP アドレスを使用する必要があります。"
+
+#. Type: string
+#. Description
+#: ../templates:17
+msgid ""
+"You have to give one address for every concurrent connection. This will "
+"depend on how many clients you expect to be online at the same time. "
+"Multiple addresses can be given as either \"10.0.0.1,10.0.0.2,10.0.0.3\" or "
+"\"10.0.0.1-3\". No spaces should be used between commas or within addresses."
+msgstr ""
+"複数の接続それぞれにアドレスを一つ割り当てねばなりません。これはどれだけのク"
+"ライアント数が同時に接続するのを想定しているか、に依存することになります。複"
+"数のアドレスは \"10.0.0.1,10.0.0.2,10.0.0.3\" か \"10.0.0.1-3\" と指定できま"
+"す。コンマやアドレスの間にスペースは使用してはいけません。"
+
+#. Type: string
+#. Description
+#: ../templates:31
+msgid "Netmask used for virtual connections."
+msgstr "仮想接続に使用されるネットマスク値"
+
+#. Type: string
+#. Description
+#: ../templates:31
+msgid ""
+"If you use IP addresses from the LAN address space, please use the same "
+"netmask as on your LAN."
+msgstr ""
+"LAN 内のアドレス空間の IP アドレスを利用している場合、LAN と同じネットマスク"
+"値を利用してください。"
+
+#. Type: string
+#. Description
+#: ../templates:37
+msgid "IP address of your WINS server."
+msgstr "WINS サーバの IP アドレス"
+
+#. Type: string
+#. Description
+#: ../templates:37
+msgid ""
+"A WINS server is used for browsing available Computers in MS-Windows "
+"networking. This address is transmitted to the clients,"
+msgstr ""
+"WINS サーバは MS-Windows ネットワークでコンピュータをブラウズする為に使われま"
+"す。このアドレスはクライアントに通知されます。"
+
+#. Type: string
+#. Description
+#: ../templates:43
+msgid "IP address of your DNS server."
+msgstr "DNS サーバの IP アドレス"
+
+#. Type: string
+#. Description
+#: ../templates:43
+msgid "This address is transmitted to the clients."
+msgstr "このアドレスはクライアントに通知されます。"
+
+#. Type: boolean
+#. Description
+#: ../templates:49
+msgid "Do you want to use MPPE data encryption ?"
+msgstr "MPPE データ暗号化を使用しますか?"
+
+#. Type: boolean
+#. Description
+#: ../templates:49
+msgid ""
+"The recommended way is to use the data encryption as it is one of the main "
+"benefits of a VPN. When you want to use MPPE (Microsoft Point-to-Point "
+"Encryption), you also  have to use CHAPMSv2 for authentication. . Note that "
+"you have to install the modified ppp packages if you want to use this data "
+"encryption."
+msgstr ""
+"お勧めのやり方は VPN の主要な利点の一つであるデータ暗号化を使う方法です。"
+"MPPE (Microsoft Point-to-Point Encryption) を利用したい場合は CHAPMSv2 を認証"
+"に利用しなければなりません。データ暗号化を利用したい場合、変更を加えた ppp "
+"パッケージをインストールせねばならないことに留意してください。"
+
+#. Type: note
+#. Description
+#: ../templates:58
+msgid "Warning: data encryption is disabled."
+msgstr "警告: データの暗号化は無効になっています。"
+
+#. Type: note
+#. Description
+#: ../templates:58
+msgid ""
+"All data transferred between the local network and the client will be "
+"transmitted without encryption ! This is a security hole."
+msgstr ""
+"ローカルネットワークとクライアント間の転送データ全ては暗号無しでやり取りされ"
+"ます!これはセキュリティホールです。"
+
+#. Type: note
+#. Description
+#: ../templates:58
+msgid "You have been warned. Now you loose your product warranty :)"
+msgstr "警告しました。もはや製品保証は行われません :)"
+
+#. Type: select
+#. Choices
+#: ../templates:66
+msgid "pap, chap, chapms, chapms-v2"
+msgstr "pap, chap, chapms, chapms-v2"
+
+#. Type: select
+#. Description
+#: ../templates:68
+msgid "Which authentication method do you want to use ?"
+msgstr "どの認証方式を利用しますか?"
+
+#. Type: select
+#. Description
+#: ../templates:68
+msgid ""
+"Possible authentication methods are: - PAP - CHAP - CHAP with Microsoft "
+"extensions - CHAP with Microsoft extensions v2"
+msgstr ""
+"利用可能な認証式は: - PAP - CHAP - CHAP with Microsoft extensions - CHAP "
+"with Microsoft extensions v2 です。"
+
+#. Type: select
+#. Description
+#: ../templates:68
+msgid ""
+"The recommended authentication method is one of the CHAP methods. However, "
+"you have to use a separate database (/etc/ppp/chap-secrets) if you want to "
+"use these. If you use PAP, you can use the standard system passwords when "
+"the ppp-pam package is installed."
+msgstr ""
+"お勧めの認証方式は CHAP 方式のいずれかです。しかし、これを利用するには専用の"
+"データベース (/etc/ppp/chap-secrets) が必要です。PAP を利用する場合、ppp-pam "
+"パッケージがインストールされていればシステム標準のパスワードが利用できます。"
--- pptpd-1.3.4.orig/samples/options.pptpd
+++ pptpd-1.3.4/samples/options.pptpd
@@ -1,5 +1,5 @@
 ###############################################################################
-# $Id: options.pptpd,v 1.11 2005/12/29 01:21:09 quozl Exp $
+# $Id$
 #
 # Sample Poptop PPP options file /etc/ppp/options.pptpd
 # Options used by PPP when a connection arrives from a client.
--- pptpd-1.3.4.orig/plugins/pptpd-logwtmp.c
+++ pptpd-1.3.4/plugins/pptpd-logwtmp.c
@@ -12,7 +12,7 @@
 #include <unistd.h>
 #include <utmp.h>
 #include <string.h>
-#include "pppd.h"
+#include <pppd/pppd.h>
 
 char pppd_version[] = VERSION;
 
--- pptpd-1.3.4.orig/plugins/pppd.h
+++ pptpd-1.3.4/plugins/pppd.h
@@ -39,8 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * upstream pppd.h,v 1.82 2003/04/07 00:01:46 paulus Exp
- * $Id: pppd.h,v 1.1 2004/04/28 11:36:07 quozl Exp $
+ * $Id: pppd.h,v 1.91 2005/08/25 23:59:34 paulus Exp $
  */
 
 /*
@@ -216,6 +215,8 @@
 extern char	ifname[];	/* Interface name */
 extern char	hostname[];	/* Our hostname */
 extern u_char	outpacket_buf[]; /* Buffer for outgoing packets */
+extern int	devfd;		/* fd of underlying device */
+extern int	fd_ppp;		/* fd for talking PPP */
 extern int	phase;		/* Current state of link - see values below */
 extern int	baud_rate;	/* Current link speed in bits/sec */
 extern char	*progname;	/* Name of this program */
@@ -244,8 +245,14 @@
 extern char	ppp_devnam[MAXPATHLEN];
 extern char     remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
 extern int      ppp_session_number; /* Session number (eg PPPoE session) */
+extern int	fd_devnull;	/* fd open to /dev/null */
 
 extern int	listen_time;	/* time to listen first (ms) */
+extern bool	doing_multilink;
+extern bool	multilink_master;
+extern bool	bundle_eof;
+extern bool	bundle_terminating;
+
 extern struct notifier *pidchange;   /* for notifications of pid changing */
 extern struct notifier *phasechange; /* for notifications of phase changes */
 extern struct notifier *exitnotify;  /* for notification that we're exiting */
@@ -305,11 +312,14 @@
 extern int	connect_delay;	/* Time to delay after connect script */
 extern int	max_data_rate;	/* max bytes/sec through charshunt */
 extern int	req_unit;	/* interface unit number to use */
+extern char	path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
+extern char	path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
 extern bool	multilink;	/* enable multilink operation */
 extern bool	noendpoint;	/* don't send or accept endpt. discrim. */
 extern char	*bundle_name;	/* bundle name for multilink */
 extern bool	dump_options;	/* print out option values */
 extern bool	dryrun;		/* check everything, print options, exit */
+extern int	child_wait;	/* # seconds to wait for children at end */
 
 #ifdef MAXOCTETS
 extern unsigned int maxoctets;	     /* Maximum octetes per session (in bytes) */
@@ -348,13 +358,11 @@
 /* Values for auth_done only */
 #define CHAP_MD5_WITHPEER	0x40
 #define CHAP_MD5_PEER		0x80
-#ifdef CHAPMS
 #define CHAP_MS_SHIFT		8	/* LSB position for MS auths */
 #define CHAP_MS_WITHPEER	0x100
 #define CHAP_MS_PEER		0x200
 #define CHAP_MS2_WITHPEER	0x400
 #define CHAP_MS2_PEER		0x800
-#endif
 
 extern char *current_option;	/* the name of the option being parsed */
 extern int  privileged_option;	/* set iff the current option came from root */
@@ -376,6 +384,7 @@
 #define PHASE_TERMINATE		9
 #define PHASE_DISCONNECT	10
 #define PHASE_HOLDOFF		11
+#define PHASE_MASTER		12
 
 /*
  * The following struct gives the addresses of procedures to call
@@ -467,13 +476,15 @@
 void untimeout __P((void (*func)(void *), void *arg));
 				/* Cancel call to func(arg) */
 void record_child __P((int, char *, void (*) (void *), void *));
-pid_t safe_fork __P((void));	/* Fork & close stuff in child */
+pid_t safe_fork __P((int, int, int));	/* Fork & close stuff in child */
 int  device_script __P((char *cmd, int in, int out, int dont_wait));
 				/* Run `cmd' with given stdin and stdout */
 pid_t run_program __P((char *prog, char **args, int must_exist,
-		       void (*done)(void *), void *arg));
+		       void (*done)(void *), void *arg, int wait));
 				/* Run program prog with args in child */
 void reopen_log __P((void));	/* (re)open the connection to syslog */
+void print_link_stats __P((void)); /* Print stats, if available */
+void reset_link_stats __P((int)); /* Reset (init) stats when link goes up */
 void update_link_stats __P((int)); /* Get stats at link termination */
 void script_setenv __P((char *, char *, int));	/* set script env var */
 void script_unsetenv __P((char *));		/* unset script env var */
@@ -483,6 +494,10 @@
 void notify __P((struct notifier *, int));
 int  ppp_send_config __P((int, int, u_int32_t, int, int));
 int  ppp_recv_config __P((int, int, u_int32_t, int, int));
+const char *protocol_name __P((int));
+void remove_pidfiles __P((void));
+void lock_db __P((void));
+void unlock_db __P((void));
 
 /* Procedures exported from tty.c. */
 void tty_init __P((void));
@@ -512,8 +527,10 @@
 
 /* Procedures exported from auth.c */
 void link_required __P((int));	  /* we are starting to use the link */
+void start_link __P((int));	  /* bring the link up now */
 void link_terminated __P((int));  /* we are finished with the link */
 void link_down __P((int));	  /* the LCP layer has left the Opened state */
+void upper_layers_down __P((int));/* take all NCPs down */
 void link_established __P((int)); /* the link is up; authenticate now */
 void start_networks __P((int));   /* start all the network control protos */
 void continue_networks __P((int)); /* start network [ip, etc] control protos */
@@ -548,15 +565,24 @@
 void demand_block __P((void));	/* set all NPs to queue up packets */
 void demand_unblock __P((void)); /* set all NPs to pass packets */
 void demand_discard __P((void)); /* set all NPs to discard packets */
-void demand_rexmit __P((int));	/* retransmit saved frames for an NP */
+void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/
 int  loop_chars __P((unsigned char *, int)); /* process chars from loopback */
 int  loop_frame __P((unsigned char *, int)); /* should we bring link up? */
 
 /* Procedures exported from multilink.c */
+#ifdef HAVE_MULTILINK
 void mp_check_options __P((void)); /* Check multilink-related options */
 int  mp_join_bundle __P((void));  /* join our link to an appropriate bundle */
+void mp_exit_bundle __P((void));  /* have disconnected our link from bundle */
+void mp_bundle_terminated __P((void));
 char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */
 int  str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */
+#else
+#define mp_bundle_terminated()	/* nothing */
+#define mp_exit_bundle()	/* nothing */
+#define doing_multilink		0
+#define multilink_master	0
+#endif
 
 /* Procedures exported from sys-*.c */
 void sys_init __P((void));	/* Do system-dependent initialization */
@@ -573,6 +599,7 @@
 void make_new_bundle __P((int, int, int, int)); /* Create new bundle */
 int  bundle_attach __P((int));	/* Attach link to existing bundle */
 void cfg_bundle __P((int, int, int, int)); /* Configure existing bundle */
+void destroy_bundle __P((void)); /* Tell driver to destroy bundle */
 void clean_check __P((void));	/* Check if line was 8-bit clean */
 void set_up_tty __P((int, int)); /* Set up port's speed, parameters, etc. */
 void restore_tty __P((int));	/* Restore port's original parameters */
@@ -617,7 +644,7 @@
 int  cif6addr __P((int, eui64_t, eui64_t));
 				/* Remove an IPv6 address from i/f */
 #endif
-int  sifdefaultroute __P((int, u_int32_t, u_int32_t));
+int  sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt));
 				/* Create default route through i/f */
 int  cifdefaultroute __P((int, u_int32_t, u_int32_t));
 				/* Delete default route through i/f */
@@ -802,7 +829,7 @@
   || defined(DEBUGCHAP) || defined(DEBUG) || defined(DEBUGIPV6CP)
 #define LOG_PPP LOG_LOCAL2
 #else
-#define LOG_PPP LOG_DAEMON
+#define LOG_PPP LOG_LOCAL2
 #endif
 #endif /* LOG_PPP */
 
