Browse Source

Merge upstream version from git commit ddb30f8

Christoph Biedl 10 years ago
parent
commit
b4157d37a1
77 changed files with 4688 additions and 5351 deletions
  1. 3 1
      AUTHORS
  2. 12 0
      BUGS
  3. 130 0
      ChangeLog
  4. 196 0
      ChangeLog-0.8
  5. 130 0
      ChangeLog-0.9
  6. 21 0
      ChangeLog-1.1.3
  7. 1 1
      Makefile.am
  8. 3 1
      Makefile.in
  9. 9 0
      NEWS
  10. 88 0
      PROTOCOL-SECURITY
  11. 6 6
      README
  12. 91 0
      RELEASING
  13. 0 0
      acconfig.h
  14. 59 0
      bcrelay.8
  15. 12 11
      bcrelay.c
  16. 11 0
      build.sh
  17. 0 0
      compat.c
  18. 0 0
      compat.h
  19. 7 1
      config.h.in
  20. 11 7
      configfile.c
  21. 1 1
      configfile.h
  22. 2873 4140
      configure
  23. 45 4
      configure.in
  24. 19 12
      ctrlpacket.c
  25. 2 2
      ctrlpacket.h
  26. 28 29
      debian/changelog
  27. 2 1
      defaults.h
  28. 1 1
      getopt.c
  29. 1 1
      getopt1.c
  30. 0 3
      html/CVS/Entries
  31. 0 1
      html/CVS/Repository
  32. 0 1
      html/CVS/Root
  33. 0 18
      html/poptop_ads_howto/CVS/Entries
  34. 0 1
      html/poptop_ads_howto/CVS/Repository
  35. 0 1
      html/poptop_ads_howto/CVS/Root
  36. 73 46
      html/poptop_ads_howto/poptop_ads_howto_1.htm
  37. 4 8
      html/poptop_ads_howto/poptop_ads_howto_10.htm
  38. 2 2
      html/poptop_ads_howto/poptop_ads_howto_11.htm
  39. 39 4
      html/poptop_ads_howto/poptop_ads_howto_12.htm
  40. 2 1
      html/poptop_ads_howto/poptop_ads_howto_2.htm
  41. 16 6
      html/poptop_ads_howto/poptop_ads_howto_3.htm
  42. 28 15
      html/poptop_ads_howto/poptop_ads_howto_4.htm
  43. 6 6
      html/poptop_ads_howto/poptop_ads_howto_5.htm
  44. 7 7
      html/poptop_ads_howto/poptop_ads_howto_6.htm
  45. 15 7
      html/poptop_ads_howto/poptop_ads_howto_7.htm
  46. 30 19
      html/poptop_ads_howto/poptop_ads_howto_8.htm
  47. 17 7
      html/poptop_ads_howto/poptop_ads_howto_9.htm
  48. 20 18
      html/poptop_ads_howto/poptop_ads_howto_a1.htm
  49. 16 19
      html/poptop_ads_howto/poptop_ads_howto_a2.htm
  50. 41 0
      html/poptop_ads_howto/poptop_ads_howto_a3.htm
  51. 34 0
      html/poptop_ads_howto/poptop_ads_howto_a4.htm
  52. 87 0
      html/poptop_ads_howto/poptop_ads_howto_a5.htm
  53. 40 0
      html/poptop_ads_howto/poptop_ads_howto_a6.htm
  54. 1 1
      inststr.h
  55. 1 1
      mkinstalldirs
  56. 1 1
      our_getopt.h
  57. 1 1
      our_syslog.h
  58. 0 882
      plugins/pppd.h
  59. 2 2
      plugins/pptpd-logwtmp.c
  60. 1 1
      ppphdlc.c
  61. 1 1
      ppphdlc.h
  62. 34 15
      pptpctrl.c
  63. 7 1
      pptpctrl.h
  64. 4 0
      pptpd.8
  65. 41 11
      pptpd.c
  66. 12 0
      pptpd.conf.5
  67. 13 4
      pptpd.spec
  68. 2 2
      pptpdefs.h
  69. 27 10
      pptpgre.c
  70. 0 0
      pptpgre.h
  71. 9 2
      pptpmanager.c
  72. 0 0
      pptpmanager.h
  73. 7 1
      samples/pptpd.conf
  74. 196 0
      tools/client-test
  75. 42 0
      tools/confmod.sh
  76. 45 0
      tools/vpnwho.pl
  77. 2 6
      version

+ 3 - 1
AUTHORS

@@ -2,7 +2,7 @@ Poptop -- The PPTP Server
 -------------------------
 -------------------------
 
 
 Current Maintainer:
 Current Maintainer:
-James Cameron <james.cameron at hp dot com>
+James Cameron <quozl at laptop dot org>
 
 
 Previous Maintainer:
 Previous Maintainer:
 Richard de Vroede <r.devroede at linvision dot com>
 Richard de Vroede <r.devroede at linvision dot com>
@@ -28,6 +28,8 @@ Pawel Guraj
 Chris Wilson
 Chris Wilson
 Anton Gorlov
 Anton Gorlov
 Charlie Brady
 Charlie Brady
+Michael Douglass <mikedoug at mikedoug dot net>
+David Lamparter <equinox at diac24 dot net>
 
 
 The Linux PPTP Server takes advantage of some Linux PPTP client code
 The Linux PPTP Server takes advantage of some Linux PPTP client code
 written by C. Scott Ananian <cananian at alumni.princeton.edu>
 written by C. Scott Ananian <cananian at alumni.princeton.edu>

+ 12 - 0
BUGS

@@ -0,0 +1,12 @@
+Review of Debian bugs
+
+171831: requires significant redesign, in TODO as item 19990705
+	(upstream acknowledges and has added it to the list)
+
+181005: requires code change, added to TODO as item 20030214
+	(upstream acknowledges and has added it to the list)
+        (ip_gre module is not needed at all, comment made)
+        (the GRE response is an acknowledgement packet)
+
+209082: debian project's problem, not upstream
+

+ 130 - 0
ChangeLog

@@ -1,3 +1,133 @@
+Thu Feb  7 11:51:46 2013  James Cameron  <quozl@laptop.org>
+
+	* plugins/pptpd-logwtmp.c: use pppd.h provided by ppp package
+	instead of our own, fix for debian #369714.
+
+	Author: Stu Teasdale <stu@drogna.org.uk>
+	Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+
+Thu Feb  7 11:50:03 2013  James Cameron  <quozl@laptop.org>
+
+	* pptpctrl.c: fix binary trash when launching ppp, fix for debian
+	#693196.
+
+	Author: tevaum@gmail.com
+
+Thu Feb  7 11:48:32 2013  James Cameron  <quozl@laptop.org>
+
+	* pptpgre.c: avoid dropping connection when kernel returns
+	ENOBUFS, fix for debian #629129.
+
+	Author: Maximiliano Curia <maxy@debian.org>
+	Author: James Cameron <quozl@laptop.org>
+
+Thu Feb  7 11:47:33 2013  James Cameron  <quozl@laptop.org>
+
+	* pptpctrl.c: add remotenumber support, fix for debian #610375,
+	#625459, and ubuntu #704245.
+
+	Author: Igor A Tarasov <develop@dicr.org>
+	Author: Michael Poetters <michael@poetters.net>
+
+Thu Feb  7 11:46:18 2013  James Cameron  <quozl@laptop.org>
+
+	* configfile.c: catch missing EOL at EOF, fix for sf.net poptop
+	ticket #35, debian #567480.
+
+	Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+
+Thu Feb  7 11:45:45 2013  James Cameron  <quozl@laptop.org>
+
+	* bcrelay.8: add manual page, fix for debian #426553.
+
+	Author: Khang Nguyen Trong <trongkhang17@gmail.com>
+
+Thu Feb  7 11:44:59 2013  James Cameron  <quozl@laptop.org>
+
+	* pptpd.c: fix a segmentation fault on invalid IP range entry.
+
+	Author: Sergey Naumov
+
+Wed May 18 14:42:28 2011  David Lamparter  <david.lamparter@adyton.net>
+
+	* pptpctrl.c, pptpd.c, pptpgre.c, pptpmanager.c: introduce VRFs
+
+	this adds support for VRFs (Virtual Routing and Forwarding
+	instances) through libvrf from vrf-tools. pptpd gains the ability
+	to have its TCP and GRE sockets in a VRF different from the one
+	the process is running in.
+
+	As pppd is started from pptpd and does not have VRF support, the
+	pppX devices will be in the initial VRF. The PPTP traffic will
+	however be flowing in the given VRF. This allows full separation
+	of encapsulated and encapsulating networks.
+
+Mon Jun 15 12:53:58 2009  Michael Douglass  <mikedoug@mikedoug.net>
+
+	* pptpctrl.c (pptp_handle_ctrl_connection): fix IDLE_WAIT
+	implementation.
+
+	pptpd processes were not terminating when the remote pptp client
+	went off the network unexpectedly.  An strace of pptpd showed the
+	select() loop in pptctrl.c was never timing out because the
+	/dev/ptmx descriptor was sending data to pptpd every 10 seconds.
+	Since the select() loop was never timing out, the IDLE_WAIT
+	mechanism never triggered.
+
+	The patch below makes the following changes:
+
+	- select() returning 0 is no longer a direct trigger case for
+	sending an ECHO REQ
+
+	- track the last time we heard anything from our TCP socket in
+	last_time (initialized to now on startup)
+
+	- any time we go through the loop and we don't hear from our TCP
+	socket, we check to see if our last_time is older than IDLE_WAIT,
+	if so, send an ECHO REQ
+
+Fri Nov 14 10:28:27 2008  Karl Hiramoto  <karl@hiramoto.org>
+
+	* ctrlpacket.c (deal_start_ctrl_conn): fix compilation with uclibc
+	with legacy support disabled.  From "man bzero": This function is
+	deprecated (marked as LEGACY in POSIX.1-2001): use memset(3) in
+	new programs.  POSIX.1-2008 removes the specification of bzero().
+
+Wed Oct  8 09:47:33 2008  James Cameron  <quozl@us.netrek.org>
+
+	* pptpctrl.c (launch_pppd): exclude ipparam and plugin from SLIRP
+	and BSD PPP configurations.  Reported by Richard P. Koett.
+
+Fri Jul 20 10:27:37 2007  Eivind Naess  <Eivind.Naess@gmail.com>
+
+	* pptpdefs.h: add packed attribute to pptp_gre_header, to ensure
+	compiler alignment efforts do not conflict with processing the
+	header.
+
+Mon May 28 12:17:06 2007  James Cameron  <quozl@us.netrek.org>
+
+	* ctrlpacket.c (deal_set_link_info): change the "Ignored a SET
+	LINK INFO" message to be LOG_DEBUG, only emit when debug mode is
+	enabled, and explain further what it is.
+
+Thu May 24 10:43:45 2007  James Cameron  <quozl@us.netrek.org>
+
+	* pptpd.conf.5: add missing logwtmp option.
+
+Tue Apr 24 13:11:28 2007  Phil Oester  <kernel@linuxace.com>
+
+	* pptpgre.c (decaps_gre): further testing has revealed a couple
+	more problems with the packet reordering/buffering code:
+
+	1) Some clients (notably the PPTP client) start their sequence
+	   numbers at 1 instead of 0 as the RFC mandates.  My previous fix
+	   caused problems with these clients.
+
+	2) Duplicate packets were causing corruption when they were placed
+	   on the queue but never used -or- when they were placed on the
+	   queue but already existed on the queue (i.e. they previously
+	   arrived out of order).
+
 Mon Apr 16 10:32:40 2007  James Cameron  <quozl@us.netrek.org>
 Mon Apr 16 10:32:40 2007  James Cameron  <quozl@us.netrek.org>
 
 
 	* pptpd-1.3.4.tar.gz: released.
 	* pptpd-1.3.4.tar.gz: released.

+ 196 - 0
ChangeLog-0.8

@@ -0,0 +1,196 @@
+PoPToP ChangeLog
+
+---------------------------------------------------------------------------
+v0.8.13 -> v0.9.0
+11th June, 1999
+
+- possibly fixed the 'error 629 on startup' bug.  this fix is incompatible
+  with the 'silent' option of pppd, so don't use the 'silent' option.
+- support a single localip with a range of remoteip's
+- new, small, fast, simple get_call_id() function
+- removed a few hardcoded values in ctrlpacket and replaced with defines
+- new pptp_read_header() - slightly more 'expensive' but should be much more
+  robust
+- use openpty() if possible, internalize tty opening, startCall much more
+  simple
+
+---------------------------------------------------------------------------
+v0.8.12 -> v0.8.13
+10th June, 1999
+
+- removed ctrl-manager pipe completely
+- moved awareness of pppd-ip-alloc option to manager only
+- if using pppd-ip-alloc, manager runs more efficiently
+- made pptpctrl able to have a none, one or both of local/remote addresses
+  rather than only both or none
+- great code simplicication
+- re-did IP parser; less potential segfaults from bad config
+- correctly calculate max connections based on number of IP addresses given
+  and statically configured maximum
+- no max connections for the pppd-ip-alloc case
+- properly permit hostnames in IP parser
+- always use fd 0 for network connection
+- fixed -c option
+- note - this version changes the 'run from inetd' options.  re-read
+  README.inetd if you use it
+
+---------------------------------------------------------------------------
+v0.8.11 -> v0.8.12
+8th June, 1999
+
+- made autoconf actually check the relevant headers
+- made config.embed.h and removed most #if EMBED in favour of using this
+- fixed some includes and re-arranged things to be a bit cleaner
+- minor cosmetic fixes
+- fixed compilation on StarOS 4 (and hence SunOS 4)
+- documentation on running from ientd
+- removed ctrl-manager pipe by default
+
+---------------------------------------------------------------------------
+v0.8.10 -> v0.8.11
+8th June, 1999
+
+- now only two executables, pptpd and pptpctrl
+- re-did dependency generation
+- minor include cleanups
+
+---------------------------------------------------------------------------
+v0.8.9 -> v0.8.10
+8th June, 1999
+
+- added getopt_long() from GNU libc for use on non-Linux platforms
+- fixed compilation on FreeBSD, Digital Unix and Solaris
+- replaced PPTPD_DEBUG define with configuration option (debug) and
+  command line option (-d/--debug)
+
+---------------------------------------------------------------------------
+v0.8.8 -> v0.8.9
+7th June, 1999
+
+- unified CTRL and GRE processes (removed pptpgre), without the vfork
+  problem since this is not forking
+- changed process name for child processes to pptpd [ip.address.here]
+- moved INTERNAL_IP_ALLOCATION to a configure option (see configure --help)
+- added support for libwrap tcp wrappers
+- made sure pppd doesn't get copies of file descriptors it shouldn't, so
+  it closes down properly
+- lots of other misc fixes
+
+---------------------------------------------------------------------------
+v0.8.7 -> v0.8.8
+4th June, 1999
+
+- increased MAX number of clients to 100
+- layout and comments have been tidied up extensively throughout code
+- new function in ctrlpacket.c for making Control Message headers
+- openBSD fixes
+- many other minor bug fixes
+- some portability issues addressed
+- accept() moved into pptpmanager.
+- pptpmanager closes one side of socketpair server fd and passes client fd
+    other side of socketpair to pptpctrl.
+- pptpmanager main loop changed to select without timeout and made to
+    watch ALL appropriate file descriptors.
+- also made resiliant against some potential error modes, eg, if we are
+    full don't select on new connections descriptor, if accept() fails
+    ignore it cleanly, etc.
+- should be more 'resource friendly' now.
+- Make error state filename instead of just CONFIG FILE: file not found.
+- Limit packet size to PACKET_MAX instead of permitting 4 more if no ACK
+    is bundled (for consistency of packet size limit).
+
+---------------------------------------------------------------------------
+v0.8.6 -> v0.8.7
+1st June, 1999
+
+- GRE seperated from pptpctrl to support vforking
+- adds link status detection (ie if a link goes down, we can figure it out
+    and deal with it) (Kevin)
+- Solaris/Slirp port (Harald Vogt)
+- cleaned up comments a lot (move towards C style to permit compiling in 
+    older compilers/increase portablity)
+- standardized #ifndef #define #endif defines in header files
+- stop inststr from nuking environment (hopefully)
+- use longer argv[0] in exec()s to make inststr much nicer
+- make inststr wipe args other than argv[0]
+- #define to remove some debugging (PPTPD_DEBUG) and to remove the
+    IP address allocation code so PPPD can be used to allocate IP addresses
+    (INTERNAL_IP_ALLOCATION)
+- in pptpctrl.c, main()'s addrlen was uninitialized - yuck, was causing
+    random variable overwriting
+- clean up some wasteful memory copying and so on, as well as remove some
+    copies into small static buffers
+- clean up some blank lines - increasing the amount of code visible one
+    screen is good if it can be done without making the formatting ugly.
+- use exit() not _exit() in pptpd - the fear of this closing fork()d
+    filedescriptors is wrong.  both have the same file descriptor closing
+    properties.
+- remove a potential leak of 2 filedescriptors in option parsing (checks
+    of optional file names).
+- miscellaneous EMBED support for syslog etc.
+- many other misc changes.
+
+---------------------------------------------------------------------------
+v0.8.5 -> v0.8.6
+21st May 1999
+
+- added new ip address reading from config file (for multiple connections)
+    there is a new pptpd configuration file example in samples/
+- pptpdebug.* is no longer... syslog now handles ALL debugging
+
+---------------------------------------------------------------------------
+v0.8.4 -> v0.8.5
+18th May 1999
+
+- command line args/config file options are broken (everything hardcoded)
+- many, many, many structural changes for a multiple connection hack
+- multiple connection support
+- reconnect support
+- OpenBSD port (may be broken for this release... Peter?)
+- logging now to syslog DAEMON|DEBUG
+
+---------------------------------------------------------------------------
+v0.8.3 -> v0.8.4
+13th May 1999
+
+- call_id/peer_id issues addressed in OUT_CALL packets
+- bug in debug log time fixed
+- local added by default to the pppd launcher
+- call_disconnect_notify bug fixed
+- -p command line arg broken
+
+---------------------------------------------------------------------------
+v0.8.2 -> v0.8.3
+11th May 1999
+
+- a few minor multiple connection hacks.. still nowhere near ready to
+    handle more than one client
+- pptpd -p logfile bug fix
+
+---------------------------------------------------------------------------
+v0.8.1 -> v0.8.2
+11th May 1999
+
+- Server will no longer die if client disconnects
+- pppd is closed down cleanly now
+- autoconf/automake is back.. but still needs some work
+- a number of minor CTRL establishment bugs fixed
+- callid assignment modified slightly in manager
+
+---------------------------------------------------------------------------
+v0.8.0 -> v0.8.1
+4th May 1999
+
+- PPTPD no longer relies on a signal (which had the potential to cause
+    a race condition) to know when to launch PPPD/GRE. The CTRL session
+    no longer relies on a signal to return from a fork. Signalling has
+    now been replaced with IPC between PPTPD and CTRL sessions.
+- The GRE/PPPD sessions are now launched *after* an OUT_CALL_RPLY is sent
+    not before it.
+- CTRL and PPTP managers are now seperate from PPTPD
+
+---------------------------------------------------------------------------
+v0.8.0
+30th April 1999
+
+PoPToP now works with windows 95/98/NT and Linux clients.

+ 130 - 0
ChangeLog-0.9

@@ -0,0 +1,130 @@
+PoPToP ChangeLog
+
+---------------------------------------------------------------------------
+v0.9.12 -> v0.9.13
+17 August, 1999
+
+- added pptpd.8
+- added pptpd.conf.5
+
+---------------------------------------------------------------------------
+v0.9.11 -> v0.9.12
+16 August, 1999
+
+- hand fixed bug in Makefile.in to work around automake bug (distdir
+  target)
+- made 'make dist' work
+- added pptpctrl.8
+- added HOWTO/FAQ to html/ and removed old docs
+
+---------------------------------------------------------------------------
+v0.9.10 -> v0.9.11
+8 August, 1999
+
+- increased "receive window size" to match the other side
+- improved behaviour if a network write ever fails
+- minor changes to macro names and operation of functions
+- check call id on incoming GRE packets
+
+---------------------------------------------------------------------------
+v0.9.9 -> v0.9.10
+2 August, 1999
+
+- keep a pid file - /var/run/pptpd.pid by default, overriden by config
+  option pidfile or commandline option -p/--pidfile
+- added another TODO item
+
+---------------------------------------------------------------------------
+v0.9.8 -> v0.9.9
+29 July, 1999
+
+- move libutil.h to after sys/types.h (FreeBSD 3.1)
+- add option file passing to SLIRP
+- reduce the number of variables used for option parsing/storage
+- add option to set local address to bind to ("listen")
+- configure script forces pppd ip allocation when needed, rather than
+  exiting on an error
+
+---------------------------------------------------------------------------
+v0.9.7 -> v0.9.8
+26 July, 1999
+
+- zero sockaddr_in (to blank out sin_len on BSD)
+- include libutil.h if there is one for openpty() proto (FreeBSD)
+- attempt to continue after failed bind() (OpenBSD?)
+
+---------------------------------------------------------------------------
+v0.9.6 -> v0.9.7
+22 July, 1999
+
+- added doc for setting up MPPE
+- use error names rather than numbers where easily possible
+
+---------------------------------------------------------------------------
+v0.9.5 -> v0.9.6
+15 July, 1999
+
+- moved binaries to /usr/local/sbin (ie, configure's --sbindir)
+- some documentation fixes
+- big warning about having to delete old /usr/local/sbin/pptp{d,ctrl,...}
+
+---------------------------------------------------------------------------
+v0.9.4 -> v0.9.5
+7 July, 1999
+
+- bad sequence number message made to detect duplicates and out of order
+  and report appropriately
+- show if libwrap is selected in configure script output
+- completely re-did connection termination to match draft spec (unfortunately
+  generates a warning when talking to Win98) 
+- changed capabilities to be more realistic
+- fixed echo reply processing (should prevent death when idle)
+- made call id handling more sane
+- made us always use the right call id in the right place
+- print errno on GRE write failures
+- bind GRE to address connection was received on
+
+---------------------------------------------------------------------------
+v0.9.3 -> v0.9.4
+5 July, 1999
+
+- fixed to detect Slackware 4.0 needing -lintl for gettext()
+- better fix for using different binary locations (cover --bindir too)
+- removed select() in ctrlpacket.c in favour of setting control sockets
+  to be nonblocking (for performance - plain read() is cheaper than
+  select() especially when you're pretty sure of success)
+
+---------------------------------------------------------------------------
+v0.9.2 -> v0.9.3
+2 July, 1999
+
+- changes to configure to fix SLIRP option and print out options chosen
+- configure --prefix fix
+
+---------------------------------------------------------------------------
+v0.9.1 -> v0.9.2
+17th June, 1999
+
+- made usage info not show details which aren't relevant to current config
+- made configure force pppd-ip-alloc on systems where we don't yet support
+  passing IP addresses to pppd (SLIRP, BSDUSER_PPP)
+- minor slirp fix for pppd startup detection
+
+---------------------------------------------------------------------------
+v0.9.0 -> v0.9.1
+17th June, 1999
+
+- made a few minor changes for slirp
+- added macros for PPTP packet creation and removed memcpy() where simple
+  assignment is sufficient; CPU usage should be lower
+- cleaned up call_id to always be passed around as a network byte order
+  u_int16_t
+- added some missing ntoh32() in pptpgre.c (currently no effect as ack_recv
+  is ignored)
+- speedups in GRE routines
+- no longer close stderr (fd 2) in pptpctrl.c to overcome problems where
+  syslog() is absent
+- increased debugging in openpty()
+
+---------------------------------------------------------------------------
+

+ 21 - 0
ChangeLog-1.1.3

@@ -0,0 +1,21 @@
+poptop (1.1.3-3) unstable; urgency=low
+
+  * v1.1.3-3
+  * Added stimeout option to pptpd.conf manpage
+  * Updated the Changelog file
+
+   -- R. de Vroede <richard@oip.tudelft.nl>  Thu, Aug 22 2002 11:34:05 +0200
+
+  * v1.1.3-2
+  * Removed debug commandline option from pptpd.init
+
+   -- R. de Vroede <richard@oip.tudelft.nl>  Tue, Aug 20 2002 11:34:05 +0200
+
+  * v1.1.3-1
+  * added config(noreplace) so old configs don't get replaced
+  * Fixed postscriptlet
+  * Adapted RPM specfile to cvs tree
+  * RPM specfile now supports --with[out] options
+
+   -- R. de Vroede <richard@oip.tudelft.nl>  Thu, Aug  1 2002 11:34:05 +0200
+

+ 1 - 1
Makefile.am

@@ -15,7 +15,7 @@ CFLAGS = -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
 #CFLAGS = -O2 -fno-builtin -Wall -ansi -DSBINDIR='"$(sbindir)"'
 #CFLAGS = -O2 -fno-builtin -Wall -ansi -DSBINDIR='"$(sbindir)"'
 #CFLAGS = -O2 -fno-builtin -Wall -ansi -pedantic -Wmissing-prototypes -Werror -DSBINDIR='"$(sbindir)"'
 #CFLAGS = -O2 -fno-builtin -Wall -ansi -pedantic -Wmissing-prototypes -Werror -DSBINDIR='"$(sbindir)"'
 
 
-man_MANS = pptpctrl.8 pptpd.8 pptpd.conf.5
+man_MANS = pptpctrl.8 pptpd.8 pptpd.conf.5 bcrelay.8
 
 
 EXTRA_DIST = \
 EXTRA_DIST = \
 html README* ChangeLog NEWS TODO $(man_MANS) \
 html README* ChangeLog NEWS TODO $(man_MANS) \

+ 3 - 1
Makefile.in

@@ -133,6 +133,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
 RANLIB = @RANLIB@
@@ -483,7 +484,8 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	    || exit 1; \
 	  fi; \
 	  fi; \
 	done
 	done
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	-find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
 	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \

+ 9 - 0
NEWS

@@ -1,3 +1,12 @@
+- add support for VRFs through libvrf [Lamparter]
+- fix implementation of IDLE_WAIT [Douglass]
+- fix compilation with uclibc with legacy support disabled [Hiramoto]
+- avoid ipparam and logwtmp on BSD [Cameron]
+- compiler fix for pptp_gre_header [Naess]
+- suppress "ignored a SET LINK INFO packet with real ACCMs" [Cameron]
+- add missing logwtmp option on pptpd.conf manyal page [Cameron]
+- fix reordering some more [Oester]
+
 1.3.4: released 2007-04-16
 1.3.4: released 2007-04-16
 
 
 - fix two release critical packet reordering bugs [Oester]
 - fix two release critical packet reordering bugs [Oester]

+ 88 - 0
PROTOCOL-SECURITY

@@ -0,0 +1,88 @@
+
+   Protocol Security
+
+   Summary
+
+                                                         by Peter Mueller
+
+   PPTP is known to be a faulty protocol. The designers of the protocol,
+   Microsoft, recommend not to use it due to the inherent risks. Lots of
+   people use PPTP anyway due to ease of use, but that doesn't mean it is
+   any less hazardous. The maintainers of PPTP Client and Poptop
+   recommend using OpenVPN (SSL based) or IPSec instead.
+
+   (Posted on [1]2005-08-10 to the [2]mailing list)
+     _________________________________________________________________
+
+   Why not use PPTP?
+
+                                                         by James Cameron
+
+   The point to point tunneling protocol (PPTP) is not secure enough for
+   some information security policies.
+
+   It's the nature of the MSCHAP V2 authentication, how it can be broken
+   trivially by capture of the datastream, and how MPPE depends on the
+   MSCHAP tokens for cryptographic keys. MPPE is also only 128-bit,
+   reasonably straightforward to attack, and the keys used at each end
+   are the same, which lowers the effort required to succeed. The obvious
+   lack of two-factor authentication, instead relying on a single
+   username and password, is also a risk. The increasing use of domestic
+   wireless systems makes information capture more likely.
+
+   However, that doesn't mean people don't accept the risks. There are
+   many corporations and individuals using PPTP with full knowledge of
+   these risks. Some use mitigating controls, and some don't.
+
+   Many people seem to judge the security of a protocol by the
+   availability of the implementation, the ease of installation, or the
+   level of documentation on our web site. Improving the documentation is
+   the purpose of this web site, and we aren't doing that in order to say
+   anything about the risks of the software! Any judgement of security
+   should be rigorously applied to the design and implementation alone.
+
+   PPTP on Linux, and Microsoft's PPTP, both implement fixes for
+   vulnerabilities that were detected years ago in Microsoft's PPTP. But
+   there remain the design vulnerabilities that cannot be fixed without
+   changing the design. The changes needed would break interoperability.
+   We can't change the Linux PPTP design, because it would stop working
+   with Microsoft PPTP. They can't change their design, because it would
+   stop working with all the other components out there, such as Nortel
+   and Cisco, embedded routers, ADSL modems and their own Windows
+   installed base.
+
+   The only option then is to deprecate the product and promote the
+   replacement. Microsoft promote something else. Our choice for Open
+   Source systems is OpenVPN or IPsec.
+
+   Level of acceptance isn't a good indicator of risk either. Some have
+   said that the shipping of MSCHAP V2, MPPE and PPTP in Linux
+   distributions is an indication of design security, but that's not the
+   reason. It's for interoperability. As an example, see how Linux
+   distributions still ship telnet, ftp, and rsh, even though these
+   components are insecure because they reveal the password in cleartext
+   in the network packets. The same can be said of many other components
+   and packages.
+
+   Our recommendations are;
+
+    1. do not implement PPTP between open source systems, because there's
+       no justification, better security can be had from OpenVPN or
+       IPsec,
+
+    2. do not implement PPTP servers unless the justification is that the
+       clients must not have to install anything to get going (Microsoft
+       PPTP is included already), and be aware of the risks of
+       information interception,
+
+    3. do not implement PPTP clients unless the justification is that the
+       server only provides PPTP, and there's nothing better that can be
+       used, and again be aware of the risks of information interception.
+
+   (Posted on [3]2005-08-10 to the [2]mailing list)
+
+References
+
+   1. http://marc.theaimsgroup.com/?l=poptop-server&m=112369621702624&w=2
+   2. http://pptpclient.sourceforge.net/contact.phtml#list
+   3. http://marc.theaimsgroup.com/?l=poptop-server&m=112365342910897&w=2

+ 6 - 6
README

@@ -1,7 +1,7 @@
-Poptop README
+PoPToP README
 -------------
 -------------
 
 
-You *must* do a 'make install' or Poptop will *NOT* find the binaries!
+You *must* do a 'make install' or PoPToP will *NOT* find the binaries!
 See INSTALL for generic compile/install instructions, and run
 See INSTALL for generic compile/install instructions, and run
 "./configure --help" for a list of valid options, or just type:
 "./configure --help" for a list of valid options, or just type:
 
 
@@ -11,20 +11,20 @@ make install
 
 
 (make install copies the binaries to /usr/local/sbin, so you better be root)
 (make install copies the binaries to /usr/local/sbin, so you better be root)
 
 
-To run Poptop simply type: 'pptpd' (or /usr/local/sbin/pptpd if you don't
+To run PoPToP simply type: 'pptpd' (or /usr/local/sbin/pptpd if you don't
 have /usr/local/sbin in your path).
 have /usr/local/sbin in your path).
 
 
 You may specify a number of options on the command line to change
 You may specify a number of options on the command line to change
-how Poptop launches PPP.
+how PoPToP launches PPPD.
 
 
 Type: 'pptpd -h' for options you may specify on the command line.
 Type: 'pptpd -h' for options you may specify on the command line.
 
 
 A sample config file is in samples/
 A sample config file is in samples/
 
 
 For more help look in html/
 For more help look in html/
-or visit the Poptop web site at: http://poptop.sourceforge.net/
+or visit the PoPToP Web site at: http://www.moretonbay.com/vpn/pptp.html
 
 
 
 
 Good Luck!
 Good Luck!
 
 
--Poptop Development Team
+-PoPToP Development Team

+ 91 - 0
RELEASING

@@ -0,0 +1,91 @@
+Releasing pptpd
+
+cvs update
+decide on version number
+update version number in the following files
+	pptpd.spec
+	configure.in
+	debian/changelog
+run ./reconf
+update NEWS, ChangeLog
+commit changes
+tag, see README.cvs, for example:
+	cvs tag -F pptpd-1_3_4
+make dist
+md5sum
+gpg --detach-sign --armor
+test
+
+
+Test Plan
+
+a) unpacks into subdirectory with correct package and version string,
+b) "./configure"
+c) "make" 
+d) "make install" 
+e) set configuration files for a tunnel, establish two tunnels, ping,
+   ssh, scp 10Mb random data, close tunnel, re-establish, ping, close
+   tunnels.
+f) "make uninstall"
+
+Packaging
+
+fakeroot rpmbuild -ta pptpd-1.3.4.tar.gz
+# fails
+mv /usr/src/rpm/SRPMS/pptpd-1.3.4-0.src.rpm .
+mv /usr/src/rpm/RPMS/i386/pptpd-1.3.4-0.i386.rpm .
+
+SourceForge
+
+ftp -n upload.sourceforge.net <<EOF
+user anonymous qz@hp.com
+cd incoming
+hash
+passive
+put pptpd-1.3.4.tar.gz
+put pptpd-1.3.4-0.src.rpm
+put pptpd-1.3.4-0.i386.rpm
+quit
+EOF
+http://sourceforge.net/
+Login
+Poptop
+Admin
+File Releases
+Add Release "pptpd-1.3.4 (experimental)" to package "pptpd"
+
+Announcement
+
+To: poptop-server@lists.sourceforge.net
+Subject: pptpd-1.3.4 released
+
+G'day,
+
+pptpd 1.3.4 has been released.
+
+Please reply to the mailing list with your test results.
+
+See:
+        http://sourceforge.net/projects/poptop (click on Files)
+        http://sourceforge.net/project/showfiles.php?group_id=44827
+
+Checksums:
+	b38df9c431041922c997c1148bedf591  pptpd-1.3.4.tar.gz
+
+Changes to pptpd since 1.3.3 are:
+- fix two release critical packet reordering bugs [Oester]
+- accept both types of domain delimiter [Cameron]
+- deprecate PPP_WAIT workaround in favour of turning off pty echo [Brady]
+
+See the detailed ChangeLog
+
+--
+
+Cryptographically sign the mail.
+
+--
+
+Update versions.inc on web site http://poptop.sourceforge.net/
+Update versions on web site http://poptop.org/ via robertw@snapgear.com
+
+--

