]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
pptp: Import patches.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 30 Jul 2010 15:43:45 +0000 (17:43 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 30 Jul 2010 15:43:45 +0000 (17:43 +0200)
pkgs/core/pptp/patches/pptp-1.7.2-compat.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-conn-free.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-conn-free2.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-ip-path.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-makedeps.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup-encrypt.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup-mppe.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup.patch [new file with mode: 0644]
pkgs/core/pptp/patches/pptp-1.7.2-waitpid.patch [new file with mode: 0644]
pkgs/core/pptp/pptp.nm

diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-compat.patch b/pkgs/core/pptp/patches/pptp-1.7.2-compat.patch
new file mode 100644 (file)
index 0000000..a6456fc
--- /dev/null
@@ -0,0 +1,71 @@
+Index: pptp_compat.c
+===================================================================
+RCS file: /cvsroot/pptpclient/pptp-linux/pptp_compat.c,v
+retrieving revision 1.1
+retrieving revision 1.3
+diff -u -r1.1 -r1.3
+--- a/pptp_compat.c    19 Feb 2008 21:43:28 -0000      1.1
++++ b/pptp_compat.c    25 Jul 2008 00:13:56 -0000      1.3
+@@ -7,14 +7,15 @@
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+-#include <stropts.h>
+ #include <stdlib.h>
++#if defined (__SVR4) && defined (__sun) /* Solaris */
++#include <stropts.h>
++#endif
+ #include <strings.h>
+ #include "pptp_compat.h"
+ #include <stdio.h>
+ #include "util.h"
+-
+ #if defined (__SVR4) && defined (__sun) /* Solaris */
+ /*
+  * daemon implementation from uClibc
+Index: pptp.c
+===================================================================
+RCS file: /cvsroot/pptpclient/pptp-linux/pptp.c,v
+retrieving revision 1.49
+retrieving revision 1.51
+diff -u -r1.49 -r1.51
+--- a/pptp.c   14 May 2008 06:32:52 -0000      1.49
++++ b/pptp.c   24 Jul 2008 05:53:05 -0000      1.51
+@@ -61,9 +61,8 @@
+ #include "version.h"
+ #if defined(__linux__)
+ #include <sys/prctl.h>
+-#else
+-#include "inststr.h"
+ #endif
++#include "inststr.h"
+ #include "util.h"
+ #include "pptp_quirks.h"
+ #include "pqueue.h"
+@@ -129,7 +128,7 @@
+ }
+ #if defined (__SVR4) && defined (__sun)
+-struct in_addr localbind = { INADDR_ANY };
++struct in_addr localbind = { .s_addr = INADDR_ANY };
+ #else
+ struct in_addr localbind = { INADDR_NONE };
+ #endif
+@@ -183,6 +182,7 @@
+     struct in_addr inetaddr;
+     volatile int callmgr_sock = -1;
+     char ttydev[PATH_MAX];
++    char *tty_name;
+     int pty_fd, tty_fd, gre_fd, rc;
+     volatile pid_t parent_pid, child_pid;
+     u_int16_t call_id, peer_call_id;
+@@ -391,7 +391,7 @@
+         file2fd("/dev/null", "wb", STDERR_FILENO);
+     }
+-    char *tty_name = ttyname(tty_fd);
++    tty_name = ttyname(tty_fd);
+     snprintf(buf, sizeof(buf), "pptp: GRE-to-PPP gateway on %s",
+               tty_name ? tty_name : "(null)");
+ #ifdef PR_SET_NAME
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-conn-free.patch b/pkgs/core/pptp/patches/pptp-1.7.2-conn-free.patch
new file mode 100644 (file)
index 0000000..331e92e
--- /dev/null
@@ -0,0 +1,90 @@
+Tue Jun 15 15:00:40 2010  James Cameron  <quozl@laptop.org>
+
+       * pptp_ctrl.c (pptp_conn_is_dead): immediately destroying the
+       connection and freeing the structure has led to segmentation
+       faults on more recent heap implementations, since we use the
+       structure after it has been freed.
+
+       Defer the free of the structure until after all uses of it have
+       ceased, by adding a connection state for dead and terminating the
+       main loop once it is detected.
+
+--- a/pptp_callmgr.c   2008-05-14 07:33:55.000000000 +0100
++++ b/pptp_callmgr.c   2010-06-15 14:32:00.478100392 +0100
+@@ -167,6 +170,7 @@
+     do {
+         int rc;
+         fd_set read_set = call_set, write_set;
++        if (pptp_conn_is_dead(conn)) break;
+         FD_ZERO (&write_set);
+         if (pptp_conn_established(conn)) {
+         FD_SET (unix_sock, &read_set);
+@@ -294,6 +298,7 @@
+       }
+         /* with extreme prejudice */
+         pptp_conn_destroy(conn);
++        pptp_conn_free(conn);
+         vector_destroy(call_list);
+     }
+ cleanup:
+--- a/pptp_ctrl.c      2008-05-14 07:33:55.000000000 +0100
++++ b/pptp_ctrl.c      2010-06-15 14:32:00.480100647 +0100
+@@ -58,8 +62,11 @@
+ struct PPTP_CONN {
+     int inet_sock;
+     /* Connection States */
+-    enum { 
+-        CONN_IDLE, CONN_WAIT_CTL_REPLY, CONN_WAIT_STOP_REPLY, CONN_ESTABLISHED 
++    enum {
++      CONN_IDLE,
++      CONN_WAIT_CTL_REPLY, CONN_WAIT_STOP_REPLY,
++      CONN_ESTABLISHED,
++      CONN_DEAD
+     } conn_state; /* on startup: CONN_IDLE */
+     /* Keep-alive states */
+     enum { 
+@@ -448,6 +457,16 @@
+     close(conn->inet_sock);
+     /* deallocate */
+     vector_destroy(conn->call);
++    conn->conn_state = CONN_DEAD;
++}
++
++int pptp_conn_is_dead(PPTP_CONN * conn)
++{
++    return conn->conn_state == CONN_DEAD;
++}
++
++void pptp_conn_free(PPTP_CONN * conn)
++{
+     free(conn);
+ }
+@@ -1038,11 +1059,13 @@
+     int i;
+     /* "Keep Alives and Timers, 1": check connection state */
+     if (global.conn->conn_state != CONN_ESTABLISHED) {
+-        if (global.conn->conn_state == CONN_WAIT_STOP_REPLY) 
++        if (global.conn->conn_state == CONN_WAIT_STOP_REPLY) {
+             /* hard close. */
+             pptp_conn_destroy(global.conn);
+-        else /* soft close */
+-            pptp_conn_close(global.conn, PPTP_STOP_NONE);
++            return;
++        }
++        /* soft close */
++        pptp_conn_close(global.conn, PPTP_STOP_NONE);
+     }
+     /* "Keep Alives and Timers, 2": check echo status */
+     if (global.conn->ka_state == KA_OUTSTANDING) {
+--- a/pptp_ctrl.h      2008-05-14 07:33:55.000000000 +0100
++++ b/pptp_ctrl.h      2010-06-15 14:32:00.864975405 +0100
+@@ -33,6 +33,8 @@
+ void pptp_call_close(PPTP_CONN * conn, PPTP_CALL * call);
+ /* hard close. */
+ void pptp_call_destroy(PPTP_CONN *conn, PPTP_CALL *call);
++int pptp_conn_is_dead(PPTP_CONN * conn);
++void pptp_conn_free(PPTP_CONN * conn);
+ /* soft close.  Will callback on completion. */
+ void pptp_conn_close(PPTP_CONN * conn, u_int8_t close_reason);
+ /* hard close */
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-conn-free2.patch b/pkgs/core/pptp/patches/pptp-1.7.2-conn-free2.patch
new file mode 100644 (file)
index 0000000..78c021e
--- /dev/null
@@ -0,0 +1,83 @@
+Fri Jun  4 10:54:04 2010  Jan Just Keijser  <jan.just.keijser@gmail.com>
+
+       * pptp_ctrl.c: check for failure return by pptp_send_ctrl_packet
+       and avoid using freed struct conn.
+
+--- a/pptp_ctrl.c      2010-06-15 15:05:46.743913798 +0100
++++ b/pptp_ctrl.c      2010-06-15 14:32:00.480100647 +0100
+@@ -396,9 +400,10 @@
+     /* don't check state against WAIT_DISCONNECT... allow multiple disconnect
+      * requests to be made.
+      */
+-    pptp_send_ctrl_packet(conn, &rqst, sizeof(rqst));
+-    pptp_reset_timer();
+-    call->state.pns = PNS_WAIT_DISCONNECT;
++    if (pptp_send_ctrl_packet(conn, &rqst, sizeof(rqst))) {
++        pptp_reset_timer();
++        call->state.pns = PNS_WAIT_DISCONNECT;
++    }
+     /* call structure will be freed when we have confirmation of disconnect. */
+ }
+@@ -431,9 +436,10 @@
+         pptp_call_close(conn, vector_get_Nth(conn->call, i));
+     /* now close connection */
+     log("Closing PPTP connection");
+-    pptp_send_ctrl_packet(conn, &rqst, sizeof(rqst));
+-    pptp_reset_timer(); /* wait 60 seconds for reply */
+-    conn->conn_state = CONN_WAIT_STOP_REPLY;
++    if (pptp_send_ctrl_packet(conn, &rqst, sizeof(rqst))) {
++        pptp_reset_timer(); /* wait 60 seconds for reply */
++        conn->conn_state = CONN_WAIT_STOP_REPLY;
++    }
+     return;
+ }
+@@ -733,8 +739,8 @@
+                     reply.version = packet->version;
+                     /* protocol version not supported */
+                     reply.result_code = hton8(5);
+-                    pptp_send_ctrl_packet(conn, &reply, sizeof(reply));
+-                    pptp_reset_timer(); /* give sender a chance for a retry */
++                    if (pptp_send_ctrl_packet(conn, &reply, sizeof(reply)))
++                        pptp_reset_timer(); /* give sender a chance for a retry */
+                 } else { /* same or greater version */
+                     if (pptp_send_ctrl_packet(conn, &reply, sizeof(reply))) {
+                         conn->conn_state = CONN_ESTABLISHED;
+@@ -841,8 +847,8 @@
+                 hton8(1), hton8(PPTP_GENERAL_ERROR_NONE), 0
+             };
+             logecho( PPTP_ECHO_RQST);
+-            pptp_send_ctrl_packet(conn, &reply, sizeof(reply));
+-            pptp_reset_timer();
++            if (pptp_send_ctrl_packet(conn, &reply, sizeof(reply)))
++                pptp_reset_timer();
+             break;
+         }
+             /* ----------- OUTGOING CALL MESSAGES ------------ */
+@@ -928,9 +935,10 @@
+                 vector_search(conn->call, ntoh16(packet->call_id), &call);
+                 if (call->callback != NULL)
+                     call->callback(conn, call, CALL_CLOSE_RQST);
+-                pptp_send_ctrl_packet(conn, &reply, sizeof(reply));
+-                pptp_call_destroy(conn, call);
+-                log("Call closed (RQST) (call id %d)", (int) call->call_id);
++                if (pptp_send_ctrl_packet(conn, &reply, sizeof(reply))) {
++                    pptp_call_destroy(conn, call);
++                    log("Call closed (RQST) (call id %d)", (int) call->call_id);
++                }
+             }
+             break;
+         }
+@@ -1067,8 +1075,9 @@
+     } else { /* ka_state == NONE */ /* send keep-alive */
+         struct pptp_echo_rqst rqst = {
+             PPTP_HEADER_CTRL(PPTP_ECHO_RQST), hton32(global.conn->ka_id) };
+-        pptp_send_ctrl_packet(global.conn, &rqst, sizeof(rqst));
+-        global.conn->ka_state = KA_OUTSTANDING;
++        if (pptp_send_ctrl_packet(global.conn, &rqst, sizeof(rqst))) {
++            global.conn->ka_state = KA_OUTSTANDING;
++        }
+     }
+     /* check incoming/outgoing call states for !IDLE && !ESTABLISHED */
+     for (i = 0; i < vector_size(global.conn->call); i++) {
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-ip-path.patch b/pkgs/core/pptp/patches/pptp-1.7.2-ip-path.patch
new file mode 100644 (file)
index 0000000..c65cb32
--- /dev/null
@@ -0,0 +1,186 @@
+Index: routing.c
+===================================================================
+RCS file: /cvsroot/pptpclient/pptp-linux/routing.c,v
+retrieving revision 1.1
+diff -u -r1.1 routing.c
+--- a/routing.c        2 Aug 2006 07:07:37 -0000       1.1
++++ b/routing.c        25 Mar 2009 13:58:28 -0000
+@@ -23,9 +23,26 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include "routing.h"
++#include "config.h"
++#if defined (__SVR4) && defined (__sun) /* Solaris */
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <net/if.h>
++#include <arpa/inet.h>
++#include <errno.h>
++#include "util.h"
++/* PF_ROUTE socket*/
++int rts; 
++/* Destination and gateway addresses */
++struct sockaddr_in rdst, rgw;
++/* Request sequence */
++int rseq;
++int dorouting;
++#else /* Solaris */
+ /* route to the server */
+ char *route;
++#endif /* Solaris */
+ /*
+@@ -54,26 +71,113 @@
+ */
+ void routing_init(char *ip) {
++#if defined (__SVR4) && defined (__sun) /* Solaris */
++  rdst.sin_family = AF_INET;
++  if ( ! inet_pton(AF_INET, ip, &rdst.sin_addr) ) {
++    log("Cannot convert address: %s", strerror(errno));
++    return;
++  }
++
++  if ( (rts = socket(PF_ROUTE, SOCK_RAW, AF_INET )) < 0 ) {
++    log("Cannot open routing socket: %s", strerror(errno));
++    return;
++  }
++
++  struct rt_msg rtm = {
++    .hdr.rtm_msglen = sizeof(struct rt_msg),
++    .hdr.rtm_version = RTM_VERSION,
++    .hdr.rtm_type = RTM_GET,
++    .hdr.rtm_addrs = RTA_DST,
++    .hdr.rtm_pid = getpid(),
++    .hdr.rtm_seq = ++rseq,
++    .addrs[RTAX_DST] = rdst
++  };
++
++  if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) {
++    log("Error writing to routing socket: %s", strerror(errno));
++    close(rts);
++    return;
++  }
++
++  while ( read(rts, &rtm, sizeof(struct rt_msg)) > 0 )
++    if ( rtm.hdr.rtm_pid == getpid() && rtm.hdr.rtm_seq == rseq) {
++      /* Check if host route already present */
++      if ( ( rtm.hdr.rtm_flags & RTF_HOST ) != RTF_HOST ) {
++        rgw = rtm.addrs[RTAX_GATEWAY];
++        dorouting = 1;
++      }
++      break;
++    }
++#else /* Solaris */ 
+   char buf[256];
+-  snprintf(buf, 255, "/bin/ip route get %s", ip);
+-  FILE *p = popen(buf, "r");
++  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);
+   pclose(p);
+   /* TODO: check for failure of command */
++#endif /* Solaris */
+ }
+ void routing_start() {
++#if defined (__SVR4) && defined (__sun) /* Solaris */
++  if ( ! dorouting )
++     return;
++
++  struct rt_msg rtm = {
++    .hdr.rtm_msglen = sizeof(struct rt_msg),
++    .hdr.rtm_version = RTM_VERSION,
++    .hdr.rtm_type = RTM_ADD,
++    .hdr.rtm_flags = RTF_HOST | RTF_GATEWAY | RTF_STATIC,
++    .hdr.rtm_addrs = RTA_DST | RTA_GATEWAY,
++    .hdr.rtm_pid = getpid(),
++    .hdr.rtm_seq = ++rseq,
++    .addrs[RTAX_DST] = rdst,
++    .addrs[RTAX_GATEWAY] = rgw
++  };
++
++  if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) {
++    log("Error adding route: %s", strerror(errno));
++  }
++#else /* Solaris */
+   char buf[256];
+-  snprintf(buf, 255, "/bin/ip route replace %s", route);
+-  FILE *p = popen(buf, "r");
++  FILE *p;
++
++  snprintf(buf, 255, "%s route replace %s", IP_BINARY, route);
++  p = popen(buf, "r");
+   pclose(p);
++#endif /* Solaris */
+ }
+ void routing_end() {
++#if defined (__SVR4) && defined (__sun) /* Solaris */
++  if ( ! dorouting)
++    return;
++
++  struct rt_msg rtm = {
++    .hdr.rtm_msglen = sizeof(struct rt_msg),
++    .hdr.rtm_version = RTM_VERSION,
++    .hdr.rtm_type = RTM_DELETE,
++    .hdr.rtm_flags = RTF_HOST | RTF_GATEWAY | RTF_STATIC,
++    .hdr.rtm_addrs = RTA_DST | RTA_GATEWAY,
++    .hdr.rtm_pid = getpid(),
++    .hdr.rtm_seq = ++rseq,
++    .addrs[RTAX_DST] = rdst,
++    .addrs[RTAX_GATEWAY] = rgw
++  };
++
++  if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) {
++    log("Error deleting route: %s", strerror(errno));
++  }
++#else /* Solaris */
+   char buf[256];
+-  snprintf(buf, 255, "/bin/ip route delete %s", route);
+-  FILE *p = popen(buf, "r");
++  FILE *p;
++
++  snprintf(buf, 255, "%s route delete %s", IP_BINARY, route);
++  p = popen(buf, "r");
+   pclose(p);
++#endif /* Solaris */
+ }
+Index: Makefile
+===================================================================
+RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v
+retrieving revision 1.47
+retrieving revision 1.49
+diff -u -r1.47 -r1.49
+--- a/Makefile 14 May 2008 06:32:52 -0000      1.47
++++ b/Makefile 24 Jul 2008 05:37:47 -0000      1.49
+@@ -1,10 +1,13 @@
+-# $Id: Makefile,v 1.47 2008/05/14 06:32:52 quozl Exp $
++# $Id: Makefile,v 1.49 2008/07/24 05:37:47 quozl Exp $
+ VERSION=1.7.2
+ RELEASE=
+ #################################################################
+-# CHANGE THIS LINE to point to the location of your pppd binary.
++# CHANGE THIS LINE to point to the location of binaries
+ PPPD = /usr/sbin/pppd
++# Solaris
++# PPPD = /usr/bin/pppd
++IP = /bin/ip
+ #################################################################
+ BINDIR=$(DESTDIR)/usr/sbin
+@@ -47,6 +52,7 @@
+       echo "/* text added by Makefile target config.h */" > config.h
+       echo "#define PPTP_LINUX_VERSION \"$(VERSION)$(RELEASE)\"" >> config.h
+       echo "#define PPPD_BINARY \"$(PPPD)\"" >> config.h
++      echo "#define IP_BINARY \"$(IP)\"" >> config.h
+ vector_test: vector_test.o vector.o
+       $(CC) -o vector_test vector_test.o vector.o
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-makedeps.patch b/pkgs/core/pptp/patches/pptp-1.7.2-makedeps.patch
new file mode 100644 (file)
index 0000000..02b36cf
--- /dev/null
@@ -0,0 +1,80 @@
+Index: Makefile
+===================================================================
+RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v
+retrieving revision 1.47
+retrieving revision 1.49
+diff -u -r1.47 -r1.49
+--- a/Makefile 14 May 2008 06:32:52 -0000      1.47
++++ b/Makefile 24 Jul 2008 05:37:47 -0000      1.49
+@@ -96,3 +102,71 @@
+ release:
+       cp pptp_$(VERSION)-0_i386.deb $(WEB)
+       cd $(WEB);make
++
++# The following include file dependencies were generated using
++# "makedepend -w0 *.c", then manually removing out of tree entries.
++# DO NOT DELETE
++
++dirutil.o: dirutil.h
++orckit_quirks.o: pptp_msg.h
++orckit_quirks.o: pptp_compat.h
++orckit_quirks.o: pptp_options.h
++orckit_quirks.o: pptp_ctrl.h
++orckit_quirks.o: util.h
++ppp_fcs.o: ppp_fcs.h
++ppp_fcs.o: pptp_compat.h
++pptp.o: config.h
++pptp.o: pptp_callmgr.h
++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
++pptp.o: pptp_ctrl.h
++pptp.o: pqueue.h
++pptp.o: pptp_options.h
++pptp_callmgr.o: pptp_callmgr.h
++pptp_callmgr.o: pptp_ctrl.h
++pptp_callmgr.o: pptp_compat.h
++pptp_callmgr.o: pptp_msg.h
++pptp_callmgr.o: dirutil.h
++pptp_callmgr.o: vector.h
++pptp_callmgr.o: util.h
++pptp_callmgr.o: routing.h
++pptp_compat.o: pptp_compat.h
++pptp_compat.o: util.h
++pptp_ctrl.o: pptp_msg.h
++pptp_ctrl.o: pptp_compat.h
++pptp_ctrl.o: pptp_ctrl.h
++pptp_ctrl.o: pptp_options.h
++pptp_ctrl.o: vector.h
++pptp_ctrl.o: util.h
++pptp_ctrl.o: pptp_quirks.h
++pptp_gre.o: ppp_fcs.h
++pptp_gre.o: pptp_compat.h
++pptp_gre.o: pptp_msg.h
++pptp_gre.o: pptp_gre.h
++pptp_gre.o: util.h
++pptp_gre.o: pqueue.h
++pptp_gre.o: test.h
++pptp_quirks.o: orckit_quirks.h
++pptp_quirks.o: pptp_options.h
++pptp_quirks.o: pptp_ctrl.h
++pptp_quirks.o: pptp_compat.h
++pptp_quirks.o: pptp_msg.h
++pptp_quirks.o: pptp_quirks.h
++pqueue.o: util.h
++pqueue.o: pqueue.h
++routing.o: routing.h
++test.o: util.h
++test.o: test.h
++util.o: util.h
++vector.o: pptp_ctrl.h
++vector.o: pptp_compat.h
++vector.o: vector.h
++vector_test.o: vector.h
++vector_test.o: pptp_ctrl.h
++vector_test.o: pptp_compat.h
++version.o: config.h
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup-encrypt.patch b/pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup-encrypt.patch
new file mode 100644 (file)
index 0000000..6f7bfa5
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/pptpsetup        2009-06-01 14:30:36.000000000 +0100
++++ b/pptpsetup        2009-06-01 14:36:39.000000000 +0100
+@@ -43,12 +43,13 @@
+ sub create {
+     my $TUNNEL = shift;
+-    # system checking
+-    &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";
++    # 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+)$}
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup-mppe.patch b/pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup-mppe.patch
new file mode 100644 (file)
index 0000000..c8668ea
--- /dev/null
@@ -0,0 +1,47 @@
+--- pptp-1.7.2/pptpsetup       2009-06-01 15:18:25.000000000 +0100
++++ pptp-1.7.2/pptpsetup       2009-06-01 15:19:25.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";
+@@ -180,29 +172,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
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup.patch b/pkgs/core/pptp/patches/pptp-1.7.2-pptpsetup.patch
new file mode 100644 (file)
index 0000000..c1d0638
--- /dev/null
@@ -0,0 +1,23 @@
+Index: pptpsetup
+===================================================================
+RCS file: /cvsroot/pptpclient/pptp-linux/pptpsetup,v
+retrieving revision 1.4
+diff -u -r1.4 pptpsetup
+--- a/pptpsetup        2 Aug 2006 07:02:47 -0000       1.4
++++ b/pptpsetup        25 Mar 2009 13:41:37 -0000
+@@ -154,6 +154,7 @@
+     # delete entry from chap-secrets
+     my $chap_file = '/etc/ppp/chap-secrets';
++    my $mode = (stat($chap_file))[2] & 07777;
+     open( FILE, $chap_file )
+         or die "$0: can't read '$chap_file': $!\n";
+@@ -171,6 +172,7 @@
+     # write new chap-secrets
+     open( FILE, ">$chap_file" )
+         or die "$0: can't write '$chap_file': $!\n";
++    chmod $mode, $chap_file;
+     print FILE $new_chap;
+     close FILE;
diff --git a/pkgs/core/pptp/patches/pptp-1.7.2-waitpid.patch b/pkgs/core/pptp/patches/pptp-1.7.2-waitpid.patch
new file mode 100644 (file)
index 0000000..ef042f1
--- /dev/null
@@ -0,0 +1,16 @@
+Tue Jun 15 15:02:28 2010  James Cameron  <quozl@us.netrek.org>
+
+       * pptp.c (open_callmgr): fix usage of status returned by waitpid;
+       it must be wrapped by WEXITSTATUS to shift bits as required.
+
+--- a/pptp.c   2010-06-15 14:35:20.265852021 +0100
++++ b/pptp.c   2010-06-15 14:32:00.478100392 +0100
+@@ -475,7 +475,7 @@
+                 }
+                 default: /* parent */
+                     waitpid(pid, &status, 0);
+-                    if (status!= 0)
++                    if (WEXITSTATUS(status) != 0)
+                         fatal("Call manager exited with error %d", status);
+                     break;
+             }
index 8519dd0c6d2e68b4a9c3ebca0ec639ced7a5ad5a..6582c1d173fa45c77dc961a16ea6c71cdebb22f9 100644 (file)
@@ -47,7 +47,8 @@ PKG_TARBALL    = $(THISAPP).tar.gz
 define STAGE_PREPARE_CMDS
        cd $(DIR_APP) && sed -i Makefile \
                -e "s/install -o root -m 555 pptp/install -m 755 pptp/" \
-               -e "s/^OPTIMIZE=.*/OPTIMIZE=$(CFLAGS)/"
+               -e "s/^OPTIMIZE=.*/OPTIMIZE=$(CFLAGS)/" \
+               -e "s/^IP.*/IP=\/sbin\/ip/"
 endef
 
 define STAGE_BUILD