Hello community,

here is the log from the commit of package pptp for openSUSE:Factory checked in 
at 2019-12-11 12:00:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pptp (Old)
 and      /work/SRC/openSUSE:Factory/.pptp.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pptp"

Wed Dec 11 12:00:33 2019 rev:19 rq:754108 version:1.10.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/pptp/pptp.changes        2017-06-23 
09:13:44.133681195 +0200
+++ /work/SRC/openSUSE:Factory/.pptp.new.4691/pptp.changes      2019-12-11 
12:00:59.588844639 +0100
@@ -1,0 +2,23 @@
+Wed Dec  4 17:19:58 UTC 2019 - Reinhard Max <[email protected]>
+
+- Update to versioin 1.10.0
+  * remove inststr in favour of prctrl PR_SET_NAME,
+  * vector tests; include in make, fix code rot, fix return status,
+  * pqueue; include missing sys/types.h,
+  * pptpsetup; prevent world-readable peers file, use
+    three-argument append, allow password trailing spaces, split
+    prints to chap-secrets, allow passwords with quotes, use
+    absolute path to pptp
+  * remove uid from ip route get output; iproute2-4.10 and later
+    may emit uid, (bsc#1131960).
+- Changes in 1.9.0
+  * close a memory leak in pqueue,
+  * avoid clobbering heap (RHBZ #1183627),
+  * fix use after free in call close request handler,
+  * add --missing-window option (Debian #680455, Ubuntu #681617),
+  * randomise call-id (Debian #721963),
+  * replace gethostbyname(3) with getaddrinfo(3),
+  * don't set build flags; use defaults,
+  * fix for (null) in "pptp: GRE-to-PPP gateway on (null)".
+
+-------------------------------------------------------------------

Old:
----
  pptp-1.8.0.tar.gz

New:
----
  pptp-1.10.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ pptp.spec ++++++
--- /var/tmp/diff_new_pack.cByYxk/_old  2019-12-11 12:01:01.360843893 +0100
+++ /var/tmp/diff_new_pack.cByYxk/_new  2019-12-11 12:01:01.364843891 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package pptp
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,17 +12,17 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           pptp
-Version:        1.8.0
+Version:        1.10.0
 Release:        0
 Summary:        Point-to-Point Tunneling Protocol (PPTP) Client
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Productivity/Networking/Security
-Url:            http://pptpclient.sourceforge.net/
+URL:            http://pptpclient.sourceforge.net/
 Source:         
http://downloads.sourceforge.net/project/pptpclient/pptp/pptp-%{version}/%{name}-%{version}.tar.gz
 Source1:        pptp-command
 Source2:        options.pptp
@@ -58,7 +58,8 @@
 
 %files
 %defattr(0644,root,root,0755)
-%doc AUTHORS COPYING NEWS README TODO USING Documentation
+%doc AUTHORS NEWS README TODO USING Documentation
+%license COPYING
 %attr(0755,root,root) %{_sbindir}/pptp
 %attr(0755,root,root) %{_sbindir}/pptpsetup
 %attr(0444,root,root) %{_mandir}/man8/pptp.8.gz

++++++ pptp-1.8.0.tar.gz -> pptp-1.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/AUTHORS new/pptp-1.10.0/AUTHORS
--- old/pptp-1.8.0/AUTHORS      2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/AUTHORS     2018-01-18 01:12:00.000000000 +0100
@@ -27,6 +27,7 @@
 Charles Shen <[email protected]>
 Jan Just Keijser <[email protected]>
 David Lamparter <[email protected]>
+Ruslan Atnabayeff <rfatnabayeff at gmail.com>
 
 Package renamed from pptp-linux to pptp after version 1.5.0.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/ChangeLog new/pptp-1.10.0/ChangeLog
--- old/pptp-1.8.0/ChangeLog    2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/ChangeLog   2018-01-18 01:12:00.000000000 +0100
@@ -1,3 +1,13 @@
+Thu Jan 18 11:10:32 2018  James Cameron  <[email protected]>
+
+       * pptp-1.10.0: released.
+         [this file is not maintained, see NEWS and "git log"]
+
+Tue Nov 29 16:13:57 2016  James Cameron  <[email protected]>
+
+       * pptp-1.9.0: released.
+         [this file is not maintained, see "git log"]
+
 Wed Oct 23 19:04:57 2013  James Cameron  <[email protected]>
 
        * pptp-1.8.0: released.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/Makefile new/pptp-1.10.0/Makefile
--- old/pptp-1.8.0/Makefile     2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/Makefile    2018-01-18 01:12:00.000000000 +0100
@@ -1,5 +1,5 @@
 # $Id: Makefile,v 1.51 2011/11/29 22:05:07 quozl Exp $
-VERSION=1.8.0
+VERSION=1.10.0
 RELEASE=
 
 #################################################################
@@ -19,7 +19,7 @@
 OPTIMIZE= -O -Wuninitialized
 DEBUG  = -g
 INCLUDE =
-CFLAGS  = -Wall $(OPTIMIZE) $(DEBUG) $(INCLUDE)
+# CFLAGS  = -Wall $(OPTIMIZE) $(DEBUG) $(INCLUDE)
 # Solaris
 # CFLAGS +=  -D_XPG4_2 -D__EXTENSIONS__
 LIBS   = -lutil
@@ -27,17 +27,17 @@
 # LIBS = -lnsl -lsocket -lresolv
 # Solaris Nevada build 14 or above
 # LIBS    = -lnsl -lsocket
-LDFLAGS        =
+# LDFLAGS      =
 
 PPTP_BIN = pptp
 
 PPTP_OBJS = pptp.o pptp_gre.o ppp_fcs.o \
             pptp_ctrl.o dirutil.o vector.o \
-           inststr.o util.o version.o test.o \
+           util.o version.o test-redirections.o \
            pptp_quirks.o orckit_quirks.o pqueue.o pptp_callmgr.o routing.o \
            pptp_compat.o
 
-PPTP_DEPS = pptp_callmgr.h pptp_gre.h ppp_fcs.h util.h test.h \
+PPTP_DEPS = pptp_callmgr.h pptp_gre.h ppp_fcs.h util.h test-redirections.h \
            pptp_quirks.h orckit_quirks.h config.h pqueue.h routing.h
 
 all: config.h $(PPTP_BIN) pptpsetup.8
@@ -46,7 +46,7 @@
        $(CC) -o $(PPTP_BIN) $(PPTP_OBJS) $(LDFLAGS) $(LIBS)
 
 pptpsetup.8: pptpsetup
-       pod2man $? > $@
+       pod2man --section=8 $? > $@
 
 config.h:
        ( \
@@ -58,9 +58,10 @@
 
 vector_test: vector_test.o vector.o
        $(CC) -o vector_test vector_test.o vector.o
+       ./vector_test
 
 clean:
-       $(RM) *.o config.h
+       $(RM) *.o config.h pptpsetup.8
 
 clobber: clean
        $(RM) $(PPTP_BIN) vector_test
@@ -122,7 +123,6 @@
 pptp.o: pptp_gre.h
 pptp.o: pptp_compat.h
 pptp.o: version.h
-pptp.o: inststr.h
 pptp.o: util.h
 pptp.o: pptp_quirks.h
 pptp.o: pptp_msg.h
@@ -152,7 +152,7 @@
 pptp_gre.o: pptp_gre.h
 pptp_gre.o: util.h
 pptp_gre.o: pqueue.h
-pptp_gre.o: test.h
+pptp_gre.o: test-redirections.h
 pptp_quirks.o: orckit_quirks.h
 pptp_quirks.o: pptp_options.h
 pptp_quirks.o: pptp_ctrl.h
@@ -162,8 +162,9 @@
 pqueue.o: util.h
 pqueue.o: pqueue.h
 routing.o: routing.h
-test.o: util.h
-test.o: test.h
+routing.o: config.h
+test-redirections.o: util.h
+test-redirections.o: test-redirections.h
 util.o: util.h
 vector.o: pptp_ctrl.h
 vector.o: pptp_compat.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/NEWS new/pptp-1.10.0/NEWS
--- old/pptp-1.8.0/NEWS 2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/NEWS        2018-01-18 01:12:00.000000000 +0100
@@ -1,3 +1,33 @@
+Release 1.10.0: (18th January 2018)
+
+- assign copyright of contributed pptpsetup and routing.c to FSF,
+- remove inststr in favour of prctrl PR_SET_NAME,
+- vector tests; include in make, fix code rot, fix return status,
+- pqueue; include missing sys/types.h,
+- pptpsetup; prevent world-readable peers file, use three-argument
+  append, allow password trailing spaces, split prints to
+  chap-secrets, allow passwords with quotes, use absolute path to
+  pptp,
+- remove uid from ip route get output; iproute2-4.10 and later may
+  emit uid,
+
+Release 1.9.0: (29th November 2016)
+
+- close a memory leak in pqueue,
+- avoid spurious error about /bin/ip on FreeBSD,
+- fix compiler warnings,
+- avoid clobbering heap (RHBZ #1183627),
+- fix use after free in call close request handler,
+- make clean to clean pptpsetup.8 (Debian #831032),
+- add --missing-window option (Debian #680455, Ubuntu #681617),
+- randomise call-id (Debian #721963),
+- replace gethostbyname(3) with getaddrinfo(3),
+- fix typo in pptp_ctrl manpage,
+- place pptpsetup manpage in correct section,
+- don't set build flags; use defaults,
+- remove pptpsetup.8 from source as it is generated,
+- fix for (null) in "pptp: GRE-to-PPP gateway on (null)".
+
 Release 1.8.0: (23rd October 2013)
 
 - options file, fix option documentation and links [Howarth]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/inststr.c new/pptp-1.10.0/inststr.c
--- old/pptp-1.8.0/inststr.c    2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/inststr.c   1970-01-01 01:00:00.000000000 +0100
@@ -1,74 +0,0 @@
-/* inststr.c ... stolen from bdupdate.c, which stole it from perl 4.
- *               Theft by C. Scott Ananian <[email protected]>
- *               Modified similarly to perl 5.8.3's alignment-checking code
-8                by Paul Howarth <[email protected]>
- *
- * $Id: inststr.c,v 1.3 2004/06/08 23:40:14 quozl Exp $
- */
-
-#include <string.h>
-
-#define PTRSIZE sizeof(void *)
-typedef unsigned long UL;
-
-void
-inststr(int argc, char **argv, char **environ, char *src)
-{
-    if (strlen(src) <= strlen(argv[0]))
-    {
-        char *ptr;
-
-        for (ptr = argv[0]; *ptr; *(ptr++) = '\0');
-
-        strcpy(argv[0], src);
-    } else
-    {
-        /* Stolen from the source to perl 4.036 (assigning to $0) */
-        /* Modified to allow for aligned array members, assuming  */
-        /* no system has something bizarre like the argv[]        */
-        /* interleaved with some other data. Also allow for argv  */
-        /* array having higher numbered elements lower in memory  */
-        /* than lower numbered elements.                          */
-        char *ptr, *ptr2;
-        int count;
-        UL mask = ~(UL)(PTRSIZE == 4 ? 3 : PTRSIZE == 8 ? 7 : PTRSIZE == 16 ? 
15 : 0);
-        int aligned = (mask < ~(UL)0) && (((UL)(argv[0]) & mask) == 
(UL)(argv[0]));
-        ptr = argv[0] + strlen(argv[0]);
-        if (argv[argc - 1] >= argv[1]) {
-            /* argv pointers in ascending memory order */
-            for (count = 1; count < argc; count++) {
-                if (argv[count] == ptr + 1
-                    ||
-                    (aligned && argv[count] > ptr && argv[count] <= (char 
*)((UL)(ptr + PTRSIZE) & mask))
-                   ) {
-                    ptr = argv[count] + strlen(argv[count]);
-                }
-            }
-        } else
-        {
-            /* sometimes the argv pointers go down in memory rather than up */
-            for (count = argc - 1; count > 0; count--) {
-                if (argv[count] == ptr + 1
-                    ||
-                    (aligned && argv[count] > ptr && argv[count] <= (char 
*)((UL)(ptr + PTRSIZE) & mask))
-                   ) {
-                    ptr = argv[count] + strlen(argv[count]);
-                }
-            }
-        }
-        for (count = 0; environ[count]; count++) {
-            if (environ[count] == ptr + 1
-                ||
-                (aligned && environ[count] > ptr && environ[count] <= (char 
*)((UL)(ptr + PTRSIZE) & mask))
-               ) {
-                   ptr = environ[count] + strlen(environ[count]);
-            }
-        }
-        count = 0;
-        for (ptr2 = argv[0]; ptr2 <= ptr; ptr2++) {
-            *ptr2 = '\0';
-            count++;
-        }
-        strncpy(argv[0], src, count);
-    }
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/inststr.h new/pptp-1.10.0/inststr.h
--- old/pptp-1.8.0/inststr.h    2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/inststr.h   1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-/* inststr.h ..... change argv[0].
- *
- * $Id: inststr.h,v 1.1 2000/12/23 08:19:51 scott Exp $
- */
-
-void inststr(int argc, char **argv, char **envp, char *src);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pptp.c new/pptp-1.10.0/pptp.c
--- old/pptp-1.8.0/pptp.c       2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pptp.c      2018-01-18 01:12:00.000000000 +0100
@@ -63,7 +63,6 @@
 #if defined(__linux__)
 #include <sys/prctl.h>
 #endif
-#include "inststr.h"
 #include "util.h"
 #include "pptp_quirks.h"
 #include "pqueue.h"
@@ -79,6 +78,7 @@
 int disable_buffer = 0;
 int test_type = 0;
 int test_rate = 100;
+int missing_window = MISSING_WINDOW;
 
 struct in_addr get_ip_address(char *name);
 int open_callmgr(struct in_addr inetaddr, char *phonenr, int argc,char 
**argv,char **envp, int pty_fd, int gre_fd);
@@ -125,7 +125,9 @@
             "  --nohostroute           Do not add host route towards 
<hostname>\n"
             "  --loglevel <level>      Sets the debugging level (0=low, 
1=default, 2=high)\n"
             "  --test-type <type>      Damage the packet stream by 
reordering\n"
-            "  --test-rate <n>         Do the test every n packets\n",
+            "  --test-rate <n>          Do the test every n packets\n"
+            "  --missing-window <n>     Enable 'missing window' validation and 
set packet\n"
+            "                           polerance (300=default, 
6000=recommended)\n",
 
             version, progname, progname);
     log("%s called with wrong arguments, program not started.", progname);
@@ -189,7 +191,7 @@
     struct in_addr inetaddr;
     volatile int callmgr_sock = -1;
     char ttydev[PATH_MAX];
-    char *tty_name;
+    char *pty_name;
     int pty_fd, tty_fd, gre_fd, rc;
     volatile pid_t parent_pid, child_pid;
     u_int16_t call_id, peer_call_id;
@@ -221,6 +223,7 @@
            {"test-rate", 1, 0, 0},
            {"rtmark", 1, 0, 0},
            {"nohostroute", 0, 0, 0},
+           {"missing-window", 1, 0, 0},
             {0, 0, 0, 0}
         };
         int option_index = 0;
@@ -230,8 +233,6 @@
         switch (c) {
             case 0: 
                 if (option_index == 0) { /* --phone specified */
-                    /* copy it to a buffer, as the argv's will be overwritten
-                     * by inststr() */
                     strncpy(phonenrbuf,optarg,sizeof(phonenrbuf));
                     phonenrbuf[sizeof(phonenrbuf) - 1] = '\0';
                     phonenr = phonenrbuf;
@@ -309,6 +310,26 @@
 #endif
                } else if (option_index == 16) { /* --nohostroute */
                    nohostroute = 1;
+               } else if (option_index == 17) { /* --missing window */
+                   int x = atoi(optarg);
+                   if (x <= 0) {
+                       fprintf(stderr, "--missing-window must be integer "
+                               "greater than zero\n");
+                       log("--missing-window must be integer "
+                           "greater than zero\n");
+                       exit(2);
+                   } else if (x < 300) {
+                       fprintf(stderr, "--missing-window is set very low: "
+                               "default=300, recommended=6000 - proceeding");
+                       log("--missing-window is set very low: "
+                           "default=300, recommended=6000 - proceeding\n");
+                   } else {
+                       fprintf(stderr, "--missing-window validation is active "
+                               "and set to: %d\n", x);
+                       log("--missing-window validation is active "
+                           "and set to: %d\n", x);
+                       missing_window = x;
+                   }
                 }
                 break;
             case '?': /* unrecognised option */
@@ -316,7 +337,6 @@
             default:
                usage(argv[0]);
         }
-        if (c == -1) break;  /* no more options for pptp */
     }
 
     /* at least one argument is required */
@@ -337,7 +357,6 @@
        documented in <1026868263.2855.67.camel@jander> */
     gre_fd = pptp_gre_bind(inetaddr);
     if (gre_fd < 0) {
-        close(callmgr_sock);
         fatal("Cannot bind GRE socket, aborting.");
     }
 
@@ -345,7 +364,6 @@
     if(launchpppd){
         rc = openpty (&pty_fd, &tty_fd, ttydev, NULL, NULL);
         if (rc < 0) { 
-            close(callmgr_sock); 
             fatal("Could not find free pty.");
         }
 
@@ -410,14 +428,12 @@
         file2fd("/dev/null", "wb", STDERR_FILENO);
     }
 
-    tty_name = ttyname(tty_fd);
+    pty_name = ttyname(pty_fd);
     snprintf(buf, sizeof(buf), "pptp: GRE-to-PPP gateway on %s",
-              tty_name ? tty_name : "(null)");
+              pty_name ? pty_name : "(null)");
 #ifdef PR_SET_NAME
     rc = prctl(PR_SET_NAME, "pptpgw", 0, 0, 0);
     if (rc != 0) perror("prctl");
-#else
-    inststr(argc, argv, envp, buf);
 #endif
     if (sigsetjmp(env, 1)!= 0) goto shutdown;
 
@@ -442,19 +458,27 @@
 /*** get the ipaddress coming from the command line 
***************************/
 struct in_addr get_ip_address(char *name)
 {
+    int rc;
     struct in_addr retval;
-    struct hostent *host = gethostbyname(name);
-    if (host == NULL) {
-        if (h_errno == HOST_NOT_FOUND)
-            fatal("gethostbyname '%s': HOST NOT FOUND", name);
-        else if (h_errno == NO_ADDRESS)
-            fatal("gethostbyname '%s': NO IP ADDRESS", name);
-        else
-            fatal("gethostbyname '%s': name server error", name);
-    }
-    if (host->h_addrtype != AF_INET)
-        fatal("Host '%s' has non-internet address", name);
-    memcpy(&retval.s_addr, host->h_addr, sizeof(retval.s_addr));
+    struct addrinfo hints, *ai;
+
+    memset(&hints, '\0', sizeof(hints));
+    hints.ai_family = AF_INET;
+#if defined(__linux__) || defined(__FreeBSD__)
+    hints.ai_flags = AI_ADDRCONFIG;     /* Unknown in OpenBSD. */
+#endif
+
+    if ( (rc = getaddrinfo(name, NULL, &hints, &ai)) )
+        fatal("getaddrinfo(): %s", gai_strerror(rc));
+
+    if (ai->ai_addr->sa_family != AF_INET)       /* Should never happen. */
+        fatal("Host '%s' possesses no IPv4 address", name);
+
+    memcpy(&retval.s_addr,
+            &(((struct sockaddr_in *) ai->ai_addr)->sin_addr.s_addr),
+            sizeof(retval.s_addr));
+    freeaddrinfo(ai);
+
     return retval;
 }
 
@@ -521,8 +545,6 @@
       int rc;
       rc = prctl(PR_SET_NAME, "pptpcm", 0, 0, 0);
       if (rc != 0) perror("prctl");
-#else
-      inststr(argc, argv, envp, buf);
 #endif
       exit(callmgr_main(3, my_argv, envp));
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pptp_callmgr.c 
new/pptp-1.10.0/pptp_callmgr.c
--- old/pptp-1.8.0/pptp_callmgr.c       2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pptp_callmgr.c      2018-01-18 01:12:00.000000000 +0100
@@ -404,14 +404,13 @@
 }
 
 /*** make a unix socket address 
***********************************************/
-void callmgr_name_unixsock(struct sockaddr_un *where, 
+void callmgr_name_unixsock(struct sockaddr_un *where,
                           struct in_addr inetaddr,
                           struct in_addr localbind)
 {
-    char localaddr[16], remoteaddr[16];
+    char localaddr[16];
     where->sun_family = AF_UNIX;
-    strncpy(localaddr,  inet_ntoa(localbind), 16);
-    strncpy(remoteaddr, inet_ntoa(inetaddr),  16);
+    strcpy(localaddr, inet_ntoa(localbind));
     snprintf(where->sun_path, sizeof(where->sun_path),
-            PPTP_SOCKET_PREFIX "%s:%s", localaddr, remoteaddr);
+            PPTP_SOCKET_PREFIX "%s:%s", localaddr, inet_ntoa(inetaddr));
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pptp_ctrl.c new/pptp-1.10.0/pptp_ctrl.c
--- old/pptp-1.8.0/pptp_ctrl.c  2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pptp_ctrl.c 2018-01-18 01:12:00.000000000 +0100
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <time.h>
 #include "pptp_msg.h"
 #include "pptp_ctrl.h"
 #include "pptp_options.h"
@@ -133,7 +134,7 @@
 #define PPTP_GENERAL_ERROR_BAD_CALLID           5
     { "(Bad-Call ID)", "The Call ID is invalid in this context" },
 #define PPTP_GENERAL_ERROR_PAC_ERROR            6
-    { "(PAC-Error)", "A generic vendor-specific error occured in the PAC" }
+    { "(PAC-Error)", "A generic vendor-specific error occurred in the PAC" }
 };
 
 #define  MAX_GENERAL_ERROR ( sizeof(pptp_general_errors) / \
@@ -325,6 +326,26 @@
   return (conn->conn_state == CONN_ESTABLISHED);
 }
 
+int randci ()
+{
+       unsigned short int i=0;
+       int fd;
+
+       fd = open("/dev/random", O_RDONLY);
+       if (fd >= 0) {
+               read(fd, &i, 2);
+               close(fd);
+       }
+
+       if (i == 0) {
+               log("problem: opening /dev/random or getting number");
+               log("using rand()");
+               srand(time(NULL));
+               i = (unsigned short int) (rand() & 0xffff);
+       }
+       return i;
+}
+
 /* This currently *only* works for client call requests.
  * We need to do something else to allocate calls for incoming requests.
  */
@@ -348,6 +369,8 @@
     if (!vector_scan(conn->call, 0, PPTP_MAX_CHANNELS - 1, &i))
         /* no more calls available! */
         return NULL;
+    if (i == 0)
+        i = randci();
     /* allocate structure. */
     if ((call = malloc(sizeof(*call))) == NULL) return NULL;
     /* Initialize call structure */
@@ -928,6 +951,7 @@
                 PPTP_HEADER_CTRL(PPTP_CALL_CLEAR_NTFY), packet->call_id,
                 1, PPTP_GENERAL_ERROR_NONE, 0, 0, {0}
             };
+            int i;
             log("Received Call Clear Request.");
             if (vector_contains(conn->call, ntoh16(packet->call_id))) {
                 PPTP_CALL * call;
@@ -935,8 +959,9 @@
                 if (call->callback != NULL)
                     call->callback(conn, call, CALL_CLOSE_RQST);
                 if (pptp_send_ctrl_packet(conn, &reply, sizeof(reply))) {
+                    i = call->call_id;
                     pptp_call_destroy(conn, call);
-                    log("Call closed (RQST) (call id %d)", (int) 
call->call_id);
+                    log("Call closed (RQST) (call id %d)", i);
                 }
             }
             break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pptp_gre.c new/pptp-1.10.0/pptp_gre.c
--- old/pptp-1.8.0/pptp_gre.c   2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pptp_gre.c  2018-01-18 01:12:00.000000000 +0100
@@ -24,7 +24,7 @@
 #include "pptp_gre.h"
 #include "util.h"
 #include "pqueue.h"
-#include "test.h"
+#include "test-redirections.h"
 
 /* globals from pptp.c */
 extern struct in_addr localbind;
@@ -54,13 +54,19 @@
 /* test redirection function pointers */
 struct test_redirections *my;
 
-#if 1
+unsigned char dest[2 * PACKET_MAX + 2]; /* largest expansion possible */
+
+#undef PRINT_PACKETS
+#ifdef PRINT_PACKETS
+
 #include <stdio.h>
 void print_packet(int fd, void *pack, unsigned int len)
 {
     unsigned char *b = (unsigned char *)pack;
     unsigned int i,j;
-    FILE *out = fdopen(fd, "w");
+    static FILE *out = NULL;
+
+    if (out == NULL) out = fdopen(fd, "w");
     fprintf(out,"-- begin packet (%u) --\n", len);
     for (i = 0; i < len; i += 16) {
         for (j = 0; j < 8; j++)
@@ -75,7 +81,7 @@
     fprintf(out, "-- end packet --\n");
     fflush(out);
 }
-#endif
+#endif /* PRINT_PACKETS */
 
 /*** time_now_usecs 
***********************************************************/
 uint64_t time_now_usecs(void)
@@ -301,7 +307,6 @@
 int encaps_hdlc(int fd, void *pack, unsigned int len)
 {
     unsigned char *source = (unsigned char *)pack;
-    unsigned char dest[2 * PACKET_MAX + 2]; /* largest expansion possible */
     unsigned int pos = 0, i;
     u_int16_t fcs;
     /* in synchronous mode there is little to do */
@@ -421,8 +426,9 @@
                 seq, seq_recv + 1);
         stats.rx_underwin++;
     /* sequence number too high, is it reasonably close? */
-    } else if ( seq < seq_recv + MISSING_WINDOW ||
-                WRAPPED(seq, seq_recv + MISSING_WINDOW) ) {
+    } else if ( (seq < seq_recv + missing_window ||
+                 WRAPPED(seq, seq_recv + missing_window)) ||
+               (missing_window == -1) ) {
        stats.rx_buffered++;
         if ( log_level >= 1 )
             log("%s packet %d (expecting %d, lost or reordered)",
@@ -533,8 +539,10 @@
     memcpy(u.buffer + header_len, pack, len);
     /* record and increment sequence numbers */
     seq_sent = seq; seq++;
+#ifdef PRINT_PACKETS
+    print_packet(2, u.buffer, header_len + len);
+#endif
     /* write this baby out to the net */
-    /* print_packet(2, u.buffer, header_len + len); */
     rc = (*my->write)(fd, u.buffer, header_len + len);
     if (rc < 0) {
         if (errno == ENOBUFS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pptpsetup new/pptp-1.10.0/pptpsetup
--- old/pptp-1.8.0/pptpsetup    2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pptpsetup   2018-01-18 01:12:00.000000000 +0100
@@ -43,14 +43,6 @@
 sub create {
     my $TUNNEL = shift;
 
-    # if encryption is requested, check for support in kernel and pppd
-    if ( $ENCRYPT ) {
-        &Check_MPPE_in_kernel
-            or die "$0: couldn't find MPPE support in kernel.\n";
-        &Check_MPPE_in_pppd
-            or die "$0: couldn't find MPPE support in pppd.\n";
-    }
-
     # input validation
     ($TUNNEL) = $TUNNEL =~ m{^(\w+)$}
       or die "$0: invalid tunnel name.\nTry '$0 --help' for more 
information.\n";
@@ -63,7 +55,7 @@
     if ( !$PASSWORD ) {
         print "Password: ";
         $PASSWORD = <STDIN>;
-        chomp $PASSWORD;
+        $PASSWORD =~ s/([^\x20\x21\x23-\x7e])/sprintf ("\\x%02x", ord ($1))/eg;
     }
 
     # put '\' between domain and username IF specified a domain
@@ -72,10 +64,13 @@
     # create or add lines to the /etc/ppp/chap-secrets file,
     # which holds usernames and passwords
     my $chap_secrets_file = '/etc/ppp/chap-secrets';
-    open( FILE, ">>$chap_secrets_file" )
+    umask( 0027 );
+    open( FILE, ">>", $chap_secrets_file )
       or die "$0: can't write to '$chap_secrets_file': $!\n";
 
-    print FILE "\n# added by pptpsetup for $TUNNEL\n$DOMAIN$USERNAME $TUNNEL 
\"$PASSWORD\" *\n";
+    print FILE "\n";
+    print FILE "# added by pptpsetup for $TUNNEL\n";
+    print FILE "$DOMAIN$USERNAME $TUNNEL \"$PASSWORD\" *\n";
 
     close FILE;
 
@@ -86,7 +81,7 @@
 
     print FILE <<"TUNNEL";
 # written by pptpsetup
-pty "pptp $SERVER --nolaunchpppd"
+pty "/usr/sbin/pptp $SERVER --nolaunchpppd"
 lock
 noauth
 nobsdcomp
@@ -114,7 +109,7 @@
           --username <USERNAME> [--password <PASSWORD>]
           [--encrypt] [--start]
 
-pptpsetup --delete <TUNNEL> 
+pptpsetup --delete <TUNNEL>
 
 Options:
 
@@ -128,12 +123,13 @@
 
 pptpsetup - Point-to-Point Tunneling Protocol setup
 
-Copyright (C) 2006 Nelson Ferraz
+Copyright (C) 2006  Free Software Foundation
 
 pptpsetup comes with ABSOLUTELY NO WARRANTY; for details see source.
 This is free software, and you are welcome to redistribute it
 under certain conditions; see source for details.
 
+Written by Nelson Ferraz.
 EOF
 
     exit;
@@ -180,29 +176,6 @@
     exit;
 }
 
-### AUXILIAR SUBS ###
-
-sub Check_MPPE_in_kernel {
-    my $command = q/modprobe ppp-compress-18/;
-    if (system( $command ) == 0) {
-        # no error!
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-sub Check_MPPE_in_pppd {
-    my $command = q/strings `which pppd`|grep -i mppe|wc --lines/;
-    my $answer  = `$command`;
-    if ($answer > 0) {
-        # ok!
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
 __END__
 
 =head1 NAME
@@ -219,8 +192,8 @@
 
 =head1 DESCRIPTION
 
-PPTP Client is a Linux, FreeBSD, NetBSD and OpenBSD client for the 
-proprietary Microsoft Point-to-Point Tunneling Protocol, PPTP. 
+PPTP Client is a Linux, FreeBSD, NetBSD and OpenBSD client for the
+proprietary Microsoft Point-to-Point Tunneling Protocol, PPTP.
 
 This script configures PPTP Client on Linux.
 
@@ -234,7 +207,7 @@
 
 =item --delete TUNNEL
 
-delete the file /etc/ppp/peers/TUNNEL and any lines from 
+delete the file /etc/ppp/peers/TUNNEL and any lines from
 /etc/ppp/chap-secrets that contains "TUNNEL" as a single word
 
 =item --server SERVER
@@ -251,7 +224,7 @@
 
 =item --password PASSWORD
 
-the password you are to use. If you don't specify a password, 
+the password you are to use. If you don't specify a password,
 pptpsetup will ask for one.
 
 =item --encrypt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pqueue.c new/pptp-1.10.0/pqueue.c
--- old/pptp-1.8.0/pqueue.c     2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pqueue.c    2018-01-18 01:12:00.000000000 +0100
@@ -29,6 +29,18 @@
 
 
 
+static void pq_freelist_add(pqueue_t *point) {
+  /* add point to the freelist */
+  point->next = pq_freelist_head;
+  point->prev = NULL;
+
+  if (point->next)
+    point->next->prev = point;
+  pq_freelist_head = point;
+}
+
+
+
 static int pqueue_alloc(u_int32_t seq, unsigned char *packet, int packlen, 
pqueue_t **new) {
 
   pqueue_t *newent;
@@ -137,6 +149,7 @@
     if (point->seq == seq) {
       // queue already contains this packet
       warn("discarding duplicate packet %d", seq);
+      pq_freelist_add(point);
       return -1;
     }
     if (point->seq > seq) {
@@ -191,25 +204,21 @@
   if (point->next) point->next->prev = point->prev;
 
   /* add point to the freelist */
-  point->next = pq_freelist_head;
-  point->prev = NULL;
-
-  if (point->next)
-    point->next->prev = point;
-  pq_freelist_head = point;
+  pq_freelist_add(point);
 
   DEBUG_CMD(
     int pq_count = 0;
     int pq_freelist_count = 0;
-    pqueue_t *point;
-    for ( point = pq_head; point ; point = point->next) {
+    pqueue_t *dpoint;
+    for (dpoint = pq_head; dpoint ; dpoint = dpoint->next) {
       ++pq_count;
     }
 
-    for ( point = pq_freelist_head; point ; point = point->next) {
+    for (dpoint = pq_freelist_head; dpoint ; dpoint = dpoint->next) {
       ++pq_freelist_count;
     }
-    log("queue length is %d, freelist length is %d", pq_count, 
pq_freelist_count);
+    log("queue length is %d, freelist length is %d", pq_count,
+        pq_freelist_count);
     );
 
   return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/pqueue.h new/pptp-1.10.0/pqueue.h
--- old/pptp-1.8.0/pqueue.h     2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/pqueue.h    2018-01-18 01:12:00.000000000 +0100
@@ -3,13 +3,17 @@
 
 #include <time.h>
 #include <sys/time.h>
+#include <sys/types.h>
 
 /* wait this many seconds for missing packets before forgetting about them */
 #define DEFAULT_PACKET_TIMEOUT 0.3
 extern int packet_timeout_usecs;
 
 /* assume packet is bad/spoofed if it's more than this many seqs ahead */
-#define MISSING_WINDOW 300
+/* default is NOT to check - command line override via '--missing-window <n>' 
*/
+/* default value is 300 - recommended is 6000 for high speed data rates */
+#define MISSING_WINDOW -1
+extern int missing_window;
 
 /* Packet queue structure: linked list of packets received out-of-order */
 typedef struct pqueue {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/routing.c new/pptp-1.10.0/routing.c
--- old/pptp-1.8.0/routing.c    2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/routing.c   2018-01-18 01:12:00.000000000 +0100
@@ -1,6 +1,6 @@
 /*
     routing.c, manipulating routing table for PPTP Client
-    Copyright (C) 2006  James Cameron <[email protected]>
+    Copyright (C) 2006  Free Software Foundation
 
     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
@@ -109,18 +109,27 @@
       }
       break;
     }
-#else /* Solaris */ 
+#endif /* Solaris */ 
+#if defined(__linux)
   char buf[256];
+  char tbuf[256];
+  const char *uid;
   FILE *p;
 
   snprintf(buf, 255, "%s route get %s", IP_BINARY, ip);
   p = popen(buf, "r");
   fgets(buf, 255, p);
   /* TODO: check for failure of fgets */
-  route = strdup(buf);
+  uid = strstr(buf, " uid");
+  if (uid) {
+    snprintf(tbuf, uid - buf + 1, "%s", buf);
+    route = strdup(tbuf);
+  } else {
+    route = strdup(buf);
+  }
   pclose(p);
   /* TODO: check for failure of command */
-#endif /* Solaris */
+#endif /* __linux__ */
 }
 
 void routing_start(void) {
@@ -143,14 +152,15 @@
   if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) {
     log("Error adding route: %s", strerror(errno));
   }
-#else /* Solaris */
+#endif
+#if defined(__linux__)
   char buf[256];
   FILE *p;
 
   snprintf(buf, 255, "%s route replace %s", IP_BINARY, route);
   p = popen(buf, "r");
   pclose(p);
-#endif /* Solaris */
+#endif /* __linux__ */
 }
 
 void routing_end(void) {
@@ -173,12 +183,13 @@
   if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) {
     log("Error deleting route: %s", strerror(errno));
   }
-#else /* Solaris */
+#endif /* Solaris */
+#if defined(__linux__)
   char buf[256];
   FILE *p;
 
   snprintf(buf, 255, "%s route delete %s", IP_BINARY, route);
   p = popen(buf, "r");
   pclose(p);
-#endif /* Solaris */
+#endif /* __linux__ */
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/test-redirections.c 
new/pptp-1.10.0/test-redirections.c
--- old/pptp-1.8.0/test-redirections.c  1970-01-01 01:00:00.000000000 +0100
+++ new/pptp-1.10.0/test-redirections.c 2018-01-18 01:12:00.000000000 +0100
@@ -0,0 +1,184 @@
+/*
+
+Packet reordering test implementation, intended to cause packets to be
+reordered for testing pptpd and other servers.  Avoids the use of
+pqueue.c so that it can be tested independently.
+
+*/
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include "util.h"
+#include "test-redirections.h"
+
+/* whether we are asked to test ordering, obtained from command line */
+extern int test_type;
+
+/* rate at which to do test ordering changes */
+extern int test_rate;
+
+/* trigger cycle */
+static int test_ordering_cycle = 0;
+
+/* phase of reordering */
+static int test_ordering_phase = 0;
+
+/* swap a packet every now and then */
+static ssize_t write_reordered_swap(int fd, const void *buf, size_t count)
+{
+  static void *pocket_buf = NULL;
+  static int pocket_count = 0;
+  int stat;
+
+  switch (test_ordering_phase) {
+  case 0: /* between triggers, send as normal */
+    test_ordering_cycle++;
+    if (test_ordering_cycle == test_rate) test_ordering_phase++;
+    return write(fd, buf, count);
+  case 1: /* triggered, swap a packet */
+    test_ordering_cycle++;
+    if (test_ordering_cycle == (test_rate+1)) {
+      /* pocket the packet */
+      pocket_count = count;
+      pocket_buf = malloc(count);
+      memcpy(pocket_buf, buf, count);
+      log("test order swap, packet buffered");
+      /* lie about the result */
+      return count;
+    } else {
+      /* after this, reset to normal */
+      test_ordering_cycle = 0;
+      test_ordering_phase = 0;
+      /* send the new packet first */
+      stat = write(fd, buf, count);
+      if ((size_t)stat != count) return stat;
+      /* then send the old packet next */
+      stat = write(fd, pocket_buf, pocket_count);
+      free(pocket_buf);
+      log("test order swap, packets sent");
+      return count;
+    }
+  default:
+    return write(fd, buf, count);
+  }
+}
+
+/* hold ten packets and send the eleventh, then the ten in order */
+static ssize_t write_reordered_retransmit(int fd, const void *buf, size_t 
count)
+{
+  int test_length = 10;
+  static void *pocket_buf[10];
+  static int pocket_count[10];
+  int stat, n;
+
+  switch (test_ordering_phase) {
+  case 0: /* between triggers, send as normal */
+    test_ordering_cycle++;
+    if (test_ordering_cycle == test_rate) test_ordering_phase++;
+    return write(fd, buf, count);
+  case 1: /* triggered, buffer the packets */
+    test_ordering_cycle++;
+    if (test_ordering_cycle == (test_rate+test_length)) {
+      test_ordering_phase = 2;
+    }
+    /* pocket the packet */
+    n = test_ordering_cycle - test_rate - 1;
+    pocket_count[n] = count;
+    pocket_buf[n] = malloc(count);
+    memcpy(pocket_buf[n], buf, count);
+    log("test order retransmit, packet buffered");
+    /* lie about the result */
+    return count;
+  case 2:
+    /* after this, reset to normal */
+    test_ordering_cycle = 0;
+    test_ordering_phase = 0;
+    /* send the new packet first */
+    stat = write(fd, buf, count);
+    if ((size_t)stat != count) return stat;
+    /* send the buffered packets in normal order */
+    for (n=0; n<test_length; n++) {
+      stat = write(fd, pocket_buf[n], pocket_count[n]);
+      /* ignores failures */
+      free(pocket_buf[n]);
+    }
+    log("test order retransmit, packets sent");
+    return count;
+  default:
+    return write(fd, buf, count);
+  }
+}
+
+/* hold ten packets and send them in reverse order */
+static ssize_t write_reordered_reverse(int fd, const void *buf, size_t count)
+{
+  int test_length = 10;
+  static void *pocket_buf[10];
+  static int pocket_count[10];
+  int stat, n;
+
+  switch (test_ordering_phase) {
+  case 0: /* between triggers, send as normal */
+    test_ordering_cycle++;
+    if (test_ordering_cycle == test_rate) test_ordering_phase++;
+    return write(fd, buf, count);
+  case 1: /* triggered, buffer the packets */
+    test_ordering_cycle++;
+    if (test_ordering_cycle == (test_rate+test_length)) {
+      test_ordering_phase = 2;
+    }
+    /* pocket the packet */
+    n = test_ordering_cycle - test_rate - 1;
+    pocket_count[n] = count;
+    pocket_buf[n] = malloc(count);
+    memcpy(pocket_buf[n], buf, count);
+    log("test order reverse, packet buffered");
+    /* lie about the result */
+    return count;
+  case 2:
+    /* after this, reset to normal */
+    test_ordering_cycle = 0;
+    test_ordering_phase = 0;
+    /* send the new packet first */
+    stat = write(fd, buf, count);
+    if ((size_t)stat != count) return stat;
+    /* send the buffered packets in reverse order */
+    for (n=test_length-1; n>0; n--) {
+      stat = write(fd, pocket_buf[n], pocket_count[n]);
+      /* ignores failures */
+      free(pocket_buf[n]);
+    }
+    log("test order reverse, packets sent");
+    return count;
+  default:
+    return write(fd, buf, count);
+  }
+}
+
+/* dispatcher for write reordering tests */
+static ssize_t write_reordered(int fd, const void *buf, size_t count)
+{
+  switch (test_type) {
+  case 1: /* swap a packet every now and then */
+    return write_reordered_swap(fd, buf, count);
+  case 2: /* hold ten packets and send the eleventh, then the ten in order */
+    return write_reordered_retransmit(fd, buf, count);
+  case 3: /* hold ten packets and send them in reverse order */
+    return write_reordered_reverse(fd, buf, count);
+  default:
+    return write(fd, buf, count);
+  }
+}
+
+struct test_redirections *test_redirections(void)
+{
+  static struct test_redirections *my = NULL;
+
+  if (my == NULL) my = malloc(sizeof(struct test_redirections));
+
+  my->write = write;
+  if (test_type) my->write = write_reordered;
+
+  return my;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/test-redirections.h 
new/pptp-1.10.0/test-redirections.h
--- old/pptp-1.8.0/test-redirections.h  1970-01-01 01:00:00.000000000 +0100
+++ new/pptp-1.10.0/test-redirections.h 2018-01-18 01:12:00.000000000 +0100
@@ -0,0 +1,5 @@
+struct test_redirections {
+  ssize_t (*write)(int fd, const void *buf, size_t count);
+};
+
+struct test_redirections *test_redirections(void);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/test.c new/pptp-1.10.0/test.c
--- old/pptp-1.8.0/test.c       2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/test.c      1970-01-01 01:00:00.000000000 +0100
@@ -1,184 +0,0 @@
-/*
-
-Packet reordering test implementation, intended to cause packets to be
-reordered for testing pptpd and other servers.  Avoids the use of
-pqueue.c so that it can be tested independently.
-
-*/
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include "util.h"
-#include "test.h"
-
-/* whether we are asked to test ordering, obtained from command line */
-extern int test_type;
-
-/* rate at which to do test ordering changes */
-extern int test_rate;
-
-/* trigger cycle */
-static int test_ordering_cycle = 0;
-
-/* phase of reordering */
-static int test_ordering_phase = 0;
-
-/* swap a packet every now and then */
-static ssize_t write_reordered_swap(int fd, const void *buf, size_t count)
-{
-  static void *pocket_buf = NULL;
-  static int pocket_count = 0;
-  int stat;
-
-  switch (test_ordering_phase) {
-  case 0: /* between triggers, send as normal */
-    test_ordering_cycle++;
-    if (test_ordering_cycle == test_rate) test_ordering_phase++;
-    return write(fd, buf, count);
-  case 1: /* triggered, swap a packet */
-    test_ordering_cycle++;
-    if (test_ordering_cycle == (test_rate+1)) {
-      /* pocket the packet */
-      pocket_count = count;
-      pocket_buf = malloc(count);
-      memcpy(pocket_buf, buf, count);
-      log("test order swap, packet buffered");
-      /* lie about the result */
-      return count;
-    } else {
-      /* after this, reset to normal */
-      test_ordering_cycle = 0;
-      test_ordering_phase = 0;
-      /* send the new packet first */
-      stat = write(fd, buf, count);
-      if ((size_t)stat != count) return stat;
-      /* then send the old packet next */
-      stat = write(fd, pocket_buf, pocket_count);
-      free(pocket_buf);
-      log("test order swap, packets sent");
-      return count;
-    }
-  default:
-    return write(fd, buf, count);
-  }
-}
-
-/* hold ten packets and send the eleventh, then the ten in order */
-static ssize_t write_reordered_retransmit(int fd, const void *buf, size_t 
count)
-{
-  int test_length = 10;
-  static void *pocket_buf[10];
-  static int pocket_count[10];
-  int stat, n;
-
-  switch (test_ordering_phase) {
-  case 0: /* between triggers, send as normal */
-    test_ordering_cycle++;
-    if (test_ordering_cycle == test_rate) test_ordering_phase++;
-    return write(fd, buf, count);
-  case 1: /* triggered, buffer the packets */
-    test_ordering_cycle++;
-    if (test_ordering_cycle == (test_rate+test_length)) {
-      test_ordering_phase = 2;
-    }
-    /* pocket the packet */
-    n = test_ordering_cycle - test_rate - 1;
-    pocket_count[n] = count;
-    pocket_buf[n] = malloc(count);
-    memcpy(pocket_buf[n], buf, count);
-    log("test order retransmit, packet buffered");
-    /* lie about the result */
-    return count;
-  case 2:
-    /* after this, reset to normal */
-    test_ordering_cycle = 0;
-    test_ordering_phase = 0;
-    /* send the new packet first */
-    stat = write(fd, buf, count);
-    if ((size_t)stat != count) return stat;
-    /* send the buffered packets in normal order */
-    for (n=0; n<test_length; n++) {
-      stat = write(fd, pocket_buf[n], pocket_count[n]);
-      /* ignores failures */
-      free(pocket_buf[n]);
-    }
-    log("test order retransmit, packets sent");
-    return count;
-  default:
-    return write(fd, buf, count);
-  }
-}
-
-/* hold ten packets and send them in reverse order */
-static ssize_t write_reordered_reverse(int fd, const void *buf, size_t count)
-{
-  int test_length = 10;
-  static void *pocket_buf[10];
-  static int pocket_count[10];
-  int stat, n;
-
-  switch (test_ordering_phase) {
-  case 0: /* between triggers, send as normal */
-    test_ordering_cycle++;
-    if (test_ordering_cycle == test_rate) test_ordering_phase++;
-    return write(fd, buf, count);
-  case 1: /* triggered, buffer the packets */
-    test_ordering_cycle++;
-    if (test_ordering_cycle == (test_rate+test_length)) {
-      test_ordering_phase = 2;
-    }
-    /* pocket the packet */
-    n = test_ordering_cycle - test_rate - 1;
-    pocket_count[n] = count;
-    pocket_buf[n] = malloc(count);
-    memcpy(pocket_buf[n], buf, count);
-    log("test order reverse, packet buffered");
-    /* lie about the result */
-    return count;
-  case 2:
-    /* after this, reset to normal */
-    test_ordering_cycle = 0;
-    test_ordering_phase = 0;
-    /* send the new packet first */
-    stat = write(fd, buf, count);
-    if ((size_t)stat != count) return stat;
-    /* send the buffered packets in reverse order */
-    for (n=test_length-1; n>0; n--) {
-      stat = write(fd, pocket_buf[n], pocket_count[n]);
-      /* ignores failures */
-      free(pocket_buf[n]);
-    }
-    log("test order reverse, packets sent");
-    return count;
-  default:
-    return write(fd, buf, count);
-  }
-}
-
-/* dispatcher for write reordering tests */
-static ssize_t write_reordered(int fd, const void *buf, size_t count)
-{
-  switch (test_type) {
-  case 1: /* swap a packet every now and then */
-    return write_reordered_swap(fd, buf, count);
-  case 2: /* hold ten packets and send the eleventh, then the ten in order */
-    return write_reordered_retransmit(fd, buf, count);
-  case 3: /* hold ten packets and send them in reverse order */
-    return write_reordered_reverse(fd, buf, count);
-  default:
-    return write(fd, buf, count);
-  }
-}
-
-struct test_redirections *test_redirections(void)
-{
-  static struct test_redirections *my = NULL;
-
-  if (my == NULL) my = malloc(sizeof(struct test_redirections));
-
-  my->write = write;
-  if (test_type) my->write = write_reordered;
-
-  return my;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/test.h new/pptp-1.10.0/test.h
--- old/pptp-1.8.0/test.h       2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/test.h      1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-struct test_redirections {
-  ssize_t (*write)(int fd, const void *buf, size_t count);
-};
-
-struct test_redirections *test_redirections(void);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/vector.c new/pptp-1.10.0/vector.c
--- old/pptp-1.8.0/vector.c     2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/vector.c    2018-01-18 01:12:00.000000000 +0100
@@ -115,7 +115,7 @@
     assert(v != NULL);
     if ((tmp =binary_search(v,key)) == NULL) return FALSE;
     assert(tmp >= v->item && tmp < v->item + v->size);
-    memmove(tmp, tmp + 1, (v->size - (v->item - tmp) - 1) * 
sizeof(*(v->item)));
+    memmove(tmp, tmp + 1, (v->size - (tmp - v->item) - 1) * 
sizeof(*(v->item)));
     v->size--;
     return TRUE;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pptp-1.8.0/vector_test.c 
new/pptp-1.10.0/vector_test.c
--- old/pptp-1.8.0/vector_test.c        2013-10-23 10:10:46.000000000 +0200
+++ new/pptp-1.10.0/vector_test.c       2018-01-18 01:12:00.000000000 +0100
@@ -11,7 +11,7 @@
 #define MAX 25
 
 void main(void) {
-    int i, j, retval;
+    int i, j, *d, retval;
 
     VECTOR *v = vector_create();
     assert(v != NULL);
@@ -26,14 +26,16 @@
     }
 
     for (i=1; i<=MAX; i++) {
-        retval = vector_insert(v, i, (PPTP_CALL *)i);
+        d = malloc(sizeof(int));
+        *d = i;
+        retval = vector_insert(v, i, (PPTP_CALL *)d);
         assert(retval);
         assert(vector_size(v)==i);
     }
     for (i=1; i<MAX; i++) {
-        retval = vector_search(v, i, (PPTP_CALL **)&j);
+        retval = vector_search(v, i, (PPTP_CALL **)&d);
         assert(retval);
-        assert(j==i);
+        assert(*d==i);
         retval = vector_contains(v, i);
         assert(retval);
     }
@@ -68,14 +70,16 @@
         retval = vector_scan(v, 1, MAX, &j);
         assert(retval);
         assert(j==k);
-        retval = vector_insert(v, k, (PPTP_CALL *) k);
+        d = malloc(sizeof(int));
+        *d = k;
+        retval = vector_insert(v, k, (PPTP_CALL *) d);
         assert(retval);
         assert(vector_size(v)==MAX);
         assert(vector_contains(v, k));
         assert(!vector_scan(v, 1, MAX, &j));
-        retval = vector_search(v, k, (PPTP_CALL **) &j);
+        retval = vector_search(v, k, (PPTP_CALL **) &d);
         assert(retval);
-        assert(j==k);
+        assert(*d==k);
     }
 
     for (i=1; i<=MAX; i++) {
@@ -91,4 +95,5 @@
     }
     assert(vector_size(v)==0);
     vector_destroy(v);
+    exit(0);
 }


Reply via email to