+ 0 - 0
acconfig.h


+ 59 - 0
bcrelay.8

@@ -0,0 +1,59 @@
+.TH BCRELAY "8" "31 Dec 2010" "Version 1.3.4" "BCRELAY MANUAL PAGE"
+.SH NAME
+\fBbcrelay\fR \- a broadcast relay daemon
+.SH SYNOPSIS
+.B bcrelay
+[\fIOPTION\fR]...
+.SH DESCRIPTION
+.B bcrelay
+simply plays as a broadcast repeater. When \fBbcrelay\fR receives packets
+from the incomming interface, it will then relay them to the outgoing
+interface.
+.LP
+.SH OPTIONS
+.TP
+\fB-d\fR,\fB\-\-daemon\fR
+Run \fBbcrelay\fR as a daemon.
+.TP
+\fB-h\fR,\fB\-\-help\fR
+Show help message.
+.TP
+\fB-i\fR,\fB\-\-incoming\fR \fIinterface-in
+Defines from which interface broadcasts will be read.
+.TP
+\fB-s\fR,\fB\-\-outgoing\fR \fIinterface-out
+Defines to which interface broadcasts will be relayed.
+.TP
+\fB-n\fR,\fB\-\-nolog\fR
+Disable any logging and tracing to /var/log/messages except fatal error
+messages.
+.TP
+\fB-s\fR,\fB\-\-ipsec\fR \fIargument\fR
+Defines an ipsec tunnel to be relayed to. Since ipsec tunnels terminate on
+the same interface, we need to define the broadcast address of the other
+end-point of the tunnel. This is done as ipsec0:x.x.x.255.
+.TP
+\fB-v\fR,\fB\-\-version\fR
+Show the version of \fBbcrelay\fR.
+.TP
+Log messages and debugging information go to syslog as daemon.
+.TP
+Interfaces can be specified as regexpressions, ie. ppp[0-9]+.
+.SH AUTHORS
+.sp
+Original \fBbcrelay\fR program was written by Luc Richards
+<TheyCallMeLuc@yahoo.com.au>.
+
+.sp
+\fBBcrelay\fR was modified for \fBpoptop\fR by Richard de Vroede
+<r.devroede@linvision.com> and rewritten by Norbert van Bolhuis
+<norbert@vanbolhuis.demon.nl> for version (v1.0+) of \fBbcrelay\fR.
+
+.sp
+This manual page was written by Nguyen Vinh for Debian GNU/Linux System (but
+may be used for others). Permission is granted to copy, distribute and/or
+modify this document under the terms of the GNU General Public License
+Version 2, and any later versions published by Free Software Foundation.
+There is no WARRANTY, to the extent permitted by the law.
+.SH SEE ALSO
+For more detailed information about \fBbcrelay\fR, please read README.

+ 12 - 11
bcrelay.c

@@ -212,10 +212,11 @@ static int vdaemon = 0;
 #define NVBCR_PRINTF( args ) \
 #define NVBCR_PRINTF( args ) \
  if ((vdaemon == 0) && (do_org_info_printfs == 1)) printf args
  if ((vdaemon == 0) && (do_org_info_printfs == 1)) printf args
 
 
+static char empty[1] = "";
 static char interfaces[32];
 static char interfaces[32];
 static char log_interfaces[MAX_IFLOGTOSTR*MAXIF];
 static char log_interfaces[MAX_IFLOGTOSTR*MAXIF];
 static char log_relayed[(MAX_IFLOGTOSTR-1)*MAXIF+81];
 static char log_relayed[(MAX_IFLOGTOSTR-1)*MAXIF+81];
-static char *ipsec = "";
+static char *ipsec = empty;
 
 
 static void showusage(char *prog)
 static void showusage(char *prog)
 {
 {
@@ -310,8 +311,8 @@ int main(int argc, char **argv) {
   regex_t preg;
   regex_t preg;
   /* command line options */
   /* command line options */
   int c;
   int c;
-  char *ifout = "";
-  char *ifin = "";
+  char *ifout = empty;
+  char *ifin = empty;
 
 
 #ifndef BCRELAY
 #ifndef BCRELAY
   fprintf(stderr,
   fprintf(stderr,
@@ -381,12 +382,12 @@ int main(int argc, char **argv) {
                         return 1;
                         return 1;
                 }
                 }
   }
   }
-  if (ifin == "") {
+  if (ifin == empty) {
        syslog(LOG_INFO,"Incoming interface required!");
        syslog(LOG_INFO,"Incoming interface required!");
        showusage(argv[0]);
        showusage(argv[0]);
        _exit(1);
        _exit(1);
   }
   }
-  if (ifout == "" && ipsec == "") {
+  if (ifout == empty && ipsec == empty) {
        syslog(LOG_INFO,"Listen-mode or outgoing or IPsec interface required!");
        syslog(LOG_INFO,"Listen-mode or outgoing or IPsec interface required!");
        showusage(argv[0]);
        showusage(argv[0]);
        _exit(1);
        _exit(1);
@@ -431,7 +432,7 @@ static void mainloop(int argc, char **argv)
   static struct ifsnr old_ifsnr[MAXIF+1]; // Old iflist to socket fd's mapping list
   static struct ifsnr old_ifsnr[MAXIF+1]; // Old iflist to socket fd's mapping list
   static struct ifsnr cur_ifsnr[MAXIF+1]; // Current iflist to socket fd's mapping list
   static struct ifsnr cur_ifsnr[MAXIF+1]; // Current iflist to socket fd's mapping list
   unsigned char buf[1518];
   unsigned char buf[1518];
-  char *logstr = "";
+  char *logstr = empty;
 
 
   no_discifs_cntr = MAX_NODISCOVER_IFS;
   no_discifs_cntr = MAX_NODISCOVER_IFS;
   ifs_change = 0;
   ifs_change = 0;
@@ -773,7 +774,7 @@ struct iflist *
 discoverActiveInterfaces(int s) {
 discoverActiveInterfaces(int s) {
   static struct iflist iflist[MAXIF+1];         // Allow for MAXIF interfaces
   static struct iflist iflist[MAXIF+1];         // Allow for MAXIF interfaces
   static struct ifconf ifs;
   static struct ifconf ifs;
-  int i, j, cntr = 0;
+  int i, cntr = 0;
   regex_t preg;
   regex_t preg;
   struct ifreq ifrflags, ifr;
   struct ifreq ifrflags, ifr;
   struct sockaddr_in *sin;
   struct sockaddr_in *sin;
@@ -816,9 +817,9 @@ discoverActiveInterfaces(int s) {
         /*
         /*
          * Get interface name
          * Get interface name
          */
          */
-        for (j=0; (j<sizeof(iflist[cntr].ifname) && j<strlen(ifs.ifc_req[i].ifr_ifrn.ifrn_name)); ++j)
-                iflist[cntr].ifname[j] = ifs.ifc_req[i].ifr_ifrn.ifrn_name[j];
-        iflist[cntr].ifname[j+1] = '\0';
+        strncpy(iflist[cntr].ifname, ifs.ifc_req[i].ifr_ifrn.ifrn_name,
+                sizeof(iflist[cntr].ifname));
+        iflist[cntr].ifname[sizeof(iflist[cntr].ifname)-1] = 0;
 
 
         /*
         /*
          * Get local IP address 
          * Get local IP address 
@@ -870,7 +871,7 @@ discoverActiveInterfaces(int s) {
     // IPSEC tunnels are a fun one.  We must change the destination address
     // IPSEC tunnels are a fun one.  We must change the destination address
     // so that it will be routed to the correct tunnel end point.
     // so that it will be routed to the correct tunnel end point.
     // We can define several tunnel end points for the same ipsec interface.
     // We can define several tunnel end points for the same ipsec interface.
-    } else if (ipsec != "" && strncmp(ifs.ifc_req[i].ifr_name, "ipsec", 5) == 0) {
+    } else if (ipsec != empty && strncmp(ifs.ifc_req[i].ifr_name, "ipsec", 5) == 0) {
       if (strncmp(ifs.ifc_req[i].ifr_name, ipsec, 6) == 0) {
       if (strncmp(ifs.ifc_req[i].ifr_name, ipsec, 6) == 0) {
         struct hostent *hp = gethostbyname(ipsec+7);
         struct hostent *hp = gethostbyname(ipsec+7);
         ioctl(s, SIOCGIFINDEX, &ifs.ifc_req[i]);
         ioctl(s, SIOCGIFINDEX, &ifs.ifc_req[i]);

+ 11 - 0
build.sh

@@ -0,0 +1,11 @@
+#!/bin/sh
+echo "build.sh: superceded by makepackage"
+exit 1
+
+POPTOPVERSION=`./version`
+CURRENTDIR=`pwd`
+THISDIR=${CURRENTDIR##*/}
+if [ -f /etc/redhat-release ]; then
+   tar -czf /usr/src/redhat/SOURCES/pptpd-${POPTOPVERSION}.tar.gz .
+   rpmbuild -ta /usr/src/redhat/SOURCES/pptpd-${POPTOPVERSION}.tar.gz
+fi

+ 0 - 0
compat.c


+ 0 - 0
compat.h


+ 7 - 1
config.h.in

@@ -4,7 +4,7 @@
  *
  *
  * Additional autoconf defines for this program.
  * Additional autoconf defines for this program.
  *
  *
- * $Id: config.h.in,v 1.25 2007/04/16 01:08:47 quozl Exp $
+ * $Id: config.h.in,v 1.26 2011/05/19 00:02:50 quozl Exp $
  */
  */
 
 
 /* Use BSD User land PPP? */
 /* Use BSD User land PPP? */
@@ -151,6 +151,9 @@
 /* Define to the one symbol short name of this package. */
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 #undef PACKAGE_TARNAME
 
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 #undef PACKAGE_VERSION
 
 
@@ -160,6 +163,9 @@
 /* Version number of package */
 /* Version number of package */
 #undef VERSION
 #undef VERSION
 
 
+/* Use vrf_socket from vrf library */
+#undef VRF
+
 /* Define to empty if `const' does not conform to ANSI C. */
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 #undef const
 
 

+ 11 - 7
configfile.c

@@ -4,7 +4,7 @@
  * Methods for accessing the PPTPD config file and searching for
  * Methods for accessing the PPTPD config file and searching for
  * PPTPD keywords.
  * PPTPD keywords.
  *
  *
- * $Id: configfile.c,v 1.2 2004/04/22 10:48:16 quozl Exp $
+ * $Id: configfile.c,v 1.3 2013/02/07 00:23:27 quozl Exp $
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
@@ -57,14 +57,18 @@ int read_config_file(char *filename, char *keyword, char *value)
 	while ((fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in)) != NULL) {
 	while ((fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in)) != NULL) {
 		/* ignore long lines */
 		/* ignore long lines */
 		if (buffer[(len = strlen(buffer)) - 1] != '\n') {
 		if (buffer[(len = strlen(buffer)) - 1] != '\n') {
-			syslog(LOG_ERR, "Long config file line ignored.");
-			do
-				fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in);
-			while (buffer[strlen(buffer) - 1] != '\n');
-			continue;
+			if (len >= MAX_CONFIG_STRING_SIZE - 2) {
+				syslog(LOG_ERR, "Long config file line ignored.");
+				char *p;
+				do
+					p = fgets(buffer, MAX_CONFIG_STRING_SIZE - 1, in);
+				while (p && buffer[strlen(buffer) - 1] != '\n');
+				continue;
+			}
+		} else {
+			len--;			/* For the NL at the end */
 		}
 		}
 
 
-		len--;			/* For the NL at the end */
 		while (--len >= 0)
 		while (--len >= 0)
 			if (buffer[len] != ' ' && buffer[len] != '\t')
 			if (buffer[len] != ' ' && buffer[len] != '\t')
 				break;
 				break;

+ 1 - 1
configfile.h

@@ -3,7 +3,7 @@
  *
  *
  * Function to read pptpd config file.
  * Function to read pptpd config file.
  *
  *
- * $Id: configfile.h,v 1.1.1.1 2002/06/21 08:51:55 fenix_nl Exp $
+ * $Id: configfile.h,v 1.1 2002/06/21 08:51:55 fenix_nl Exp $
  */
  */
 
 
 #ifndef _PPTPD_CONFIGFILE_H
 #ifndef _PPTPD_CONFIGFILE_H

File diff suppressed because it is too large
+ 2873 - 4140
configure


+ 45 - 4
configure.in

@@ -86,6 +86,26 @@ AC_ARG_ENABLE(bcrelay,
 	    esac
 	    esac
 	], [AC_MSG_RESULT(default no)])
 	], [AC_MSG_RESULT(default no)])
 
 
+AC_MSG_CHECKING(command line for VRF build)
+AC_ARG_ENABLE(vrf,
+	[  --enable-vrf              Enable support for VRFs],
+	[
+	    case "$enableval" in
+		yes)
+		    AC_MSG_RESULT(yes)
+		    VRF=$enableval
+		    ;;
+		no)
+		    AC_MSG_RESULT(explicit no)
+		    ;;
+		*)
+		    AC_MSG_RESULT(unrecognised... terminating)
+		    exit 1
+		    ;;
+	    esac
+	], [AC_MSG_RESULT(default no)])
+
+
 AC_PROG_CC
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_PROG_INSTALL
@@ -207,10 +227,6 @@ if test "$ac_cv_header_libintl_h" = yes; then
   fi
   fi
 fi
 fi
 
 
-AC_SUBST(XTRALIBS_CTRL)
-AC_SUBST(XTRALIBS_MGR)
-AC_SUBST(HAVE_OPENPTY)
-
 if test "$BCRELAY" = "yes"; then
 if test "$BCRELAY" = "yes"; then
   if test "$BCRELAY" = "yes"; then
   if test "$BCRELAY" = "yes"; then
     XTRA_PROG="bcrelay"
     XTRA_PROG="bcrelay"
@@ -220,7 +236,25 @@ if test "$BCRELAY" = "yes"; then
   fi
   fi
 fi
 fi
 
 
+if test "$VRF" = "yes"; then
+	AC_CHECKING([for vrf Library and Header files])
+	AC_CHECK_HEADER(vrf.h, ,
+		AC_MSG_ERROR([vrf headers were not found])
+	)
+
+	AC_CHECK_LIB(vrf, vrf_socket, [
+		AC_DEFINE(VRF, 1, [Use vrf_socket from vrf library])
+		XTRALIBS_CTRL="$XTRALIBS_CTRL -lvrf"
+		XTRALIBS_MGR="$XTRALIBS_MGR -lvrf"
+	], [
+		AC_MSG_ERROR(vrf library was not found)
+	])
+fi
+
+AC_SUBST(XTRALIBS_CTRL)
+AC_SUBST(XTRALIBS_MGR)
 AC_SUBST(XTRA_PROG)
 AC_SUBST(XTRA_PROG)
+AC_SUBST(HAVE_OPENPTY)
 
 
 echo '==============================================================================='
 echo '==============================================================================='
 
 
@@ -251,5 +285,12 @@ else
   echo 'No.'
   echo 'No.'
 fi
 fi
 
 
+echo -n '   VRF support:        '
+if test "$VRF" = "yes"; then
+  echo 'Yes.'
+else
+  echo 'No.'
+fi
+
 AC_CACHE_SAVE
 AC_CACHE_SAVE
 AC_OUTPUT(Makefile)
 AC_OUTPUT(Makefile)

+ 19 - 12
ctrlpacket.c

@@ -3,7 +3,7 @@
  *
  *
  * PPTP Control Message packet reading, formatting and writing.
  * PPTP Control Message packet reading, formatting and writing.
  *
  *
- * $Id: ctrlpacket.c,v 1.6 2005/08/03 09:10:59 quozl Exp $
+ * $Id: ctrlpacket.c,v 1.8 2008/11/13 23:49:22 quozl Exp $
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
@@ -69,7 +69,7 @@ static int make_out_call_rqst(unsigned char *rply_packet, ssize_t * rply_size);
 int read_pptp_packet(int clientFd, unsigned char *packet, unsigned char *rply_packet, ssize_t * rply_size)
 int read_pptp_packet(int clientFd, unsigned char *packet, unsigned char *rply_packet, ssize_t * rply_size)
 {
 {
 
 
-	size_t bytes_read;
+	ssize_t bytes_read;
 	int pptp_ctrl_type = 0;	/* Control Message Type */
 	int pptp_ctrl_type = 0;	/* Control Message Type */
 
 
 	/* read a packet and parse header */
 	/* read a packet and parse header */
@@ -133,10 +133,10 @@ int read_pptp_packet(int clientFd, unsigned char *packet, unsigned char *rply_pa
  * retn:        Number of bytes written on success.
  * retn:        Number of bytes written on success.
  *              -1 on write failure.
  *              -1 on write failure.
  */
  */
-size_t send_pptp_packet(int clientFd, unsigned char *packet, size_t packet_size)
+ssize_t send_pptp_packet(int clientFd, unsigned char *packet, size_t packet_size)
 {
 {
 
 
-	size_t bytes_written;
+	ssize_t bytes_written;
 
 
 	if ((bytes_written = write(clientFd, packet, packet_size)) == -1) {
 	if ((bytes_written = write(clientFd, packet, packet_size)) == -1) {
 		/* write failed */
 		/* write failed */
@@ -146,7 +146,7 @@ size_t send_pptp_packet(int clientFd, unsigned char *packet, size_t packet_size)
 	} else {
 	} else {
 		/* debugging */
 		/* debugging */
 		if (pptpctrl_debug) {
 		if (pptpctrl_debug) {
-			syslog(LOG_DEBUG, "CTRL: I wrote %d bytes to the client.", packet_size);
+			syslog(LOG_DEBUG, "CTRL: I wrote %lu bytes to the client.", (unsigned long) packet_size);
 			syslog(LOG_DEBUG, "CTRL: Sent packet to client");
 			syslog(LOG_DEBUG, "CTRL: Sent packet to client");
 		}
 		}
 		return bytes_written;
 		return bytes_written;
@@ -237,7 +237,7 @@ ssize_t read_pptp_header(int clientFd, unsigned char *packet, int *pptp_ctrl_typ
 						return(0);
 						return(0);
 					memcpy(buffer, packet, bytes_ttl);
 					memcpy(buffer, packet, bytes_ttl);
 				}
 				}
-				syslog(LOG_ERR, "CTRL: Error reading ctrl packet length (bytes_ttl=%d): %s", bytes_ttl, strerror(errno));
+				syslog(LOG_ERR, "CTRL: Error reading ctrl packet length (bytes_ttl=%lu): %s", (unsigned long) bytes_ttl, strerror(errno));
 				return -1;
 				return -1;
 			}
 			}
 			/* FALLTHRU */
 			/* FALLTHRU */
@@ -291,7 +291,7 @@ ssize_t read_pptp_header(int clientFd, unsigned char *packet, int *pptp_ctrl_typ
 					return(0);
 					return(0);
 				memcpy(buffer, packet, bytes_ttl);
 				memcpy(buffer, packet, bytes_ttl);
 			}
 			}
-			syslog(LOG_ERR, "CTRL: Error reading ctrl packet (bytes_ttl=%d,length=%d): %s", bytes_ttl, length, strerror(errno));
+			syslog(LOG_ERR, "CTRL: Error reading ctrl packet (bytes_ttl=%lu,length=%d): %s", (unsigned long) bytes_ttl, length, strerror(errno));
 			return -1;
 			return -1;
 		}
 		}
 		/* FALLTHRU */
 		/* FALLTHRU */
@@ -377,9 +377,9 @@ void deal_start_ctrl_conn(unsigned char *packet, unsigned char *rply_packet, ssi
 	start_ctrl_conn_rply.bearer_cap = htons(OUR_BEARER);
 	start_ctrl_conn_rply.bearer_cap = htons(OUR_BEARER);
 	start_ctrl_conn_rply.max_channels = htons(MAX_CHANNELS);
 	start_ctrl_conn_rply.max_channels = htons(MAX_CHANNELS);
 	start_ctrl_conn_rply.firmware_rev = htons(PPTP_FIRMWARE_VERSION);
 	start_ctrl_conn_rply.firmware_rev = htons(PPTP_FIRMWARE_VERSION);
-	bzero(start_ctrl_conn_rply.hostname, MAX_HOSTNAME_SIZE);
+	memset(start_ctrl_conn_rply.hostname, 0, MAX_HOSTNAME_SIZE);
 	strncpy((char *)start_ctrl_conn_rply.hostname, PPTP_HOSTNAME, MAX_HOSTNAME_SIZE);
 	strncpy((char *)start_ctrl_conn_rply.hostname, PPTP_HOSTNAME, MAX_HOSTNAME_SIZE);
-	bzero(start_ctrl_conn_rply.vendor, MAX_VENDOR_SIZE);
+	memset(start_ctrl_conn_rply.vendor, 0, MAX_VENDOR_SIZE);
 	strncpy((char *)start_ctrl_conn_rply.vendor, PPTP_VENDOR, MAX_VENDOR_SIZE);
 	strncpy((char *)start_ctrl_conn_rply.vendor, PPTP_VENDOR, MAX_VENDOR_SIZE);
 	COPY_CTRL_PACKET(start_ctrl_conn_rply, rply_packet, rply_size);
 	COPY_CTRL_PACKET(start_ctrl_conn_rply, rply_packet, rply_size);
 	DEBUG_PACKET("START CTRL CONN RPLY");
 	DEBUG_PACKET("START CTRL CONN RPLY");
@@ -541,9 +541,16 @@ void deal_set_link_info(unsigned char *packet)
 	struct pptp_set_link_info *set_link_info;
 	struct pptp_set_link_info *set_link_info;
 
 
 	set_link_info = (struct pptp_set_link_info *) packet;
 	set_link_info = (struct pptp_set_link_info *) packet;
-	if(set_link_info->send_accm != 0xffffffff || set_link_info->recv_accm != 0xffffffff)
-		syslog(LOG_ERR, "CTRL: Ignored a SET LINK INFO packet with real ACCMs!");
-	else if(pptpctrl_debug)
+	if (set_link_info->send_accm != 0xffffffff || set_link_info->recv_accm != 0xffffffff) {
+		/* Async-Control-Character-Map (ACCM) are bits that
+		   show which control characters should be escaped by the
+		   PPP implementation ... pptpd leaves pppd to negotiate
+		   that via LCP and does not process SET LINK INFO
+		   packets ... this is not complaint with the RFC but
+		   still works. */
+		if (pptpctrl_debug)
+			syslog(LOG_DEBUG, "CTRL: Ignored a SET LINK INFO packet with real ACCMs! (intentional non-compliance with section 2.15 of RFC 2637, ACCM is negotiated by PPP LCP asyncmap)");
+	} else if (pptpctrl_debug)
 		syslog(LOG_DEBUG, "CTRL: Got a SET LINK INFO packet with standard ACCMs");
 		syslog(LOG_DEBUG, "CTRL: Got a SET LINK INFO packet with standard ACCMs");
 }
 }
 
 

