net-dialup/pptpclient-1.8.0 is now in main portage tree, removing
This commit is contained in:
parent
6821a18010
commit
3a0c7c93fd
@ -1,7 +0,0 @@
|
|||||||
AUX pptp_fe.pl 8100 SHA256 f980fd3ff529bd4476852be39e05579bbeb9dc5c299795050a8d146ed6c4c648 SHA512 1fca3e6e5ab1438297e142745e87c96b5f6bf1dcb2ea0def466b3a54ebcb391771b1803f2c70e852b201a7eb2e50bbc4dc0f49ca648e64ac20e177027d85eee0 WHIRLPOOL 0e0a2de971c3b955d06f9679880febd110fb7676928563422ea94ad89d6116e7b987155e841fd5f04b73851b056c0e3bc3b5ca67476d78892ad3e5b4cdd74819
|
|
||||||
AUX pptpclient-1.8.0-process-name.patch 1134 SHA256 ce8d2abc8b47ac20ee574e1278a948fcb5746345f686f390676a795379c27b53 SHA512 4615438cb457c3fe0e2e7342f0aa234f3b63fccb069d217c9b7340e1b6a73ca7879e85b21742f155bb5a16db5a1bd55da14f9867486760a49479f96bdddbc451 WHIRLPOOL 9978c48a9034446aaa89ff6e35df7b90b19d2d80f49010a9714e4b923f3c2dbf34c3f8c31b5c50ea14e07d53c2708726b8c9311be684a923caf9cd414ecaa1d1
|
|
||||||
AUX xpptp_fe.pl 5620 SHA256 18c6098a66721a4f5c5b387c2ea312c21224c11ad6b2ddaec83f63049b1ab053 SHA512 110502f17b6d5dc9920c249ae593f5e4a178fed71be15764935ecdd39e30b55ac8ba448ff018af9bd8f3080d7b01b5829c64b5cd5c784d6ad440c1a2a97e4245 WHIRLPOOL 0ac3e98a9fdec1a00c9e3e0d1ae45b4e698c8f69bcc7595f2cf92d4d77e4951cb32ce5387a772cd4aa152987ea0b09f8d6f87b9cace4c593b7877e8c5471ede1
|
|
||||||
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.8.0.ebuild 1354 SHA256 f1d68197c20d109c5244e8ec3c244a794b66faa4050b7458826d0a1ac3c335ce SHA512 bcfb33f13430cab3d36a7a02685a13c835d50f003e8571801545560544a618def99d8ef1c8e6519b71c614b8ac8dfb318459c9bffe3428720fd148de37d70c21 WHIRLPOOL 9969ef843ca687bdb0d81d1bd6ebbf3685c55d1f2ecf21be482e6ae895c230b9e9a7545d667e645dce4886fefb1a18fc99239e4e5169200e78ccb56560bbf389
|
|
||||||
MISC metadata.xml 231 SHA256 7596f4acd11f03a92d9066e5e12cb03e424f10e74c2cf1019101ee09c54186b4 SHA512 6a5adf9639104e5c81462c7ed84d06e5d70b7db33d6820f8fd5e0fac39a5b3c079d9a02d066def8a4a61c56ddaea7a19e1bb62fad6555a0ecc87dd2b652196d9 WHIRLPOOL 92227640d49b57878f75bf98cd589dd91a9f7dfd6f38c330d60a42ecd82f66d9d72413711d0873e59d190865e5c17cc74e898eae01f5c18238a2ee5c299a6e90
|
|
@ -1,370 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
#
|
|
||||||
# $Id: pptp_fe.pl,v 1.1 2003/02/26 23:31:46 agriffis 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;
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
--- 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));
|
|
||||||
}
|
|
||||||
|
|
@ -1,255 +0,0 @@
|
|||||||
#!/usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# $Id: xpptp_fe.pl,v 1.1 2003/02/26 23:31:46 agriffis 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");
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
|
||||||
<pkgmetadata>
|
|
||||||
<maintainer>
|
|
||||||
<email>admin@pinkbyte.ru</email>
|
|
||||||
<name>Sergey Popov</name>
|
|
||||||
</maintainer>
|
|
||||||
</pkgmetadata>
|
|
@ -1,53 +0,0 @@
|
|||||||
# Copyright 1999-2013 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: /var/cvsroot/gentoo-x86/net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild,v 1.7 2013/10/25 09:27:10 pinkbyte Exp $
|
|
||||||
|
|
||||||
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
|
|
||||||
http://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/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"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user