summaryrefslogtreecommitdiffstats
path: root/lib/network/vpn/vpnc.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-05-25 15:39:46 +0000
committerOlivier Blin <oblin@mandriva.com>2007-05-25 15:39:46 +0000
commit1d37bfdbbe874abd6dcb5563eea19f531de09e1c (patch)
tree74845e43ed8fa59c7aaafd1a87efaa6b0c83c228 /lib/network/vpn/vpnc.pm
parentc6ba983db7d5a82ee63599e775be0f8211447c72 (diff)
downloaddrakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.gz
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.bz2
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.xz
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.zip
sync with 2007.1 (because of SVN loss)2007.1
Diffstat (limited to 'lib/network/vpn/vpnc.pm')
-rw-r--r--lib/network/vpn/vpnc.pm74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/network/vpn/vpnc.pm b/lib/network/vpn/vpnc.pm
new file mode 100644
index 0000000..f0c8369
--- /dev/null
+++ b/lib/network/vpn/vpnc.pm
@@ -0,0 +1,74 @@
+package network::vpn::vpnc;
+
+use base qw(network::vpn);
+
+use strict;
+use common;
+
+sub get_type { 'vpnc' }
+sub get_description { N("Cisco VPN Concentrator") }
+sub get_packages { 'vpnc' }
+
+sub read_config {
+ my ($connection) = @_;
+ my @fields = group_by2(list_fields($connection));
+ foreach (cat_($connection->get_config_path)) {
+ foreach my $field (@fields) {
+ # all strings start exactly one space after the keyword string
+ /^$field->[0] (.*)/ and ${$field->[1]{val}} = $1;
+ }
+ }
+}
+
+sub write_config {
+ my ($connection) = @_;
+ output_with_perm($connection->get_config_path, 0600, map {
+ if_(${$_->[1]{val}}, $_->[0], ' ', ${$_->[1]{val}}, "\n");
+ } group_by2(list_fields($connection)));
+}
+
+sub get_settings {
+ my ($connection) = @_;
+ second(list2kv(list_fields($connection)));
+}
+
+sub list_fields {
+ my ($connection) = @_;
+ (
+ 'IPSec gateway' => {
+ label => N("Gateway"),
+ val => \$connection->{gateway},
+ },
+ 'IPSec ID' => {
+ label => N("Group name"),
+ val => \$connection->{id},
+ },
+ 'IPSec secret' => {
+ label => N("Group secret"),
+ val => \$connection->{secret},
+ hidden => 1,
+ },
+ 'Xauth username' => {
+ label => N("Username"),
+ val => \$connection->{username},
+ },
+ 'Xauth password' => {
+ label => N("Password"),
+ val => \$connection->{password},
+ hidden => 1,
+ },
+ 'UDP Encapsulate' => {
+ text => N("Use Cisco-UDP encapsulation"),
+ type => 'bool',
+ val => \$connection->{udp},
+ advanced => 1,
+ },
+ 'UDP Encapsulation Port' => {
+ label => N("Use specific UDP port"),
+ val => \$connection->{udp_port},
+ advanced => 1,
+ },
+ );
+}
+
+1;