+ 2 - 2
ctrlpacket.h

@@ -3,14 +3,14 @@
  *
  *
  * Functions to parse and send pptp control packets.
  * Functions to parse and send pptp control packets.
  *
  *
- * $Id: ctrlpacket.h,v 1.1.1.1 2002/06/21 08:51:58 fenix_nl Exp $
+ * $Id: ctrlpacket.h,v 1.1 2002/06/21 08:51:58 fenix_nl Exp $
  */
  */
 
 
 #ifndef _PPTPD_CTRLPACKET_H
 #ifndef _PPTPD_CTRLPACKET_H
 #define _PPTPD_CTRLPACKET_H
 #define _PPTPD_CTRLPACKET_H
 
 
 int read_pptp_packet(int clientFd, unsigned char *packet, unsigned char *rply_packet, ssize_t * rply_size);
 int read_pptp_packet(int clientFd, unsigned char *packet, unsigned char *rply_packet, ssize_t * rply_size);
-size_t send_pptp_packet(int clientFd, unsigned char *packet, size_t packet_size);
+ssize_t send_pptp_packet(int clientFd, unsigned char *packet, size_t packet_size);
 void make_echo_req_packet(unsigned char *rply_packet, ssize_t * rply_size, u_int32_t echo_id);
 void make_echo_req_packet(unsigned char *rply_packet, ssize_t * rply_size, u_int32_t echo_id);
 void make_call_admin_shutdown(unsigned char *rply_packet, ssize_t * rply_size);
 void make_call_admin_shutdown(unsigned char *rply_packet, ssize_t * rply_size);
 void make_stop_ctrl_req(unsigned char *rply_packet, ssize_t * rply_size);
 void make_stop_ctrl_req(unsigned char *rply_packet, ssize_t * rply_size);

+ 28 - 29
debian/changelog

@@ -44,14 +44,14 @@ pptpd (1.3.4-4) unstable; urgency=low
     plugin.
     plugin.
     Closes: #610375: remotenumber support
     Closes: #610375: remotenumber support
   * Report that the init script also supports a "status" option.
   * Report that the init script also supports a "status" option.
-    Closes: #536424: init.d script error message does not mention 
+    Closes: #536424: init.d script error message does not mention
                      "status" action
                      "status" action
 
 
  -- Rene Mayrhofer <rmayr@debian.org>  Tue, 29 Mar 2011 11:03:36 +0200
  -- Rene Mayrhofer <rmayr@debian.org>  Tue, 29 Mar 2011 11:03:36 +0200
 
 
 pptpd (1.3.4-3) unstable; urgency=low
 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 
+  * Add build-dependency to ppp-dev >=2.4.5-3 and depend on ppp >=2.4.5-3
     to make logwtmp plugin work again.
     to make logwtmp plugin work again.
     Closes: #593278: ppp 2.4.5 implies a recompilation pf pptpd
     Closes: #593278: ppp 2.4.5 implies a recompilation pf pptpd
   * Fixed a typo in the README file.
   * Fixed a typo in the README file.
@@ -74,7 +74,7 @@ pptpd (1.3.4-2) unstable; urgency=low
     Closes: #416404: pptpd freeze
     Closes: #416404: pptpd freeze
   * Use the new configure option for bcrelay support.
   * Use the new configure option for bcrelay support.
     Closes: #421999: No bcrelay support in pptpd
     Closes: #421999: No bcrelay support in pptpd
-    Closes: #424764: pptpd: bcrelay support missing 
+    Closes: #424764: pptpd: bcrelay support missing
 
 
  -- Rene Mayrhofer <rmayr@debian.org>  Mon, 21 May 2007 23:31:53 +0100
  -- Rene Mayrhofer <rmayr@debian.org>  Mon, 21 May 2007 23:31:53 +0100
 
 
@@ -93,25 +93,25 @@ pptpd (1.3.0-2) unstable; urgency=high
     Closes: #396187 pptpd: Patch to disable unnecessary lines in syslog
     Closes: #396187 pptpd: Patch to disable unnecessary lines in syslog
   * Update to work with pppd 2.4.4b1. Thanks to Stu Teasdalefor the
   * Update to work with pppd 2.4.4b1. Thanks to Stu Teasdalefor the
     patch.
     patch.
-    Closes: #369714: pptpd-logwtmp.so does not work with ppp 2.4.4b1 
+    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
     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
   * Add a comment to the default config file that points to a Windows
     bug. Thanks to Stéphane Rosi for the patch.
     bug. Thanks to Stéphane Rosi for the patch.
     Closes: #384523: pptpd: Warn about a bug in Microsoft Windows VPN
     Closes: #384523: pptpd: Warn about a bug in Microsoft Windows VPN
-                     client 
+                     client
 
 
  -- Rene Mayrhofer <rmayr@debian.org>  Mon,  6 Nov 2006 18:35:28 +0000
  -- Rene Mayrhofer <rmayr@debian.org>  Mon,  6 Nov 2006 18:35:28 +0000
 
 
 pptpd (1.3.0-1) unstable; urgency=low
 pptpd (1.3.0-1) unstable; urgency=low
 
 
   * New upstream release.
   * New upstream release.
-    Closes: #366395: pptpd: New Upstream version - fixes reordering and 
+    Closes: #366395: pptpd: New Upstream version - fixes reordering and
                      loopback bugs
                      loopback bugs
     This release also includes the patches contributed by Ilguiz Latypov to
     This release also includes the patches contributed by Ilguiz Latypov to
-    allow multiple control connections from the same client IP (e.g. for 
+    allow multiple control connections from the same client IP (e.g. for
     multiple clients behind the same NAT connecting to the same pptpd server).
     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.
     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 
+    Closes: #171831: pptpd allocates call ID 0 for every new TCP link
   * Acknowledge NMU. Thanks to Luk for helping out.
   * Acknowledge NMU. Thanks to Luk for helping out.
     Closes: #356104: diff for 1.2.3-1.1 NMU of pptpd
     Closes: #356104: diff for 1.2.3-1.1 NMU of pptpd
     Closes: #350456: bcrelay: Should "Conflicts: pptpd (<< 1.2.3-1)"
     Closes: #350456: bcrelay: Should "Conflicts: pptpd (<< 1.2.3-1)"
@@ -130,11 +130,11 @@ pptpd (1.2.3-1) unstable; urgency=low
 
 
   * New upstream release.
   * New upstream release.
   * Added watch file.
   * Added watch file.
-  * Manually updated the pppd headers for the logwtmp plugin again. 
+  * 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.
     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
     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 
+  * 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).
     to use it and recommends are still handled rather poorly).
     Closes: #347414: pptpd: Splitting bcrelay as a separate package
     Closes: #347414: pptpd: Splitting bcrelay as a separate package
   * Update dh_compat to level 4 now.
   * Update dh_compat to level 4 now.
@@ -156,15 +156,15 @@ pptpd (1.2.1-4) unstable; urgency=low
     reflect this in the depends.
     reflect this in the depends.
     Thanks to Norman Rasmussen for actually suggesting this simple fix for
     Thanks to Norman Rasmussen for actually suggesting this simple fix for
     this bug report.
     this bug report.
-    Closes: #305012: logwtmp plugin is for pppd version 2.4.3, but version 
-                     is 2.4.2 
+    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
  -- Rene Mayrhofer <rmayr@debian.org>  Tue, 19 Apr 2005 14:33:55 +0200
 
 
 pptpd (1.2.1-3) unstable; urgency=low
 pptpd (1.2.1-3) unstable; urgency=low
 
 
   * Updated the ppp headers for the pppd plugin to ppp 2.4.3.
   * 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 
+    Closes: #297508: new pppd 2.4.3 in sid failed to start with
                      /usr/lib/pptpd/pptpd-logwtmp.so
                      /usr/lib/pptpd/pptpd-logwtmp.so
 
 
  -- Rene Mayrhofer <rmayr@debian.org>  Mon,  4 Apr 2005 14:48:16 +0200
  -- Rene Mayrhofer <rmayr@debian.org>  Mon,  4 Apr 2005 14:48:16 +0200
@@ -179,10 +179,10 @@ pptpd (1.2.1-2) unstable; urgency=low
   * Fixed upstream URL in the copyright file.
   * Fixed upstream URL in the copyright file.
     Closes: #261240: pptpd: Wrong upstream url
     Closes: #261240: pptpd: Wrong upstream url
   * Patched logwtmp to work with ppp 2.4.2 instead of 2.4.3 (patch provided by upstream).
   * 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 
+    Closes: #259487: pptpd: Issue with logwtmp being for verison 2.4.3 in
                      pptpd 1.2.1-1
                      pptpd 1.2.1-1
   * Removed (not implemented) "reload" target from init.d script, upstream does not provide a reload mechanism.
   * Removed (not implemented) "reload" target from init.d script, upstream does not provide a reload mechanism.
-  * Changed Standards-Version to 3.6.1.0. 
+  * Changed Standards-Version to 3.6.1.0.
 
 
  -- Rene Mayrhofer <rene@mayrhofer.eu.org>  Sun,  5 Sep 2004 17:05:35 +0200
  -- Rene Mayrhofer <rene@mayrhofer.eu.org>  Sun,  5 Sep 2004 17:05:35 +0200
 
 
@@ -194,15 +194,15 @@ pptpd (1.2.1-1) unstable; urgency=low
     Closes: #239211: pptpd: Japanese po-debconf template translation (ja.po)
     Closes: #239211: pptpd: Japanese po-debconf template translation (ja.po)
   * Additionally install README.logwtmp and README.portslave under
   * Additionally install README.logwtmp and README.portslave under
     /usr/share/doc/pptpd now.
     /usr/share/doc/pptpd now.
-    
+
  -- Rene Mayrhofer <rmayr@debian.org>  Wed, 30 Jun 2004 10:24:51 +0200
  -- Rene Mayrhofer <rmayr@debian.org>  Wed, 30 Jun 2004 10:24:51 +0200
 
 
 pptpd (1.2.0-1) unstable; urgency=low
 pptpd (1.2.0-1) unstable; urgency=low
 
 
   * New upstream version.
   * New upstream version.
-    Closes: #107933: pptpd: pptpd segfaults if called without arguments 
-    Closes: #126486: pptpd: wish it had better integration support with 
-    		     Portslave 
+    Closes: #107933: pptpd: pptpd segfaults if called without arguments
+    Closes: #126486: pptpd: wish it had better integration support with
+    		     Portslave
 
 
  -- Rene Mayrhofer <rmayr@debian.org>  Tue,  4 May 2004 09:54:01 +0200
  -- Rene Mayrhofer <rmayr@debian.org>  Tue,  4 May 2004 09:54:01 +0200
 
 
@@ -214,17 +214,17 @@ pptpd (1.1.4.0b4-1) unstable; urgency=low
     Closes: #57849 (Remove recommends line)
     Closes: #57849 (Remove recommends line)
   * Enable the MSCHAP and MPPE options again in the default config, but now
   * Enable the MSCHAP and MPPE options again in the default config, but now
     changed for the new upstream pppd syntax.
     changed for the new upstream pppd syntax.
-  * Also include the new upstream source in the upload - 
+  * Also include the new upstream source in the upload -
     dpkg-buildpackage was confused by the version number.
     dpkg-buildpackage was confused by the version number.
-  * Enhance the init script to: 
+  * Enhance the init script to:
     - Include a "status" option.
     - Include a "status" option.
     - Force pptpd to close its file descriptors.
     - Force pptpd to close its file descriptors.
     Closes: #189426: pptpd does not close/redirect stdout and stderr
     Closes: #189426: pptpd does not close/redirect stdout and stderr
   * Use po-debconf for debconf translations and add pt_BR and FR translations.
   * Use po-debconf for debconf translations and add pt_BR and FR translations.
-    However, debconf is still not used for autoconfig until I find time to 
+    However, debconf is still not used for autoconfig until I find time to
     implement the config script properly. It will come, soon ;)
     implement the config script properly. It will come, soon ;)
     Also fix some english short descriptions - thanks for pointing that out.
     Also fix some english short descriptions - thanks for pointing that out.
-    Closes: #191703: Update packaging to use the newer gettext-based debconf 
+    Closes: #191703: Update packaging to use the newer gettext-based debconf
             template translation system
             template translation system
     Closes: #208049: Please switch to gettext-based debconf templates
     Closes: #208049: Please switch to gettext-based debconf templates
     Closes: #211273: French translation of gettext debconf template
     Closes: #211273: French translation of gettext debconf template
@@ -233,9 +233,9 @@ pptpd (1.1.4.0b4-1) unstable; urgency=low
   * Move the HOWTO-IPX+PPTP.txt file from the html/ directory to the normal
   * Move the HOWTO-IPX+PPTP.txt file from the html/ directory to the normal
     doc directory.
     doc directory.
     Closes: #220707: CVS directory, and non-html in 'html' dir
     Closes: #220707: CVS directory, and non-html in 'html' dir
-  * Document that IP forwarding needs to be enabled, but refer to 
+  * Document that IP forwarding needs to be enabled, but refer to
     /etc/network/options instead of /proc/sys/net/ipv4/ip_forward.
     /etc/network/options instead of /proc/sys/net/ipv4/ip_forward.
-    Closes: #168718: Documentation has no reference to 
+    Closes: #168718: Documentation has no reference to
             /proc/sys/net/ipv4/ip_forward
             /proc/sys/net/ipv4/ip_forward
 
 
  -- Rene Mayrhofer <rmayr@debian.org>  Wed, 23 Apr 2003 13:34:50 +0200
  -- Rene Mayrhofer <rmayr@debian.org>  Wed, 23 Apr 2003 13:34:50 +0200
@@ -243,7 +243,7 @@ pptpd (1.1.4.0b4-1) unstable; urgency=low
 pptpd (1.1.4-0.b3.1) unstable; urgency=HIGH
 pptpd (1.1.4-0.b3.1) unstable; urgency=HIGH
 
 
   * New upstream release (to fix the security issue).
   * New upstream release (to fix the security issue).
-    Closes: #189363: pptpd: PoPToP versions earlier than 1.1.3 have a 
+    Closes: #189363: pptpd: PoPToP versions earlier than 1.1.3 have a
                      remotely exploitable buffer overflow
                      remotely exploitable buffer overflow
     Closes: #107933: pptpd: pptpd segfaults if called without arguments
     Closes: #107933: pptpd: pptpd segfaults if called without arguments
   * Enabled the broadcast relay option.
   * Enabled the broadcast relay option.
@@ -299,7 +299,7 @@ pptpd (1.1.2-1) unstable; urgency=low
 
 
 pptpd (1.0.1-2) unstable; urgency=low
 pptpd (1.0.1-2) unstable; urgency=low
 
 
-  * Changed the dependency from perl to perl-base. 
+  * Changed the dependency from perl to perl-base.
 
 
  -- Rene Mayrhofer <rene.mayrhofer@vianova.at>  Tue, 26 Dec 2000 15:44:38 +0100
  -- Rene Mayrhofer <rene.mayrhofer@vianova.at>  Tue, 26 Dec 2000 15:44:38 +0100
 
 
@@ -363,4 +363,3 @@ pptpd (0.9.12-1) unstable; urgency=low
   * Initial Release.
   * Initial Release.
 
 
  -- Rene Mayrhofer <rmayr@vianova.at>  Tue, 24 Aug 1999 08:05:10 +0200
  -- Rene Mayrhofer <rmayr@vianova.at>  Tue, 24 Aug 1999 08:05:10 +0200
-

+ 2 - 1
defaults.h

@@ -4,7 +4,7 @@
  * This file contains some tuneable parameters, most of which can be overriden
  * This file contains some tuneable parameters, most of which can be overriden
  * at run-time.
  * at run-time.
  *
  *
- * $Id: defaults.h,v 1.9 2006/09/04 23:17:25 quozl Exp $
+ * $Id: defaults.h,v 1.10 2011/05/19 00:02:50 quozl Exp $
  */
  */
 
 
 #ifndef _PPTPD_DEFAULTS_H
 #ifndef _PPTPD_DEFAULTS_H
@@ -67,6 +67,7 @@
 #define LOCALIP_KEYWORD			"localip"
 #define LOCALIP_KEYWORD			"localip"
 #define REMOTEIP_KEYWORD		"remoteip"
 #define REMOTEIP_KEYWORD		"remoteip"
 #define LISTEN_KEYWORD			"listen"
 #define LISTEN_KEYWORD			"listen"
+#define VRF_KEYWORD			"vrf"
 #define PIDFILE_KEYWORD			"pidfile"
 #define PIDFILE_KEYWORD			"pidfile"
 #define STIMEOUT_KEYWORD		"stimeout"
 #define STIMEOUT_KEYWORD		"stimeout"
 #define NOIPPARAM_KEYWORD		"noipparam"
 #define NOIPPARAM_KEYWORD		"noipparam"

+ 1 - 1
getopt.c

@@ -7,7 +7,7 @@
  *        * <config.h> changed to "config.h"
  *        * <config.h> changed to "config.h"
  *        * #include "our_getopt.h" near #define ELIDE_CODE
  *        * #include "our_getopt.h" near #define ELIDE_CODE
  *
  *
