summaryrefslogtreecommitdiff
path: root/net-dialup/pptpclient
diff options
context:
space:
mode:
Diffstat (limited to 'net-dialup/pptpclient')
-rw-r--r--net-dialup/pptpclient/Manifest12
-rw-r--r--net-dialup/pptpclient/files/pptp_fe.pl370
-rw-r--r--net-dialup/pptpclient/files/pptpclient-1.7.2-process-name.patch42
-rw-r--r--net-dialup/pptpclient/files/pptpclient-1.8.0-process-name.patch39
-rw-r--r--net-dialup/pptpclient/files/xpptp_fe.pl255
-rw-r--r--net-dialup/pptpclient/metadata.xml9
-rw-r--r--net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild52
-rw-r--r--net-dialup/pptpclient/pptpclient-1.8.0.ebuild52
8 files changed, 831 insertions, 0 deletions
diff --git a/net-dialup/pptpclient/Manifest b/net-dialup/pptpclient/Manifest
new file mode 100644
index 000000000000..4a315c9da0dc
--- /dev/null
+++ b/net-dialup/pptpclient/Manifest
@@ -0,0 +1,12 @@
+AUX pptp_fe.pl 8097 SHA256 47a47315c8cad7b3d8c79d57629a22d699fd2176e6675fbe6b0084cd9280b11b SHA512 7ea144546b0435a6c94306c831a91edb0915342b31701d87a417f45547353dad9509b5e4dfe1abf117982d3fecdd466af79c0a232f13ee0890bb375f41543342 WHIRLPOOL 048b93d84c3690ba9ae62bb9868451b8f92c6a5e5a2291d9f51c4b930af21d80e6105b29b17663f036c6821e22ff7d392a5f369354a0fdb3bd924dc44120690d
+AUX pptpclient-1.7.2-process-name.patch 1242 SHA256 a16bc434f301af72f43cca41a17e8232006878295b0f4f2a3fc5dbe85b020b5e SHA512 f0157c828783838493ad56a0737fa696ce3422d6db50c76c9f8d6771c57a359a3ebafbd30bba09b4e440a4cad28f935f7bf8992695bccd16b16143cdadf62a25 WHIRLPOOL 5a52106ae0483d486622be6412440af7459664e32949f574cbe5061a9d827c4fce590a12f675833555dfb3e7b1484e84b0716887e5c14fff28a9104a36c1a7aa
+AUX pptpclient-1.8.0-process-name.patch 1134 SHA256 ce8d2abc8b47ac20ee574e1278a948fcb5746345f686f390676a795379c27b53 SHA512 4615438cb457c3fe0e2e7342f0aa234f3b63fccb069d217c9b7340e1b6a73ca7879e85b21742f155bb5a16db5a1bd55da14f9867486760a49479f96bdddbc451 WHIRLPOOL 9978c48a9034446aaa89ff6e35df7b90b19d2d80f49010a9714e4b923f3c2dbf34c3f8c31b5c50ea14e07d53c2708726b8c9311be684a923caf9cd414ecaa1d1
+AUX xpptp_fe.pl 5620 SHA256 a9e642002b3155c026460c8f42c7b20484a28cf137cf4879f1dcfdf0cef8ee96 SHA512 fa6d31c9b9ae319ea3cbbba389664f04c6fff8d2d17a826870ebca236e04df4ca51cb2cd60961a2cd78ee3c99af2738c4bf87edaf49032dd3ec1dbe5d3632833 WHIRLPOOL 68bde38df71000487c998bbade0c79383bffadbecc44e8db57c41264b104f8a6d4c519ded242e3137ee8166beb19a5f35900d632640d5fbc2c73d0446957a26d
+DIST pptp-1.7.2.tar.gz 81113 SHA256 e98ae0065d2a39fa3131654ff28cb7070e996f668ed6d0e7d9a445b8d37694bc SHA512 8c070bd0e2fac68e54eefcc21a31b567f74080764130cf94bf1e29138c3a43b8f56721836d826343528062fc6afcffee03ad93631678cc9b946bc6a8f4ce3dec WHIRLPOOL 4a1a38e3e50fe77e553933532147a202858ba54f009fb8b98c33539122014a61fae6df69d985d118329a5b62f86bdfe4ca4bcb62b1586c4dbd76f4a9750f1280
+DIST pptp-1.8.0.tar.gz 86778 SHA256 e39c42d933242a8a6dd8600a0fa7f0a5ec8f066d10c4149d8e81a5c68fe4bbda SHA512 cabcc2ef29d20859af923c6d96c524e83a80549839d1ad6fccaf9ec0ed5e7a5de7120e0694e6160b374952ea3ecb7b69d9809641000d6bf2585eeedb2d29c073 WHIRLPOOL da21a83f78c2973d90679d2ae76b47bd32ad0327d55ff943c5f663513fe2ce6736ca0910f55cb9929667e935975c1ac523641e12eaa3c42ba60e30d017d5942c
+DIST pptp-command-20130515.bz2 7269 SHA256 c94f6ccb4370adb4c8f857ed260326583484d461df54dc06a966b1387c68cd6a SHA512 3b0ad28c5f7bf4f674ba8742e8a3be50cb62521f767142a1a1e74263707bc860126b7238a4aea307366a71100a193d18f3ec7599f4c0c52cd259f8b1d6b429bf WHIRLPOOL 2f1c9c1e6c4fb75bc4932c8536d0b10aa89c7fc53ba0887875b7920c8fc2bc894e7863ae4830dd907e9a4459c16f747b3454fda542664f61ac80353164121773
+EBUILD pptpclient-1.7.2-r3.ebuild 1220 SHA256 2b0f22d9e6c27b8ab7acd42593b14340dbb6bf7a168f190d91b5c4389d98aac9 SHA512 ab459c4f20e422ea293902d6e05e7499e665acd71c5cb5e3761286ff4820628fac98322f0c7e06539b68f8f0c9c565382866d0bff2777624944fb580af8ce9f6 WHIRLPOOL 0b13b1c1bf354cbccea9202939439d0e22354b9affd5a87cbd14803c533928d6010a3f9f0afe699eeffa5c6fda7ef96143850500a2788f6adf396fe8ad2f2735
+EBUILD pptpclient-1.8.0.ebuild 1227 SHA256 949bbcd275599af43379332351951421aa5002de2166dc75c37333b4697175de SHA512 e95fb37a5bb9fa83e8d647e7dfb67ea28773390f77da625937f2e830e99402873ecf76d919bed310c69dc5e5c6f1c6ab3d6393a71a09dcd4a13306816b8c4cf7 WHIRLPOOL fe6e5ed85b74fe557f4103f9e31932c6e3be4f715b37614fdfb43130edae5f871fc935ffd1bde18a835d33ea745d9c74175d3c2350c49f49e7c196f3926c1acf
+MISC ChangeLog 3125 SHA256 2d6c00ddf6b76ab480fd72c4317ea983f8c13070e7afe831e9b25076382dbace SHA512 d3b21cf92c1f5c48ffadc87ef3438a09f8da55ddffa234179f524bdf423f095ebccefc44d043bd3cf4aa839f17c68fd56c64ffd54a0e603a59d7a8475203922f WHIRLPOOL 8cdd5d6bd48ad0034ad97bf9a06736d6f1c3ed5c7bf3fa01e1ecda0f5722cf2bdef7b91efd2d87cf7568f3d52fce2e8f2cc3f57b1ee97560ad6d9dc3aa63e66e
+MISC ChangeLog-2015 10145 SHA256 c012d1415fc96985985acff8ac3869bf0cb9f313545fa13b740110ade19e3c10 SHA512 9bb69b4982f9400ea0f90c280ecc4c6c83ef3b4d1cba09687ad8da270a5f1f97d65c60232aed63f89ac6349f19e33d6f1f943eddbe0fae754989c3e0d284363a WHIRLPOOL da1e91aaf5ed007cde8f0c203f88eac7b220fd5790476809828b25b3c986d36b7c69f652584e27f2891230e904db3bb311fac430b27dbee89794f0663865bdee
+MISC metadata.xml 378 SHA256 7367c609ea9be38f4dad6b5a4e3e9df752e8640edee8ca15116aa1d2ee25f1f2 SHA512 7a4b7cfeecee2503bcf7171f7a66edc27962a6f461695dfad358421be6c1bfc794e438d9136448278b11a4fd0761df03132d8ee66b7e43f7b407c0a5bad09ea7 WHIRLPOOL b360c7bef6671b0873ecf79d40582e1b422b88b4c8ed40ba947b7b42d9aa997dccfa54fd95887f29c740fb7c8e20520c43df19fa1e78f9ea3b0563b9b029e06f
diff --git a/net-dialup/pptpclient/files/pptp_fe.pl b/net-dialup/pptpclient/files/pptp_fe.pl
new file mode 100644
index 000000000000..83899d9a2c91
--- /dev/null
+++ b/net-dialup/pptpclient/files/pptp_fe.pl
@@ -0,0 +1,370 @@
+#!/usr/bin/perl
+#
+# $Id: pptp_fe.pl,v 1.1 2001/11/29 05:19:10 quozl Exp $
+#
+# pptp_fe.pl, privileged portion of xpptp_fe.pl
+# Copyright (C) 2001 Smoot Carl-Mitchell (smoot@tic.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+use strict;
+use Getopt::Std;
+use Time::localtime;
+use IO::Handle;
+
+my $Usage = "usage: pptp_fe [-c config_file] [-d] [-h] [-k] [-n network]
+ [-p] [-r routes] [-t timeout] [host]
+ where:
+ -c - configuration file (default is ~/.pptp_fe.conf)
+ -d - pppd debug flag
+ -h - this help message
+ -k - kill pppd daemon with route to network
+ -n - network number of remote private network in x.x.x.x/n notation
+ -r - routes to add to routing table separated by commas
+ -p - suppress prompting
+ -t - connection timeout retry interval in seconds (default 60 seconds)
+ host - remote PPTP server name
+";
+
+my %Opt;
+getopts("c:dhkn:pr:t:", \%Opt);
+
+my $Config_File = $Opt{'c'};
+$Config_File = "$ENV{'HOME'}/.pptp_fe.conf" unless $Opt{'c'};
+my $Config;
+my $Debug = $Opt{'d'};
+$Debug = 0 unless $Debug;
+my $Debug_Flag = "debug" if $Debug;
+my $Help = $Opt{'h'};
+my $Kill = $Opt{'k'};
+my $Net = $Opt{'n'};
+my $No_Prompt = $Opt{'p'};
+my $Route = $Opt{'r'};
+my $Timeout = $Opt{'t'}; $Timeout = 60 unless $Timeout;
+
+print($Usage), exit(1) if $Help;
+
+my $Server = $ARGV[0];
+
+my $State = "disconnected";
+
+system("modprobe ppp-compress-18");
+
+$Config = cmd_read_config_file($Config_File);
+for my $cmd (@$Config) {
+ cmd_set($cmd, 1);
+}
+
+print "($State) > " unless $No_Prompt;
+STDOUT->flush;
+for (;;) {
+ my $rin = '';
+ my $rout = '';
+ vec($rin, fileno(STDIN), 1) = 1;
+ command() if select($rout=$rin, undef, undef, 5);
+
+ my $interface = "";
+ if ($State eq "connected" && ! ($interface = net_interface_up($Net))) {
+ print "\n";
+ print "interface $interface for $Net not up - restarting\n";
+ cmd_connect();
+ print "($State) > " unless $No_Prompt;;
+ }
+}
+
+sub command {
+
+ my $input;
+ sysread(STDIN, $input, 1024);
+
+ for my $line1 (split("\n", $input)) {
+ my $line = $line1;
+ $line =~ s/\s*$//;
+ $line =~ s/^\s*//;
+ my ($command, $arguments) = split(" ", $line, 2);
+
+ if ($command eq "c") {
+ cmd_connect();
+ }
+ elsif ($command eq "d") {
+ cmd_disconnect();
+ }
+ elsif ($command eq "h") {
+ cmd_help();
+ }
+ elsif ($command eq "l") {
+ cmd_list();
+ }
+ elsif ($command eq "q") {
+ cmd_disconnect();
+ exit 0;
+ }
+ elsif ($command eq "r") {
+ $Config = cmd_read_config_file($arguments);
+ }
+ elsif ($command eq "s") {
+ cmd_set($arguments, 0);
+ }
+ elsif ($command eq "w") {
+ cmd_write_config_file($arguments);
+ }
+ elsif ($command ne "") {
+ print "unknown command\n";
+ }
+ }
+ print "($State) > " unless $No_Prompt;
+ STDOUT->flush;
+}
+
+sub cmd_connect {
+
+ cmd_disconnect() if $State eq "connected";
+
+ my $start_time = time();
+ my $date_string = ctime($start_time);
+ print "$date_string Running pptp $Server $Debug_Flag";
+ system("pptp $Server $Debug_Flag");
+
+ my $interface = "";
+
+ do {
+ sleep 1;
+ $interface = net_interface_up($Net);
+ print ".";
+ } until ($interface || time() > $start_time + $Timeout);
+
+ if (time() > $start_time + $Timeout) {
+ print "timed out after $Timeout sec\n";
+ $State = "disconnected";
+ return 0;
+ }
+
+ print "\n";
+
+ my $ifcfg = `ifconfig $interface`;
+ $ifcfg =~ /P-t-P:(.*) Mask/;
+ my $ip = $1;
+ print "setting route to network $Net to interface $interface\n";
+ system("route add -net $Net dev $interface metric 2");
+
+ # Routes are separated by commas
+ my @route = split(/,/, $Route);
+ for my $route (@route) {
+ my $net_flag = "";
+ $net_flag = "-net" if $route =~ /\//;
+
+ print "setting route to $route to interface $interface\n";
+ system("route add $net_flag $route dev $interface");
+ }
+
+ $State = "connected";
+ print "connected\n";
+ return 1;
+}
+
+sub cmd_disconnect {
+
+ return 1 if $State eq "disconnected";
+
+ my $interface = net_interface_up($Net);
+ my $pid_file = "/var/run/$interface.pid";
+
+ # delete the named pipes - XXX this is a bit crude
+ system("rm -f /var/run/pptp/*");
+
+ $State = "disconnected", return 1 unless $interface && -f $pid_file;
+
+ my $pid = `cat $pid_file`;
+ chomp $pid;
+ print "killing pppd($pid)\n";
+ kill("HUP", $pid);
+ print "waiting for pppd to die";
+ do {
+ sleep 1;
+ print ".";
+ }
+ until (kill(0, $pid));
+
+ print "\n";
+ $State = "disconnected";
+ print "disconnected\n";
+ return 1;
+}
+
+sub cmd_list {
+
+ print "Server = $Server\n";
+ print "Network = $Net\n";
+ print "Routes = $Route\n";
+ print "Debug = $Debug_Flag\n";
+ print "No_Prompt = $No_Prompt\n";
+ print "Timeout = $Timeout\n";
+ print "\n";
+}
+
+sub cmd_help {
+
+ print "Commands are:\n";
+ print "c - initiate PPTP connection\n";
+ print "d - disconnect PPTP\n";
+ print "h - this help message\n";
+ print "l - list current configuration\n";
+ print "q - quite the program\n";
+ print "r - read configuration file\n";
+ print "s - set configuration variable (l for a list)\n";
+ print "w - write the configuration file\n";
+
+}
+
+sub cmd_set {
+ my $input = shift;
+ my $no_replace = shift;
+
+ my ($variable, $value) = split(/\s*=\s*/, $input);
+
+ $variable = "\L$variable";
+ if (! $variable) {
+ print "syntax: s variable = value\n";
+ return 0;
+ }
+
+ if ($variable eq "server") {
+ $Server = $value unless $no_replace && $Server;
+ }
+ elsif ($variable eq "network") {
+ $Net = $value unless $no_replace && $Net;
+ }
+ elsif ($variable eq "routes") {
+ $Route = $value unless $no_replace && $Route;
+ }
+ elsif ($variable eq "debug") {
+ $Debug_Flag = $value unless $no_replace && $Debug_Flag;
+ }
+ elsif ($variable eq "no_prompt") {
+ $No_Prompt = $value unless $no_replace && $No_Prompt;
+ }
+ elsif ($variable eq "timeout") {
+ $Timeout = $value unless $no_replace && $Timeout;
+ }
+ elsif ($variable eq "config_file") {
+ $Config_File = $value unless $no_replace && $Config_File;
+ }
+ else {
+ print "unknown variable\n";
+ }
+}
+
+sub cmd_read_config_file {
+ my $file = shift;
+
+ my $config = [];
+ $file = $Config_File unless $file;
+ local *IN;
+ if (!open(IN, $file)) {
+ print "cannot open $file\n";
+ return $config;
+ }
+
+ my @config_file = <IN>;
+ close IN;
+ push @config_file, "\n";
+ chomp @config_file;
+
+ for my $line (@config_file) {
+ next if /\s*#/;
+
+ if ($line =~ /\S/) {
+ $line =~ s/^\s*//;
+ $line =~ s/\s*$//;
+ push @$config, $line;
+ next;
+ }
+ }
+ return $config;
+}
+
+sub cmd_write_config_file {
+ my $file = shift;
+
+ $file = $Config_File unless $file;
+ local *OUT;
+ if (!open(OUT, ">$file")) {
+ print "cannot open $file\n";
+ return 0;
+ }
+
+ my $oldfh = select OUT;
+ cmd_list();
+ close OUT;
+ select $oldfh;
+
+ return 1;
+}
+
+sub net_interface_up {
+ my $cidr = shift;
+
+ # cidr is net/bits
+ my($net, $nbits) = split(/\//, $cidr);
+
+ # compute the network number
+ my $netnum = netnum($net, $nbits);
+ local(*INTERFACE);
+ open(INTERFACE, "ifconfig|") || die "cannot run ifconfig - $!\n";
+
+ my $interface = "";
+ my @interface = <INTERFACE>;
+ close INTERFACE;
+ for (@interface) {
+ chomp;
+
+ # new interface
+ if (/^[a-zA-Z]/) {
+ if ($interface =~ /(.*) Link.*P-t-P:(.*) Mask/) {
+ my $interface_name = $1;
+ my $ip = $2;
+ return $interface_name
+ if netnum($ip, $nbits) == $netnum;
+ }
+ $interface = "";
+ }
+ $interface .= $_;
+ }
+ return "";
+}
+
+sub netnum {
+ my $net = shift;
+ my $bits = shift;
+
+ my @octets = split(/\./, $net);
+ my $netnum = 0;
+ for my $octet (@octets) {
+ $netnum <<= 8;
+ $netnum |= $octet;
+ }
+
+ my $mask = 0;
+ for (1..$bits) {
+ $mask <<= 1;
+ $mask |= 1;
+ }
+ $mask = $mask << (32-$bits);
+
+ $netnum &= $mask;
+
+ return $netnum;
+}
diff --git a/net-dialup/pptpclient/files/pptpclient-1.7.2-process-name.patch b/net-dialup/pptpclient/files/pptpclient-1.7.2-process-name.patch
new file mode 100644
index 000000000000..b0051f81bde0
--- /dev/null
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-process-name.patch
@@ -0,0 +1,42 @@
+diff -Nru pptp-1.7.2.orig/pptp.c pptp-1.7.2/pptp.c
+--- pptp-1.7.2.orig/pptp.c 2008-05-14 08:33:55.000000000 +0200
++++ pptp-1.7.2/pptp.c 2009-06-20 10:53:07.000000000 +0200
+@@ -59,11 +59,7 @@
+ #include "pptp_callmgr.h"
+ #include "pptp_gre.h"
+ #include "version.h"
+-#if defined(__linux__)
+-#include <sys/prctl.h>
+-#else
+ #include "inststr.h"
+-#endif
+ #include "util.h"
+ #include "pptp_quirks.h"
+ #include "pqueue.h"
+@@ -394,12 +390,7 @@
+ char *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
+- 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;
+
+ signal(SIGINT, sighandler);
+@@ -495,13 +486,7 @@
+ char *my_argv[3] = { argv[0], inet_ntoa(inetaddr), phonenr };
+ char buf[128];
+ snprintf(buf, sizeof(buf), "pptp: call manager for %s", my_argv[1]);
+-#ifdef PR_SET_NAME
+- 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 --git a/net-dialup/pptpclient/files/pptpclient-1.8.0-process-name.patch b/net-dialup/pptpclient/files/pptpclient-1.8.0-process-name.patch
new file mode 100644
index 000000000000..926574762499
--- /dev/null
+++ b/net-dialup/pptpclient/files/pptpclient-1.8.0-process-name.patch
@@ -0,0 +1,39 @@
+--- pptp.c.orig 2013-10-23 12:10:46.000000000 +0400
++++ pptp.c 2013-11-26 13:05:43.259867888 +0400
+@@ -60,9 +60,6 @@
+ #include "pptp_callmgr.h"
+ #include "pptp_gre.h"
+ #include "version.h"
+-#if defined(__linux__)
+-#include <sys/prctl.h>
+-#endif
+ #include "inststr.h"
+ #include "util.h"
+ #include "pptp_quirks.h"
+@@ -413,12 +410,7 @@
+ 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
+- 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;
+
+ signal(SIGINT, sighandler);
+@@ -517,13 +509,7 @@
+ char *my_argv[3] = { argv[0], inet_ntoa(inetaddr), phonenr };
+ char buf[128];
+ snprintf(buf, sizeof(buf), "pptp: call manager for %s", my_argv[1]);
+-#ifdef PR_SET_NAME
+- 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 --git a/net-dialup/pptpclient/files/xpptp_fe.pl b/net-dialup/pptpclient/files/xpptp_fe.pl
new file mode 100644
index 000000000000..e32dcd9eabc8
--- /dev/null
+++ b/net-dialup/pptpclient/files/xpptp_fe.pl
@@ -0,0 +1,255 @@
+#!/usr/bin/perl -w
+#
+# $Id: xpptp_fe.pl.pl,v 1.1 2001/11/29 05:19:10 quozl Exp $
+#
+# xpptp_fe.pl.pl, graphical user interface for PPTP configuration
+# Copyright (C) 2001 Smoot Carl-Mitchell (smoot@tic.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+use Tk;
+use Tk::DirTree;
+
+=pod
+TK driver for pptp_fe.pl command script
+=cut
+
+=pod
+Global flags which correspnd to the pptp_fe.pl flags and options
+=cut
+
+my $Debug = 0;
+my $Debug_Flag = "";
+my $Network = "";
+my $Server = "";
+my $Routes = "";
+my $Get_Current_Config = 0;
+
+=pod
+
+Start up pptp_fe.pl and connect its input and output to the TK frontend.
+All I/O is done in raw mode, so the reads and writes are atomic and
+unbuffered.
+
+=cut
+
+pipe OUTPUT_READ, OUTPUT_WRITE;
+pipe COMMAND_READ, COMMAND_WRITE;
+
+my $Child_Pid = fork();
+die "cannot fork - $!\n" if $Child_Pid == -1;
+
+if ($Child_Pid) { # parent
+ close OUTPUT_WRITE;
+ close COMMAND_READ;
+}
+else { # child
+ close OUTPUT_READ;
+ close COMMAND_WRITE;
+
+ open(STDIN, "<&COMMAND_READ");
+ open(STDOUT, ">&OUTPUT_WRITE");
+
+ exec("pptp_fe.pl -p");
+}
+
+=pod
+The main window which present the various pptp_fe.pl options.
+
+The window is composed of:
+
+ Server name
+ Network number
+ Routes
+Connect Button Disconnect Button Write Config Button Quit Button
+=cut
+
+my $Main = MainWindow->new();
+$Main->Label(-text => "PPTP")->pack;
+
+my $Server_Frame = $Main->Frame->pack(-fill => 'x',
+ -padx => 5,
+ -pady => 5);
+
+$Server_Frame->Label(-text => "Remote PPTP Host")->pack(-side => "left");
+$Server_Frame->Entry(
+ -text => "Host",
+ -width => 30,
+ -textvariable => \$Server,
+ )->pack(-side => "left");
+
+
+my $Net_Frame = $Main->Frame->pack(-fill => 'x',
+ -padx => 5,
+ -pady => 5);
+
+=pod
+Network number entry box. This is the argument to the the -n flag
+=cut
+
+$Net_Frame->Label(-text => "Network Number")->pack(-side => "left");
+$Net_Frame->Entry(
+ -text => "Network",
+ -width => 15,
+ -textvariable => \$Network,
+ )->pack(-side => "left");
+
+=pod
+Additional static routes (-r) flag
+=cut
+
+my $Route_Frame = $Main->Frame->pack(
+ -fill => 'x',
+ -padx => 5,
+ -pady => 5);
+
+$Route_Frame->Label(-text => "Routes")->pack(-side => "left");
+
+$Route_Frame->Entry(
+ -text => "Routes",
+ -width => 30,
+ -textvariable => \$Routes
+ )->pack(
+ -side => "left",
+ -padx => 5,
+ -pady => 5);
+
+=pod
+Buttons
+
+Connect - Connect to a remote PPTP server
+
+Disconnect - Disconnect from the remote PPTP server
+
+Write - Write a configuration file
+
+Quit - Terminates the running pptp daemon and pptp_fe.pl program.
+=cut
+
+my $Button_Frame = $Main->Frame->pack(-fill => 'x', -pady => 5);
+
+my $Disconnect_Button;
+my $Connect_Button;
+my $Read_Button;
+my $Write_Button;
+my $Quit_Button;
+
+$Connect_Button = $Button_Frame->Button(
+ -text => "Connect",
+ -command =>
+ sub {
+ update_config();
+ syswrite(COMMAND_WRITE, "c\n");
+
+ $Connect_Button->configure(-state => "disabled");
+ $Disconnect_Button->configure(-state => "normal");
+ },
+ )->pack(-side => "left", -pady => 5, -padx => 5);
+
+$Disconnect_Button = $Button_Frame->Button(
+ -text => "Disconnect",
+ -state => "disabled",
+ -command =>
+ sub {
+ syswrite(COMMAND_WRITE, "d\n");
+
+ $Connect_Button->configure(-state => "normal");
+ $Disconnect_Button->configure(-state => "disabled");
+ }
+ )->pack(-side => "left", -pady => 5, -padx => 5);
+
+$Write_Button = $Button_Frame->Button(
+ -text => "Write Config",
+ -command =>
+ sub {
+ syswrite(COMMAND_WRITE, "w\n");
+
+ }
+ )->pack(-side => "left", -pady => 5, -padx => 5);
+
+$Quit_Button = $Button_Frame->Button(
+ -text => "Quit",
+ -command =>
+ sub {
+ syswrite(COMMAND_WRITE, "q\n");
+
+ $Connect_Button->configure(-state => "disabled");
+ $Disconnect_Button->configure(-state => "disabled");
+ $Quit_Button->configure(-state => "disabled");
+ }
+ )->pack(-side => "left", -pady => 5, -padx => 5);
+
+my $Log_Window = $Main->Toplevel;
+$Log_Window->title("PPTP Log");
+
+my $Log_Widget = $Log_Window->Text(
+ -height => 20,
+ -width => 80,
+ )->pack;
+
+
+$Log_Widget->fileevent(OUTPUT_READ, "readable", sub {
+ my $in = "";
+ my $n = sysread(OUTPUT_READ, $in, 1024);
+ if ($n == 0) {
+ close OUTPUT_READ;
+ $Main->destroy;
+ exit 0;
+ }
+
+ if (!$Get_Current_Config) {
+ $Log_Widget->insert("end", $in);
+ $Log_Widget->see("end");
+ }
+ else {
+ $Get_Current_Config = 0;
+
+ for my $line (split("\n", $in)) {
+ next unless $line =~ /\S/;
+
+ my ($variable, $value) = split(/\s*=\s*/, $line);
+ $variable = "\L$variable";
+
+ if ($variable eq "server") {
+ $Server = $value;
+ }
+ elsif ($variable eq "network") {
+ $Network = $value;
+ }
+ elsif ($variable eq "routes") {
+ $Routes = $value;
+ }
+ elsif ($variable eq "debug") {
+ $Debug = $value;
+ }
+ }
+ }
+
+ return 1;
+});
+
+syswrite(COMMAND_WRITE, "l\n");
+$Get_Current_Config = 1;
+
+MainLoop;
+
+sub update_config {
+
+ syswrite(COMMAND_WRITE, "s server = $Server\n");
+ syswrite(COMMAND_WRITE, "s network = $Network\n");
+ syswrite(COMMAND_WRITE, "s routes = $Routes\n");
+ syswrite(COMMAND_WRITE, "s debug = $Debug_Flag\n");
+}
diff --git a/net-dialup/pptpclient/metadata.xml b/net-dialup/pptpclient/metadata.xml
new file mode 100644
index 000000000000..15734ef7acba
--- /dev/null
+++ b/net-dialup/pptpclient/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <longdescription>PPTP Client is a client for the proprietary Microsoft Point-to-Point Tunneling Protocol.</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">pptpclient</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild b/net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild
new file mode 100644
index 000000000000..56577c7da2bf
--- /dev/null
+++ b/net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils toolchain-funcs
+
+MY_P="${P/client}"
+MY_CMD="pptp-command-20130515"
+
+DESCRIPTION="Linux client for PPTP"
+HOMEPAGE="http://pptpclient.sourceforge.net/"
+SRC_URI="mirror://sourceforge/pptpclient/${MY_P}.tar.gz
+ https://dev.gentoo.org/~pinkbyte/distfiles/pptpclient/${MY_CMD}.bz2"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 ~arm ppc ppc64 x86"
+IUSE="tk"
+
+DEPEND="net-dialup/ppp
+ dev-lang/perl
+ tk? ( dev-perl/Tk )"
+RDEPEND="${DEPEND}
+ sys-apps/iproute2"
+
+RESTRICT="test" #make test is useless and vector_test.c is broken
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( AUTHORS ChangeLog DEVELOPERS NEWS README TODO USING )
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-process-name.patch
+ epatch_user
+}
+
+src_compile() {
+ emake OPTIMISE= DEBUG= CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC="$(tc-getCC)"
+}
+
+src_install() {
+ default
+ dodoc Documentation/*
+ dodir /etc/pptp.d
+
+ # The current version of pptp-linux doesn't include the
+ # RH-specific portions, so include them ourselves.
+ newsbin "${WORKDIR}/${MY_CMD}" pptp-command
+ dosbin "${FILESDIR}/pptp_fe.pl"
+ use tk && dosbin "${FILESDIR}/xpptp_fe.pl"
+}
diff --git a/net-dialup/pptpclient/pptpclient-1.8.0.ebuild b/net-dialup/pptpclient/pptpclient-1.8.0.ebuild
new file mode 100644
index 000000000000..47150a73c096
--- /dev/null
+++ b/net-dialup/pptpclient/pptpclient-1.8.0.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils toolchain-funcs
+
+MY_P="${P/client}"
+MY_CMD="pptp-command-20130515"
+
+DESCRIPTION="Linux client for PPTP"
+HOMEPAGE="http://pptpclient.sourceforge.net/"
+SRC_URI="mirror://sourceforge/pptpclient/${MY_P}.tar.gz
+ https://dev.gentoo.org/~pinkbyte/distfiles/pptpclient/${MY_CMD}.bz2"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 ~arm ~arm64 ppc ppc64 x86"
+IUSE="tk"
+
+DEPEND="net-dialup/ppp
+ dev-lang/perl
+ tk? ( dev-perl/Tk )"
+RDEPEND="${DEPEND}
+ sys-apps/iproute2"
+
+RESTRICT="test" #make test is useless and vector_test.c is broken
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( AUTHORS ChangeLog DEVELOPERS NEWS README TODO USING )
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-process-name.patch
+ epatch_user
+}
+
+src_compile() {
+ emake OPTIMISE= DEBUG= CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC="$(tc-getCC)"
+}
+
+src_install() {
+ default
+ dodoc Documentation/*
+ dodir /etc/pptp.d
+
+ # The current version of pptp-linux doesn't include the
+ # RH-specific portions, so include them ourselves.
+ newsbin "${WORKDIR}/${MY_CMD}" pptp-command
+ dosbin "${FILESDIR}/pptp_fe.pl"
+ use tk && dosbin "${FILESDIR}/xpptp_fe.pl"
+}