New version

Resolves: rhbz#1022685
- Dropped compat, ip-path, pptpsetup, makedeps, parallel-build,
  pptpsetup-encrypt, waitpid, conn-free, conn-free2,
  call-disconnect-notify, nohostroute-option, fsf-update
  sign-compare, unused, prototype, nested-externs, aliasing
  options.pptp, so_mark, const, field-init patches (all upstreamed)
This commit is contained in:
Jaroslav Škarvada 2013-10-25 11:06:09 +02:00
parent 7a99049ab0
commit 5361581b09
24 changed files with 15 additions and 1927 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
pptp-1.7.2.tar.gz
/pptp-1.8.0.tar.gz

View File

@ -1,172 +0,0 @@
diff -up pptp-1.7.2/pptp.c.alias pptp-1.7.2/pptp.c
--- pptp-1.7.2/pptp.c.alias 2011-12-06 22:24:06.617318769 +0000
+++ pptp-1.7.2/pptp.c 2011-12-06 22:36:25.761692858 +0000
@@ -463,7 +463,10 @@ int open_callmgr(struct in_addr inetaddr
char **envp, int pty_fd, int gre_fd)
{
/* Try to open unix domain socket to call manager. */
- struct sockaddr_un where;
+ union {
+ struct sockaddr a;
+ struct sockaddr_un u;
+ } where;
const int NUM_TRIES = 3;
int i, fd;
pid_t pid;
@@ -473,12 +476,12 @@ int open_callmgr(struct in_addr inetaddr
fatal("Could not create unix domain socket: %s", strerror(errno));
}
/* Make address */
- callmgr_name_unixsock(&where, inetaddr, localbind);
+ callmgr_name_unixsock(&where.u, inetaddr, localbind);
for (i = 0; i < NUM_TRIES; i++) {
- if (connect(fd, (struct sockaddr *) &where, sizeof(where)) < 0) {
+ if (connect(fd, &where.a, sizeof(where.u)) < 0) {
/* couldn't connect. We'll have to launch this guy. */
- unlink (where.sun_path);
+ unlink (where.u.sun_path);
/* fork and launch call manager process */
switch (pid = fork()) {
diff -up pptp-1.7.2/pptp_callmgr.c.alias pptp-1.7.2/pptp_callmgr.c
--- pptp-1.7.2/pptp_callmgr.c.alias 2011-12-06 22:24:06.617318769 +0000
+++ pptp-1.7.2/pptp_callmgr.c 2011-12-06 22:34:46.142647941 +0000
@@ -196,14 +196,17 @@ int callmgr_main(int argc, char **argv,
/* Step 5b: Handle new connection to UNIX socket */
if (FD_ISSET(unix_sock, &read_set)) {
/* New call! */
- struct sockaddr_un from;
- socklen_t len = sizeof(from);
+ union {
+ struct sockaddr a;
+ struct sockaddr_un u;
+ } from;
+ socklen_t len = sizeof(from.u);
PPTP_CALL * call;
struct local_callinfo *lci;
int s;
/* Accept the socket */
FD_CLR (unix_sock, &read_set);
- if ((s = accept(unix_sock, (struct sockaddr *) &from, &len)) < 0) {
+ if ((s = accept(unix_sock, &from.a, &len)) < 0) {
warn("Socket not accepted: %s", strerror(errno));
goto skip_accept;
}
@@ -313,11 +316,14 @@ cleanup:
/*** open_inetsock ************************************************************/
int open_inetsock(struct in_addr inetaddr)
{
- struct sockaddr_in dest, src;
+ union {
+ struct sockaddr a;
+ struct sockaddr_in i;
+ } dest, src;
int s;
- dest.sin_family = AF_INET;
- dest.sin_port = htons(PPTP_PORT);
- dest.sin_addr = inetaddr;
+ dest.i.sin_family = AF_INET;
+ dest.i.sin_port = htons(PPTP_PORT);
+ dest.i.sin_addr = inetaddr;
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
warn("socket: %s", strerror(errno));
return s;
@@ -332,14 +338,14 @@ int open_inetsock(struct in_addr inetadd
#endif
if (localbind.s_addr != INADDR_NONE) {
bzero(&src, sizeof(src));
- src.sin_family = AF_INET;
- src.sin_addr = localbind;
- if (bind(s, (struct sockaddr *) &src, sizeof(src)) != 0) {
+ src.i.sin_family = AF_INET;
+ src.i.sin_addr = localbind;
+ if (bind(s, &src.a, sizeof(src.i)) != 0) {
warn("bind: %s", strerror(errno));
close(s); return -1;
}
}
- if (connect(s, (struct sockaddr *) &dest, sizeof(dest)) < 0) {
+ if (connect(s, &dest.a, sizeof(dest.i)) < 0) {
warn("connect: %s", strerror(errno));
close(s); return -1;
}
@@ -349,7 +355,10 @@ int open_inetsock(struct in_addr inetadd
/*** open_unixsock ************************************************************/
int open_unixsock(struct in_addr inetaddr)
{
- struct sockaddr_un where;
+ union {
+ struct sockaddr a;
+ struct sockaddr_un u;
+ } where;
struct stat st;
char *dir;
int s;
@@ -357,21 +366,21 @@ int open_unixsock(struct in_addr inetadd
warn("socket: %s", strerror(errno));
return s;
}
- callmgr_name_unixsock( &where, inetaddr, localbind);
- if (stat(where.sun_path, &st) >= 0) {
+ callmgr_name_unixsock( &where.u, inetaddr, localbind);
+ if (stat(where.u.sun_path, &st) >= 0) {
warn("Call manager for %s is already running.", inet_ntoa(inetaddr));
close(s); return -1;
}
/* Make sure path is valid. */
- dir = dirname(where.sun_path);
+ dir = dirname(where.u.sun_path);
if (!make_valid_path(dir, 0770))
- fatal("Could not make path to %s: %s", where.sun_path, strerror(errno));
+ fatal("Could not make path to %s: %s", where.u.sun_path, strerror(errno));
free(dir);
- if (bind(s, (struct sockaddr *) &where, sizeof(where)) < 0) {
+ if (bind(s, &where.a, sizeof(where.u)) < 0) {
warn("bind: %s", strerror(errno));
close(s); return -1;
}
- chmod(where.sun_path, 0777);
+ chmod(where.u.sun_path, 0777);
listen(s, 127);
return s;
}
diff -up pptp-1.7.2/pptp_gre.c.alias pptp-1.7.2/pptp_gre.c
--- pptp-1.7.2/pptp_gre.c.alias 2011-12-06 22:24:06.627318773 +0000
+++ pptp-1.7.2/pptp_gre.c 2011-12-06 22:24:06.629318775 +0000
@@ -85,7 +85,10 @@ uint64_t time_now_usecs(void)
/*** Open IP protocol socket **************************************************/
int pptp_gre_bind(struct in_addr inetaddr)
{
- struct sockaddr_in src_addr, loc_addr;
+ union {
+ struct sockaddr a;
+ struct sockaddr_in i;
+ } loc_addr, src_addr;
int s = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
if (s < 0) { warn("socket: %s", strerror(errno)); return -1; }
#ifdef SO_MARK
@@ -98,16 +101,16 @@ int pptp_gre_bind(struct in_addr inetadd
#endif
if (localbind.s_addr != INADDR_NONE) {
bzero(&loc_addr, sizeof(loc_addr));
- loc_addr.sin_family = AF_INET;
- loc_addr.sin_addr = localbind;
- if (bind(s, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) != 0) {
+ loc_addr.i.sin_family = AF_INET;
+ loc_addr.i.sin_addr = localbind;
+ if (bind(s, &loc_addr.a, sizeof(loc_addr.i)) != 0) {
warn("bind: %s", strerror(errno)); close(s); return -1;
}
}
- src_addr.sin_family = AF_INET;
- src_addr.sin_addr = inetaddr;
- src_addr.sin_port = 0;
- if (connect(s, (struct sockaddr *) &src_addr, sizeof(src_addr)) < 0) {
+ src_addr.i.sin_family = AF_INET;
+ src_addr.i.sin_addr = inetaddr;
+ src_addr.i.sin_port = 0;
+ if (connect(s, &src_addr.a, sizeof(src_addr.i)) < 0) {
warn("connect: %s", strerror(errno)); close(s); return -1;
}
my = test_redirections();

View File

@ -1,39 +0,0 @@
Fix broken Call-Disconnect-Notify code
Submitted upstream: http://marc.info/?l=pptpclient-devel&m=128594487715881&w=1
--- pptp-1.7.2/pptp_ctrl.c 2010-11-30 15:26:29.856391644 +0000
+++ pptp-1.7.2/pptp_ctrl.c 2010-11-30 15:26:29.861391766 +0000
@@ -941,15 +941,25 @@ int ctrlp_disp(PPTP_CONN * conn, void *
{
struct pptp_call_clear_ntfy *packet =
(struct pptp_call_clear_ntfy *)buffer;
+ int i;
+ u_int16_t our_call_id;
+ u_int16_t peer_call_id = ntoh16(packet->call_id);
log("Call disconnect notification received (call id %d)",
- ntoh16(packet->call_id));
- if (vector_contains(conn->call, ntoh16(packet->call_id))) {
- PPTP_CALL * call;
- ctrlp_error(packet->result_code, packet->error_code,
- packet->cause_code, pptp_call_disc_ntfy,
- MAX_CALL_DISC_NTFY);
- vector_search(conn->call, ntoh16(packet->call_id), &call);
- pptp_call_destroy(conn, call);
+ (int) peer_call_id);
+ /* See if we can map the peer's call id to our own */
+ for (i = 0; i < vector_size(conn->call); i++) {
+ PPTP_CALL * call = vector_get_Nth(conn->call, i);
+ if (call->peer_call_id == peer_call_id) {
+ our_call_id = call->call_id;
+ if (vector_contains(conn->call, our_call_id)) {
+ ctrlp_error(packet->result_code, packet->error_code,
+ packet->cause_code, pptp_call_disc_ntfy,
+ MAX_CALL_DISC_NTFY);
+ vector_search(conn->call, our_call_id, &call);
+ pptp_call_destroy(conn, call);
+ }
+ break;
+ }
}
/* XXX we could log call stats here XXX */
/* XXX not all servers send this XXX */

View File

@ -1,71 +0,0 @@
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
--- pptp_compat.c 19 Feb 2008 21:43:28 -0000 1.1
+++ 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
--- pptp.c 14 May 2008 06:32:52 -0000 1.49
+++ 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

View File

@ -1,90 +0,0 @@
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.
--- pptp_callmgr.c 2008-05-14 07:33:55.000000000 +0100
+++ 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:
--- pptp_ctrl.c 2008-05-14 07:33:55.000000000 +0100
+++ 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) {
--- pptp_ctrl.h 2008-05-14 07:33:55.000000000 +0100
+++ 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 */

View File

@ -1,83 +0,0 @@
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.
--- pptp_ctrl.c 2010-06-15 15:05:46.743913798 +0100
+++ 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++) {

View File

@ -1,52 +0,0 @@
diff -up pptp-1.7.2/pptp.c.const pptp-1.7.2/pptp.c
--- pptp-1.7.2/pptp.c.const 2011-11-30 18:58:39.713148113 +0000
+++ pptp-1.7.2/pptp.c 2011-12-01 09:23:29.716446618 +0000
@@ -565,10 +565,13 @@ int get_call_id(int sock, pid_t gre, pid
void launch_pppd(char *ttydev, int argc, char **argv)
{
char *new_argv[argc + 4];/* XXX if not using GCC, hard code a limit here. */
+ char str_pppd[] = PPPD_BINARY;
+ char str_direct[] = "-direct";
+ char str_38400[] = "38400";
int i = 0, j;
- new_argv[i++] = PPPD_BINARY;
+ new_argv[i++] = str_pppd;
#ifdef USER_PPP
- new_argv[i++] = "-direct";
+ new_argv[i++] = str_direct;
/* ppp expects to have stdin connected to ttydev */
if ((j = open(ttydev, O_RDWR)) == -1)
fatal("Cannot open %s: %s", ttydev, strerror(errno));
@@ -577,7 +580,7 @@ void launch_pppd(char *ttydev, int argc,
close(j);
#else
new_argv[i++] = ttydev;
- new_argv[i++] = "38400";
+ new_argv[i++] = str_38400;
#endif
for (j = 0; j < argc; j++)
new_argv[i++] = argv[j];
diff -up pptp-1.7.2/util.c.const pptp-1.7.2/util.c
--- pptp-1.7.2/util.c.const 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/util.c 2011-11-30 18:58:39.719148114 +0000
@@ -16,7 +16,7 @@
#endif
/* implementation of log_string, defined as extern in util.h */
-char *log_string = "anon";
+const char *log_string = "anon";
static void open_log(void) __attribute__ ((constructor));
static void close_log(void) __attribute__ ((destructor));
diff -up pptp-1.7.2/util.h.const pptp-1.7.2/util.h
--- pptp-1.7.2/util.h.const 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/util.h 2011-11-30 18:59:47.458171318 +0000
@@ -10,7 +10,7 @@
/* log_string is an identifier for this pptp process, passed from
command line using --log-string=X, and included with every log message.
Useful for people with multiple pptp sessions open at a time */
-extern char * log_string;
+extern const char * log_string;
/* log_level sets the logging verbosity. Values range from 0 (errors only)
to 1 (errors and warnings) to 2 (high verbosity, for debugging) */

View File

@ -1,11 +0,0 @@
--- pptp-1.7.2/orckit_quirks.c.field 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/orckit_quirks.c 2011-12-01 09:31:04.762035792 +0000
@@ -62,7 +62,7 @@ int
orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet)
{
struct pptp_start_ctrl_conn fixed_packet = {
- {0}, /* we'll set the header later */
+ {0, 0, 0, 0, 0}, /* we'll set the header later */
hton16(PPTP_VERSION), 0, 0,
hton32(PPTP_FRAME_ASYNC), hton32(PPTP_BEARER_ANALOG),
hton16(0) /* max channels */,

View File

@ -1,182 +0,0 @@
Index: COPYING
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/COPYING,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 COPYING
--- COPYING 23 Dec 2000 08:19:51 -0000 1.1.1.1
+++ COPYING 8 Nov 2011 16:01:32 -0000
@@ -1,12 +1,12 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@
The precise terms and conditions for copying, distribution and
modification follow.
-
- GNU GENERAL PUBLIC LICENSE
+
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
-
+
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
-
+
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
-
+
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
+ Copyright (C) <year> <name of author>
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
@@ -303,16 +303,16 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -335,5 +335,5 @@
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
+library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
Index: README
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/README,v
retrieving revision 1.5
diff -u -r1.5 README
--- README 28 Aug 2007 00:17:13 -0000 1.5
+++ README 8 Nov 2011 16:01:32 -0000
@@ -17,7 +17,8 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
You can find notes on installing in the file INSTALL, usage notes in
the file USING, design notes in the Documentation directory, and the
Index: pptp.c
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/pptp.c,v
retrieving revision 1.55
diff -u -r1.55 pptp.c
--- pptp.c 3 Mar 2011 22:44:57 -0000 1.55
+++ pptp.c 8 Nov 2011 16:01:33 -0000
@@ -14,7 +14,8 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
pptp.c ... client shell to launch call managers, data handlers, and
the pppd from the command line.
Index: routing.c
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/routing.c,v
retrieving revision 1.5
diff -u -r1.5 routing.c
--- routing.c 3 Mar 2011 22:44:57 -0000 1.5
+++ routing.c 8 Nov 2011 16:01:33 -0000
@@ -14,7 +14,8 @@
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
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA
*/

View File

@ -1,186 +0,0 @@
Index: routing.c
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/routing.c,v
retrieving revision 1.1
diff -u -r1.1 routing.c
--- routing.c 2 Aug 2006 07:07:37 -0000 1.1
+++ 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
--- Makefile 14 May 2008 06:32:52 -0000 1.47
+++ 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

View File

@ -1,80 +0,0 @@
Index: Makefile
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v
retrieving revision 1.47
retrieving revision 1.49
diff -u -r1.47 -r1.49
--- Makefile 14 May 2008 06:32:52 -0000 1.47
+++ 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

View File

@ -1,23 +0,0 @@
diff -up pptp-1.7.2/pptp_gre.c.nested pptp-1.7.2/pptp_gre.c
--- pptp-1.7.2/pptp_gre.c.nested 2011-12-06 16:45:34.605691678 +0000
+++ pptp-1.7.2/pptp_gre.c 2011-12-06 19:07:14.169449813 +0000
@@ -23,6 +23,10 @@
#include "pqueue.h"
#include "test.h"
+/* globals from pptp.c */
+extern struct in_addr localbind;
+extern int rtmark;
+
#define PACKET_MAX 8196
/* test for a 32 bit counter overflow */
#define WRAPPED( curseq, lastseq) \
@@ -82,8 +86,6 @@ uint64_t time_now_usecs(void)
int pptp_gre_bind(struct in_addr inetaddr)
{
struct sockaddr_in src_addr, loc_addr;
- extern struct in_addr localbind;
- extern int rtmark;
int s = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
if (s < 0) { warn("socket: %s", strerror(errno)); return -1; }
#ifdef SO_MARK

View File

@ -1,150 +0,0 @@
This implements the --nohostroute option that routing.c talks about. It
prevents pptp from adding a host route towards the VPN server and would
usually be used with either "Split tunneling" or the --rtmark option.
Also document it appropriately.
(routing.c had it as --no-host-route, however the dashes are
inconsistent with --nobuffer and --nolaunchpppd)
Signed-off-by: David Lamparter <david.lamparter@adyton.net>
Cc: David Lamparter <equinox@diac24.net>
Cc: Franco Fichtner <franco.fichtner@adyton.net>
---
Attached code is put into public domain affirmed by both me
(David Lamparter, the author) as well as my employer (Adyton
Systems AG) who paid for it to be written. Assigning copyright
to the FSF is impossible under German law.
David Lamparter | Software Developer | Adyton Systems AG
Mozartstr. 3 | 04107 Leipzig | Germany
phone +49 341.39 299 343 | fax +49 341.39 299 343-9
trade register: Amtsgericht Leipzig HRB26578
ChangeLog | 6 ++++++
NEWS | 1 +
pptp.8 | 27 +++++++++++++++++++++++++++
pptp.c | 5 +++++
pptp_callmgr.c | 7 +++++--
routing.c | 2 +-
6 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/pptp.8 b/pptp.8
index 2da66c9..017b5db 100644
--- a/pptp.8
+++ b/pptp.8
@@ -92,6 +92,11 @@ can be used with
(requires root privileges or the CAP_NET_ADMIN capability.)
.TP
+.B \-\-nohostroute
+Do not configure a host route pointing towards the PPTP server.
+(cf. ROUTING below)
+
+.TP
.B \-\-loglevel <level>
Sets the debugging level (0=low, 1=default, 2=high)
@@ -115,6 +120,28 @@ Default is 100. Has no effect if test-type is zero. The result of
test types 2 and 3 are undefined if this value is less than ten.
+.SH "ROUTING"
+When PPTP is used in conjunction with a default route on top of the
+tunnel (or just any route encompassing the PPTP server),
+the mechanics of routing would cause the PPTP packets themselves
+to be routed over the tunnel. This would result in an encapsulation
+loop, destroying connectivity.
+
+.B pptp
+by default works around this by looking up the route towards the
+PPTP server at startup and configures a host route with that data.
+This essentially "freezes" routing for PPTP packets at the startup
+configuration. This behaviour can be disabled with
+.B --nohostroute
+if undesired (like when using
+.B --rtmark
+to implement policy routing).
+
+.B NB:
+the route added by
+.B pptp
+is currently not deleted at exit!
+
.SH "QUIRKS"
.TP
diff --git a/pptp.c b/pptp.c
index 26b6006..a3d4ad6 100644
--- a/pptp.c
+++ b/pptp.c
@@ -121,6 +121,7 @@ void usage(char *progname)
#ifdef SO_MARK
" --rtmark <n> Use specified policy routing mark for all packets\n"
#endif
+ " --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",
@@ -136,6 +137,7 @@ struct in_addr localbind = { .s_addr = INADDR_ANY };
struct in_addr localbind = { INADDR_NONE };
#endif
int rtmark = 0;
+int nohostroute = 0;
static int signaled = 0;
/*** do nothing signal handler ************************************************/
@@ -217,6 +219,7 @@ int main(int argc, char **argv, char **envp)
{"test-type", 1, 0, 0},
{"test-rate", 1, 0, 0},
{"rtmark", 1, 0, 0},
+ {"nohostroute", 0, 0, 0},
{0, 0, 0, 0}
};
int option_index = 0;
@@ -303,6 +306,8 @@ int main(int argc, char **argv, char **envp)
"this binary was compiled.\n");
exit(2);
#endif
+ } else if (option_index == 16) { /* --nohostroute */
+ nohostroute = 1;
}
break;
case '?': /* unrecognised option */
diff --git a/pptp_callmgr.c b/pptp_callmgr.c
index e6b6fd3..3c5b83d 100644
--- a/pptp_callmgr.c
+++ b/pptp_callmgr.c
@@ -32,6 +32,7 @@
extern struct in_addr localbind; /* from pptp.c */
extern int rtmark;
+extern int nohostroute;
int open_inetsock(struct in_addr inetaddr);
int open_unixsock(struct in_addr inetaddr);
@@ -124,8 +125,10 @@ int callmgr_main(int argc, char **argv, char **envp)
phonenr = argc == 3 ? argv[2] : NULL;
if (inet_aton(argv[1], &inetaddr) == 0)
fatal("Invalid IP address: %s", argv[1]);
- routing_init(inet_ntoa(inetaddr));
- routing_start();
+ if (!nohostroute) {
+ routing_init(inet_ntoa(inetaddr));
+ routing_start();
+ }
/* Step 1: Open sockets. */
if ((inet_sock = open_inetsock(inetaddr)) < 0)
fatal("Could not open control connection to %s", argv[1]);
diff --git a/routing.c b/routing.c
index b132d64..7ef5724 100644
--- a/routing.c
+++ b/routing.c
@@ -51,7 +51,7 @@ Design discussion.
The primary task of this module is to add a host route to the PPTP
server so that the kernel continues to deliver PPTP control and data
connection packets to the server despite the new PPP interface that is
-created. The flag --no-host-route is to disable this (not yet implemented).
+created. The flag --nohostroute is to disable this.
A secondary task may be to implement all-to-tunnel routing if the
appropriate flag is specified on the command line. The flag

View File

@ -1,35 +0,0 @@
Index: options.pptp
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/options.pptp,v
retrieving revision 1.3
diff -u -r1.3 options.pptp
--- options.pptp 26 Mar 2006 23:11:05 -0000 1.3
+++ options.pptp 30 Aug 2012 12:38:36 -0000
@@ -33,17 +33,25 @@
# Encryption
# (There have been multiple versions of PPP with encryption support,
-# choose with of the following sections you will use. Note that MPPE
+# choose which of the following sections you will use. Note that MPPE
# requires the use of MSCHAP-V2 during authentication)
+#
+# Note that using PPTP with MPPE and MSCHAP-V2 should be considered
+# insecure:
+# http://marc.info/?l=pptpclient-devel&m=134372640219039&w=2
+# https://github.com/moxie0/chapcrack/blob/master/README.md
+# http://technet.microsoft.com/en-us/security/advisory/2743314
# http://ppp.samba.org/ the PPP project version of PPP by Paul Mackarras
# ppp-2.4.2 or later with MPPE only, kernel module ppp_mppe.o
+# If the kernel is booted in FIPS mode (fips=1), the ppp_mppe.ko module
+# is not allowed and PPTP-MPPE is not available.
# {{{
# Require MPPE 128-bit encryption
#require-mppe-128
# }}}
-# http://polbox.com/h/hs001/ fork from PPP project by Jan Dubiec
+# http://mppe-mppc.alphacron.de/ fork from PPP project by Jan Dubiec
# ppp-2.4.2 or later with MPPE and MPPC, kernel module ppp_mppe_mppc.o
# {{{
# Require MPPE 128-bit encryption

View File

@ -1,26 +0,0 @@
Index: Makefile
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v
retrieving revision 1.50
diff -u -r1.50 Makefile
--- Makefile 4 Jun 2010 01:04:12 -0000 1.50
+++ Makefile 11 Nov 2011 13:31:16 -0000
@@ -48,11 +48,13 @@
pptpsetup.8: pptpsetup
pod2man $? > $@
-config.h:
- 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
+config.h:
+ ( \
+ echo "/* text added by Makefile target config.h */"; \
+ echo "#define PPTP_LINUX_VERSION \"$(VERSION)$(RELEASE)\""; \
+ echo "#define PPPD_BINARY \"$(PPPD)\""; \
+ echo "#define IP_BINARY \"$(IP)\"" \
+ ) > config.h
vector_test: vector_test.o vector.o
$(CC) -o vector_test vector_test.o vector.o

View File

@ -1,22 +0,0 @@
--- pptpsetup 2009-06-01 14:30:36.000000000 +0100
+++ 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+)$}

View File

@ -1,23 +0,0 @@
Index: pptpsetup
===================================================================
RCS file: /cvsroot/pptpclient/pptp-linux/pptpsetup,v
retrieving revision 1.4
diff -u -r1.4 pptpsetup
--- pptpsetup 2 Aug 2006 07:02:47 -0000 1.4
+++ 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;

View File

@ -1,219 +0,0 @@
diff -up pptp-1.7.2/pptp_ctrl.c.prototype pptp-1.7.2/pptp_ctrl.c
--- pptp-1.7.2/pptp_ctrl.c.prototype 2011-12-06 16:41:47.391574067 +0000
+++ pptp-1.7.2/pptp_ctrl.c 2011-12-06 16:41:47.405574074 +0000
@@ -174,7 +174,7 @@ int max_echo_wait = PPTP_TIMEOUT;
/* Local prototypes */
static void pptp_reset_timer(void);
-static void pptp_handle_timer();
+static void pptp_handle_timer(void);
/* Write/read as much as we can without blocking. */
int pptp_write_some(PPTP_CONN * conn);
int pptp_read_some(PPTP_CONN * conn);
@@ -1059,7 +1059,7 @@ static void pptp_reset_timer(void)
/*** Handle keep-alive timer **************************************************/
-static void pptp_handle_timer()
+static void pptp_handle_timer(void)
{
int i;
/* "Keep Alives and Timers, 1": check connection state */
diff -up pptp-1.7.2/pptp_gre.c.prototype pptp-1.7.2/pptp_gre.c
--- pptp-1.7.2/pptp_gre.c.prototype 2011-12-06 16:41:47.392574067 +0000
+++ pptp-1.7.2/pptp_gre.c 2011-12-06 16:45:34.605691678 +0000
@@ -71,7 +71,7 @@ void print_packet(int fd, void *pack, un
#endif
/*** time_now_usecs ***********************************************************/
-uint64_t time_now_usecs()
+uint64_t time_now_usecs(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
diff -up pptp-1.7.2/pptp_quirks.c.prototype pptp-1.7.2/pptp_quirks.c
--- pptp-1.7.2/pptp_quirks.c.prototype 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/pptp_quirks.c 2011-12-06 16:41:47.405574074 +0000
@@ -30,7 +30,7 @@ int set_quirk_index(int index)
return -1;
}
-int get_quirk_index()
+int get_quirk_index(void)
{
return quirk_index;
}
diff -up pptp-1.7.2/pptp_quirks.h.prototype pptp-1.7.2/pptp_quirks.h
--- pptp-1.7.2/pptp_quirks.h.prototype 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/pptp_quirks.h 2011-12-06 16:41:47.406574074 +0000
@@ -53,7 +53,7 @@ int set_quirk_index(int index);
/* get the global quirk index. return the index on success,
-1 if no quirk is defined */
-int get_quirk_index();
+int get_quirk_index(void);
#endif /* INC_PPTP_QUIRKS_H */
diff -up pptp-1.7.2/pqueue.c.prototype pptp-1.7.2/pqueue.c
--- pptp-1.7.2/pqueue.c.prototype 2011-12-06 16:41:47.392574067 +0000
+++ pptp-1.7.2/pqueue.c 2011-12-06 16:41:47.406574074 +0000
@@ -217,7 +217,7 @@ int pqueue_del (pqueue_t *point) {
-pqueue_t *pqueue_head () {
+pqueue_t *pqueue_head (void) {
return pq_head;
}
diff -up pptp-1.7.2/pqueue.h.prototype pptp-1.7.2/pqueue.h
--- pptp-1.7.2/pqueue.h.prototype 2011-12-06 16:41:47.392574067 +0000
+++ pptp-1.7.2/pqueue.h 2011-12-06 16:41:47.407574075 +0000
@@ -24,7 +24,7 @@ typedef struct pqueue {
int pqueue_add (u_int32_t seq, unsigned char *packet, int packlen);
int pqueue_del (pqueue_t *point);
-pqueue_t *pqueue_head ();
+pqueue_t *pqueue_head (void);
int pqueue_expiry_time (pqueue_t *entry);
#endif /* PQUEUE_H */
diff -up pptp-1.7.2/routing.c.prototype pptp-1.7.2/routing.c
--- pptp-1.7.2/routing.c.prototype 2011-12-06 16:41:47.388574065 +0000
+++ pptp-1.7.2/routing.c 2011-12-06 16:41:47.407574075 +0000
@@ -123,7 +123,7 @@ void routing_init(char *ip) {
#endif /* Solaris */
}
-void routing_start() {
+void routing_start(void) {
#if defined (__SVR4) && defined (__sun) /* Solaris */
if ( ! dorouting )
return;
@@ -153,7 +153,7 @@ void routing_start() {
#endif /* Solaris */
}
-void routing_end() {
+void routing_end(void) {
#if defined (__SVR4) && defined (__sun) /* Solaris */
if ( ! dorouting)
return;
diff -up pptp-1.7.2/routing.h.prototype pptp-1.7.2/routing.h
--- pptp-1.7.2/routing.h.prototype 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/routing.h 2011-12-06 16:41:47.407574075 +0000
@@ -1,3 +1,3 @@
void routing_init(char *ip);
-void routing_start();
-void routing_end();
+void routing_start(void);
+void routing_end(void);
diff -up pptp-1.7.2/test.c.prototype pptp-1.7.2/test.c
--- pptp-1.7.2/test.c.prototype 2011-12-06 16:41:47.393574067 +0000
+++ pptp-1.7.2/test.c 2011-12-06 16:41:47.408574076 +0000
@@ -171,7 +171,7 @@ static ssize_t write_reordered(int fd, c
}
}
-struct test_redirections *test_redirections()
+struct test_redirections *test_redirections(void)
{
static struct test_redirections *my = NULL;
diff -up pptp-1.7.2/test.h.prototype pptp-1.7.2/test.h
--- pptp-1.7.2/test.h.prototype 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/test.h 2011-12-06 16:41:47.408574076 +0000
@@ -2,4 +2,4 @@ struct test_redirections {
ssize_t (*write)(int fd, const void *buf, size_t count);
};
-struct test_redirections *test_redirections();
+struct test_redirections *test_redirections(void);
diff -up pptp-1.7.2/util.c.prototype pptp-1.7.2/util.c
--- pptp-1.7.2/util.c.prototype 2011-12-06 16:41:47.396574070 +0000
+++ pptp-1.7.2/util.c 2011-12-06 16:41:47.409574076 +0000
@@ -87,7 +87,7 @@ int file2fd(const char *path, const char
static int sigpipe[2];
/* create a signal pipe, returns 0 for success, -1 with errno for failure */
-int sigpipe_create()
+int sigpipe_create(void)
{
int rc;
@@ -133,20 +133,20 @@ void sigpipe_assign(int signum)
}
/* return the signal pipe read file descriptor for select(2) */
-int sigpipe_fd()
+int sigpipe_fd(void)
{
return sigpipe[0];
}
/* read and return the pending signal from the pipe */
-int sigpipe_read()
+int sigpipe_read(void)
{
int signum;
read(sigpipe[0], &signum, sizeof(signum));
return signum;
}
-void sigpipe_close()
+void sigpipe_close(void)
{
close(sigpipe[0]);
close(sigpipe[1]);
diff -up pptp-1.7.2/util.h.prototype pptp-1.7.2/util.h
--- pptp-1.7.2/util.h.prototype 2011-12-06 16:41:47.396574070 +0000
+++ pptp-1.7.2/util.h 2011-12-06 16:41:47.409574076 +0000
@@ -35,7 +35,7 @@ int file2fd(const char *path, const char
/* signal to pipe delivery implementation */
/* create a signal pipe, returns 0 for success, -1 with errno for failure */
-int sigpipe_create();
+int sigpipe_create(void);
/* generic handler for signals, writes signal number to pipe */
void sigpipe_handler(int signum);
@@ -44,11 +44,11 @@ void sigpipe_handler(int signum);
void sigpipe_assign(int signum);
/* return the signal pipe read file descriptor for select(2) */
-int sigpipe_fd();
+int sigpipe_fd(void);
/* read and return the pending signal from the pipe */
-int sigpipe_read();
+int sigpipe_read(void);
-void sigpipe_close();
+void sigpipe_close(void);
#endif /* INC_UTIL_H */
diff -up pptp-1.7.2/vector.c.prototype pptp-1.7.2/vector.c
--- pptp-1.7.2/vector.c.prototype 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/vector.c 2011-12-06 16:41:47.409574076 +0000
@@ -35,7 +35,7 @@ struct vector_struct {
static struct vector_item *binary_search(VECTOR *v, int key);
/*** vector_create ************************************************************/
-VECTOR *vector_create()
+VECTOR *vector_create(void)
{
const int INITIAL_SIZE = 4;
diff -up pptp-1.7.2/vector.h.prototype pptp-1.7.2/vector.h
--- pptp-1.7.2/vector.h.prototype 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/vector.h 2011-12-06 16:41:47.410574077 +0000
@@ -12,7 +12,7 @@
typedef struct vector_struct VECTOR;
-VECTOR *vector_create();
+VECTOR *vector_create(void);
void vector_destroy(VECTOR *v);
int vector_size(VECTOR *v);

View File

@ -1,150 +0,0 @@
diff -up pptp-1.7.2/pptp_ctrl.c.sign-compare pptp-1.7.2/pptp_ctrl.c
--- pptp-1.7.2/pptp_ctrl.c.sign-compare 2011-11-30 16:33:00.877964659 +0000
+++ pptp-1.7.2/pptp_ctrl.c 2011-11-30 18:49:17.603973525 +0000
@@ -193,7 +193,7 @@ int ctrlp_disp(PPTP_CONN * conn, void *
void pptp_set_link(PPTP_CONN * conn, int peer_call_id);
/*** log error information in control packets *********************************/
-static void ctrlp_error( int result, int error, int cause,
+static void ctrlp_error( int result, u_int8_t error, int cause,
const char *result_text[], int max_result)
{
if( cause >= 0)
@@ -238,7 +238,7 @@ static const char *ctrl_msg_types[] = {
#define MAX_CTRLMSG_TYPE 15
/*** report a sent packet ****************************************************/
-static void ctrlp_rep( void * buffer, int size, int isbuff)
+static void ctrlp_rep( void * buffer, size_t size, int isbuff)
{
struct pptp_header *packet = buffer;
unsigned int type;
@@ -532,7 +532,7 @@ int pptp_write_some(PPTP_CONN * conn) {
return -1;
}
}
- assert(retval <= conn->write_size);
+ assert((size_t)retval <= conn->write_size);
conn->write_size -= retval;
memmove(conn->write_buffer, conn->write_buffer + retval, conn->write_size);
ctrlp_rep(conn->write_buffer, retval, 0);
diff -up pptp-1.7.2/pptp_gre.c.sign-compare pptp-1.7.2/pptp_gre.c
--- pptp-1.7.2/pptp_gre.c.sign-compare 2011-11-30 16:33:00.899964648 +0000
+++ pptp-1.7.2/pptp_gre.c 2011-11-30 16:33:00.911964643 +0000
@@ -200,8 +200,7 @@ void pptp_gre_copy(u_int16_t call_id, u_
int decaps_hdlc(int fd, int (*cb)(int cl, void *pack, unsigned int len), int cl)
{
unsigned char buffer[PACKET_MAX];
- unsigned int start = 0;
- int end;
+ ssize_t start = 0, end;
int status;
static unsigned int len = 0, escape = 0;
static unsigned char copy[PACKET_MAX];
@@ -210,7 +209,7 @@ int decaps_hdlc(int fd, int (*cb)(int cl
/* this is the only blocking read we will allow */
if ((end = read (fd, buffer, sizeof(buffer))) <= 0) {
int saved_errno = errno;
- warn("short read (%d): %s", end, strerror(saved_errno));
+ warn("short read (%zd): %s", end, strerror(saved_errno));
switch (saved_errno) {
case EMSGSIZE: {
socklen_t optval, optlen = sizeof(optval);
@@ -499,7 +498,7 @@ int encaps_gre (int fd, void *pack, unsi
if (errno == ENOBUFS)
rc = 0; /* Simply ignore it */
stats.tx_failed++;
- } else if (rc < sizeof(u.header) - sizeof(u.header.seq)) {
+ } else if ((size_t)rc < sizeof(u.header) - sizeof(u.header.seq)) {
stats.tx_short++;
} else {
stats.tx_acks++;
@@ -533,7 +532,7 @@ int encaps_gre (int fd, void *pack, unsi
if (errno == ENOBUFS)
rc = 0; /* Simply ignore it */
stats.tx_failed++;
- } else if (rc < header_len + len) {
+ } else if ((size_t)rc < header_len + len) {
stats.tx_short++;
} else {
stats.tx_sent++;
diff -up pptp-1.7.2/pqueue.c.sign-compare pptp-1.7.2/pqueue.c
--- pptp-1.7.2/pqueue.c.sign-compare 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/pqueue.c 2011-11-30 16:41:39.598648652 +0000
@@ -17,7 +17,7 @@
#define MIN_CAPACITY 128 /* min allocated buffer for a packet */
-static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new);
+static int pqueue_alloc (u_int32_t seq, unsigned char *packet, int packlen, pqueue_t **new);
int packet_timeout_usecs = DEFAULT_PACKET_TIMEOUT * 1000000;
@@ -29,7 +29,7 @@ static pqueue_t *pq_freelist_head = NULL
-static int pqueue_alloc(int seq, unsigned char *packet, int packlen, pqueue_t **new) {
+static int pqueue_alloc(u_int32_t seq, unsigned char *packet, int packlen, pqueue_t **new) {
pqueue_t *newent;
@@ -125,7 +125,7 @@ static int pqueue_alloc(int seq, unsigne
-int pqueue_add (int seq, unsigned char *packet, int packlen) {
+int pqueue_add (u_int32_t seq, unsigned char *packet, int packlen) {
pqueue_t *newent, *point;
/* get a new entry */
diff -up pptp-1.7.2/pqueue.h.sign-compare pptp-1.7.2/pqueue.h
--- pptp-1.7.2/pqueue.h.sign-compare 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/pqueue.h 2011-11-30 18:42:16.733706666 +0000
@@ -15,14 +15,14 @@ extern int packet_timeout_usecs;
typedef struct pqueue {
struct pqueue *next;
struct pqueue *prev;
- int seq;
+ u_int32_t seq;
struct timeval expires;
unsigned char *packet;
int packlen;
int capacity;
} pqueue_t;
-int pqueue_add (int seq, unsigned char *packet, int packlen);
+int pqueue_add (u_int32_t seq, unsigned char *packet, int packlen);
int pqueue_del (pqueue_t *point);
pqueue_t *pqueue_head ();
int pqueue_expiry_time (pqueue_t *entry);
diff -up pptp-1.7.2/test.c.sign-compare pptp-1.7.2/test.c
--- pptp-1.7.2/test.c.sign-compare 2008-05-14 07:33:55.000000000 +0100
+++ pptp-1.7.2/test.c 2011-11-30 18:45:44.553853995 +0000
@@ -52,7 +52,7 @@ static ssize_t write_reordered_swap(int
test_ordering_phase = 0;
/* send the new packet first */
stat = write(fd, buf, count);
- if (stat != count) return stat;
+ if ((size_t)stat != count) return stat;
/* then send the old packet next */
stat = write(fd, pocket_buf, pocket_count);
free(pocket_buf);
@@ -96,7 +96,7 @@ static ssize_t write_reordered_retransmi
test_ordering_phase = 0;
/* send the new packet first */
stat = write(fd, buf, count);
- if (stat != count) return stat;
+ 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]);
@@ -142,7 +142,7 @@ static ssize_t write_reordered_reverse(i
test_ordering_phase = 0;
/* send the new packet first */
stat = write(fd, buf, count);
- if (stat != count) return stat;
+ 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]);

View File

@ -1,134 +0,0 @@
This adds support for setting SO_MARK for the PPTP TCP control
connection as well as on the GRE packets. SO_MARK is propagated
to the IP/IPv6 policy routing & netfilter mark.
This makes working with "austrian style" pptp internet dialup
much easier since you can create a separate routing table for
pptpclient. There you put a separate default route for pptp,
and pppd then sets your regular default route as usual.
Note: uses capability CAP_NET_ADMIN.
Signed-off-by: David Lamparter <david.lamparter@adyton.net>
Cc: David Lamparter <equinox@diac24.net>
Cc: Franco Fichtner <franco.fichtner@adyton.net>
--
Attached code is put into public domain affirmed by both me
(David Lamparter, the author) as well as my employer (Adyton
Systems AG) who paid for it to be written. Assigning copyright
to the FSF is impossible under German law.
--
David Lamparter | Software Developer | Adyton Systems AG
Mozartstr. 3 | 04107 Leipzig | Germany
phone +49 341.39 299 343 | fax +49 341.39 299 343-9
trade register: Amtsgericht Leipzig HRB26578
--- pptp-linux/pptp.8.orig 2008-05-14 08:32:52.000000000 +0200
+++ pptp-linux/pptp.8 2011-02-21 14:39:30.017877324 +0100
@@ -82,6 +82,16 @@
.B \-\-localbind <addr>
Bind to specified IP address instead of wildcard
.TP
+.B \-\-rtmark <n>
+Use specified policy routing mark for all packets.
+This causes both the TCP control connection's packets as well as the
+GRE packets to bear the given policy routing / netfilter mark. This
+can be used with
+.I ip rule
+(from iproute2) to use a separate routing table for the pptp client.
+
+(requires root privileges or the CAP_NET_ADMIN capability.)
+.TP
.B \-\-loglevel <level>
Sets the debugging level (0=low, 1=default, 2=high)
--- pptp-linux/pptp_callmgr.c.orig 2010-06-15 07:04:32.000000000 +0200
+++ pptp-linux/pptp_callmgr.c 2011-02-21 14:32:46.471449998 +0100
@@ -31,6 +31,7 @@
#include "routing.h"
extern struct in_addr localbind; /* from pptp.c */
+extern int rtmark;
int open_inetsock(struct in_addr inetaddr);
int open_unixsock(struct in_addr inetaddr);
@@ -321,6 +322,14 @@
warn("socket: %s", strerror(errno));
return s;
}
+#ifdef SO_MARK
+ if (rtmark) {
+ if (setsockopt(s, SOL_SOCKET, SO_MARK, &rtmark, sizeof(rtmark))) {
+ warn("setsockopt(SO_MARK): %s", strerror(errno));
+ close(s); return -1;
+ }
+ }
+#endif
if (localbind.s_addr != INADDR_NONE) {
bzero(&src, sizeof(src));
src.sin_family = AF_INET;
--- pptp-linux/pptp.c.orig 2010-06-16 01:38:04.000000000 +0200
+++ pptp-linux/pptp.c 2011-02-21 14:33:49.210896419 +0100
@@ -118,6 +118,9 @@
" --max-echo-wait Time to wait before giving up on lack of reply\n"
" --logstring <name> Use <name> instead of 'anon' in syslog messages\n"
" --localbind <addr> Bind to specified IP address instead of wildcard\n"
+#ifdef SO_MARK
+ " --rtmark <n> Use specified policy routing mark for all packets\n"
+#endif
" --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",
@@ -132,6 +135,7 @@
#else
struct in_addr localbind = { INADDR_NONE };
#endif
+int rtmark = 0;
static int signaled = 0;
/*** do nothing signal handler ************************************************/
@@ -212,6 +216,7 @@
{"version", 0, 0, 0},
{"test-type", 1, 0, 0},
{"test-rate", 1, 0, 0},
+ {"rtmark", 1, 0, 0},
{0, 0, 0, 0}
};
int option_index = 0;
@@ -290,6 +295,14 @@
test_type = atoi(optarg);
} else if (option_index == 14) { /* --test-rate */
test_rate = atoi(optarg);
+ } else if (option_index == 15) { /* --rtmark */
+#ifdef SO_MARK
+ rtmark = atoi(optarg);
+#else
+ fprintf(stderr, "--rtmark support was missing when "
+ "this binary was compiled.\n");
+ exit(2);
+#endif
}
break;
case '?': /* unrecognised option */
--- pptp-linux/pptp_gre.c.orig 2008-07-24 07:37:47.000000000 +0200
+++ pptp-linux/pptp_gre.c 2011-02-21 14:32:33.131567611 +0100
@@ -86,8 +86,17 @@
{
struct sockaddr_in src_addr, loc_addr;
extern struct in_addr localbind;
+ extern int rtmark;
int s = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
if (s < 0) { warn("socket: %s", strerror(errno)); return -1; }
+#ifdef SO_MARK
+ if (rtmark) {
+ if (setsockopt(s, SOL_SOCKET, SO_MARK, &rtmark, sizeof(rtmark))) {
+ warn("setsockopt(SO_MARK): %s", strerror(errno));
+ close(s); return -1;
+ }
+ }
+#endif
if (localbind.s_addr != INADDR_NONE) {
bzero(&loc_addr, sizeof(loc_addr));
loc_addr.sin_family = AF_INET;

View File

@ -1,73 +0,0 @@
diff -up pptp-1.7.2/pptp_callmgr.c.unused pptp-1.7.2/pptp_callmgr.c
--- pptp-1.7.2/pptp_callmgr.c.unused 2011-12-01 09:58:47.127960697 +0000
+++ pptp-1.7.2/pptp_callmgr.c 2011-12-01 09:58:47.149960723 +0000
@@ -38,12 +38,12 @@ void close_unixsock(int fd, struct in_ad
sigjmp_buf callmgr_env;
-void callmgr_sighandler(int sig) {
+void callmgr_sighandler(int sig __attribute__ ((unused))) {
/* TODO: according to signal(2), siglongjmp() is unsafe used here */
siglongjmp (callmgr_env, 1);
}
-void callmgr_do_nothing(int sig) {
+void callmgr_do_nothing(int sig __attribute__ ((unused))) {
/* do nothing signal handler */
}
@@ -104,7 +104,7 @@ void call_callback(PPTP_CONN *conn, PPTP
*****************************************************************************/
/*** Call Manager *************************************************************/
-int callmgr_main(int argc, char **argv, char **envp)
+int callmgr_main(int argc, char **argv, char **envp __attribute__ ((unused)))
{
struct in_addr inetaddr;
int inet_sock, unix_sock;
@@ -377,7 +377,7 @@ int open_unixsock(struct in_addr inetadd
}
/*** close_inetsock ***********************************************************/
-void close_inetsock(int fd, struct in_addr inetaddr)
+void close_inetsock(int fd, struct in_addr inetaddr __attribute__ ((unused)))
{
close(fd);
}
diff -up pptp-1.7.2/pptp.c.unused pptp-1.7.2/pptp.c
--- pptp-1.7.2/pptp.c.unused 2011-12-01 09:58:47.143960715 +0000
+++ pptp-1.7.2/pptp.c 2011-12-01 10:01:40.171147875 +0000
@@ -151,13 +151,13 @@ void do_nothing(int sig)
sigjmp_buf env;
/*** signal handler ***********************************************************/
-void sighandler(int sig)
+void sighandler(int sig __attribute__ ((unused)))
{
siglongjmp(env, 1);
}
/*** report statistics signal handler (SIGUSR1) *******************************/
-void sigstats(int sig)
+void sigstats(int sig __attribute__ ((unused)))
{
syslog(LOG_NOTICE, "GRE statistics:\n");
#define LOG(name,value) syslog(LOG_NOTICE, name "\n", stats .value)
@@ -508,7 +508,7 @@ int open_callmgr(struct in_addr inetaddr
}
/*** call the call manager main ***********************************************/
-void launch_callmgr(struct in_addr inetaddr, char *phonenr, int argc,
+void launch_callmgr(struct in_addr inetaddr, char *phonenr, int argc __attribute__ ((unused)),
char**argv,char**envp)
{
char *my_argv[3] = { argv[0], inet_ntoa(inetaddr), phonenr };
@@ -566,7 +566,7 @@ void launch_pppd(char *ttydev, int argc,
{
char *new_argv[argc + 4];/* XXX if not using GCC, hard code a limit here. */
char str_pppd[] = PPPD_BINARY;
- char str_direct[] = "-direct";
+ char str_direct[] __attribute__ ((unused)) = "-direct";
char str_38400[] = "38400";
int i = 0, j;
new_argv[i++] = str_pppd;

View File

@ -1,16 +0,0 @@
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.
--- pptp.c 2010-06-15 14:35:20.265852021 +0100
+++ 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;
}

102
pptp.spec
View File

@ -1,34 +1,13 @@
Name: pptp
Version: 1.7.2
Release: 22%{?dist}
Version: 1.8.0
Release: 1%{?dist}
Summary: Point-to-Point Tunneling Protocol (PPTP) Client
Group: Applications/Internet
License: GPLv2+
URL: http://pptpclient.sourceforge.net/
Source0: http://downloads.sf.net/pptpclient/pptp-%{version}.tar.gz
Source1: pptp-tmpfs.conf
Patch0: pptp-1.7.2-compat.patch
Patch1: pptp-1.7.2-ip-path.patch
Patch2: pptp-1.7.2-pptpsetup.patch
Patch3: pptp-1.7.2-makedeps.patch
Patch4: pptp-1.7.2-pptpsetup-encrypt.patch
Patch5: pptp-1.7.2-pptpsetup-mppe.patch
Patch6: pptp-1.7.2-waitpid.patch
Patch7: pptp-1.7.2-conn-free.patch
Patch8: pptp-1.7.2-conn-free2.patch
Patch9: pptp-1.7.2-call-disconnect-notify.patch
Patch10: pptp-1.7.2-so_mark.patch
Patch11: pptp-1.7.2-nohostroute-option.patch
Patch12: pptp-1.7.2-parallel-build.patch
Patch13: pptp-1.7.2-fsf-update.patch
Patch14: pptp-1.7.2-sign-compare.patch
Patch15: pptp-1.7.2-const.patch
Patch16: pptp-1.7.2-field-init.patch
Patch17: pptp-1.7.2-unused.patch
Patch18: pptp-1.7.2-prototype.patch
Patch19: pptp-1.7.2-nested-externs.patch
Patch20: pptp-1.7.2-aliasing.patch
Patch21: pptp-1.7.2-options.pptp.patch
Patch0: pptp-1.7.2-pptpsetup-mppe.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildRequires: /usr/bin/pod2man
Requires: ppp >= 2.4.2, /sbin/ip
@ -53,73 +32,9 @@ tunnels.
%prep
%setup -q
# Remove reference to stropts.h, not shipped in F9 onwards (applied upstream)
%patch0 -p0 -b .compat
# Make location of "ip" binary build-time configurable (applied upstream)
%patch1 -p0 -b .ip-path
# Retain permissions on /etc/ppp/chap-secrets (#492090, applied upstream)
%patch2 -p0 -b .bz492090
# Fix Makefile dependencies to support parallel make (applied upstream)
%patch3 -p0 -b .makedeps
%patch12 -p0 -b .parallel
# Don't check for MPPE capability in kernel or pppd unless we're creating a
# tunnel that requires encryption (applied upstream)
%patch4 -p0 -b .encrypt
# Don't check for MPPE capability in kernel and pppd at all because current
# Fedora releases and EL ≥ 5 include MPPE support out of the box (#502967)
%patch5 -p1 -b .mppe
# Fix waitpid usage (upstream patch)
%patch6 -p0 -b .waitpid
# Move free of connection struct out of main loop (upstream patch)
%patch7 -p0 -b .conn-free
# Avoid using connection struct after it is freed (upstream patch)
%patch8 -p0 -b .conn-free2
# Add call ID of outgoing call so that Call-Disconnect-Notify from peer causes
# correct disconnection sequence (upstream patch)
%patch9 -p1 -b .cdn
# Add support for setting SO_MARK for the PPTP TCP control connection as well
# as on the GRE packets (upstream patch)
%patch10 -p1 -b .so_mark
# Implement the --nohostroute option that routing.c talks about (upstream patch)
%patch11 -p1 -b .nohostroute
# Update the FSF address references and GPLv2 license text (upstream patch)
%patch13 -p0 -b .fsf
# Fix comparisons between signed and unsigned integers (upstream patch)
%patch14 -p1 -b .sign-compare
# Fix const usage (upstream patch)
%patch15 -p1 -b .const
# Add missing field initializers (upstream patch)
%patch16 -p1 -b .field
# Suppress warnings about possibly unused variables (upstream patch)
%patch17 -p1 -b .unused
# Fix declarations that are not prototypes (upstream patch)
%patch18 -p1 -b .prototype
# Fix warnings about nested externs (upstream patch)
%patch19 -p1 -b .nested
# Fix aliasing issues (upstream patch)
%patch20 -p1 -b .alias
# Additional commentary in options.pptp regarding encryption (upstream patch)
%patch21 -b .options-comments
%patch0 -p1 -b .mppe
# Pacify rpmlint
perl -pi -e 's/install -o root -m 555 pptp/install -m 755 pptp/;' Makefile
@ -161,6 +76,15 @@ rm -rf %{buildroot}
%{_mandir}/man8/pptpsetup.8*
%changelog
* Fri Oct 25 2013 Jaroslav Škarvada <jskarvad@redhat.com> - 1.8.0-1
- New version
Resolves: rhbz#1022685
- Dropped compat, ip-path, pptpsetup, makedeps, parallel-build,
pptpsetup-encrypt, waitpid, conn-free, conn-free2,
call-disconnect-notify, nohostroute-option, fsf-update
sign-compare, unused, prototype, nested-externs, aliasing
options.pptp, so_mark, const, field-init patches (all upstreamed)
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7.2-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

View File

@ -1 +1 @@
4c3d19286a37459a632c7128c92a9857 pptp-1.7.2.tar.gz
4efce9f263e2c3f38d79d9df222476de pptp-1.8.0.tar.gz