- * $Id: getopt.c,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+ * $Id: getopt.c,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
  */
  */
 
 
 /* Getopt for GNU.
 /* Getopt for GNU.

+ 1 - 1
getopt1.c

@@ -6,7 +6,7 @@
  * NOTE: Changed to make dependencies work better:
  * NOTE: Changed to make dependencies work better:
  *        * <config.h> changed to "config.h"
  *        * <config.h> changed to "config.h"
  *
  *
- * $Id: getopt1.c,v 1.1.1.1 2002/06/21 08:51:58 fenix_nl Exp $
+ * $Id: getopt1.c,v 1.1 2002/06/21 08:51:58 fenix_nl Exp $
  */
  */
 
 
 /* getopt_long and getopt_long_only entry points for GNU getopt.
 /* getopt_long and getopt_long_only entry points for GNU getopt.

+ 0 - 3
html/CVS/Entries

@@ -1,3 +0,0 @@
-/HOWTO-PoPToP.txt/1.2/Thu Apr 22 04:54:07 2004//
-/setup_pptp_client.html/1.1.1.1/Thu Apr 22 04:54:07 2004//
-D/poptop_ads_howto////

+ 0 - 1
html/CVS/Repository

@@ -1 +0,0 @@
-poptop/html

+ 0 - 1
html/CVS/Root

@@ -1 +0,0 @@
-:ext:quozl@poptop.cvs.sourceforge.net:/cvsroot/poptop

+ 0 - 18
html/poptop_ads_howto/CVS/Entries

@@ -1,18 +0,0 @@
-/diagram1.jpg/1.1/Tue Oct 25 03:08:14 2005//
-/poptop_ads_howto_2.htm/1.1/Tue Oct 25 03:08:14 2005//
-/poptop_ads_howto_3.htm/1.2/Thu Jan  5 00:21:15 2006//
-/test.txt/1.1/Tue Apr 18 03:02:31 2006//
-/poptop_ads_howto_1.htm/1.11/Mon Apr 16 00:42:09 2007//
-/poptop_ads_howto_10.htm/1.5/Mon Apr 16 00:42:09 2007//
-/poptop_ads_howto_11.htm/1.4/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_12.htm/1.3/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_4.htm/1.10/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_5.htm/1.5/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_6.htm/1.5/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_6a.htm/1.2/Sun Jan 14 23:46:51 2007//
-/poptop_ads_howto_7.htm/1.5/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_8.htm/1.6/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_9.htm/1.3/Mon Apr 16 00:42:10 2007//
-/poptop_ads_howto_a1.htm/1.1/Mon May  8 07:29:48 2006//
-/poptop_ads_howto_a2.htm/1.1/Mon May  8 07:29:48 2006//
-D

+ 0 - 1
html/poptop_ads_howto/CVS/Repository

@@ -1 +0,0 @@
-poptop/html/poptop_ads_howto

+ 0 - 1
html/poptop_ads_howto/CVS/Root

@@ -1 +0,0 @@
-:ext:quozl@poptop.cvs.sourceforge.net:/cvsroot/poptop

File diff suppressed because it is too large
+ 73 - 46
html/poptop_ads_howto/poptop_ads_howto_1.htm


+ 4 - 8
html/poptop_ads_howto/poptop_ads_howto_10.htm

@@ -7,10 +7,10 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>15. pptpd and freeradius </strong></p>
+<p><strong>16. pptpd and freeradius </strong></p>
 <p>The section covers the configuration of pptpd + freeradius + AD. If you are looking at the integration via winbind. Go to <a href="poptop_ads_howto_7.htm">this section</a>.</p>
 <p>The section covers the configuration of pptpd + freeradius + AD. If you are looking at the integration via winbind. Go to <a href="poptop_ads_howto_7.htm">this section</a>.</p>
 <hr>
 <hr>
-<a name="radiusd"></a><strong>15.1 Enable freeradius</strong>
+<a name="radiusd"></a><strong>16.1 Enable freeradius</strong>
 <p>To enable radiusd on bootup, use the chkconfig command.</p>
 <p>To enable radiusd on bootup, use the chkconfig command.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# chkconfig radiusd on </pre>
   <pre>[root@pptp ~]# chkconfig radiusd on </pre>
@@ -23,12 +23,12 @@ Starting RADIUS server: Sun Sep  4 11:26:24 2005 : Info: Starting - reading conf
 </blockquote>
 </blockquote>
 <p></p>
 <p></p>
 <hr>
 <hr>
-<a name="pptpdradius"></a><strong>15.2 Configure pptpd </strong>
+<a name="pptpdradius"></a><strong>16.2 Configure pptpd </strong>
 <p>There are two configuration files for pptpd. The first one is /etc/pptpd.conf. You can very much keep it as it is except the ip address range for the ppp connections. Edit the file and add two lines at the bottom to specify the local ip address and the ip address pool for the remote connections. </p>
 <p>There are two configuration files for pptpd. The first one is /etc/pptpd.conf. You can very much keep it as it is except the ip address range for the ppp connections. Edit the file and add two lines at the bottom to specify the local ip address and the ip address pool for the remote connections. </p>
 <blockquote>
 <blockquote>
   <pre>localip 10.0.0.10<br>remoteip 10.0.0.101-200 </pre>
   <pre>localip 10.0.0.10<br>remoteip 10.0.0.101-200 </pre>
 </blockquote>
 </blockquote>
-<p>10.0.0.10 is the ip address of the internal network card eth0. The remoteip is the address pool for the remote connections. If you are running FC6, please refer to <a href="file:///C:/StudioMX/poptop_ads_howto_4.htm#pptpd">Section 7.2</a> for details on the logwtmp option.</p>
+<p>10.0.0.10 is the ip address of the internal network card eth0. The remoteip is the address pool for the remote connections. If you are running FC6, please refer to <a href="file:///C:/StudioMX/poptop_ads_howto_4.htm#pptpd">Section 8.2</a> for details on the logwtmp option.</p>
 <p>Please note that pptpd by default has a 100 connections limit. You can override it by the "connection" parameter in the pptp.conf file. Read the remarks in the file.</p>
 <p>Please note that pptpd by default has a 100 connections limit. You can override it by the "connection" parameter in the pptp.conf file. Read the remarks in the file.</p>
 <p>The second configuration file is /etc/ppp/options.pptpd. I stripped off all remarks from my options.pptpd and it is like this:</p>
 <p>The second configuration file is /etc/ppp/options.pptpd. I stripped off all remarks from my options.pptpd and it is like this:</p>
 <blockquote>
 <blockquote>
@@ -48,10 +48,6 @@ plugin radius.so
 plugin radattr.so</pre>
 plugin radattr.so</pre>
 </blockquote>
 </blockquote>
 <p>There are two plugins we used in here. The first one radius.so is required while the second one radattr.so is optional. Radattr.so basically records the parameters passed from radius to pppd in a file. Check the man page of pppd-radattr for details. </p>
 <p>There are two plugins we used in here. The first one radius.so is required while the second one radattr.so is optional. Radattr.so basically records the parameters passed from radius to pppd in a file. Check the man page of pppd-radattr for details. </p>
-<p>Then, we need to fix the permission of a winbind directory.</p>
-<blockquote>
-  <pre>[root@pptp ~]# chgrp radiusd /var/cache/samba/winbindd_privileged/</pre>
-</blockquote>
 <p>If you have Windows XP clients, you may want to reduce the MTU size. Add the  line, /sbin/ifconfig $1 mtu 1400, to /etc/ppp/ip-up as shown in the following list.</p>
 <p>If you have Windows XP clients, you may want to reduce the MTU size. Add the  line, /sbin/ifconfig $1 mtu 1400, to /etc/ppp/ip-up as shown in the following list.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ppp]# cat ip-up
   <pre>[root@pptp ppp]# cat ip-up

+ 2 - 2
html/poptop_ads_howto/poptop_ads_howto_11.htm

@@ -7,7 +7,7 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>16. pptp Client Installation</strong></p>
+<p><strong>17. pptp Client Installation</strong></p>
 <p>I will only describe the Windows XP pptp client installation. For other operating system, please see the documents in <a href="http://poptop.sourceforge.net/dox/">here</a>. </p>
 <p>I will only describe the Windows XP pptp client installation. For other operating system, please see the documents in <a href="http://poptop.sourceforge.net/dox/">here</a>. </p>
 <ul>
 <ul>
   <li>Start -> Settings -> Control Panels -> Network Connections.</li>
   <li>Start -> Settings -> Control Panels -> Network Connections.</li>
@@ -27,7 +27,7 @@
 </ul>
 </ul>
 <p>That's all for a standard configuration. All traffic from the PC will pipe through the pptp tunnel except those for the local attached network segment. This is the recommended way of implementing VPN for security reasons.</p>
 <p>That's all for a standard configuration. All traffic from the PC will pipe through the pptp tunnel except those for the local attached network segment. This is the recommended way of implementing VPN for security reasons.</p>
 <hr>
 <hr>
-<strong><a name="splittunnel"></a>16.1 Split Tunneling</strong>
+<strong><a name="splittunnel"></a>17.1 Split Tunneling</strong>
 <p>Split Tunneling allows you to configure the network so that only selected traffic is directed to the VPN tunnel. For instance,   you want browsing  traffic to go to the Internet directly but corporate traffic goes via the VPN, then you will need split tunneling. It is also important if your ISP requires a heatbeat from your machine to keep the connection alive. </p>
 <p>Split Tunneling allows you to configure the network so that only selected traffic is directed to the VPN tunnel. For instance,   you want browsing  traffic to go to the Internet directly but corporate traffic goes via the VPN, then you will need split tunneling. It is also important if your ISP requires a heatbeat from your machine to keep the connection alive. </p>
 <p>While split tunneling provides convenience, it causes  security problems because <span name="intelliTxt" id="intelliTxt">it essentially renders the VPN vulnerable to attack as it is accessible through the public, non-secure network. Check your company security policy before inplementing split tunneling. </span></p>
 <p>While split tunneling provides convenience, it causes  security problems because <span name="intelliTxt" id="intelliTxt">it essentially renders the VPN vulnerable to attack as it is accessible through the public, non-secure network. Check your company security policy before inplementing split tunneling. </span></p>
 <p>To set up split tunneling:</p>
 <p>To set up split tunneling:</p>

+ 39 - 4
html/poptop_ads_howto/poptop_ads_howto_12.htm

@@ -7,14 +7,14 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>17. pptp Server Administration </strong></p>
+<p><strong>18. pptp Server Administration </strong></p>
 <p>This section covers a few tricks on pptp server management. It is far from a complete guide. Any suggestions are welcome.</p>
 <p>This section covers a few tricks on pptp server management. It is far from a complete guide. Any suggestions are welcome.</p>
 <p>The packages <strong>psacct</strong> and <strong>SysVinit</strong> are required for the utilities used in here. They should be installed by default. If they are  not, please install them through yum.</p>
 <p>The packages <strong>psacct</strong> and <strong>SysVinit</strong> are required for the utilities used in here. They should be installed by default. If they are  not, please install them through yum.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# yum install psacct SysVinit </pre>
   <pre>[root@pptp ~]# yum install psacct SysVinit </pre>
 </blockquote><p></p>
 </blockquote><p></p>
 <hr>
 <hr>
-<strong><a name="whoisonline"></a>17.1 Who is Online?</strong>
+<strong><a name="whoisonline"></a>18.1 Who is Online?</strong>
 <p>To check who is online, the &quot;last&quot; command is used:</p>
 <p>To check who is online, the &quot;last&quot; command is used:</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# last | grep ppp | grep still
   <pre>[root@pptp ~]# last | grep ppp | grep still
@@ -23,7 +23,7 @@ James    ppp3         202.xx.xxx.xxx   Sat Nov 19 17:38   still logged in   <br>
 <p><strong><em>last</em></strong> is from SysVinit. It reads the information from /var/log/wtmp. </p>
 <p><strong><em>last</em></strong> is from SysVinit. It reads the information from /var/log/wtmp. </p>
 <p><strong>Note:</strong> for <em><strong>last</strong></em> to work properly, the logwtmp option in the /etc/pptpd.conf must be enabled. If you are sure there are pptp connections but see no output from the above mentioned command, check the logwtmp option in the pptpd.conf file is enabled. </p>
 <p><strong>Note:</strong> for <em><strong>last</strong></em> to work properly, the logwtmp option in the /etc/pptpd.conf must be enabled. If you are sure there are pptp connections but see no output from the above mentioned command, check the logwtmp option in the pptpd.conf file is enabled. </p>
 <hr>
 <hr>
-<strong><a name="accounting"></a>17.2 Accounting </strong>
+<strong><a name="accounting"></a>18.2 Accounting </strong>
 <p>The &quot;ac&quot; utility from package psacct will provide a report on the connection time.</p>
 <p>The &quot;ac&quot; utility from package psacct will provide a report on the connection time.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# ac -d -p
   <pre>[root@pptp ~]# ac -d -p
@@ -50,7 +50,7 @@ If you want the statistics from older version of wtmp, use the -f parameter in &
 2. If users use shell to log in the server as well, the ac will return the connection time of both pptp and shell connections.
 2. If users use shell to log in the server as well, the ac will return the connection time of both pptp and shell connections.
 </p>
 </p>
 <hr> 
 <hr> 
-<strong><a name="disconnect"></a>17.3 Disconnect a User</strong>
+<strong><a name="disconnect"></a>18.3 Disconnect a User</strong>
 <p>To disconnect an active connection, you will have to kill the pppd process associate with it. Firstly, run the command in section 16.1 to find out the remote ip address of the user. Say you want to disconnect Mary, her ip address in the above example is 1.2.3.4. Then, find the PID of the pppd process.
 <p>To disconnect an active connection, you will have to kill the pppd process associate with it. Firstly, run the command in section 16.1 to find out the remote ip address of the user. Say you want to disconnect Mary, her ip address in the above example is 1.2.3.4. Then, find the PID of the pppd process.
 </p>
 </p>
 <blockquote>
 <blockquote>
@@ -65,6 +65,41 @@ root   8672  8671  0 16:59 ?      00:00:00 /usr/sbin/pppd local file /etc/ppp/op
   <pre>[root@pptp /]# kill 8672</pre>
   <pre>[root@pptp /]# kill 8672</pre>
 </blockquote><br>
 </blockquote><br>
 <hr>
 <hr>
+<strong><a name="oneconnection"></a>18.4 Allow Only One Connection per User</strong>
+<p>By default, a user can make multiple connections to the pptpd server. To restrict one connection per user, create two script files in the /etc/ppp directory. When the same user logs in twice, the first connection will be disconnected. This is actually done on the ppp level, not with the pptpd. </p>
+<p>The first file is /etc/ppp/auth-up</p>
+<blockquote>
+  <pre>
+  #!/bin/sh
+  # get the username/ppp line number from the parameters
+  PPPLINE=$1
+  USER=$2
+  # create the directory to keep pid files per user
+  mkdir -p /var/run/pptpd-users
+  # if there is a session already for this user, terminate the old one
+  if [ -f /var/run/pptpd-users/$USER ]; then
+    kill -HUP `cat /var/run/pptpd-users/$USER`
+    rm /var/run/pptpd-users/$USER
+  fi
+  # write down the username in the ppp line file
+  echo $USER &gt; /var/run/pptpd-users/$PPPLINE.new
+</pre>
+</blockquote>
+<p>The second file is /etc/ppp/ip-up.local</p>
+<blockquote>
+  <pre>
+  #!/bin/sh
+  REALDEVICE=$1
+  # Get the username from the ppp line record file
+  USER=`cat /var/run/pptpd-users/$REALDEVICE.new`
+  # Copy the ppp line pid
+  cp &quot;/var/run/$REALDEVICE.pid&quot; /var/run/pptpd-users/$USER
+  # remove the ppp line record file
+  rm &quot;/var/run/pptpd-users/$REALDEVICE.new&quot;
+</pre>
+</blockquote>
+<p>The method presented here may not be the best one, but it works for me. (If you have a better way, please let me know.)</p>
+<hr>
 <a href="poptop_ads_howto_a1.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_11.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
 <a href="poptop_ads_howto_a1.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_11.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
 </body>
 </body>
 </html>
 </html>

+ 2 - 1
html/poptop_ads_howto/poptop_ads_howto_2.htm

@@ -10,7 +10,7 @@
 <p><a name="test"></a><strong>4. The Test Environment</strong></p>
 <p><a name="test"></a><strong>4. The Test Environment</strong></p>
 <p>I have built a test environment as shown in the diagram. In the rest of the howto, the configurations of software are based on this topology. </p>
 <p>I have built a test environment as shown in the diagram. In the rest of the howto, the configurations of software are based on this topology. </p>
 <p><img src="diagram1.jpg"></p>
 <p><img src="diagram1.jpg"></p>
-<p>A Windows 2003 SP1 Server is set up as the AD domain controller, DNS server and WINS server. The pptp gateway is the Linux box which has 2 network cards. One connects to the internal network, 10.0.0.0/24, and the other one connects to the Internet with ip address 192.168.0.10/24. The internal network has two subnets, 10.0.0.0/24 and 172.16.0.0/24. </p>
+<p>A Windows 2003 R2 SP2 Server is set up as the AD domain controller, DNS server and WINS server. The pptp gateway is the Linux box which has 2 network cards. One connects to the internal network, 10.0.0.0/24, and the other one connects to the Internet with ip address 192.168.0.10/24. The internal network has two subnets, 10.0.0.0/24 and 172.16.0.0/24. </p>
 <p>The domain name of the Windows AD domain is EXAMPLENET.ORG and the corresponding netbios name is EXAMPLE. </p>
 <p>The domain name of the Windows AD domain is EXAMPLENET.ORG and the corresponding netbios name is EXAMPLE. </p>
 <p><strong>Windows Domain Summary</strong>:</p>
 <p><strong>Windows Domain Summary</strong>:</p>
 <table width="558" border="0">
 <table width="558" border="0">
@@ -41,6 +41,7 @@
 </table>
 </table>
 
 
 </p>
 </p>
+<p><em><strong>Note:</strong> The Windows server that I used for FC4/5/6 testing was a Windows 2003 standard with SP1. In another word, the information presented in Appendix for FC 4, 5 and 6 is not tested for Windows 2003 R2 although I believe it should work.</em></p>
 <hr>
 <hr>
 <a href="poptop_ads_howto_3.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_1.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a></body>
 <a href="poptop_ads_howto_3.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_1.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a></body>
 </html>
 </html>

+ 16 - 6
html/poptop_ads_howto/poptop_ads_howto_3.htm

@@ -15,7 +15,17 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><a name="network"><strong>5. Network Configuration </strong></a></p>
+<p><strong><a name="selinux"></a>5. Fedora and SELINUX</strong></p>
+<p>There is a report from Frederick Chapleau on SELINUX causing problem on PPTPD. It affects user authentication with Winbind and Radius. SELINUX is enabled by default on Fedora, you may very likely run into this problem if you take all default settings when installing Fedora. </p>
+<p>Frederick said in his email:</p>
+<blockquote>
+  <p>&quot;This issue was not appearing with plain text file (chap.secret) or with CHAPv1 authentication. Only in the combination of MS-CHAPv2 and Winbind (with or without radius)&quot;</p>
+</blockquote>
+<p>Disabling SELINUX may be an easy fix but you may want to consider the security implication too.</p>
+<p>For more information on this issue, please go to <a href="http://yaoblogs.com/blogs/fchapleau/archive/2007/04/24/pptp-and-the-bug.aspx">here</a>.</p>
+<p></p>
+<hr>
+<a name="network"><strong>6. Network Configuration </strong></a>
 <p>Microsoft AD depends heavily on DNS. You should have the DNS server working first. </p>
 <p>Microsoft AD depends heavily on DNS. You should have the DNS server working first. </p>
 <p>The pptp gateway should use the Active Directory DNS server instead of the one provided by your ISP. Otherwise, the gateway may have problems to locate the domain controller. Here is the /etc/resolv.conf in my test gateway. </p>
 <p>The pptp gateway should use the Active Directory DNS server instead of the one provided by your ISP. Otherwise, the gateway may have problems to locate the domain controller. Here is the /etc/resolv.conf in my test gateway. </p>
 <blockquote>
 <blockquote>
@@ -23,11 +33,11 @@
 nameserver 10.0.0.1</pre>
 nameserver 10.0.0.1</pre>
 </blockquote><p></p>
 </blockquote><p></p>
 <hr>
 <hr>
-<a name="defaultroute"><strong>5.1 Default Gateway and Static Routes</strong></a>
+<a name="defaultroute"><strong>6.1 Default Gateway and Static Routes</strong></a>
 <p>The pptp gateway has two network cards. It is important that the default gateway is pointing to the Internet, your ISP router. Make sure that the internal network card does not have a default gateway address configured. Check the network card configuration files in /etc/sysconfig/network-scripts. </p>
 <p>The pptp gateway has two network cards. It is important that the default gateway is pointing to the Internet, your ISP router. Make sure that the internal network card does not have a default gateway address configured. Check the network card configuration files in /etc/sysconfig/network-scripts. </p>
 <p>In my test setup, eth0 is the internal card and eth1 is the external one. In the /etc/sysconfig/network-scripts/ifcfg-eth0, it does not have the line GATEWAY=&quot;x.x.x.x&quot;. In the ifcfg-eth1, it has an entry GATEWAY=&quot;x.x.x.x&quot; pointing to the ISP router ip address.</p>
 <p>In my test setup, eth0 is the internal card and eth1 is the external one. In the /etc/sysconfig/network-scripts/ifcfg-eth0, it does not have the line GATEWAY=&quot;x.x.x.x&quot;. In the ifcfg-eth1, it has an entry GATEWAY=&quot;x.x.x.x&quot; pointing to the ISP router ip address.</p>
-<p>My test internal network has multiple subnets, static routes are set up to direct traffic correctly. If you have a simple single segment internal network, you can skip the following step and go to <a href="#pforward">step 5.2</a>.</p>
-<p>To set up static routes in FC4, create a file static-routes in /etc/sysconfig directory. My static-routes file has one line: </p>
+<p>My test internal network has multiple subnets, static routes are set up to direct traffic correctly. If you have a simple single segment internal network, you can skip the following step and go to <a href="#pforward">step 6.2</a>.</p>
+<p>To set up static routes in Fedora, create a file static-routes in /etc/sysconfig directory. My static-routes file has one line: </p>
 <blockquote>
 <blockquote>
   <pre>any net 172.16.0.0 netmask 255.255.255.0 dev eth0</pre>
   <pre>any net 172.16.0.0 netmask 255.255.255.0 dev eth0</pre>
 </blockquote>
 </blockquote>
@@ -38,10 +48,10 @@ nameserver 10.0.0.1</pre>
 192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1<br>172.16.0.0      0.0.0.0         255.255.255.0   U         0 0          0 eth0<br>10.0.0.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0<br>169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0<br>0.0.0.0         192.168.0.2     0.0.0.0         UG        0 0          0 eth1</pre>
 192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1<br>172.16.0.0      0.0.0.0         255.255.255.0   U         0 0          0 eth0<br>10.0.0.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0<br>169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0<br>0.0.0.0         192.168.0.2     0.0.0.0         UG        0 0          0 eth1</pre>
 </blockquote>
 </blockquote>
 <p><hr>
 <p><hr>
-<strong><a name="pforward"></a>5.2 Enable Packet Forwarding</strong>
+<strong><a name="pforward"></a>6.2 Enable Packet Forwarding</strong>
 <p>For ppp to work, the packet forwarding must be enabled. Edit /etc/sysctl.conf with your favourite editor and change the line:</p>
 <p>For ppp to work, the packet forwarding must be enabled. Edit /etc/sysctl.conf with your favourite editor and change the line:</p>
 <blockquote>
 <blockquote>
-  <pre>net.ipv4.ip_forward = 0</pre><p></p>
+  <pre>net.ipv4.ip_forward = 0</pre>
 </blockquote>
 </blockquote>
 <p>to</p>
 <p>to</p>
 <blockquote>
 <blockquote>

+ 28 - 15
html/poptop_ads_howto/poptop_ads_howto_4.htm

@@ -7,35 +7,48 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong><a name="mppe"></a>6. Install MPPE Kernel Module </strong></p>
-<p>Kernel version 2.6.15 or above has MPPE built-in which is required for MSCHAPv2. Fedora Core 5 and 6 kernel version on the CD are 2.6.15 and 2.6.18 respectively. That means you do not need to install the MPPE module as you have to for Fedora Core 4. Information for FC4 and MPPE is in <a href="poptop_ads_howto_a1.htm">Appendix A1 and A1.1</a>.</p>
+<p><strong><a name="mppe"></a>7. Install MPPE Kernel Module </strong></p>
+<p>If you plan to use MSCHAPv2, MPPE is required. Kernel version 2.6.15 or above has already got MPPE built-in. Fedora Core 8 kernel version on the DVD is 2.6.23.1. That means you do not need to install the MPPE module as you have to for older kernels. Information for MPPE on FC4 / 5 / 6 is in <a href="poptop_ads_howto_a1.htm">Appendix A1</a>.</p>
 <p>To test if your kernel supports MPPE:</p>
 <p>To test if your kernel supports MPPE:</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# modprobe ppp-compress-18 &amp;&amp; echo ok</pre>
   <pre>[root@pptp ~]# modprobe ppp-compress-18 &amp;&amp; echo ok</pre>
 </blockquote>
 </blockquote>
-<p>It should resturn an &quot;ok&quot;.</p>
-<p><strong>Note:</strong> The latest kernel for Fedora Core 5/6 at the time of writing is 2.6.18.</p>
+<p>It should return an &quot;ok&quot;.</p>
+<p><strong>Note:</strong> The latest kernel for Fedora Core 8 at the time of writing is 2.6.26.3.</p>
 <hr>
 <hr>
-<strong><a name="pppd_pptpd" id="pppd_pptpd"></a>7. pppd and  pptpd</strong>
-<p><a name="pppd"><strong>7.1 pppd </strong></a></p>
-<p>FC5 comes with ppp-2.4.3-6.2.1 and FC6 has ppp-2.4.4-1. MPPE support is already enabled.  If ppp is not installed, use<em> yum</em> to install it.</p>
+<strong><a name="pppd_pptpd" id="pppd_pptpd"></a>8. pppd and  pptpd</strong>
+<p><a name="pppd"><strong>8.1 pppd </strong></a></p>
+<p>FC8 comes with ppp-2.4.4-2. MPPE support is already enabled.  If ppp is not installed, use<em> yum</em> to install it.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# yum install ppp</pre>
   <pre>[root@pptp ~]# yum install ppp</pre>
 </blockquote>
 </blockquote>
-<p><strong>Note</strong>: Information on how to update ppp module on FC4 is in <a href="poptop_ads_howto_a1.htm#pppd">Appendix A2</a>.</p>
+<p><strong>Note</strong>: Information on how to update ppp module on FC4 / 5/ 6 is in <a href="poptop_ads_howto_a2.htm">Appendix A2</a>.</p>
 <hr>
 <hr>
-<a name="pptpd"></a><strong>7.2 Install pptpd</strong>
-<p>From <a href="http://sourceforge.net/project/showfiles.php?group_id=44827">here</a> download the pptpd rpm, pptpd-1.3.3-1.fc5.i386.rpm or pptpd-1.3.3-1.fc6.i386.rpm according to your Fedora version, and install it.</p>
+<a name="pptpd"></a><strong>8.2 Install pptpd</strong>
+<p>From <a href="http://sourceforge.net/project/showfiles.php?group_id=44827">here</a> download the pptpd tar ball, pptpd-1.3.4.tar.gz. You can make a RPM from it with the<em> rpmbuild</em> command. If you don't have the <em>rpmbuild</em> command installed. Get the package <strong>rpm-build</strong> through <em>yum</em>. </p>
 <blockquote>
 <blockquote>
-  <pre>[root@pptp ~]# rpm -ivh pptpd-1.3.3-1.*.i386.rpm</pre></blockquote>
+  <pre>[root@pptp ~]# rpmbuild -ta pptpd-1.3.4.tar.gz</pre>
+</blockquote>
+<p>The command will create a pptpd rpm in /usr/src/redhat/RPMS/i386 directory. Install the package with the <em>rpm</em> commad.</p>
+<blockquote>
+  <pre>[root@pptp ~]# cd /usr/src/redhat/RPMS/i386/
+[root@pptp i386]# rpm -ivh pptpd-1.3.4-1.i386.rpm</pre>
+</blockquote>
 <p><strong>Note:</strong><br>
 <p><strong>Note:</strong><br>
-The pptpd FC6 package is built against ppp-2.4.3 but FC6 has ppp-2.4.4. It prevents the tunnel to be established  and gives the following error message is in /var/log/message.</p>
+The pptpd rpm package is built against ppp-2.4.3 but FC6 or above has ppp-2.4.4. It prevents the tunnel to be established  and gives the following error message is in /var/log/message.</p>
 <blockquote>
 <blockquote>
   <p>Plugin /usr/lib/pptpd/pptpd-logwtmp.so is for pppd version 2.4.3, this is 2.4.4 </p>
   <p>Plugin /usr/lib/pptpd/pptpd-logwtmp.so is for pppd version 2.4.3, this is 2.4.4 </p>
 </blockquote>
 </blockquote>
-<p>The workaround is to disable the logwtmp option in /etc/pptpd.conf.</p>
-<p>I have produced a patched RPM to address the problem. You may find a copy from <a href="http://rapidshare.com/files/11740134/pptpd-1.3.3-2.fc6.i386.rpm">here</a>.</p>
+<p>The workaround is to disable the logwtmp option in /etc/pptpd.conf. The drawback is the<em> last</em> command won't show the pptpd login information.</p>
+<p>I have produced a patched RPMs for pptpd to address the problem. You can find them from the following links.</p>
+<dt>For Fedora 8</dt>
+  <dd><a href="http://rapidshare.com/files/147328050/pptpd-1.3.4-2.fc8.i386.rpm">pptpd-1.3.4-2.fc8.i386.rpm</a> (binary RPM - current version) </dd>
+  <dd><a href="http://rapidshare.com/files/147328118/pptpd-1.3.4-2.fc8.src.rpm">pptpd-1.3.4-2.fc8.src.rpm</a> (source RPM)<br></dd>
+<dt>For Fedora 6</dt>
+  <dd><a href="http://rapidshare.com/files/11740134/pptpd-1.3.3-2.fc6.i386.rpm">pptpd-1.3.3-2.fc6.i386.rpm</a> (binary RPM - older version) </dd>
+  <dd><a href="http://rapidshare.com/files/31923326/pptpd-1.3.4-2.FC6.i386.rpm">pptpd-1.3.4-2.FC6.i386.rpm</a> (binary RPM - current version) </dd>
+  <br>
 <hr>
 <hr>
-<a href="poptop_ads_howto_5.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_3.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
+<a href="poptop_ads_howto_5.htm">Next</a>&nbsp;&nbsp;<a href="poptop_ads_howto_3.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
 </body>
 </body>
 </html>
 </html>

+ 6 - 6
html/poptop_ads_howto/poptop_ads_howto_5.htm

@@ -7,17 +7,17 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>8. Samba
+<p><strong>9. Samba
 </strong></p>
 </strong></p>
-<p>FC5 comes with samba v3.0.21b and FC6 has version 3.0.32c. The current samba RPM version from <em>yum</em> at the time of writing for FC5 is v3.0.23c. It is highly recommended to use the latest version. </p>
+<p>Fedora 8 comes with samba v3.0.26a. The current samba RPM version from <em>yum</em> at the time of writing for F8 is v3.0.32. It is highly recommended to use the latest version. </p>
 <p>The required RPM packages for samba in Fedora are <em>samba, samba-client, samba-common</em>.  Install through <em>yum</em> if any of them is missing. </p>
 <p>The required RPM packages for samba in Fedora are <em>samba, samba-client, samba-common</em>.  Install through <em>yum</em> if any of them is missing. </p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# yum install samba samba-common samba-client</pre>
   <pre>[root@pptp ~]# yum install samba samba-common samba-client</pre>
 </blockquote>
 </blockquote>
 <p><strong>Note: </strong>
 <p><strong>Note: </strong>
-Information on Samba and FC4 can be found in <a href="poptop_ads_howto_a2.htm#samba">Appendix A3</a>.</p>
+Information on Samba for FC4 / 5 / 6 can be found in <a href="poptop_ads_howto_a3.htm">Appendix A3</a>.</p>
 <hr>
 <hr>
-<strong><a name="smbconf"></a>8.1 Configure Samba</strong>
+<strong><a name="smbconf"></a>9.1 Configure Samba</strong>
 <p>No matter you choose to use winbind or freeradius to connect to Active Directory, you will have to configure samba properly. The configuration file of samba is in /etc/samba and is called smb.conf. The file should have at least the following lines. </p>
 <p>No matter you choose to use winbind or freeradius to connect to Active Directory, you will have to configure samba properly. The configuration file of samba is in /etc/samba and is called smb.conf. The file should have at least the following lines. </p>
 <blockquote>
 <blockquote>
   <pre>[global]
   <pre>[global]
@@ -42,7 +42,7 @@ max log size = 50
 <strong>password server = 10.0.0.1</strong>
 <strong>password server = 10.0.0.1</strong>
 # enable encrypt passwords
 # enable encrypt passwords
 <strong>encrypt passwords = yes</strong>
 <strong>encrypt passwords = yes</strong>
-# default socket options setting on older samba. It is not defined in v3.0.23c
+# default socket options setting on older samba. It is not defined in v3.0.23c or above
 ;socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
 ;socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
 # not to be a master browser
 # not to be a master browser
 domain master = no 
 domain master = no 
@@ -51,7 +51,7 @@ preferred master = no
 <strong>wins server = 10.0.0.1</strong>
 <strong>wins server = 10.0.0.1</strong>
 dns proxy = no
 dns proxy = no
 # require this line to join the domain in older samba
 # require this line to join the domain in older samba
-# I don't need this for samba v3.0.23
+# I don't need this for samba v3.0.23 or above
 <strong>;client use spnego = yes</strong>
 <strong>;client use spnego = yes</strong>
 # winbind stuff
 # winbind stuff
 <strong>idmap uid = 50001-550000
 <strong>idmap uid = 50001-550000

File diff suppressed because it is too large
+ 7 - 7
html/poptop_ads_howto/poptop_ads_howto_6.htm


+ 15 - 7
html/poptop_ads_howto/poptop_ads_howto_7.htm

@@ -7,12 +7,18 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>11. pptpd and winbindd </strong></p>
+<p><strong>12. pptpd and winbindd </strong></p>
 <p>The section covers how to configure pptpd + winbindd + AD. If you are working on the freeradius configuration, you may skip this section and go to the <a href="poptop_ads_howto_8.htm">next one</a>. </p>
 <p>The section covers how to configure pptpd + winbindd + AD. If you are working on the freeradius configuration, you may skip this section and go to the <a href="poptop_ads_howto_8.htm">next one</a>. </p>
 <p>Most of the hard work has been done in the previous sections. You are very close to the final stage.</p>
 <p>Most of the hard work has been done in the previous sections. You are very close to the final stage.</p>
 <hr>
 <hr>
-<strong><a name="wbtest"></a>11.1 Enable and Test winbindd</strong>
-<p>Start samba and winbindd with the &quot;service&quot; command.</p>
+<strong><a name="wbtest"></a>12.1 Enable and Test winbindd</strong>
+<p>For Fedora 8, start samba and winbindd with the <em>&quot;service&quot;</em> command.</p>
+<blockquote>
+  <pre>[root@pptp ~]# service smb start<br>Starting SMB services: [  OK  ]
+[root@pptp ~]# service nmb start<br>Starting NMB services: [  OK  ]
+[root@pptp ~]# service winbind start<br>Starting Winbind services: [  OK  ] </pre>
+</blockquote>
+<p>For older version of Fedora, the <em>&quot;service smb start</em>&quot; will start both smb and nmb.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# service smb start<br>Starting SMB services: [  OK  ]<br>Starting NMB services: [  OK  ]
   <pre>[root@pptp ~]# service smb start<br>Starting SMB services: [  OK  ]<br>Starting NMB services: [  OK  ]
 [root@pptp ~]# service winbind start<br>Starting Winbind services: [  OK  ] </pre>
 [root@pptp ~]# service winbind start<br>Starting Winbind services: [  OK  ] </pre>
@@ -27,18 +33,20 @@
 <br>[root@acna-pptp etc]# wbinfo -u<br>EXAMPLE+Administrator<br>EXAMPLE+Guest<br>EXAMPLE+SUPPORT_388945a0<br>EXAMPLE+DC1$<br>EXAMPLE+krbtgt<br>EXAMPLE+skwok<br>EXAMPLE+ldapuser<br>EXAMPLE+pptpdsvr$ 
 <br>[root@acna-pptp etc]# wbinfo -u<br>EXAMPLE+Administrator<br>EXAMPLE+Guest<br>EXAMPLE+SUPPORT_388945a0<br>EXAMPLE+DC1$<br>EXAMPLE+krbtgt<br>EXAMPLE+skwok<br>EXAMPLE+ldapuser<br>EXAMPLE+pptpdsvr$ 
 </pre>
 </pre>
 </blockquote>
 </blockquote>
-<p>To enable samba and winbind on bootup, use the chkconfig command.</p>
+<p>To enable samba, nmb and winbind on bootup, use the chkconfig command.</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# chkconfig winbind on
   <pre>[root@pptp ~]# chkconfig winbind on
+[root@pptp ~]# chkconfig nmb on
 [root@pptp ~]# chkconfig smb on </pre>
 [root@pptp ~]# chkconfig smb on </pre>
-</blockquote><p></p>
+</blockquote>
+<p>Please note that for older version of Fedora, smb will spawn nmb automatically. But for F8, they are separated.</p>
 <hr>
 <hr>
-<strong><a name="pptpconf"></a>11.2 Configure pptpd </strong>
+<strong><a name="pptpconf"></a>12.2 Configure pptpd </strong>
 <p>There are two configuration files for pptpd. The first one is /etc/pptpd.conf. You can very much keep it as it is except the ip address range for the ppp connections. Edit the file and add two lines at the bottom to specify the local ip address and the ip address pool for the remote connections. </p>
 <p>There are two configuration files for pptpd. The first one is /etc/pptpd.conf. You can very much keep it as it is except the ip address range for the ppp connections. Edit the file and add two lines at the bottom to specify the local ip address and the ip address pool for the remote connections. </p>
 <blockquote>
 <blockquote>
   <pre>localip 10.0.0.10<br>remoteip 10.0.0.101-200 </pre>
   <pre>localip 10.0.0.10<br>remoteip 10.0.0.101-200 </pre>
 </blockquote>
 </blockquote>
-<p>10.0.0.10 is the ip address of the internal network card eth0. The remoteip is the address pool for the remote connections. If you are running FC6, please refer to <a href="poptop_ads_howto_4.htm#pptpd">Section 7.2</a> for details on the logwtmp option. </p>
+<p>10.0.0.10 is the ip address of the internal network card eth0. The remoteip is the address pool for the remote connections. If you are running FC6 or above, please refer to <a href="poptop_ads_howto_4.htm#pptpd">Section 8.2</a> for details on the logwtmp option. </p>
 <p>Please note that pptpd by default has a 100 connections limit. You can override it by the &quot;connections&quot; parameter in the pptp.conf file. Read the remarks in the file. </p>
 <p>Please note that pptpd by default has a 100 connections limit. You can override it by the &quot;connections&quot; parameter in the pptp.conf file. Read the remarks in the file. </p>
 <p>The second configuration file is /etc/ppp/options.pptpd. I stripped off all remarks from my options.pptpd and it is like this:</p>
 <p>The second configuration file is /etc/ppp/options.pptpd. I stripped off all remarks from my options.pptpd and it is like this:</p>
 <blockquote>
 <blockquote>

File diff suppressed because it is too large
+ 30 - 19
html/poptop_ads_howto/poptop_ads_howto_8.htm


+ 17 - 7
html/poptop_ads_howto/poptop_ads_howto_9.htm

@@ -7,23 +7,32 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>14. Freeradius</strong></p>
-<p>Freeradius has a massive 57KB configuration file. Fortunately, we only have to change a few lines. </p>
+<p><strong>15. Freeradius</strong></p>
+<p>Firstly, for Fedora 8, add user radiusd to group wbpriv.</p>
+<blockquote>
+  <pre>[root@pptp ~]# usermod -G wbpriv radiusd</pre>
+</blockquote>
+<p>For Fedora 4 / 5 / 6, change the permission of the winbind_privileged directory. </p>
+<blockquote>
+<pre>[root@pptp ~]# chgrp radiusd /var/cache/samba/winbindd_privileged/</pre>
+</blockquote>
+<p>Secondly, we will need to modify the freeradius configuration file. Fortunately, we have only to change a few lines. </p>
 <hr>
 <hr>
-<a name="mschap2"></a><strong>14.1 Configure Freeradius for MSCHAPv2
+<a name="mschap2"></a><strong>15.1 Configure Freeradius for MSCHAPv2
 </strong>
 </strong>
 <p>Edit /etc/raddb/radiusd.conf to enable MSCAHP2. Open the file and locate the module section and then the mschap subsection.</p>
 <p>Edit /etc/raddb/radiusd.conf to enable MSCAHP2. Open the file and locate the module section and then the mschap subsection.</p>
 <blockquote>
 <blockquote>
   <pre>modules {<br>
   <pre>modules {<br>
         ....[snip]....<br>
         ....[snip]....<br>
         mschap {
         mschap {
-                authtype = MS-CHAP
                 use_mppe = yes
                 use_mppe = yes
                 require_encryption = yes
                 require_encryption = yes
                 require_strong = yes
                 require_strong = yes
                 ntlm_auth = &quot;/usr/bin/ntlm_auth --request-nt-key --username=%{Stripped-User-Name:-%{User-Name:-None}} --challenge=%{mschap:Challenge:-00} --nt-response=%{mschap:NT-Response:-00}&quot;<br>        }<br>
                 ntlm_auth = &quot;/usr/bin/ntlm_auth --request-nt-key --username=%{Stripped-User-Name:-%{User-Name:-None}} --challenge=%{mschap:Challenge:-00} --nt-response=%{mschap:NT-Response:-00}&quot;<br>        }<br>
         ....[snip]....<br>
         ....[snip]....<br>
-}</pre>
+}
+
+</pre>
 </blockquote>
 </blockquote>
 <p>The mschap option in the authorize and authenticate sections is enabled by default. If they are not, enable them accordingly. Save the file. </p>
 <p>The mschap option in the authorize and authenticate sections is enabled by default. If they are not, enable them accordingly. Save the file. </p>
 <p>The radius server has a secret key for security. The default key for freeradius is testing123. It is a good idea to change it for obvious security reasons. The key is in /etc/raddb/clients.conf. </p>
 <p>The radius server has a secret key for security. The default key for freeradius is testing123. It is a good idea to change it for obvious security reasons. The key is in /etc/raddb/clients.conf. </p>
@@ -33,10 +42,11 @@
         ....[snip]....
         ....[snip]....
 </pre>
 </pre>
 </blockquote>
 </blockquote>
-<p><strong>Note</strong>: if you change the secret key, you must modify the /etc/radiusclient/servers so that they match each other.
+<p><strong>Note</strong>: if you change the secret key, you must modify the /etc/radiusclient-ng/servers so that they match each other.
 </p>
 </p>
+<p>Refer to <a href="poptop_ads_howto_a6.htm">Appendix 6</a> for information on Fedora 4 / 5 / 6.</p>
 <hr>
 <hr>
-<p><strong><a name="access"></a>14.2 PPTP Access Control </strong></p>
+<p><strong><a name="access"></a>15.2 PPTP Access Control </strong></p>
 <p>The above configuration allows everyone with a valid userID in the AD to connect to the pptpd server. If you want to restrict access to a group of users, you can create a group, say VPN_Allowed, in the AD. Add users to the group and modify the ntml_auth line in /etc/raddb/radius.conf to include the parameter &quot;--require-membership-of=EXAMPLE+VPN_Allowed&quot;. </p>
 <p>The above configuration allows everyone with a valid userID in the AD to connect to the pptpd server. If you want to restrict access to a group of users, you can create a group, say VPN_Allowed, in the AD. Add users to the group and modify the ntml_auth line in /etc/raddb/radius.conf to include the parameter &quot;--require-membership-of=EXAMPLE+VPN_Allowed&quot;. </p>
 <p>In the example, I split the line into multiple lines for clarity. It should be one continuous line in the configuration file. </p>
 <p>In the example, I split the line into multiple lines for clarity. It should be one continuous line in the configuration file. </p>
 <blockquote>
 <blockquote>

+ 20 - 18
html/poptop_ads_howto/poptop_ads_howto_a1.htm

@@ -9,14 +9,27 @@
 
 
 <body>
 <body>
 <p><strong>APPENDIX</strong></p>
 <p><strong>APPENDIX</strong></p>
-<p><strong><a name="mppe"></a>A1. Install MPPE Kernel Module on Fedora Core 4</strong><br> 
-  (last update: 6 March 2006) </p>
-<p>MPPE support is required for MSCHAPv2. Depending on the kernel version, you may or may not require to perform this step. Kernel version 2.6.15 or above has MPPE built-in. If you are using the latest FC4 2.6.15 kernel, you can go to <a href="poptop_ads_howto_4.htm#pppd_pptpd">Step 7</a> now. If you are using an older kernel  which  does not support MPPE, you will have to add this feature to it. </p>
+<p><strong><a name="mppe"></a>A1. Install MPPE Kernel Module on Fedora Core 4 / 5 / 6 </strong></p>
+<p>In summary, Fedora Core 5 or above, the Kernel has built-in MPPE functionality.</p>
+<hr>
+<strong><a name="a11_fc56" id="a11_fc56"></a>A1.1 Fedora Core 5 and 6</strong><br>
+(last update: 19 May 2007)
+<p>Kernel version 2.6.15 or above has MPPE built-in which is required for MSCHAPv2. Fedora Core 5 and 6 kernel version on the CD are 2.6.15 and 2.6.18 respectively. That means you do not need to install the MPPE module as you have to for Fedora Core 4. Information for FC4 and MPPE is in <a href="poptop_ads_howto_a1.htm">Appendix A1.2</a>.</p>
+<p>To test if your kernel supports MPPE:</p>
+<blockquote>
+  <pre>[root@pptp ~]# modprobe ppp-compress-18 &amp;&amp; echo ok</pre>
+</blockquote>
+<p>It should return an &quot;ok&quot;. Then move to <a href="poptop_ads_howto_4.htm#pppd_pptpd">step 8</a>.</p>
+<p><strong>Note:</strong> The latest kernel for Fedora Core 5/6 at the time of writing is 2.6.20.</p>
+<hr>
+<strong><a name="a12_fc4"></a>A1.2 Fedora Core 4<br>
+</strong>(last update: 6 March 2006) 
+<p>MPPE support is required for MSCHAPv2. Depending on the kernel version, you may or may not require to perform this step. Kernel version 2.6.15 or above has MPPE built-in. If you are using the latest FC4 2.6.15 kernel, you can go to <a href="poptop_ads_howto_4.htm#pppd_pptpd">Step 8 </a> now. If you are using an older kernel  which  does not support MPPE, you will have to add this feature to it. </p>
 <p>To test if your kernel supports MPPE:</p>
 <p>To test if your kernel supports MPPE:</p>
 <blockquote>
 <blockquote>
   <pre>[root@pptp ~]# modprobe ppp-compress-18 &amp;&amp; echo ok</pre>
   <pre>[root@pptp ~]# modprobe ppp-compress-18 &amp;&amp; echo ok</pre>
 </blockquote>
 </blockquote>
-<p>If it returns an &quot;ok&quot;, you can safely skip this step and move to <a href="poptop_ads_howto_4.htm#pppd_pptpd">Step 7</a>. If you see &quot;FATAL: Module ppp_mppe not found.&quot;, install MPPE support as described in the following procedure:</p>
+<p>If it returns an &quot;ok&quot;, you can safely skip this step and move to <a href="poptop_ads_howto_4.htm#pppd_pptpd">Step 8 </a>. If you see &quot;FATAL: Module ppp_mppe not found.&quot;, install MPPE support as described in the following procedure:</p>
 <p>  Download the MPPE module builder in rpm format from <a href="http://sourceforge.net/project/showfiles.php?group_id=44827">here</a>. The required RPMs are::</p>
 <p>  Download the MPPE module builder in rpm format from <a href="http://sourceforge.net/project/showfiles.php?group_id=44827">here</a>. The required RPMs are::</p>
 <blockquote>
 <blockquote>
   <pre>dkms-2.0.6-1.noarch.rpm
   <pre>dkms-2.0.6-1.noarch.rpm
@@ -28,26 +41,15 @@ kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm</pre>
 [root@pptp ~]# rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm </pre>
 [root@pptp ~]# rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm </pre>
 </blockquote>
 </blockquote>
 <p>If you upgrade your kernel to 2.6.13 or above, kernel_ppp_mppe version 1.0.2 or above must be used. Otherwise, the pptp tunnel will not connect and you will see error message &quot;This system lacks kernel support for PPP.&quot; in /var/log/messages.</p>
 <p>If you upgrade your kernel to 2.6.13 or above, kernel_ppp_mppe version 1.0.2 or above must be used. Otherwise, the pptp tunnel will not connect and you will see error message &quot;This system lacks kernel support for PPP.&quot; in /var/log/messages.</p>
+<p>Please see <a href="#autoinstaller">A1.3 Kernel Upgrade and dkms_autoinstaller</a> for more information on dkms. </p>
 <dt><strong>Note:</strong></dt>
 <dt><strong>Note:</strong></dt>
 <dd>(1) Fedora Extra provides also a dkms rpm, dkms-2.0.6-3.fc4.noarch.rpm. I have not tested it. You may want to use the one I mentioned above to make sure the installation will work. </dd>
 <dd>(1) Fedora Extra provides also a dkms rpm, dkms-2.0.6-3.fc4.noarch.rpm. I have not tested it. You may want to use the one I mentioned above to make sure the installation will work. </dd>
 <br><hr>
 <br><hr>
-<strong><a name="autoinstaller"></a>A1.1 Kernel Upgrade and dkms_autoinstaller</strong><br>
+<strong><a name="autoinstaller"></a>A1.3 Kernel Upgrade and dkms_autoinstaller</strong><br>
 (last update: 6 March 2006)
 (last update: 6 March 2006)
 <p>If you upgrade your kernel after installing dkms, thanks to the dkms_autoinstaller service, you will not have to worry about the dkms kernel module. dkms_autoinstaller runs on every bootup. It checks  the dkms module to ensure it match the kernel version. If a mismatch is found, it will create a proper one for the boot kernel. </p>
 <p>If you upgrade your kernel after installing dkms, thanks to the dkms_autoinstaller service, you will not have to worry about the dkms kernel module. dkms_autoinstaller runs on every bootup. It checks  the dkms module to ensure it match the kernel version. If a mismatch is found, it will create a proper one for the boot kernel. </p>
 <p>For dkms_autoinstaller to work, you will need the correct kernel-devel version installed in your system. It is always a good idea to install the kernel-devel rpm alongside with your new kernel.</p>
 <p>For dkms_autoinstaller to work, you will need the correct kernel-devel version installed in your system. It is always a good idea to install the kernel-devel rpm alongside with your new kernel.</p>
 <hr>
 <hr>
-<a name="pppd"><strong>A2. Upgrade pppd on Fedora Core 4 </strong></a><br>
-(last update 6 March 2006)
-<p>FC4 comes with ppp-2.4.2-7. It is required to be upgraded to a patched version which supports MPPE. The patched version can be found in <a href="http://sourceforge.net/project/showfiles.php?group_id=44827">here</a>. Download the rpm for FC4. At the time of writing, the latest version is 2.4.3-5. Get the FC4 rpm: </p>
-<blockquote>
-  <pre>ppp-2.4.3-5.fc4.i386.rpm</pre>
-</blockquote>
-<p>Upgrade the ppp with the downloaded version:</p>
-<blockquote>
-  <pre>[root@pptp ~]# rpm -Uvh ppp-2.4.3-5.fc4.i386.rpm</pre>
-</blockquote>
-<p><strong>Note</strong>: If you are a Gentoo user, and are using kernel v2.6.15, the ppp-2.4.3-5 does NOT work because of MPPC. You may find more information from <a href="http://kernel-bugs.osdl.org/show_bug.cgi?id=5827">here</a>.</p>
-<hr>
-<a href="poptop_ads_howto_a2.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_a1.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
+<a href="poptop_ads_howto_a2.htm">Next</a> &nbsp;&nbsp;<a href="poptop_ads_howto_12.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
 </body>
 </body>
 </html>
 </html>

+ 16 - 19
html/poptop_ads_howto/poptop_ads_howto_a2.htm

@@ -7,32 +7,28 @@
 </head>
 </head>
 
 
 <body>
 <body>
-<p><strong>A3. Samba for Fedora Core 4<br>
-  </strong>(last update: 6 March 2006)</p>
-<p>FC4 comes with samba v3.0.14a. The samba project released v3.0.20 on 20 August 2005. Here is a quote from the v3.0.20 release note about winbind.</p>
+<p><a name="pppd"><strong>A2. Upgrade pppd on Fedora Core 4 / 5 / 6 </strong></a></p>
+<p><a name="fc56_pppd"></a><strong>A2.1 Fedora 5 and 6</strong><br>
+(last update: 19 May 2007)</p>
+<p>FC5 comes with ppp-2.4.3-6.2.1 and FC6 has ppp-2.4.4-1. MPPE support is already enabled. If ppp is not installed, use<em> yum</em> to install it.</p>
 <blockquote>
 <blockquote>
-  <p>-- quote --<br>
-    Winbindd has been completely rewritten in this release to support
-an almost completely non-blocking, asynchronous request/reply
-model.  This means that winbindd will scale much better in 
-large domain environments and on high latency networks.<br>
-  </p>
+  <pre>[root@pptp ~]# yum install ppp</pre>
 </blockquote>
 </blockquote>
-<p>It is highly recommended to upgrade samba to v3.0.20 or above. The latest samba v3.0.21c rpms for FC4 can be found in <a href="http://us5.samba.org/samba/ftp/Binary_Packages/Fedora/RPMS/i386/core/4/">here</a>. Download a copy and then update samba with command &quot;rpm -Uvh samba*.rpm&quot;. </p>
-<p><strong>Note: </strong>
-Samba v3.0.21 has a bug on the oplock code. Avoid this version. Use v3.0.21a or above. </p>
+<p><strong>Note</strong>: Information on how to update ppp module on FC4 is in <a href="#f4_pppd">the next section.</a></p>
 <hr>
 <hr>
-<a name="fc4freeradius"></a><strong>A4. Software for Radius Setup on Fedora Core 4</strong><br>
-(last update: 1 February 2006)
-<p>In additional to the software we installed in the previous sections, we need two more. Freeradius is one of them. FC4 comes with freeradius-1.0.2-2 but it is broken. At the time of writing, the latest one is freeradius-1.0.4-1.FC4.1. Get it from <em>yum</em> as it has quite a few dependences. <em>yum</em> will resolve all required dependences automagically.</p>
+<p><strong><a name="f4_pppd"></a>A2.2 Fedora Core 4</strong><br>
+(last update: 6 March 2006) </p>
+<p>FC4 comes with ppp-2.4.2-7. It is required to be upgraded to a patched version which supports MPPE. The patched version can be found in <a href="http://sourceforge.net/project/showfiles.php?group_id=44827">here</a>. Download the rpm for FC4. At the time of writing, the latest version is 2.4.3-5. Get the FC4 rpm: </p>
 <blockquote>
 <blockquote>
-  <pre>[root@pptp ~]# yum install freeradius</pre>
+  <pre>ppp-2.4.3-5.fc4.i386.rpm</pre>
 </blockquote>
 </blockquote>
-<p>The second software you will need is radiusclient. Get the FC4 rpm, radiusclient-0.3.2-0.2.fc4.rf.i386.rpm, from <a href="http://rpmforge.net/user/packages/radiusclient/">RPMforge</a>. Install it with &quot;rpm -ivh&quot;.</p>
-
+<p>Upgrade the ppp with the downloaded version:</p>
+<blockquote>
+  <pre>[root@pptp ~]# rpm -Uvh ppp-2.4.3-5.fc4.i386.rpm</pre>
+</blockquote>
+<p><strong>Note</strong>: If you are a Gentoo user, and are using kernel v2.6.15, the ppp-2.4.3-5 does NOT work because of MPPC. You may find more information from <a href="http://kernel-bugs.osdl.org/show_bug.cgi?id=5827">here</a>.</p>
 <hr>
 <hr>
-<a href="poptop_ads_howto_a1.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
+<a href="poptop_ads_howto_a3.htm">Next</a>&nbsp;&nbsp;<a href="poptop_ads_howto_a1.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
 <p>&nbsp; </p>
 <p>&nbsp; </p>
 </body>
 </body>
 </html>
 </html>

+ 41 - 0
html/poptop_ads_howto/poptop_ads_howto_a3.htm

@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Poptop MSCHAP2 ADS Howto</title>
+</head>
+
+<body>
+<p><a name="a3_samba"></a><strong>A3. Samba for Fedora Core 4 / 5 / 6 </strong></p>
+<p><strong><a name="fc56_samba"></a>A3.1 Fedora Core 5 / 6</strong><br>
+(last update: 19 May 2007)</p>
+<p>FC5 comes with samba v3.0.21b and FC6 has version 3.0.23c. The current samba RPM version from <em>yum</em> at the time of writing for FC5/6 is v3.0.24. It is highly recommended to use the latest version. </p>
+<p>The required RPM packages for samba in Fedora are <em>samba, samba-client, samba-common</em>. Install through <em>yum</em> if any of them is missing. </p>
+<blockquote>
+  <pre>[root@pptp ~]# yum install samba samba-common samba-client</pre>
+</blockquote>
+<p>Please go to <a href="poptop_ads_howto_5.htm#smbconf">Section 9.1</a> to continue the Samba configuration. </p>
+<p><strong>Note: </strong> Information on Samba and FC4 can be found in <a href="poptop_ads_howto_a2.htm#samba">the next section</a>.</p>
+<hr>
+<strong>A3.2 Fedora Core 4 </strong><br>
+(last update: 6 March 2006)
+<p>FC4 comes with samba v3.0.14a. The samba project released v3.0.20 on 20 August 2005. Here is a quote from the v3.0.20 release note about winbind.</p>
+<blockquote>
+  <p>-- quote --<br>
+    Winbindd has been completely rewritten in this release to support
+an almost completely non-blocking, asynchronous request/reply
+model.  This means that winbindd will scale much better in 
+large domain environments and on high latency networks.<br>
+-- quote --
+  </p>
+</blockquote>
+<p>It is highly recommended to upgrade samba to v3.0.20 or above. The latest samba v3.0.21c rpms for FC4 can be found in <a href="http://us5.samba.org/samba/ftp/Binary_Packages/Fedora/RPMS/i386/core/4/">here</a>. Download a copy and then update samba with command &quot;rpm -Uvh samba*.rpm&quot;.</p>
+<p>Please go to <a href="poptop_ads_howto_5.htm#smbconf">Section 9.1</a> to continue the Samba configuration.</p>
+<p><strong>Note: </strong>
+Samba v3.0.21 has a bug on the oplock code. Avoid this version. Use v3.0.21a or above. </p>
+<hr>
+<a href="poptop_ads_howto_a4.htm">Next</a>&nbsp;&nbsp;<a href="poptop_ads_howto_a2.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
+<p>&nbsp; </p>
+</body>
+</html>

+ 34 - 0
html/poptop_ads_howto/poptop_ads_howto_a4.htm

@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Poptop MSCHAP2 ADS Howto</title>
+</head>
+
+<body>
+<p><a name="a4freeradius"></a><strong>A4. Software for Radius Setup on Fedora Core 4 / 5 / 6</strong></p>
+ 
+<p><strong><a name="fc56_freeradius"></a>A4.1 Fedora 5 / 6</strong><br>
+(last update: 19 May 2007)</p>
+ <p>FC5 and FC6 have freeradius bundled. FC5 has freeradius-1.0.5 and FC6 has freeradius-1.1.3. Get it from <em>yum</em> if it is not installed. It has quite a few dependences and <em>yum</em> will resolve all required dependences automagically.</p>
+ <blockquote>
+   <pre>[root@pptp ~]# yum install freeradius </pre>
+ </blockquote>
+ <p>The second software you will need is radiusclient. Get the rpm, radiusclient-0.3.2-0.2.fc5.rf.i386.rpm or radiusclient-0.3.2-0.2.fc6.rf.i386.rpm, from <a href="http://dries.ulyssis.org/rpm/packages/radiusclient/info.html">here</a>. Install it with &quot;rpm -ivh&quot;.</p>
+ <p>After installing freeradius and radiusclient, move to <a href="poptop_howto_a5.htm#rclientconf">Appendix A5</a></p>
+ <p><strong>Note:</strong> information for FC4 is in <a href="#fc4freeradius">the next section </a>.</p>
+ <hr>
+ <strong>A4.2 Fedore 4 </strong><br>
+(last update: 1 February 2006)
+<p>In additional to the software we installed in the previous sections, we need two more. Freeradius is one of them. FC4 comes with freeradius-1.0.2-2 but it is broken. At the time of writing, the latest one is freeradius-1.0.4-1.FC4.1. Get it from <em>yum</em> as it has quite a few dependences. <em>yum</em> will resolve all required dependences automagically. </p>
+ <blockquote>
+  <pre>[root@pptp ~]# yum install freeradius</pre>
+</blockquote>
+<p>The second software you will need is radiusclient. Get the FC4 rpm, radiusclient-0.3.2-0.2.fc4.rf.i386.rpm, from <a href="http://rpmforge.net/user/packages/radiusclient/">RPMforge</a>. Install it with &quot;rpm -ivh&quot;.</p>
+<p>After installing freeradius and radiusclient, move to <a href="poptop_ads_howto_a5.htm#rclientconf">Appendix A5</a></p>
+<hr>
+<a href="poptop_ads_howto_a5.htm">Next</a>&nbsp;&nbsp;<a href="poptop_ads_howto_a3.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
+<p>&nbsp; </p>
+</body>
+</html>

File diff suppressed because it is too large
+ 87 - 0
html/poptop_ads_howto/poptop_ads_howto_a5.htm


+ 40 - 0
html/poptop_ads_howto/poptop_ads_howto_a6.htm

@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Poptop MSCHAP2 ADS Howto</title>
+</head>
+
+<body>
+<p><strong>A6. Configure Freeradius for MSCHAPv2 on Fedora 4 / 5 / 6<br>
+</strong>(last update: 19 May 2007) </p>
+ 
+<p>Edit /etc/raddb/radiusd.conf to enable MSCAHP2. Open the file and locate the module section and then the mschap subsection.</p>
+<blockquote>
+  <pre>modules {<br>
+        ....[snip]....<br>
+        mschap {
+                authtype = MS-CHAP
+                use_mppe = yes
+                require_encryption = yes
+                require_strong = yes
+                ntlm_auth = &quot;/usr/bin/ntlm_auth --request-nt-key --username=%{Stripped-User-Name:-%{User-Name:-None}} --challenge=%{mschap:Challenge:-00} --nt-response=%{mschap:NT-Response:-00}&quot;<br>        }<br>
+        ....[snip]....<br>
+}</pre>
+</blockquote>
+<p>The mschap option in the authorize and authenticate sections is enabled by default. If they are not, enable them accordingly. Save the file. </p>
+<p>The radius server has a secret key for security. The default key for freeradius is testing123. It is a good idea to change it for obvious security reasons. The key is in /etc/raddb/clients.conf. </p>
+<blockquote>
+  <pre>client 127.0.0.1 {<br>        #<br>        #  The shared secret use to &quot;encrypt&quot; and &quot;sign&quot; packets between<br>        #  the NAS and FreeRADIUS.  You MUST change this secret from the<br>        #  default, otherwise it's not a secret any more!<br>        #<br>        #  The secret can be any string, up to 32 characters in length.<br>        #<br>        secret          = testing123 
+
+        ....[snip]....
+</pre>
+</blockquote>
+<p><strong>Note</strong>: if you change the secret key, you must modify the /etc/radiusclient/servers so that they match each other. </p>
+
+<hr>
+<a href="poptop_ads_howto_a5.htm">Previous</a>&nbsp;&nbsp;<a href="poptop_ads_howto_1.htm#toc">Content</a>
+<p>&nbsp; </p>
+</body>
+</html>

+ 1 - 1
inststr.h

@@ -4,7 +4,7 @@
  * Change process title
  * Change process title
  * From code by C. S. Ananian
  * From code by C. S. Ananian
  *
  *
- * $Id: inststr.h,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+ * $Id: inststr.h,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
  */
  */
 
 
 #ifndef _PPTPD_INSTSTR_H
 #ifndef _PPTPD_INSTSTR_H

+ 1 - 1
mkinstalldirs

@@ -4,7 +4,7 @@
 # Created: 1993-05-16
 # Created: 1993-05-16
 # Public domain
 # Public domain
 
 
-# $Id: mkinstalldirs,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+# $Id: mkinstalldirs,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
 
 
 errstatus=0
 errstatus=0
 
 

+ 1 - 1
our_getopt.h

@@ -3,7 +3,7 @@
  *
  *
  * Header file for the getopt_long deprived.
  * Header file for the getopt_long deprived.
  *
  *
- * $Id: our_getopt.h,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+ * $Id: our_getopt.h,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
  */
  */
 
 
 /* Declarations for getopt.
 /* Declarations for getopt.

+ 1 - 1
our_syslog.h

@@ -3,7 +3,7 @@
  *
  *
  * Syslog replacement functions
  * Syslog replacement functions
  *
  *
- * $Id: our_syslog.h,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+ * $Id: our_syslog.h,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
  */
  */
 
 
 #ifndef _PPTPD_SYSLOG_H
 #ifndef _PPTPD_SYSLOG_H

+ 0 - 882
plugins/pppd.h

@@ -1,882 +0,0 @@
-/*
- * pppd.h - PPP daemon global declarations.
- *
- * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The name "Carnegie Mellon University" must not be used to
- *    endorse or promote products derived from this software without
- *    prior written permission. For permission or any legal
- *    details, please contact
- *      Office of Technology Transfer
- *      Carnegie Mellon University
- *      5000 Forbes Avenue
- *      Pittsburgh, PA  15213-3890
- *      (412) 268-4387, fax: (412) 268-7395
- *      tech-transfer@andrew.cmu.edu
- *
- * 4. Redistributions of any form whatsoever must retain the following
- *    acknowledgment:
- *    "This product includes software developed by Computing Services
- *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
- *
- * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * 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 $
- */
-
-/*
- * TODO:
- */
-
-#ifndef __PPPD_H__
-#define __PPPD_H__
-
-#include <stdio.h>		/* for FILE */
-#include <limits.h>		/* for NGROUPS_MAX */
-#include <sys/param.h>		/* for MAXPATHLEN and BSD4_4, if defined */
-#include <sys/types.h>		/* for u_int32_t, if defined */
-#include <sys/time.h>		/* for struct timeval */
-#include <net/ppp_defs.h>
-#include "patchlevel.h"
-
-#if defined(__STDC__)
-#include <stdarg.h>
-#define __V(x)	x
-#else
-#include <varargs.h>
-#define __V(x)	(va_alist) va_dcl
-#define const
-#define volatile
-#endif
-
-#ifdef INET6
-#include "eui64.h"
-#endif
-
-/*
- * Limits.
- */
-
-#define NUM_PPP		1	/* One PPP interface supported (per process) */
-#define MAXWORDLEN	1024	/* max length of word in file (incl null) */
-#define MAXARGS		1	/* max # args to a command */
-#define MAXNAMELEN	256	/* max length of hostname or name for auth */
-#define MAXSECRETLEN	256	/* max length of password or secret */
-
-/*
- * Option descriptor structure.
- */
-
-typedef unsigned char	bool;
-
-enum opt_type {
-	o_special_noarg = 0,
-	o_special = 1,
-	o_bool,
-	o_int,
-	o_uint32,
-	o_string,
-	o_wild
-};
-
-typedef struct {
-	char	*name;		/* name of the option */
-	enum opt_type type;
-	void	*addr;
-	char	*description;
-	unsigned int flags;
-	void	*addr2;
-	int	upper_limit;
-	int	lower_limit;
-	const char *source;
-	short int priority;
-	short int winner;
-} option_t;
-
-/* Values for flags */
-#define OPT_VALUE	0xff	/* mask for presupplied value */
-#define OPT_HEX		0x100	/* int option is in hex */
-#define OPT_NOARG	0x200	/* option doesn't take argument */
-#define OPT_OR		0x400	/* OR in argument to value */
-#define OPT_INC		0x800	/* increment value */
-#define OPT_A2OR	0x800	/* for o_bool, OR arg to *(u_char *)addr2 */
-#define OPT_PRIV	0x1000	/* privileged option */
-#define OPT_STATIC	0x2000	/* string option goes into static array */
-#define OPT_LLIMIT	0x4000	/* check value against lower limit */
-#define OPT_ULIMIT	0x8000	/* check value against upper limit */
-#define OPT_LIMITS	(OPT_LLIMIT|OPT_ULIMIT)
-#define OPT_ZEROOK	0x10000	/* 0 value is OK even if not within limits */
-#define OPT_HIDE	0x10000	/* for o_string, print value as ?????? */
-#define OPT_A2LIST	0x10000 /* for o_special, keep list of values */
-#define OPT_A2CLRB	0x10000 /* o_bool, clr val bits in *(u_char *)addr2 */
-#define OPT_NOINCR	0x20000	/* value mustn't be increased */
-#define OPT_ZEROINF	0x40000	/* with OPT_NOINCR, 0 == infinity */
-#define OPT_PRIO	0x80000	/* process option priorities for this option */
-#define OPT_PRIOSUB	0x100000 /* subsidiary member of priority group */
-#define OPT_ALIAS	0x200000 /* option is alias for previous option */
-#define OPT_A2COPY	0x400000 /* addr2 -> second location to rcv value */
-#define OPT_ENABLE	0x800000 /* use *addr2 as enable for option */
-#define OPT_A2CLR	0x1000000 /* clear *(bool *)addr2 */
-#define OPT_PRIVFIX	0x2000000 /* user can't override if set by root */
-#define OPT_INITONLY	0x4000000 /* option can only be set in init phase */
-#define OPT_DEVEQUIV	0x8000000 /* equiv to device name */
-#define OPT_DEVNAM	(OPT_INITONLY | OPT_DEVEQUIV)
-#define OPT_A2PRINTER	0x10000000 /* *addr2 is a fn for printing option */
-#define OPT_A2STRVAL	0x20000000 /* *addr2 points to current string value */
-#define OPT_NOPRINT	0x40000000 /* don't print this option at all */
-
-#define OPT_VAL(x)	((x) & OPT_VALUE)
-
-/* Values for priority */
-#define OPRIO_DEFAULT	0	/* a default value */
-#define OPRIO_CFGFILE	1	/* value from a configuration file */
-#define OPRIO_CMDLINE	2	/* value from the command line */
-#define OPRIO_SECFILE	3	/* value from options in a secrets file */
-#define OPRIO_ROOT	100	/* added to priority if OPT_PRIVFIX && root */
-
-#ifndef GIDSET_TYPE
-#define GIDSET_TYPE	gid_t
-#endif
-
-/* Structure representing a list of permitted IP addresses. */
-struct permitted_ip {
-    int		permit;		/* 1 = permit, 0 = forbid */
-    u_int32_t	base;		/* match if (addr & mask) == base */
-    u_int32_t	mask;		/* base and mask are in network byte order */
-};
-
-/*
- * Unfortunately, the linux kernel driver uses a different structure
- * for statistics from the rest of the ports.
- * This structure serves as a common representation for the bits
- * pppd needs.
- */
-struct pppd_stats {
-    unsigned int	bytes_in;
-    unsigned int	bytes_out;
-    unsigned int	pkts_in;
-    unsigned int	pkts_out;
-};
-
-/* Used for storing a sequence of words.  Usually malloced. */
-struct wordlist {
-    struct wordlist	*next;
-    char		*word;
-};
-
-/* An endpoint discriminator, used with multilink. */
-#define MAX_ENDP_LEN	20	/* maximum length of discriminator value */
-struct epdisc {
-    unsigned char	class;
-    unsigned char	length;
-    unsigned char	value[MAX_ENDP_LEN];
-};
-
-/* values for epdisc.class */
-#define EPD_NULL	0	/* null discriminator, no data */
-#define EPD_LOCAL	1
-#define EPD_IP		2
-#define EPD_MAC		3
-#define EPD_MAGIC	4
-#define EPD_PHONENUM	5
-
-typedef void (*notify_func) __P((void *, int));
-
-struct notifier {
-    struct notifier *next;
-    notify_func	    func;
-    void	    *arg;
-};
-
-/*
- * Global variables.
- */
-
-extern int	hungup;		/* Physical layer has disconnected */
-extern int	ifunit;		/* Interface unit number */
-extern char	ifname[];	/* Interface name */
-extern char	hostname[];	/* Our hostname */
-extern u_char	outpacket_buf[]; /* Buffer for outgoing packets */
-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 */
-extern int	redirect_stderr;/* Connector's stderr should go to file */
-extern char	peer_authname[];/* Authenticated name of peer */
-extern int	auth_done[NUM_PPP]; /* Methods actually used for auth */
-extern int	privileged;	/* We were run by real-uid root */
-extern int	need_holdoff;	/* Need holdoff period after link terminates */
-extern char	**script_env;	/* Environment variables for scripts */
-extern int	detached;	/* Have detached from controlling tty */
-extern GIDSET_TYPE groups[NGROUPS_MAX];	/* groups the user is in */
-extern int	ngroups;	/* How many groups valid in groups */
-extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
-extern int	link_stats_valid; /* set if link_stats is valid */
-extern unsigned	link_connect_time; /* time the link was up for */
-extern int	using_pty;	/* using pty as device (notty or pty opt.) */
-extern int	log_to_fd;	/* logging to this fd as well as syslog */
-extern bool	log_default;	/* log_to_fd is default (stdout) */
-extern char	*no_ppp_msg;	/* message to print if ppp not in kernel */
-extern volatile int status;	/* exit status for pppd */
-extern bool	devnam_fixed;	/* can no longer change devnam */
-extern int	unsuccess;	/* # unsuccessful connection attempts */
-extern int	do_callback;	/* set if we want to do callback next */
-extern int	doing_callback;	/* set if this is a callback */
-extern int	error_count;	/* # of times error() has been called */
-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	listen_time;	/* time to listen first (ms) */
-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 */
-extern struct notifier *sigreceived; /* notification of received signal */
-extern struct notifier *ip_up_notifier; /* IPCP has come up */
-extern struct notifier *ip_down_notifier; /* IPCP has gone down */
-extern struct notifier *auth_up_notifier; /* peer has authenticated */
-extern struct notifier *link_down_notifier; /* link has gone down */
-extern struct notifier *fork_notifier;	/* we are a new child process */
-
-/* Values for do_callback and doing_callback */
-#define CALLBACK_DIALIN		1	/* we are expecting the call back */
-#define CALLBACK_DIALOUT	2	/* we are dialling out to call back */
-
-/*
- * Variables set by command-line options.
- */
-
-extern int	debug;		/* Debug flag */
-extern int	kdebugflag;	/* Tell kernel to print debug messages */
-extern int	default_device;	/* Using /dev/tty or equivalent */
-extern char	devnam[MAXPATHLEN];	/* Device name */
-extern int	crtscts;	/* Use hardware flow control */
-extern bool	modem;		/* Use modem control lines */
-extern int	inspeed;	/* Input/Output speed requested */
-extern u_int32_t netmask;	/* IP netmask to set on interface */
-extern bool	lockflag;	/* Create lock file to lock the serial dev */
-extern bool	nodetach;	/* Don't detach from controlling tty */
-extern bool	updetach;	/* Detach from controlling tty when link up */
-extern char	*initializer;	/* Script to initialize physical link */
-extern char	*connect_script; /* Script to establish physical link */
-extern char	*disconnect_script; /* Script to disestablish physical link */
-extern char	*welcomer;	/* Script to welcome client after connection */
-extern char	*ptycommand;	/* Command to run on other side of pty */
-extern int	maxconnect;	/* Maximum connect time (seconds) */
-extern char	user[MAXNAMELEN];/* Our name for authenticating ourselves */
-extern char	passwd[MAXSECRETLEN];	/* Password for PAP or CHAP */
-extern bool	auth_required;	/* Peer is required to authenticate */
-extern bool	persist;	/* Reopen link after it goes down */
-extern bool	uselogin;	/* Use /etc/passwd for checking PAP */
-extern char	our_name[MAXNAMELEN];/* Our name for authentication purposes */
-extern char	remote_name[MAXNAMELEN]; /* Peer's name for authentication */
-extern bool	explicit_remote;/* remote_name specified with remotename opt */
-extern bool	demand;		/* Do dial-on-demand */
-extern char	*ipparam;	/* Extra parameter for ip up/down scripts */
-extern bool	cryptpap;	/* Others' PAP passwords are encrypted */
-extern int	idle_time_limit;/* Shut down link if idle for this long */
-extern int	holdoff;	/* Dead time before restarting */
-extern bool	holdoff_specified; /* true if user gave a holdoff value */
-extern bool	notty;		/* Stdin/out is not a tty */
-extern char	*pty_socket;	/* Socket to connect to pty */
-extern char	*record_file;	/* File to record chars sent/received */
-extern bool	sync_serial;	/* Device is synchronous serial device */
-extern int	maxfail;	/* Max # of unsuccessful connection attempts */
-extern char	linkname[MAXPATHLEN]; /* logical name for link */
-extern bool	tune_kernel;	/* May alter kernel settings as necessary */
-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 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 */
-
-#ifdef MAXOCTETS
-extern unsigned int maxoctets;	     /* Maximum octetes per session (in bytes) */
-extern int       maxoctets_dir;      /* Direction :
-				      0 - in+out (default)
-				      1 - in 
-				      2 - out
-				      3 - max(in,out) */
-extern int       maxoctets_timeout;  /* Timeout for check of octets limit */
-#define PPP_OCTETS_DIRECTION_SUM        0
-#define PPP_OCTETS_DIRECTION_IN         1
-#define PPP_OCTETS_DIRECTION_OUT        2
-#define PPP_OCTETS_DIRECTION_MAXOVERAL  3
-/* same as previos, but little different on RADIUS side */
-#define PPP_OCTETS_DIRECTION_MAXSESSION 4	
-#endif
-
-#ifdef PPP_FILTER
-extern struct	bpf_program pass_filter;   /* Filter for pkts to pass */
-extern struct	bpf_program active_filter; /* Filter for link-active pkts */
-#endif
-
-#ifdef MSLANMAN
-extern bool	ms_lanman;	/* Use LanMan password instead of NT */
-				/* Has meaning only with MS-CHAP challenges */
-#endif
-
-/* Values for auth_pending, auth_done */
-#define PAP_WITHPEER	0x1
-#define PAP_PEER	0x2
-#define CHAP_WITHPEER	0x4
-#define CHAP_PEER	0x8
-#define EAP_WITHPEER	0x10
-#define EAP_PEER	0x20
-
-/* 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 */
-extern char *option_source;	/* string saying where the option came from */
-extern int  option_priority;	/* priority of current options */
-
-/*
- * Values for phase.
- */
-#define PHASE_DEAD		0
-#define PHASE_INITIALIZE	1
-#define PHASE_SERIALCONN	2
-#define PHASE_DORMANT		3
-#define PHASE_ESTABLISH		4
-#define PHASE_AUTHENTICATE	5
-#define PHASE_CALLBACK		6
-#define PHASE_NETWORK		7
-#define PHASE_RUNNING		8
-#define PHASE_TERMINATE		9
-#define PHASE_DISCONNECT	10
-#define PHASE_HOLDOFF		11
-
-/*
- * The following struct gives the addresses of procedures to call
- * for a particular protocol.
- */
-struct protent {
-    u_short protocol;		/* PPP protocol number */
-    /* Initialization procedure */
-    void (*init) __P((int unit));
-    /* Process a received packet */
-    void (*input) __P((int unit, u_char *pkt, int len));
-    /* Process a received protocol-reject */
-    void (*protrej) __P((int unit));
-    /* Lower layer has come up */
-    void (*lowerup) __P((int unit));
-    /* Lower layer has gone down */
-    void (*lowerdown) __P((int unit));
-    /* Open the protocol */
-    void (*open) __P((int unit));
-    /* Close the protocol */
-    void (*close) __P((int unit, char *reason));
-    /* Print a packet in readable form */
-    int  (*printpkt) __P((u_char *pkt, int len,
-			  void (*printer) __P((void *, char *, ...)),
-			  void *arg));
-    /* Process a received data packet */
-    void (*datainput) __P((int unit, u_char *pkt, int len));
-    bool enabled_flag;		/* 0 iff protocol is disabled */
-    char *name;			/* Text name of protocol */
-    char *data_name;		/* Text name of corresponding data protocol */
-    option_t *options;		/* List of command-line options */
-    /* Check requested options, assign defaults */
-    void (*check_options) __P((void));
-    /* Configure interface for demand-dial */
-    int  (*demand_conf) __P((int unit));
-    /* Say whether to bring up link for this pkt */
-    int  (*active_pkt) __P((u_char *pkt, int len));
-};
-
-/* Table of pointers to supported protocols */
-extern struct protent *protocols[];
-
-/*
- * This struct contains pointers to a set of procedures for
- * doing operations on a "channel".  A channel provides a way
- * to send and receive PPP packets - the canonical example is
- * a serial port device in PPP line discipline (or equivalently
- * with PPP STREAMS modules pushed onto it).
- */
-struct channel {
-	/* set of options for this channel */
-	option_t *options;
-	/* find and process a per-channel options file */
-	void (*process_extra_options) __P((void));
-	/* check all the options that have been given */
-	void (*check_options) __P((void));
-	/* get the channel ready to do PPP, return a file descriptor */
-	int  (*connect) __P((void));
-	/* we're finished with the channel */
-	void (*disconnect) __P((void));
-	/* put the channel into PPP `mode' */
-	int  (*establish_ppp) __P((int));
-	/* take the channel out of PPP `mode', restore loopback if demand */
-	void (*disestablish_ppp) __P((int));
-	/* set the transmit-side PPP parameters of the channel */
-	void (*send_config) __P((int, u_int32_t, int, int));
-	/* set the receive-side PPP parameters of the channel */
-	void (*recv_config) __P((int, u_int32_t, int, int));
-	/* cleanup on error or normal exit */
-	void (*cleanup) __P((void));
-	/* close the device, called in children after fork */
-	void (*close) __P((void));
-};
-
-extern struct channel *the_channel;
-
-/*
- * Prototypes.
- */
-
-/* Procedures exported from main.c. */
-void set_ifunit __P((int));	/* set stuff that depends on ifunit */
-void detach __P((void));	/* Detach from controlling tty */
-void die __P((int));		/* Cleanup and exit */
-void quit __P((void));		/* like die(1) */
-void novm __P((char *));	/* Say we ran out of memory, and die */
-void timeout __P((void (*func)(void *), void *arg, int s, int us));
-				/* Call func(arg) after s.us seconds */
-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 */
-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));
-				/* Run program prog with args in child */
-void reopen_log __P((void));	/* (re)open the connection to syslog */
-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 */
-void new_phase __P((int));	/* signal start of new phase */
-void add_notifier __P((struct notifier **, notify_func, void *));
-void remove_notifier __P((struct notifier **, notify_func, void *));
-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));
-
-/* Procedures exported from tty.c. */
-void tty_init __P((void));
-
-/* Procedures exported from utils.c. */
-void log_packet __P((u_char *, int, char *, int));
-				/* Format a packet and log it with syslog */
-void print_string __P((char *, int,  void (*) (void *, char *, ...),
-		void *));	/* Format a string for output */
-int slprintf __P((char *, int, char *, ...));		/* sprintf++ */
-int vslprintf __P((char *, int, char *, va_list));	/* vsprintf++ */
-size_t strlcpy __P((char *, const char *, size_t));	/* safe strcpy */
-size_t strlcat __P((char *, const char *, size_t));	/* safe strncpy */
-void dbglog __P((char *, ...));	/* log a debug message */
-void info __P((char *, ...));	/* log an informational message */
-void notice __P((char *, ...));	/* log a notice-level message */
-void warn __P((char *, ...));	/* log a warning message */
-void error __P((char *, ...));	/* log an error message */
-void fatal __P((char *, ...));	/* log an error message and die(1) */
-void init_pr_log __P((char *, int));	/* initialize for using pr_log */
-void pr_log __P((void *, char *, ...));	/* printer fn, output to syslog */
-void end_pr_log __P((void));	/* finish up after using pr_log */
-void dump_packet __P((const char *, u_char *, int));
-				/* dump packet to debug log if interesting */
-ssize_t complete_read __P((int, void *, size_t));
-				/* read a complete buffer */
-
-/* Procedures exported from auth.c */
-void link_required __P((int));	  /* we are starting to use the link */
-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 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 */
-void np_up __P((int, int));	  /* a network protocol has come up */
-void np_down __P((int, int));	  /* a network protocol has gone down */
-void np_finished __P((int, int)); /* a network protocol no longer needs link */
-void auth_peer_fail __P((int, int));
-				/* peer failed to authenticate itself */
-void auth_peer_success __P((int, int, int, char *, int));
-				/* peer successfully authenticated itself */
-void auth_withpeer_fail __P((int, int));
-				/* we failed to authenticate ourselves */
-void auth_withpeer_success __P((int, int, int));
-				/* we successfully authenticated ourselves */
-void auth_check_options __P((void));
-				/* check authentication options supplied */
-void auth_reset __P((int));	/* check what secrets we have */
-int  check_passwd __P((int, char *, int, char *, int, char **));
-				/* Check peer-supplied username/password */
-int  get_secret __P((int, char *, char *, char *, int *, int));
-				/* get "secret" for chap */
-int  get_srp_secret __P((int unit, char *client, char *server, char *secret,
-    int am_server));
-int  auth_ip_addr __P((int, u_int32_t));
-				/* check if IP address is authorized */
-int  auth_number __P((void));	/* check if remote number is authorized */
-int  bad_ip_adrs __P((u_int32_t));
-				/* check if IP address is unreasonable */
-
-/* Procedures exported from demand.c */
-void demand_conf __P((void));	/* config interface(s) for demand-dial */
-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 */
-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 */
-void mp_check_options __P((void)); /* Check multilink-related options */
-int  mp_join_bundle __P((void));  /* join our link to an appropriate bundle */
-char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */
-int  str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */
-
-/* Procedures exported from sys-*.c */
-void sys_init __P((void));	/* Do system-dependent initialization */
-void sys_cleanup __P((void));	/* Restore system state before exiting */
-int  sys_check_options __P((void)); /* Check options specified */
-void sys_close __P((void));	/* Clean up in a child before execing */
-int  ppp_available __P((void));	/* Test whether ppp kernel support exists */
-int  get_pty __P((int *, int *, char *, int));	/* Get pty master/slave */
-int  open_ppp_loopback __P((void)); /* Open loopback for demand-dialling */
-int  tty_establish_ppp __P((int));  /* Turn serial port into a ppp interface */
-void tty_disestablish_ppp __P((int)); /* Restore port to normal operation */
-void generic_disestablish_ppp __P((int dev_fd)); /* Restore device setting */
-int  generic_establish_ppp __P((int dev_fd)); /* Make a ppp interface */
-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 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 */
-void setdtr __P((int, int));	/* Raise or lower port's DTR line */
-void output __P((int, u_char *, int)); /* Output a PPP packet */
-void wait_input __P((struct timeval *));
-				/* Wait for input, with timeout */
-void add_fd __P((int));		/* Add fd to set to wait for */
-void remove_fd __P((int));	/* Remove fd from set to wait for */
-int  read_packet __P((u_char *)); /* Read PPP packet */
-int  get_loop_output __P((void)); /* Read pkts from loopback */
-void tty_send_config __P((int, u_int32_t, int, int));
-				/* Configure i/f transmit parameters */
-void tty_set_xaccm __P((ext_accm));
-				/* Set extended transmit ACCM */
-void tty_recv_config __P((int, u_int32_t, int, int));
-				/* Configure i/f receive parameters */
-int  ccp_test __P((int, u_char *, int, int));
-				/* Test support for compression scheme */
-void ccp_flags_set __P((int, int, int));
-				/* Set kernel CCP state */
-int  ccp_fatal_error __P((int)); /* Test for fatal decomp error in kernel */
-int  get_idle_time __P((int, struct ppp_idle *));
-				/* Find out how long link has been idle */
-int  get_ppp_stats __P((int, struct pppd_stats *));
-				/* Return link statistics */
-void netif_set_mtu __P((int, int)); /* Set PPP interface MTU */
-int  netif_get_mtu __P((int));      /* Get PPP interface MTU */
-int  sifvjcomp __P((int, int, int, int));
-				/* Configure VJ TCP header compression */
-int  sifup __P((int));		/* Configure i/f up for one protocol */
-int  sifnpmode __P((int u, int proto, enum NPmode mode));
-				/* Set mode for handling packets for proto */
-int  sifdown __P((int));	/* Configure i/f down for one protocol */
-int  sifaddr __P((int, u_int32_t, u_int32_t, u_int32_t));
-				/* Configure IPv4 addresses for i/f */
-int  cifaddr __P((int, u_int32_t, u_int32_t));
-				/* Reset i/f IP addresses */
-#ifdef INET6
-int  sif6addr __P((int, eui64_t, eui64_t));
-				/* Configure IPv6 addresses for i/f */
-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));
-				/* Create default route through i/f */
-int  cifdefaultroute __P((int, u_int32_t, u_int32_t));
-				/* Delete default route through i/f */
-int  sifproxyarp __P((int, u_int32_t));
-				/* Add proxy ARP entry for peer */
-int  cifproxyarp __P((int, u_int32_t));
-				/* Delete proxy ARP entry for peer */
-u_int32_t GetMask __P((u_int32_t)); /* Get appropriate netmask for address */
-int  lock __P((char *));	/* Create lock file for device */
-int  relock __P((int));		/* Rewrite lock file with new pid */
-void unlock __P((void));	/* Delete previously-created lock file */
-void logwtmp __P((const char *, const char *, const char *));
-				/* Write entry to wtmp file */
-int  get_host_seed __P((void));	/* Get host-dependent random number seed */
-int  have_route_to __P((u_int32_t)); /* Check if route to addr exists */
-#ifdef PPP_FILTER
-int  set_filters __P((struct bpf_program *pass, struct bpf_program *active));
-				/* Set filter programs in kernel */
-#endif
-#ifdef IPX_CHANGE
-int  sipxfaddr __P((int, unsigned long, unsigned char *));
-int  cipxfaddr __P((int));
-#endif
-int  get_if_hwaddr __P((u_char *addr, char *name));
-char *get_first_ethernet __P((void));
-
-/* Procedures exported from options.c */
-int setipaddr __P((char *, char **, int)); /* Set local/remote ip addresses */
-int  parse_args __P((int argc, char **argv));
-				/* Parse options from arguments given */
-int  options_from_file __P((char *filename, int must_exist, int check_prot,
-			    int privileged));
-				/* Parse options from an options file */
-int  options_from_user __P((void)); /* Parse options from user's .ppprc */
-int  options_for_tty __P((void)); /* Parse options from /etc/ppp/options.tty */
-int  options_from_list __P((struct wordlist *, int privileged));
-				/* Parse options from a wordlist */
-int  getword __P((FILE *f, char *word, int *newlinep, char *filename));
-				/* Read a word from a file */
-void option_error __P((char *fmt, ...));
-				/* Print an error message about an option */
-int int_option __P((char *, int *));
-				/* Simplified number_option for decimal ints */
-void add_options __P((option_t *)); /* Add extra options */
-void check_options __P((void));	/* check values after all options parsed */
-int  override_value __P((const char *, int, const char *));
-				/* override value if permitted by priority */
-void print_options __P((void (*) __P((void *, char *, ...)), void *));
-				/* print out values of all options */
-
-int parse_dotted_ip __P((char *, u_int32_t *));
-
-/*
- * Hooks to enable plugins to change various things.
- */
-extern int (*new_phase_hook) __P((int));
-extern int (*idle_time_hook) __P((struct ppp_idle *));
-extern int (*holdoff_hook) __P((void));
-extern int (*pap_check_hook) __P((void));
-extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
-				 struct wordlist **paddrs,
-				 struct wordlist **popts));
-extern void (*pap_logout_hook) __P((void));
-extern int (*pap_passwd_hook) __P((char *user, char *passwd));
-extern int (*allowed_address_hook) __P((u_int32_t addr));
-extern void (*ip_up_hook) __P((void));
-extern void (*ip_down_hook) __P((void));
-extern void (*ip_choose_hook) __P((u_int32_t *));
-
-extern int (*chap_check_hook) __P((void));
-extern int (*chap_passwd_hook) __P((char *user, char *passwd));
-
-/* Let a plugin snoop sent and received packets.  Useful for L2TP */
-extern void (*snoop_recv_hook) __P((unsigned char *p, int len));
-extern void (*snoop_send_hook) __P((unsigned char *p, int len));
-
-/*
- * Inline versions of get/put char/short/long.
- * Pointer is advanced; we assume that both arguments
- * are lvalues and will already be in registers.
- * cp MUST be u_char *.
- */
-#define GETCHAR(c, cp) { \
-	(c) = *(cp)++; \
-}
-#define PUTCHAR(c, cp) { \
-	*(cp)++ = (u_char) (c); \
-}
-
-
-#define GETSHORT(s, cp) { \
-	(s) = *(cp)++ << 8; \
-	(s) |= *(cp)++; \
-}
-#define PUTSHORT(s, cp) { \
-	*(cp)++ = (u_char) ((s) >> 8); \
-	*(cp)++ = (u_char) (s); \
-}
-
-#define GETLONG(l, cp) { \
-	(l) = *(cp)++ << 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; \
-}
-#define PUTLONG(l, cp) { \
-	*(cp)++ = (u_char) ((l) >> 24); \
-	*(cp)++ = (u_char) ((l) >> 16); \
-	*(cp)++ = (u_char) ((l) >> 8); \
-	*(cp)++ = (u_char) (l); \
-}
-
-#define INCPTR(n, cp)	((cp) += (n))
-#define DECPTR(n, cp)	((cp) -= (n))
-
-/*
- * System dependent definitions for user-level 4.3BSD UNIX implementation.
- */
-
-#define TIMEOUT(r, f, t)	timeout((r), (f), (t), 0)
-#define UNTIMEOUT(r, f)		untimeout((r), (f))
-
-#define BCOPY(s, d, l)		memcpy(d, s, l)
-#define BZERO(s, n)		memset(s, 0, n)
-#define	BCMP(s1, s2, l)		memcmp(s1, s2, l)
-
-#define PRINTMSG(m, l)		{ info("Remote message: %0.*v", l, m); }
-
-/*
- * MAKEHEADER - Add Header fields to a packet.
- */
-#define MAKEHEADER(p, t) { \
-    PUTCHAR(PPP_ALLSTATIONS, p); \
-    PUTCHAR(PPP_UI, p); \
-    PUTSHORT(t, p); }
-
-/*
- * Exit status values.
- */
-#define EXIT_OK			0
-#define EXIT_FATAL_ERROR	1
-#define EXIT_OPTION_ERROR	2
-#define EXIT_NOT_ROOT		3
-#define EXIT_NO_KERNEL_SUPPORT	4
-#define EXIT_USER_REQUEST	5
-#define EXIT_LOCK_FAILED	6
-#define EXIT_OPEN_FAILED	7
-#define EXIT_CONNECT_FAILED	8
-#define EXIT_PTYCMD_FAILED	9
-#define EXIT_NEGOTIATION_FAILED	10
-#define EXIT_PEER_AUTH_FAILED	11
-#define EXIT_IDLE_TIMEOUT	12
-#define EXIT_CONNECT_TIME	13
-#define EXIT_CALLBACK		14
-#define EXIT_PEER_DEAD		15
-#define EXIT_HANGUP		16
-#define EXIT_LOOPBACK		17
-#define EXIT_INIT_FAILED	18
-#define EXIT_AUTH_TOPEER_FAILED	19
-#ifdef MAXOCTETS
-#define EXIT_TRAFFIC_LIMIT	20
-#endif
-#define EXIT_CNID_AUTH_FAILED	21
-
-/*
- * Debug macros.  Slightly useful for finding bugs in pppd, not particularly
- * useful for finding out why your connection isn't being established.
- */
-#ifdef DEBUGALL
-#define DEBUGMAIN	1
-#define DEBUGFSM	1
-#define DEBUGLCP	1
-#define DEBUGIPCP	1
-#define DEBUGIPV6CP	1
-#define DEBUGUPAP	1
-#define DEBUGCHAP	1
-#endif
-
-#ifndef LOG_PPP			/* we use LOG_LOCAL2 for syslog by default */
-#if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUGSYS) \
-  || defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \
-  || defined(DEBUGCHAP) || defined(DEBUG) || defined(DEBUGIPV6CP)
-#define LOG_PPP LOG_LOCAL2
-#else
-#define LOG_PPP LOG_DAEMON
-#endif
-#endif /* LOG_PPP */
-
-#ifdef DEBUGMAIN
-#define MAINDEBUG(x)	if (debug) dbglog x
-#else
-#define MAINDEBUG(x)
-#endif
-
-#ifdef DEBUGSYS
-#define SYSDEBUG(x)	if (debug) dbglog x
-#else
-#define SYSDEBUG(x)
-#endif
-
-#ifdef DEBUGFSM
-#define FSMDEBUG(x)	if (debug) dbglog x
-#else
-#define FSMDEBUG(x)
-#endif
-
-#ifdef DEBUGLCP
-#define LCPDEBUG(x)	if (debug) dbglog x
-#else
-#define LCPDEBUG(x)
-#endif
-
-#ifdef DEBUGIPCP
-#define IPCPDEBUG(x)	if (debug) dbglog x
-#else
-#define IPCPDEBUG(x)
-#endif
-
-#ifdef DEBUGIPV6CP
-#define IPV6CPDEBUG(x)  if (debug) dbglog x
-#else
-#define IPV6CPDEBUG(x)
-#endif
-
-#ifdef DEBUGUPAP
-#define UPAPDEBUG(x)	if (debug) dbglog x
-#else
-#define UPAPDEBUG(x)
-#endif
-
-#ifdef DEBUGCHAP
-#define CHAPDEBUG(x)	if (debug) dbglog x
-#else
-#define CHAPDEBUG(x)
-#endif
-
-#ifdef DEBUGIPXCP
-#define IPXCPDEBUG(x)	if (debug) dbglog x
-#else
-#define IPXCPDEBUG(x)
-#endif
-
-#ifndef SIGTYPE
-#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
-#define SIGTYPE void
-#else
-#define SIGTYPE int
-#endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */
-#endif /* SIGTYPE */
-
-#ifndef MIN
-#define MIN(a, b)	((a) < (b)? (a): (b))
-#endif
-#ifndef MAX
-#define MAX(a, b)	((a) > (b)? (a): (b))
-#endif
-
-#ifndef offsetof
-#define offsetof(type, member) ((size_t) &((type *)0)->member)
-#endif
-
-#endif /* __PPP_H__ */

+ 2 - 2
plugins/pptpd-logwtmp.c

@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: pptpd-logwtmp.c,v 1.5 2007/04/16 00:21:02 quozl Exp $
+ * $Id: pptpd-logwtmp.c,v 1.6 2013/02/07 00:37:39 quozl Exp $
  * pptpd-logwtmp.c - pppd plugin to update wtmp for a pptpd user
  * pptpd-logwtmp.c - pppd plugin to update wtmp for a pptpd user
  *
  *
  * Copyright 2004 James Cameron.
  * Copyright 2004 James Cameron.
@@ -12,7 +12,7 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <utmp.h>
 #include <utmp.h>
 #include <string.h>
 #include <string.h>
-#include "pppd.h"
+#include <pppd/pppd.h>
 
 
 char pppd_version[] = VERSION;
 char pppd_version[] = VERSION;
 
 

+ 1 - 1
ppphdlc.c

@@ -4,7 +4,7 @@
  * Copied from C. S. Ananian's linux client ppp_fcs.c
  * Copied from C. S. Ananian's linux client ppp_fcs.c
  * This code can also be found in RFC1662
  * This code can also be found in RFC1662
  *
  *
- * $Id: ppphdlc.c,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+ * $Id: ppphdlc.c,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
  */
  */
 
 
 /* Fast Frame Check Sequence (FCS) Implementation, for HDLC-like framing of
 /* Fast Frame Check Sequence (FCS) Implementation, for HDLC-like framing of

+ 1 - 1
ppphdlc.h

@@ -3,7 +3,7 @@
  *
  *
  * Copied from C. S. Ananians ppp_fcs.h
  * Copied from C. S. Ananians ppp_fcs.h
  *
  *
- * $Id: ppphdlc.h,v 1.1.1.1 2002/06/21 08:52:00 fenix_nl Exp $
+ * $Id: ppphdlc.h,v 1.1 2002/06/21 08:52:00 fenix_nl Exp $
  */
  */
 
 
 #ifndef _PPTPD_PPPHDLC_H
 #ifndef _PPTPD_PPPHDLC_H

+ 34 - 15
pptpctrl.c

@@ -3,7 +3,7 @@
  *
  *
  * PPTP control connection between PAC-PNS pair
  * PPTP control connection between PAC-PNS pair
  *
  *
- * $Id: pptpctrl.c,v 1.20 2006/12/08 00:01:40 quozl Exp $
+ * $Id: pptpctrl.c,v 1.25 2013/02/07 00:32:29 quozl Exp $
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
@@ -54,6 +54,9 @@
 // placing net/if.h here fixes build on Solaris
 // placing net/if.h here fixes build on Solaris
 #include <net/if.h>
 #include <net/if.h>
 
 
+#ifdef VRF
+char *vrf = NULL;
+#endif
 static char *ppp_binary = PPP_BINARY;
 static char *ppp_binary = PPP_BINARY;
 static int pptp_logwtmp;
 static int pptp_logwtmp;
 static int noipparam;			/* if true, don't send ipparam to ppp */
 static int noipparam;			/* if true, don't send ipparam to ppp */
@@ -135,6 +138,9 @@ int main(int argc, char **argv)
 	/* note: update pptpctrl.8 if the argument list format is changed */
 	/* note: update pptpctrl.8 if the argument list format is changed */
 	GETARG_INT(pptpctrl_debug);
 	GETARG_INT(pptpctrl_debug);
 	GETARG_INT(noipparam);
 	GETARG_INT(noipparam);
+#ifdef VRF
+	GETARG_STRING(vrf);
+#endif
 	GETARG_VALUE(pppdxfig);
 	GETARG_VALUE(pppdxfig);
 	GETARG_VALUE(speed);
 	GETARG_VALUE(speed);
 	GETARG_VALUE(pppLocal);
 	GETARG_VALUE(pppLocal);
@@ -142,8 +148,17 @@ int main(int argc, char **argv)
 	if (arg < argc) GETARG_INT(unique_call_id);
 	if (arg < argc) GETARG_INT(unique_call_id);
 	if (arg < argc) GETARG_STRING(ppp_binary);
 	if (arg < argc) GETARG_STRING(ppp_binary);
 	if (arg < argc) GETARG_INT(pptp_logwtmp);
 	if (arg < argc) GETARG_INT(pptp_logwtmp);
-	
+
+#ifdef VRF
+	if (!*vrf) {
+		free(vrf);
+		vrf = NULL;
+	}
+#endif
 	if (pptpctrl_debug) {
 	if (pptpctrl_debug) {
+#ifdef VRF
+		syslog(LOG_DEBUG, "CTRL: VRF used = %s", vrf ? vrf : "NONE");
+#endif
 		if (*pppLocal)
 		if (*pppLocal)
 			syslog(LOG_DEBUG, "CTRL: local address = %s", pppLocal);
 			syslog(LOG_DEBUG, "CTRL: local address = %s", pppLocal);
 		if (*pppRemote)
 		if (*pppRemote)
@@ -226,6 +241,7 @@ static void pptp_handle_ctrl_connection(char **pppaddrs, struct in_addr *inetadd
 	int echo_wait = FALSE;		/* Waiting for echo? */
 	int echo_wait = FALSE;		/* Waiting for echo? */
 	u_int32_t echo_count = 0;	/* Sequence # of echo */
 	u_int32_t echo_count = 0;	/* Sequence # of echo */
 	time_t echo_time = 0;		/* Time last echo req sent */
 	time_t echo_time = 0;		/* Time last echo req sent */
+	time_t last_time = time(NULL);	/* Time last received data */
 	struct timeval idleTime;	/* How long to select() */
 	struct timeval idleTime;	/* How long to select() */
 
 
 	/* General local variables */
 	/* General local variables */
@@ -281,16 +297,6 @@ static void pptp_handle_ctrl_connection(char **pppaddrs, struct in_addr *inetadd
 			} else if (encaps_gre(-1, NULL, 0))
 			} else if (encaps_gre(-1, NULL, 0))
 				/* Pending ack and nothing else to do */
 				/* Pending ack and nothing else to do */
 				encaps_gre(gre_fd, NULL, 0);	/* send ack with no payload */
 				encaps_gre(gre_fd, NULL, 0);	/* send ack with no payload */
-			else if (echo_wait != TRUE) {
-				/* Timeout. Start idle link detection. */
-				echo_count++;
-				if (pptpctrl_debug)
-					syslog(LOG_DEBUG, "CTRL: Sending ECHO REQ id %d", echo_count);
-				time(&echo_time);
-				make_echo_req_packet(rply_packet, &rply_size, echo_count);
-				echo_wait = TRUE;
-				send_packet = TRUE;
-			}
 			break;
 			break;
 
 
 		default:
 		default:
@@ -328,6 +334,7 @@ static void pptp_handle_ctrl_connection(char **pppaddrs, struct in_addr *inetadd
 		/* handle control messages */
 		/* handle control messages */
 
 
 		if (FD_ISSET(clientSocket, &fds)) {
 		if (FD_ISSET(clientSocket, &fds)) {
+			time(&last_time);
 			send_packet = TRUE;
 			send_packet = TRUE;
 			switch (read_pptp_packet(clientSocket, packet, rply_packet, &rply_size)) {
 			switch (read_pptp_packet(clientSocket, packet, rply_packet, &rply_size)) {
 			case 0:
 			case 0:
@@ -420,6 +427,15 @@ static void pptp_handle_ctrl_connection(char **pppaddrs, struct in_addr *inetadd
 
 
 			/* Otherwise, the already-formed reply will do fine, so send it */
 			/* Otherwise, the already-formed reply will do fine, so send it */
 			}
 			}
+		/* send echo request packet if we have not heard from the TCP socket in IDLE_TIME */
+		} else if (echo_wait != TRUE && (time(NULL) - last_time) > IDLE_WAIT) {
+			echo_count++;
+			if (pptpctrl_debug)
+				syslog(LOG_DEBUG, "CTRL: Sending ECHO REQ id %d", echo_count);
+			time(&echo_time);
+			make_echo_req_packet(rply_packet, &rply_size, echo_count);
+			echo_wait = TRUE;
+			send_packet = TRUE;
 		}
 		}
 
 
 		/* send reply packet - this may block, but it should be very rare */
 		/* send reply packet - this may block, but it should be very rare */
@@ -657,9 +673,10 @@ static int startCall(char **pppaddrs, struct in_addr *inetaddrs)
  */
  */
 static void launch_pppd(char **pppaddrs, struct in_addr *inetaddrs)
 static void launch_pppd(char **pppaddrs, struct in_addr *inetaddrs)
 {
 {
-	char *pppd_argv[14];
+	char *pppd_argv[16];
 	int an = 0;
 	int an = 0;
 	sigset_t sigs;
 	sigset_t sigs;
+	char pppInterfaceIPs[33];
 
 
 	pppd_argv[an++] = ppp_binary;
 	pppd_argv[an++] = ppp_binary;
 
 
@@ -760,11 +777,9 @@ static void launch_pppd(char **pppaddrs, struct in_addr *inetaddrs)
 	}
 	}
 	
 	
 	if (*pppaddrs[0] || *pppaddrs[1]) {
 	if (*pppaddrs[0] || *pppaddrs[1]) {
-		char pppInterfaceIPs[33];
 		sprintf(pppInterfaceIPs, "%s:%s", pppaddrs[0], pppaddrs[1]);
 		sprintf(pppInterfaceIPs, "%s:%s", pppaddrs[0], pppaddrs[1]);
 		pppd_argv[an++] = pppInterfaceIPs;
 		pppd_argv[an++] = pppInterfaceIPs;
 	}
 	}
-#endif
 
 
         if (!noipparam) {
         if (!noipparam) {
                  pppd_argv[an++] = "ipparam";
                  pppd_argv[an++] = "ipparam";
@@ -777,6 +792,10 @@ static void launch_pppd(char **pppaddrs, struct in_addr *inetaddrs)
                  pppd_argv[an++] = "pptpd-original-ip";
                  pppd_argv[an++] = "pptpd-original-ip";
                  pppd_argv[an++] = inet_ntoa(inetaddrs[1]);
                  pppd_argv[an++] = inet_ntoa(inetaddrs[1]);
         }
         }
+#endif
+
+	pppd_argv[an++] = "remotenumber";
+	pppd_argv[an++] = inet_ntoa(inetaddrs[1]);
 
 
 	/* argv arrays must always be NULL terminated */
 	/* argv arrays must always be NULL terminated */
 	pppd_argv[an++] = NULL;
 	pppd_argv[an++] = NULL;

+ 7 - 1
pptpctrl.h

@@ -3,7 +3,7 @@
  *
  *
  * PPTP control function prototypes.
  * PPTP control function prototypes.
  *
  *
- * $Id: pptpctrl.h,v 1.1.1.1 2002/06/21 08:52:01 fenix_nl Exp $
+ * $Id: pptpctrl.h,v 1.2 2011/05/19 00:02:50 quozl Exp $
  */
  */
 
 
 #ifndef _PPTPD_PPTPCTRL_H
 #ifndef _PPTPD_PPTPCTRL_H
@@ -11,4 +11,10 @@
 
 
 extern int pptpctrl_debug;
 extern int pptpctrl_debug;
 
 
+#ifdef VRF
+extern char *vrf;
+#else
+#define vrf_socket(vrf, dom, typ, prot) socket(dom, typ, prot)
+#endif
+
 #endif	/* !_PPTPD_PPTPCTRL_H */
 #endif	/* !_PPTPD_PPTPCTRL_H */

+ 4 - 0
pptpd.8

@@ -117,6 +117,10 @@ With this option, pptpd does not pass an address, and so pppd may use
 radius or chap-secrets to allocate an address.
 radius or chap-secrets to allocate an address.
 
 
 .TP
 .TP
+\fB-V\fR|\fB--vrf \fIvrf-name
+specifies the VRF to be used for listening in.
+
+.TP
 .BR -v | --version
 .BR -v | --version
 displays the current version of the pptp daemon.
 displays the current version of the pptp daemon.
 
 

+ 41 - 11
pptpd.c

@@ -4,7 +4,7 @@
  * Grabs any command line argument and processes any further options in
  * Grabs any command line argument and processes any further options in
  * the pptpd config file, before throwing over to pptpmanager.c.
  * the pptpd config file, before throwing over to pptpmanager.c.
  *
  *
- * $Id: pptpd.c,v 1.18 2006/09/04 23:17:25 quozl Exp $
+ * $Id: pptpd.c,v 1.20 2013/02/07 00:12:09 quozl Exp $
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
@@ -54,6 +54,9 @@ char *ppp_binary = NULL;
 char *pppdoptstr = NULL;
 char *pppdoptstr = NULL;
 char *speedstr = NULL;
 char *speedstr = NULL;
 char *bindaddr = NULL;
 char *bindaddr = NULL;
+#ifdef VRF
+char *vrf = NULL;
+#endif
 #ifdef BCRELAY
 #ifdef BCRELAY
 char *bcrelay = NULL;
 char *bcrelay = NULL;
 #endif
 #endif
@@ -86,8 +89,11 @@ static void showusage(char *prog)
 	printf("\npptpd v%s\n", VERSION);
 	printf("\npptpd v%s\n", VERSION);
 	printf("Usage: pptpd [options], where options are:\n\n");
 	printf("Usage: pptpd [options], where options are:\n\n");
 #ifdef BCRELAY
 #ifdef BCRELAY
+#define OPT_BCRELAY "b"
 	printf(" [-b] [--bcrelay if]       Use broadcast relay for broadcasts comming from.\n");
 	printf(" [-b] [--bcrelay if]       Use broadcast relay for broadcasts comming from.\n");
 	printf("                           the specified interface (default is eth1).\n");
 	printf("                           the specified interface (default is eth1).\n");
+#else
+#define OPT_BCRELAY ""
 #endif
 #endif
 	printf(" [-c] [--conf file]        Specifies the config file to read default\n");
 	printf(" [-c] [--conf file]        Specifies the config file to read default\n");
 	printf("                           settings from (default is %s).\n", PPTPD_CONFIG_FILE_DEFAULT);
 	printf("                           settings from (default is %s).\n", PPTPD_CONFIG_FILE_DEFAULT);
@@ -98,6 +104,14 @@ static void showusage(char *prog)
 	printf(" [-i] [--noipparam]        Suppress the passing of the client's IP address\n");
 	printf(" [-i] [--noipparam]        Suppress the passing of the client's IP address\n");
 	printf("                           to PPP, which is done by default otherwise.\n");
 	printf("                           to PPP, which is done by default otherwise.\n");
 	printf(" [-l] [--listen x.x.x.x]   Specifies IP of local interface to listen to.\n");
 	printf(" [-l] [--listen x.x.x.x]   Specifies IP of local interface to listen to.\n");
+#ifdef VRF
+#define OPT_VRFA "V:"
+#define OPT_VRF "V"
+	printf(" [-V] [--vrf name]         Use given VRF for GRE/TCP sockets.\n");
+#else
+#define OPT_VRFA ""
+#define OPT_VRF ""
+#endif
 #if !defined(BSDUSER_PPP)
 #if !defined(BSDUSER_PPP)
 	printf(" [-o] [--option file]      Specifies the PPP options file to use\n");
 	printf(" [-o] [--option file]      Specifies the PPP options file to use\n");
 	printf("                           (default is /etc/ppp/options).\n");
 	printf("                           (default is /etc/ppp/options).\n");
@@ -148,11 +162,7 @@ int main(int argc, char **argv)
 	/* process command line options */
 	/* process command line options */
 	while (1) {
 	while (1) {
 		int option_index = 0;
 		int option_index = 0;
-#ifdef BCRELAY
-		char *optstring = "b:c:de:fhil:o:p:s:t:vwC:D";
-#else
-		char *optstring = "c:de:fhil:o:p:s:t:vwC:D";
-#endif
+		char *optstring = OPT_BCRELAY ":c:de:fhil:o:p:s:t:vwC:D" OPT_VRFA;
 
 
 		static struct option long_options[] =
 		static struct option long_options[] =
 		{
 		{
@@ -174,6 +184,9 @@ int main(int argc, char **argv)
 			{"logwtmp", 0, 0, 0},
 			{"logwtmp", 0, 0, 0},
 			{"connections", 1, 0, 0},
 			{"connections", 1, 0, 0},
 			{"delegate", 0, 0, 0},
 			{"delegate", 0, 0, 0},
+#ifdef VRF
+			{"vrf", 1, 0, 0},
+#endif
 			{0, 0, 0, 0}
 			{0, 0, 0, 0}
 		};
 		};
 
 
@@ -182,11 +195,8 @@ int main(int argc, char **argv)
 			break;
 			break;
 		/* convert long options to short form */
 		/* convert long options to short form */
 		if (c == 0)
 		if (c == 0)
-#ifdef BCRELAY
-			c = "bcdefhilopstvwCD"[option_index];
-#else
-			c = "cdefhilopstvwCD"[option_index];
-#endif
+			c = OPT_BCRELAY "cdefhilopstvwCD" OPT_VRF [option_index];
+
 		switch (c) {
 		switch (c) {
 #ifdef BCRELAY
 #ifdef BCRELAY
 		case 'b': /* --bcrelay */
 		case 'b': /* --bcrelay */
@@ -205,6 +215,13 @@ int main(int argc, char **argv)
 			bindaddr = strdup(tmpstr);
 			bindaddr = strdup(tmpstr);
 			break;
 			break;
 
 
+#ifdef VRF
+		case 'V': /* --vrf */
+			if (vrf) free(vrf);
+			vrf = strdup(optarg);
+			break;
+#endif
+
 		case 'h': /* --help */
 		case 'h': /* --help */
 			showusage(argv[0]);
 			showusage(argv[0]);
 			return 0;
 			return 0;
@@ -323,6 +340,12 @@ int main(int argc, char **argv)
 		bindaddr = strdup(tmpstr);
 		bindaddr = strdup(tmpstr);
 	}
 	}
 
 
+#ifdef VRF
+	if (!vrf && read_config_file(configFile, VRF_KEYWORD, tmp) > 0) {
+		vrf = strdup(tmp);
+	}
+#endif
+
 	if (!speedstr && read_config_file(configFile, SPEED_KEYWORD, tmp) > 0)
 	if (!speedstr && read_config_file(configFile, SPEED_KEYWORD, tmp) > 0)
 		speedstr = strdup(tmp);
 		speedstr = strdup(tmp);
 
 
@@ -735,6 +758,13 @@ static void processIPStr(int type, char *ipstr)
 				continue;
 				continue;
 			}
 			}
 
 
+			if (upper < lower) {
+				syslog(LOG_ERR, "MGR: Bad %s IP range: %s",
+				       (type == LOCAL) ? "local" : "remote",
+				       ipstr);
+				exit(1);
+			}
+
 			for (n = lower; n <= upper; n++) {
 			for (n = lower; n <= upper; n++) {
 				sprintf(tmpstr5, "%s%d%s", ip_pre, n, ip_post);
 				sprintf(tmpstr5, "%s%d%s", ip_pre, n, ip_post);
 				/* Check if the ip address is valid */
 				/* Check if the ip address is valid */

+ 12 - 0
pptpd.conf.5

@@ -33,6 +33,12 @@ Equivalent to the command line
 .B --stimeout
 .B --stimeout
 option.
 option.
 .TP
 .TP
+.BI "logwtmp"
+update
+.BR wtmp (5)
+as users connect and disconnect.  See
+.BR wtmp (1).
+.TP
 .B debug
 .B debug
 turns on debugging mode, sending debugging information to 
 turns on debugging mode, sending debugging information to 
 .BR syslog (3).
 .BR syslog (3).
@@ -111,6 +117,12 @@ connections (TCP port 1723). Equivalent to the command line
 .B --listen
 .B --listen
 option.
 option.
 .TP
 .TP
+.BI "vrf " vrf-name
+VRF to use for the TCP listening socket as well as the GRE
+packets. Equivalent to the command line
+.B --vrf
+option.
+.TP
 .BI "pidfile " pid-file
 .BI "pidfile " pid-file
 specifies an alternate location to store the process ID file
 specifies an alternate location to store the process ID file
 (default /var/run/pptpd.pid).  Equivalent to the command line
 (default /var/run/pptpd.pid).  Equivalent to the command line

+ 13 - 4
pptpd.spec

@@ -8,6 +8,7 @@
 # --with    ipalloc
 # --with    ipalloc
 # --without bcrelay
 # --without bcrelay
 #
 #
+%define ppp_version %(rpm -q --qf='%{Version}\\n' ppp)
 
 
 Summary:        PoPToP Point to Point Tunneling Server
 Summary:        PoPToP Point to Point Tunneling Server
 Name:           pptpd
 Name:           pptpd
@@ -18,7 +19,8 @@ Group:          Applications/Internet
 URL:            http://poptop.sourceforge.net/
 URL:            http://poptop.sourceforge.net/
 Source0:        http://dl.sf.net/poptop/pptpd-%{version}.tar.gz
 Source0:        http://dl.sf.net/poptop/pptpd-%{version}.tar.gz
 Buildroot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Buildroot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Requires:       ppp >= 2.4.3
+Requires:       ppp = %{ppp_version}
+BuildRequires:  ppp
 
 
 %if %{?_without_libwrap:0}%{!?_without_libwrap:1}
 %if %{?_without_libwrap:0}%{!?_without_libwrap:1}
 BuildRequires: tcp_wrappers
 BuildRequires: tcp_wrappers
@@ -29,12 +31,14 @@ Requires(preun):  /sbin/chkconfig, /sbin/service
 Requires(postun): /sbin/service
 Requires(postun): /sbin/service
 
 
 %description
 %description
-This implements a Virtual Private Networking Server (VPN) that is
+This implements a Virtual Private Networking (VPN) Server that is
 compatible with Microsoft VPN clients. It allows windows users to
 compatible with Microsoft VPN clients. It allows windows users to
 connect to an internal firewalled network using their dialup.
 connect to an internal firewalled network using their dialup.
 
 
 %prep
 %prep
 %setup -q
 %setup -q
+date +'#define DATE "%d %b %y"' > plugins/patchlevel.h
+echo '#define VERSION "%{ppp_version}"' >> plugins/patchlevel.h
 
 
 # Fix permissions for debuginfo package
 # Fix permissions for debuginfo package
 %{__chmod} 644 *.[ch]
 %{__chmod} 644 *.[ch]
@@ -54,7 +58,6 @@ connect to an internal firewalled network using their dialup.
 	%{?_with_ipalloc:--with-pppd-ip-alloc} \
 	%{?_with_ipalloc:--with-pppd-ip-alloc} \
 	%{!?_without_bcrelay:--with-bcrelay} \
 	%{!?_without_bcrelay:--with-bcrelay} \
 	%{?_without_bcrelay:--without-bcrelay}
 	%{?_without_bcrelay:--without-bcrelay}
-(echo '#undef VERSION'; echo '#define VERSION "2.4.3"') >> plugins/patchlevel.h
 %{__make} CFLAGS='-fno-builtin -fPIC -DSBINDIR=\"%{_sbindir}\" %{optflags}'
 %{__make} CFLAGS='-fno-builtin -fPIC -DSBINDIR=\"%{_sbindir}\" %{optflags}'
 
 
 %install
 %install
@@ -100,7 +103,7 @@ fi
 
 
 %files
 %files
 %defattr(-,root,root,0755)
 %defattr(-,root,root,0755)
-%doc AUTHORS COPYING INSTALL README* TODO ChangeLog* samples
+%doc AUTHORS COPYING README* TODO ChangeLog* samples
 %{_sbindir}/pptpd
 %{_sbindir}/pptpd
 %{_sbindir}/pptpctrl
 %{_sbindir}/pptpctrl
 %{_sbindir}/pptp-portslave
 %{_sbindir}/pptp-portslave
@@ -116,6 +119,12 @@ fi
 %config(noreplace) /etc/ppp/options.pptpd
 %config(noreplace) /etc/ppp/options.pptpd
 
 
 %changelog
 %changelog
+* Thu Aug 30 2012 Charlie Brady <charlie_brady@mitel.com> 1.3.4-2
+- Update pptpd-logwtmp plugin version compatibility to match buildsys
+  ppp version.
+- Enforce ppp version compatibility via strict dependency.
+- Remove 'INSTALL' file from documentation directory
+
 * Tue Sep  5 2006 Paul Howarth <paul@city-fan.org> - 1.3.3-1
 * Tue Sep  5 2006 Paul Howarth <paul@city-fan.org> - 1.3.3-1
 - Update to 1.3.3
 - Update to 1.3.3
 - Add dist tag
 - Add dist tag

+ 2 - 2
pptpdefs.h

@@ -3,7 +3,7 @@
  *
  *
  * PPTP structs and defines
  * PPTP structs and defines
  *
  *
- * $Id: pptpdefs.h,v 1.4 2006/12/08 00:01:40 quozl Exp $
+ * $Id: pptpdefs.h,v 1.5 2007/07/20 00:34:09 quozl Exp $
  */
  */
 
 
 #ifndef _PPTPD_PPTPDEFS_H
 #ifndef _PPTPD_PPTPDEFS_H
@@ -309,7 +309,7 @@ struct pptp_gre_header {
 	u_int32_t seq;		/* sequence number.  Present if S==1 */
 	u_int32_t seq;		/* sequence number.  Present if S==1 */
 	u_int32_t ack;		/* seq number of highest packet recieved by */
 	u_int32_t ack;		/* seq number of highest packet recieved by */
 	/* sender in this session */
 	/* sender in this session */
-};
+} __attribute__((packed));
 
 
 /* For our call ID pairs */
 /* For our call ID pairs */
 #define PNS_VALUE 0
 #define PNS_VALUE 0

+ 27 - 10
pptpgre.c

@@ -4,7 +4,7 @@
  * originally by C. S. Ananian
  * originally by C. S. Ananian
  * Modified for PoPToP
  * Modified for PoPToP
  *
  *
- * $Id: pptpgre.c,v 1.9 2007/04/16 00:21:02 quozl Exp $
+ * $Id: pptpgre.c,v 1.12 2013/02/07 00:31:15 quozl Exp $
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
@@ -33,6 +33,9 @@
 #ifdef HAVE_SYS_UIO_H
 #ifdef HAVE_SYS_UIO_H
 #include <sys/uio.h>
 #include <sys/uio.h>
 #endif
 #endif
+#ifdef VRF
+#include <vrf.h>
+#endif
 
 
 #include "ppphdlc.h"
 #include "ppphdlc.h"
 #include "pptpgre.h"
 #include "pptpgre.h"
@@ -70,7 +73,7 @@ int pptp_gre_init(u_int32_t call_id_pair, int pty_fd, struct in_addr *inetaddrs)
 	int gre_fd;
 	int gre_fd;
 
 
 	/* Open IP protocol socket */
 	/* Open IP protocol socket */
-	gre_fd = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
+	gre_fd = vrf_socket(vrf, AF_INET, SOCK_RAW, PPTP_PROTO);
 	if (gre_fd < 0) {
 	if (gre_fd < 0) {
 		syslog(LOG_ERR, "GRE: socket() failed");
 		syslog(LOG_ERR, "GRE: socket() failed");
 		return -1;
 		return -1;
@@ -137,8 +140,9 @@ int decaps_hdlc(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl)
 		 */
 		 */
 		if ((status = read(fd, buffer, sizeof(buffer))) <= 0) {
 		if ((status = read(fd, buffer, sizeof(buffer))) <= 0) {
 			syslog(LOG_ERR, "GRE: read(fd=%d,buffer=%lx,len=%d) from PTY failed: status = %d error = %s%s",
 			syslog(LOG_ERR, "GRE: read(fd=%d,buffer=%lx,len=%d) from PTY failed: status = %d error = %s%s",
-			       fd, (unsigned long) buffer, sizeof(buffer), 
-			       status, status ? strerror(errno) : "No error", 
+			       fd, (unsigned long) buffer,
+			       (int) sizeof(buffer),
+			       status, status ? strerror(errno) : "No error",
 			       errno != EIO ? "" : ", usually caused by unexpected termination of pppd, check option syntax and pppd logs");
 			       errno != EIO ? "" : ", usually caused by unexpected termination of pppd, check option syntax and pppd logs");
 			/* FAQ: mistakes in pppd option spelling in
 			/* FAQ: mistakes in pppd option spelling in
 			 * /etc/ppp/options.pptpd often cause EIO,
 			 * /etc/ppp/options.pptpd often cause EIO,
@@ -345,7 +349,8 @@ int decaps_gre(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl)
 	dequeue_gre(cb, cl);
 	dequeue_gre(cb, cl);
 	if ((status = read(fd, buffer, sizeof(buffer))) <= 0) {
 	if ((status = read(fd, buffer, sizeof(buffer))) <= 0) {
 		syslog(LOG_ERR, "GRE: read(fd=%d,buffer=%lx,len=%d) from network failed: status = %d error = %s",
 		syslog(LOG_ERR, "GRE: read(fd=%d,buffer=%lx,len=%d) from network failed: status = %d error = %s",
-		       fd, (unsigned long) buffer, sizeof(buffer), status, status ? strerror(errno) : "No error");
+		       fd, (unsigned long) buffer, (int) sizeof(buffer),
+		       status, status ? strerror(errno) : "No error");
 		stats.rx_errors++;
 		stats.rx_errors++;
 		return -1;
 		return -1;
 	}
 	}
@@ -403,15 +408,20 @@ int decaps_gre(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl)
 			stats.rx_truncated++;
 			stats.rx_truncated++;
 			return 0;
 			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)
 			if (pptpctrl_debug)
 				syslog(LOG_DEBUG, "GRE: accepting packet #%d", 
 				syslog(LOG_DEBUG, "GRE: accepting packet #%d", 
 				       seq);
 				       seq);
 			stats.rx_accepted++;
 			stats.rx_accepted++;
 			gre.seq_recv = seq;
 			gre.seq_recv = seq;
 			return cb(cl, buffer + ip_len + headersize, payload_len);
 			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)
 			if (pptpctrl_debug)
 				syslog(LOG_DEBUG,
 				syslog(LOG_DEBUG,
 				       "GRE: discarding duplicate or old packet #%d (expecting #%d)", 
 				       "GRE: discarding duplicate or old packet #%d (expecting #%d)", 
@@ -438,6 +448,7 @@ int encaps_gre(int fd, void *pack, unsigned len)
 		unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)];
 		unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)];
 	} u;
 	} u;
 	unsigned header_len;
 	unsigned header_len;
+	ssize_t status;
 #ifdef HAVE_WRITEV
 #ifdef HAVE_WRITEV
 	struct iovec iovec[2];
 	struct iovec iovec[2];
 #endif
 #endif
@@ -488,12 +499,18 @@ int encaps_gre(int fd, void *pack, unsigned len)
 	iovec[0].iov_len = header_len;
 	iovec[0].iov_len = header_len;
 	iovec[1].iov_base = pack;
 	iovec[1].iov_base = pack;
 	iovec[1].iov_len = len;
 	iovec[1].iov_len = len;
-	return writev(fd, iovec, 2);
+	status = writev(fd, iovec, 2);
 #else
 #else
 	/* copy payload into buffer */
 	/* copy payload into buffer */
 	memcpy(u.buffer + header_len, pack, len);
 	memcpy(u.buffer + header_len, pack, len);
 	/* record and increment sequence numbers */
 	/* record and increment sequence numbers */
 	/* write this baby out to the net */
 	/* write this baby out to the net */
-	return write(fd, u.buffer, header_len + len);
+	status = write(fd, u.buffer, header_len + len);
 #endif
 #endif
+	/* if ENOBUFS, do not close the connection */
+	if ((status < 0) && (errno == ENOBUFS)) {
+		gre.seq_sent--;
+		status = 0;
+	}
+	return status;
 }
 }

+ 0 - 0
pptpgre.h


+ 9 - 2
pptpmanager.c

@@ -3,7 +3,7 @@
  *
  *
  * Manages the PoPToP sessions.
  * Manages the PoPToP sessions.
  *
  *
- * $Id: pptpmanager.c,v 1.14 2005/12/29 09:59:49 quozl Exp $
+ * $Id: pptpmanager.c,v 1.15 2011/05/19 00:02:50 quozl Exp $
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
@@ -32,6 +32,9 @@
 #include <time.h>
 #include <time.h>
 #include <sys/time.h>
 #include <sys/time.h>
 #include <fcntl.h>
 #include <fcntl.h>
+#ifdef VRF
+#include <vrf.h>
+#endif
 
 
 #if HAVE_LIBWRAP
 #if HAVE_LIBWRAP
 /* re-include, just in case HAVE_SYSLOG_H wasn't defined */
 /* re-include, just in case HAVE_SYSLOG_H wasn't defined */
@@ -413,7 +416,7 @@ static int createHostSocket(int *hostSocket)
 #endif
 #endif
 
 
 	/* create the master socket and check it worked */
 	/* create the master socket and check it worked */
-	if ((*hostSocket = socket(AF_INET, SOCK_STREAM, 0)) == 0)
+	if ((*hostSocket = vrf_socket(vrf, AF_INET, SOCK_STREAM, 0)) == 0)
 		return -1;
 		return -1;
 
 
 	/* set master socket to allow daemon to be restarted with connections active  */
 	/* set master socket to allow daemon to be restarted with connections active  */
@@ -492,6 +495,10 @@ static void connectCall(int clientSocket, int clientNumber)
 	ctrl_noipparam[1] = '\0';
 	ctrl_noipparam[1] = '\0';
 	ctrl_argv[pptpctrl_argc++] = ctrl_noipparam;
 	ctrl_argv[pptpctrl_argc++] = ctrl_noipparam;
 
 
+#ifdef VRF
+	ctrl_argv[pptpctrl_argc++] = vrf ? vrf : "";
+#endif
+
 	/* optionfile = TRUE or FALSE; so the CTRL manager knows whether to load a non-standard options file */
 	/* optionfile = TRUE or FALSE; so the CTRL manager knows whether to load a non-standard options file */
 	NUM2ARRAY(pppdoptfile_argv, pppdoptstr ? 1 : 0);
 	NUM2ARRAY(pppdoptfile_argv, pppdoptstr ? 1 : 0);
 	pppdoptfile_argv[1] = '\0';
 	pppdoptfile_argv[1] = '\0';

+ 0 - 0
pptpmanager.h


+ 7 - 1
samples/pptpd.conf

@@ -1,5 +1,5 @@
 ###############################################################################
 ###############################################################################
-# $Id: pptpd.conf,v 1.10 2006/09/04 23:30:57 quozl Exp $
+# $Id: pptpd.conf,v 1.11 2011/05/19 00:02:50 quozl Exp $
 #
 #
 # Sample Poptop configuration file /etc/pptpd.conf
 # Sample Poptop configuration file /etc/pptpd.conf
 #
 #
@@ -38,6 +38,12 @@ option /etc/ppp/options.pptpd
 #
 #
 logwtmp
 logwtmp
 
 
+# TAG: vrf <vrfname>
+#	Switches PPTP & GRE sockets to the specified VRF, which must exist
+#	Only available if VRF support was compiled into pptpd.
+#
+#vrf test
+
 # TAG: bcrelay <if>
 # TAG: bcrelay <if>
 #	Turns on broadcast relay to clients from interface <if>
 #	Turns on broadcast relay to clients from interface <if>
 #
 #

+ 196 - 0
tools/client-test

@@ -0,0 +1,196 @@
+#!/bin/sh
+#
+#   $Id: client-test,v 1.2 2006/02/13 23:50:44 quozl Exp $
+#
+#   client-test, PPTP lab test script
+#   Copyright (C) 2005  James Cameron (quozl@us.netrek.org)
+#
+#   This program 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; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program 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 program; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+# --
+#
+#   Creates many tunnels from a test client to a single server.
+#   Test sequence is as follows
+#
+#   1.  on server ... set it to listen on chosen network address
+#       ip addr add 10.9.0.3/16 dev eth0
+#       and edit /etc/hosts.allow to cover range "ALL: 10.9.0.0/16"
+#
+#   2.  on client ... run pptpconfig to define a tunnel named test
+#
+#   3.  run "./client-test start" to create the tunnels
+#
+#   4.  run "./client-test status" to test the tunnels with ping
+#
+#   5.  run "./client-test stop" to stop the tunnels
+#
+
+# number of sets of tunnels to create
+MAX_C=10
+
+# number of tunnels in each set
+MAX_D=100
+
+# network address prefix for test network
+PREFIX=10.9
+
+# address of server on test network
+SERVER=10.9.0.3
+
+# create a virtual interface for the address
+function if_up {
+    ip addr add ${PREFIX}.${2}.${3}/16 dev eth0 && echo -n .
+}
+
+# delete the virtual interface
+function if_down {
+    ip addr del ${PREFIX}.${2}.${3}/16 dev eth0 2>/dev/null && echo -n .
+# expected error on 2.6.8 ...
+# RTNETLINK answers: Cannot assign requested address
+}
+
+# create a tunnel from the virtual interface to the server
+function tu_up {
+    pppd call test updetach linkname test-${1} \
+        pty "pptp ${SERVER} --nolaunchpppd --localbind=${PREFIX}.${2}.${3}"
+}
+
+# create a tunnel from the virtual interface to the server
+function tu_up_fast {
+    pppd call test linkname test-${1} \
+        pty "pptp ${SERVER} --nolaunchpppd --localbind=${PREFIX}.${2}.${3}"
+    echo -n .
+    sleep 0.1
+}
+
+# delete a tunnel previously created
+function tu_down {
+    if test -f /var/run/ppp-test-${1}.pid; then
+	kill `head -1 /var/run/ppp-test-${1}.pid` && echo -n .
+    fi
+}
+
+# start tunnels rapidly and fill up available memory until swap free
+# starts to be scarce
+function filler {
+    if_up $1 $2 $3
+    tu_up_fast $1 $2 $3
+    swapfree=`grep SwapFree /proc/meminfo |awk '{print $2}'`
+    until test ${swapfree} -gt 4096; do
+	echo -n -
+	sleep 1
+    done
+}
+
+# check the state of a tunnel slot
+function state {
+    echo -n "slot ${1} "
+    if ! test -f /var/run/ppp-test-${1}.pid; then
+	echo -n "(missing) "
+    else
+	pid=`head -1 /var/run/ppp-test-${1}.pid`
+	echo -n "pid ${pid} "
+	if ! kill -0 ${pid} 2>/dev/null; then
+	    echo -n "(missing) "
+	fi
+	iface=`tail -1 /var/run/ppp-test-${1}.pid`
+	echo -n "iface ${iface} "
+	if ! ip addr show dev ${iface} 1>/dev/null 2>/dev/null; then
+	    echo -n "(missing) "
+	fi
+	inet=`ip addr show dev ${iface}|egrep --only-matching "inet [0-9.]*"|awk '{print $2}'`
+	echo -n "inet ${inet} "
+	peer=`ip addr show dev ${iface}|egrep --only-matching "peer [0-9.]*"|awk '{print $2}'`
+	echo -n "peer ${peer} "
+	avg=`/bin/ping -c 1 ${peer} 2>/dev/null | grep "rtt min" | cut -f6 -d/`
+	if test -z "${avg}"; then
+	    echo -n "ping (missing) "
+	else
+	    echo -n "ping ${avg} "
+	fi
+    fi
+    echo
+}
+
+# general purpose iteration function to call a handler (above) once
+# for each slot in the test set.  Handler receives slot number, then
+# the fragments of IP address a.b.C.D.
+function iterate {
+    x=1
+    for c in `seq ${MAX_C}`; do
+	for d in `seq ${MAX_D}`; do
+	    ${1} ${x} ${c} ${d}
+	    x=`expr ${x} + 1`
+	done
+    done
+}
+
+# start the test
+function start {
+    iterate if_up
+    echo
+    iterate tu_up
+    echo
+}
+
+# start slow test
+function fill {
+    iterate filler
+    echo
+}
+
+# stop the test
+function stop {
+    iterate tu_down
+    echo
+    sleep 10
+    iterate if_down
+    echo
+}
+
+# check status of test
+function status {
+    iterate state
+}
+
+# main dispatcher
+case "$1" in
+    start)
+	start
+	break
+    ;;
+    fill)
+	fill
+	break
+    ;;
+    stop)
+	stop
+	break
+    ;;
+    restart)
+	stop
+	start
+	break
+    ;;
+    status)
+        status
+	break
+    ;;
+    *)
+	echo "Usage: ${0} start|fill|stop|restart|status" 1>&2
+	exit 1
+    ;;
+esac
+

+ 42 - 0
tools/confmod.sh

@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# This program 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; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Your copy is available at: http://www.gnu.org/licenses/gpl.html
+
+TEMP=$(locate /etc/conf.modules); if [ -n "$TEMP" ]; then ln -s /etc/conf.modules /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias ppp ppp_generic")
+if [ -n "$TEMP" ]; then
+        grep -v "alias ppp ppp_generic" /etc/modules.conf > /etc/modules.conf1;
+        mv -f /etc/modules.conf1 /etc/modules.conf
+fi
+TEMP=$(cat /etc/modules.conf | grep "alias char-major-108 off")
+if [ -n "$TEMP" ]; then
+        grep -v "alias char-major-108 off" /etc/modules.conf > /etc/modules.conf1;
+        mv -f /etc/modules.conf1 /etc/modules.conf
+fi
+TEMP=$(cat /etc/modules.conf | grep "alias char-major-108 ppp_generic")
+if [ -z "$TEMP" ]; then echo "alias char-major-108 ppp_generic" >> /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias ppp-compress-18 ppp_mppe")
+if [ -z "$TEMP" ]; then echo "alias ppp-compress-18 ppp_mppe" >> /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias ppp-compress-21 bsd_comp")
+if [ -z "$TEMP" ]; then echo "alias ppp-compress-21 bsd_comp" >> /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias ppp-compress-24 ppp_deflate")
+if [ -z "$TEMP" ]; then echo "alias ppp-compress-24 ppp_deflate" >> /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias ppp-compress-26 ppp_deflate")
+if [ -z "$TEMP" ]; then echo "alias ppp-compress-26 ppp_deflate" >> /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias tty-ldisc-3 ppp_async")
+if [ "$TEMP" = "" ]; then echo "alias tty-ldisc-3 ppp_async" >> /etc/modules.conf; fi
+TEMP=$(cat /etc/modules.conf | grep "alias tty-ldisc-14 ppp_synctty")
+if [ -z "$TEMP" ]; then echo "alias tty-ldisc-14 ppp_synctty" >> /etc/modules.conf; fi

+ 45 - 0
tools/vpnwho.pl

@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+# NOTE: superceded by --logwtmp feature, see ../README.logwtmp
+#
+# By Jason Collins-Webb (jason@rbaltd.co.uk)
+# usage: vpnwho
+#
+# This program 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; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Your copy is available at: http://www.gnu.org/licenses/gpl.html
+#
+
+$TDateM = substr(`/bin/date +"%b"`, 0, -1);
+$TDateD = substr(`/bin/date +"%e"`, 0, -1);
+$whoson = `/bin/ps -eo pid,bsdstart,cmd|/bin/grep "pptpd \\["`;
+if ($whoson ne "") {
+@logons = split(/\n/, $whoson);
+foreach $l (@logons) {
+  if ($l =~ /(\d+)\s+(\d+:\d+).*\[(\d+\.\d+\.\d+\.\d+)\]/) {
+    $PID = $1+1;
+    $IP = $3;
+    $STIME = $2;
+    open MESSAGES, "</var/log/messages";
+    while(<MESSAGES>){
+      if ($_ =~ /.*\spppd\[$PID\]:\s+MSCHAP-v2\s.*\s(.+\\)*(.+)$/i) {
+          $User = lc($2);
+          }
+     }
+     close MESSAGES;
+  print "Current VPN connection from $User ($IP), started at $STIME\n";
+  }
+}
+} else {
+print "There are no current VPN connections.\n";
+}

+ 2 - 6
version

@@ -1,28 +1,24 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
-# Grab current version number from configure.in and emit on stdout
+# Little shell script to grab current version number from configure.in
 #
 #
-# $Id: version,v 1.1.1.1 2002/06/21 08:52:02 fenix_nl Exp $
+# $Id: version,v 1.1 2002/06/21 08:52:02 fenix_nl Exp $
 
 
 VER=`grep AM_INIT_AUTOMAKE configure.in | awk -F'[(),]' '{print $3}'`
 VER=`grep AM_INIT_AUTOMAKE configure.in | awk -F'[(),]' '{print $3}'`
-
 if [ "$1" == "-VERSION" ]
 if [ "$1" == "-VERSION" ]
 then
 then
   echo $VER | awk -F'.' '{print $1}'
   echo $VER | awk -F'.' '{print $1}'
   exit
   exit
 fi
 fi
-
 if [ "$1" == "-PATCHLEVEL" ]
 if [ "$1" == "-PATCHLEVEL" ]
 then
 then
   echo $VER | awk -F'.' '{print $2}'
   echo $VER | awk -F'.' '{print $2}'
   exit
   exit
 fi
 fi
-
 if [ "$1" == "-SUBLEVEL" ]
 if [ "$1" == "-SUBLEVEL" ]
 then
 then
   echo $VER | awk -F'.' '{print $3}'
   echo $VER | awk -F'.' '{print $3}'
   exit
   exit
 fi
 fi
-
 echo $VER
 echo $VER
 exit
 exit