summaryrefslogtreecommitdiffstats
path: root/knetworkmanager-0.8/vpn-plugins
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-17 17:38:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-17 17:38:53 +0000
commit1e0dd58661c9097fb41218ee7e3515f2d8ba8dac (patch)
treea263b4ad0c1f7fba6013f5d9854db4cb4962df82 /knetworkmanager-0.8/vpn-plugins
downloadknetworkmanager8-1e0dd58661c9097fb41218ee7e3515f2d8ba8dac.tar.gz
knetworkmanager8-1e0dd58661c9097fb41218ee7e3515f2d8ba8dac.zip
Add dead-ended knetworkmanager 0.8 source
Add copy of same for knetworkmanager 0.9 starting point git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetworkmanager8@1259314 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knetworkmanager-0.8/vpn-plugins')
-rw-r--r--knetworkmanager-0.8/vpn-plugins/Makefile.am17
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/AUTHORS2
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/Makefile.am5
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/configure.in.in14
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop25
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/src/Makefile.am12
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp566
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h110
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnauth.ui80
-rw-r--r--knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnprop.ui619
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/AUTHORS1
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/Makefile.am5
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/configure.in.in5
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/knetworkmanager_pptp.desktop23
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am12
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake34
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp231
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h84
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui95
-rw-r--r--knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui244
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/Makefile.am5
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/authors1
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/configure.in.in14
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop21
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/src/Makefile.am12
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp234
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h99
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanauth.ui88
-rw-r--r--knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanprop.ui236
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/AUTHORS2
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/Makefile.am5
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/configure.in.in14
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop23
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/src/Makefile.am12
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp402
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h89
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncauth.ui68
-rw-r--r--knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncprop.ui279
38 files changed, 3788 insertions, 0 deletions
diff --git a/knetworkmanager-0.8/vpn-plugins/Makefile.am b/knetworkmanager-0.8/vpn-plugins/Makefile.am
new file mode 100644
index 0000000..6349be1
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/Makefile.am
@@ -0,0 +1,17 @@
+SUBDIRS=
+
+if WITH_OPENVPN
+SUBDIRS += openvpn
+endif
+
+if WITH_VPNC
+SUBDIRS += vpnc
+endif
+
+if WITH_STRONGSWAN
+SUBDIRS += strongswan
+endif
+
+if WITH_PPTP
+SUBDIRS += pptp
+endif
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/AUTHORS b/knetworkmanager-0.8/vpn-plugins/openvpn/AUTHORS
new file mode 100644
index 0000000..f4340ea
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/AUTHORS
@@ -0,0 +1,2 @@
+Thomas Kallenberg <[email protected]> <[email protected]>
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/Makefile.am b/knetworkmanager-0.8/vpn-plugins/openvpn/Makefile.am
new file mode 100644
index 0000000..81ae93b
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = src
+
+service_DATA = knetworkmanager_openvpn.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/configure.in.in b/knetworkmanager-0.8/vpn-plugins/openvpn/configure.in.in
new file mode 100644
index 0000000..00b2409
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/configure.in.in
@@ -0,0 +1,14 @@
+KNETWORKMANAGER_OPENVPN_VERSION=0.1
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_OPENVPN_VERSION, $KNETWORKMANAGER_OPENVPN_VERSION, [KNetworkManager OpenVPN Plugin Version])
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_OPENVPN_VERSION_STRING, "$KNETWORKMANAGER_OPENVPN_VERSION", [KNetworkManager OpenVPN Plugin Version String])
+
+PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([TQT dbus bindings missing])
+])
+
+OPENVPN_CFLAGS="$DBUS_TQT_CFLAGS"
+OPENVPN_LIBS="$DBUS_TQT_LIBS"
+
+AC_SUBST(OPENVPN_CFLAGS)
+AC_SUBST(OPENVPN_LIBS)
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop b/knetworkmanager-0.8/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop
new file mode 100644
index 0000000..a6abde3
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop
@@ -0,0 +1,25 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Icon=
+ServiceTypes=KNetworkManager/VPNPlugin
+X-KDE-Library=knetworkmanager_openvpn
+X-NetworkManager-Services=openvpn
+X-KDE-PluginInfo-Author=Helmut Schaa
+X-KDE-PluginInfo-Name=knetworkmanager_openvpn
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=VPNService
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=OpenVPN
+Name[bn]=ওপেন-ভিপিএন
+Name[ca]=VPN oberta
+Name[xx]=xxOpenVPNxx
+Comment=OpenVPN
+Comment[bn]=ওপেন-ভিপিএন
+Comment[ca]=VPN oberta
+Comment[xx]=xxOpenVPNxx
+
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/src/Makefile.am b/knetworkmanager-0.8/vpn-plugins/openvpn/src/Makefile.am
new file mode 100644
index 0000000..af37dc3
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/src/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(OPENVPN_CFLAGS) $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = knetworkmanager_openvpn.la
+knetworkmanager_openvpn_la_SOURCES = knetworkmanager-openvpn.cpp \
+ openvpnprop.ui \
+ openvpnauth.ui
+noinst_HEADERS = knetworkmanager-openvpn.h
+knetworkmanager_openvpn_la_LDFLAGS = -module $(all_libraries)
+knetworkmanager_openvpn_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp b/knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp
new file mode 100644
index 0000000..0593a08
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp
@@ -0,0 +1,566 @@
+/***************************************************************************
+ *
+ * knetworkmanager-openvpn.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#include <klocale.h>
+#include <tqmessagebox.h>
+#include <tqbutton.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <tqobjectlist.h>
+#include <tqobject.h>
+#include <tqcheckbox.h>
+#include <kpassdlg.h>
+#include <kgenericfactory.h>
+#include <tqwidgetstack.h>
+#include <tqfileinfo.h>
+#include <tqhostaddress.h>
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-openvpn.h"
+
+typedef KGenericFactory<OpenVPNPlugin> OpenVPNPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( knetworkmanager_openvpn, OpenVPNPluginFactory("knetworkmanager_openvpn"));
+
+/************************************
+* OpenVPNPlugin
+************************************/
+OpenVPNPlugin::OpenVPNPlugin(TQObject* parent, const char* name, const TQStringList& args)
+ : VPNPlugin(parent, name, args)
+{
+
+}
+
+OpenVPNPlugin::~OpenVPNPlugin()
+{
+
+}
+
+VPNConfigWidget* OpenVPNPlugin::CreateConfigWidget(TQWidget* parent)
+{
+ return new OpenVPNConfig(parent);
+}
+
+VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* parent)
+{
+ return new OpenVPNAuthentication(parent);
+}
+
+/************************************
+* OpenVPNConnectionType
+************************************/
+OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop)
+{
+ if (prop == 0)
+ return X509;
+ else if (prop == 1)
+ return SHARED_KEY;
+ else if (prop == 2)
+ return PASSWORD;
+ else if (prop == 3)
+ return X509USERPASS;
+ return UNKNOWN;
+}
+
+int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
+{
+ switch(connType)
+ {
+ case X509:
+ return 0;
+ case SHARED_KEY:
+ return 1;
+ case PASSWORD:
+ return 2;
+ case X509USERPASS:
+ return 3;
+ default:
+ return -1;
+ }
+ return -1;
+}
+
+/************************************
+* OpenVPNConfig
+************************************/
+
+OpenVPNConfig::OpenVPNConfig(TQWidget* parent)
+ : VPNConfigWidget(parent)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _openvpnWidget = new OpenVPNConfigWidget(this);
+ tqlayout->addWidget(_openvpnWidget);
+
+ connect(_openvpnWidget->chkUseCipher, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboCipher, TQT_SLOT(setEnabled(bool)));
+ connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboDirection, TQT_SLOT(setEnabled(bool)));
+ connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->editTLSAuth, TQT_SLOT(setEnabled(bool)));
+ connect(_openvpnWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _openvpnWidget->routes, TQT_SLOT(setEnabled(bool)));
+
+ // add all Cipher modes to the Combobox
+ getCipherModes();
+
+ // switch to the right configuration interface when selecting the connection type
+ connect(_openvpnWidget->cboConnectionType, TQT_SIGNAL( activated(int)), _openvpnWidget->widgetStack, TQT_SLOT(raiseWidget(int)));
+ this->languageChange();
+}
+
+OpenVPNConfig::~OpenVPNConfig()
+{
+
+}
+
+void OpenVPNConfig::languageChange()
+{
+ _openvpnWidget->cboConnectionType->insertItem(i18n("X.509 Certificates"), OpenVPNConnectionType::X509 );
+ _openvpnWidget->cboConnectionType->insertItem(i18n("Pre-shared key") , OpenVPNConnectionType::SHARED_KEY );
+ _openvpnWidget->cboConnectionType->insertItem(i18n("Password Authentication") , OpenVPNConnectionType::PASSWORD );
+ _openvpnWidget->cboConnectionType->insertItem(i18n("X.509 with Password Authentication") , OpenVPNConnectionType::X509USERPASS );
+
+ _openvpnWidget->cboDirection->insertItem(i18n("none"));
+ _openvpnWidget->cboDirection->insertItem(i18n("0"));
+ _openvpnWidget->cboDirection->insertItem(i18n("1"));
+}
+
+TQString OpenVPNConfig::findOpenVPNBinary()
+{
+ static const char *openvpn_binary_paths[] =
+ {
+ "/usr/sbin/openvpn",
+ "/sbin/openvpn",
+ NULL
+ };
+
+ const char **openvpn_binary = openvpn_binary_paths;
+
+ while (*openvpn_binary != NULL) {
+ if ( TQFileInfo(*openvpn_binary).exists())
+ break;
+ openvpn_binary++;
+ }
+
+ return *openvpn_binary;
+}
+
+
+void OpenVPNConfig::receiveCipherData(KProcess*, char* buffer, int len)
+{
+ // add possible cipher modes to the combobox
+ TQStringList cipherModes = TQStringList::split("\n", TQString::tqfromLatin1(buffer, len), false );
+ for (TQStringList::ConstIterator it = cipherModes.begin(); it != cipherModes.end(); ++it)
+ {
+ _openvpnWidget->cboCipher->insertItem((*it));
+ }
+}
+
+void OpenVPNConfig::getCipherModes()
+{
+ // get all possible cipher modes
+ TQString openvpn = findOpenVPNBinary();
+ if (!openvpn.isNull())
+ {
+ KProcess* cipherHelper = new KProcess();
+ cipherHelper->setUseShell(true, "/bin/sh");
+ *cipherHelper << TQString::tqfromLatin1("%1 --show-ciphers | awk '/^[A-Z][A-Z0-9]+-/ { print $1 }'").tqarg(openvpn);
+ connect (cipherHelper, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(receiveCipherData(KProcess*, char*, int)));
+ kdDebug() << "starting openvpn to get cipher modes" << endl;
+ if (!cipherHelper->start(KProcess::Block, KProcess::Stdout))
+ kdDebug() << "error starting openvpn" << endl;
+ }
+
+}
+
+void OpenVPNConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
+{
+ // fill up our inputfields
+ for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
+ {
+ TQString entry = it.key();
+ TQString value = it.data();
+
+ if (entry == "connection-type")
+ {
+ OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt());
+ _openvpnWidget->cboConnectionType->setCurrentItem(type);
+ _openvpnWidget->widgetStack->raiseWidget(type);
+ }
+ else if (entry == "remote")
+ {
+ _openvpnWidget->gateway->setText(value);
+ }
+ else if (entry == "port")
+ {
+ if (value.toInt() > 0)
+ {
+ _openvpnWidget->port->setText(value);
+ _openvpnWidget->chkDefaultPort->setChecked(false);
+ }
+ else
+ {
+ _openvpnWidget->chkDefaultPort->setChecked(true);
+ }
+ }
+ else if (entry == "proto" || entry == "proto-tcp")
+ {
+ _openvpnWidget->chkUseTCP->setChecked( value == "yes");
+ }
+ else if (entry == "ca")
+ {
+ _openvpnWidget->editCA->setURL(value);
+ }
+ else if (entry == "cert")
+ {
+ _openvpnWidget->editCert->setURL(value);
+ }
+ else if (entry == "key")
+ {
+ _openvpnWidget->editKey->setURL(value);
+ }
+ else if (entry == "cipher")
+ {
+ _openvpnWidget->chkUseCipher->setChecked(true);
+ _openvpnWidget->cboCipher->setCurrentItem(value);
+ }
+ else if (entry == "comp-lzo")
+ {
+ _openvpnWidget->chkUseLZO->setChecked(value == "true");
+ }
+ else if (entry == "shared-key" || entry == "static-key")
+ {
+ _openvpnWidget->editSharedKey->setURL(value);
+ }
+ else if (entry == "username")
+ {
+ _openvpnWidget->editUsername->setText(value);
+ }
+ else if (entry == "local-ip")
+ {
+ _openvpnWidget->editLocalIP->setText(value);
+ }
+ else if (entry == "remote-ip")
+ {
+ _openvpnWidget->editRemoteIP->setText(value);
+ }
+ else if (entry == "dev" || entry == "tap-dev") {
+ _openvpnWidget->chkUseTAP->setChecked(value == "true");
+ }
+ else if (entry == "ta")
+ {
+ _openvpnWidget->chkUseTLS->setChecked(true);
+ _openvpnWidget->editTLSAuth->setURL(value);
+ }
+ else if (entry == "ta-dir")
+ {
+ _openvpnWidget->cboDirection->setCurrentItem(value);
+ }
+ else
+ {
+ kdDebug() << TQString("OpenVPN: Property '%1' not handled").tqarg(entry) << endl;
+ }
+ }
+
+ // set routes
+ if (!routes.empty())
+ {
+ _openvpnWidget->chkIPAdresses->setChecked(true);
+ _openvpnWidget->routes->setText(routes.join(" "));
+ }
+}
+
+TQMap<TQString, TQString>OpenVPNConfig::getVPNProperties()
+{
+ // build a StingList of properties
+ TQMap<TQString, TQString> strlist;
+
+ strlist.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem())));
+ strlist.insert("remote", TQString(_openvpnWidget->gateway->text()));
+
+ // port is not necessary
+ if (!_openvpnWidget->port->text().isEmpty() && !_openvpnWidget->chkDefaultPort->isChecked())
+ strlist.insert("port", _openvpnWidget->port->text());
+
+ strlist.insert("ca", TQString(_openvpnWidget->editCA->url()));
+ strlist.insert("cert",TQString(_openvpnWidget->editCert->url() ));
+ strlist.insert("key", TQString(_openvpnWidget->editKey->url()));
+
+ if (_openvpnWidget->chkUseCipher->isChecked())
+ strlist.insert("cipher", TQString(_openvpnWidget->cboCipher->currentText()));
+
+ if (_openvpnWidget->chkUseLZO->isChecked())
+ strlist.insert("comp-lzo", TQString("true"));
+ else
+ strlist.insert("comp-lzo", TQString("false"));
+
+ strlist.insert("static-key", TQString(_openvpnWidget->editSharedKey->url()));
+ strlist.insert("username", TQString(_openvpnWidget->editUsername->text()));
+ strlist.insert("local-ip", TQString(_openvpnWidget->editLocalIP->text()));
+ strlist.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text()));
+
+ if (_openvpnWidget->chkUseTAP->isChecked()) {
+ strlist.insert("tap-dev", "true");
+ strlist.insert("proto-tcp", "true");
+ } else {
+ strlist.insert("tap-dev", "false");
+ strlist.insert("proto-tcp", "false");
+ }
+
+ if (_openvpnWidget->chkUseTLS->isChecked())
+ strlist.insert("ta", TQString(_openvpnWidget->editTLSAuth->url()));
+
+ strlist.insert("ta-dir", TQString(_openvpnWidget->cboDirection->currentText()));
+
+ return strlist;
+}
+
+TQStringList OpenVPNConfig::getVPNRoutes()
+{
+ TQStringList strlist;
+ if(_openvpnWidget->chkIPAdresses->isChecked())
+ {
+ strlist = TQStringList::split(" ", _openvpnWidget->routes->text());
+ }
+ return strlist;
+}
+
+bool OpenVPNConfig::hasChanged()
+{
+ return true;
+}
+
+bool OpenVPNConfig::isValid(TQStringList& err_msg)
+{
+ bool retval = true;
+
+ // check gateway
+ if (_openvpnWidget->gateway->text().isEmpty())
+ {
+ err_msg.append(i18n("You have to specify a gateway"));
+ retval = false;
+ }
+
+ bool ok = false;
+ _openvpnWidget->port->text().toULong(&ok);
+ if (!ok && !_openvpnWidget->port->text().isEmpty() )
+ {
+ err_msg.append(i18n("The port number has to be numeric"));
+ retval = false;
+ }
+
+ switch(_openvpnWidget->cboConnectionType->currentItem())
+ {
+ case OpenVPNConnectionType::X509:
+ // check if ca file is correct
+ if (_openvpnWidget->editCA->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no CA file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("CA file not valid"));
+ }
+
+ // check if cert file is correct
+ if (_openvpnWidget->editCert->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no CERT file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("CERT file not valid"));
+ }
+
+ // check if key file is correct
+ if (_openvpnWidget->editKey->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no Key file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("Key file not valid"));
+ }
+
+ break;
+
+
+ case OpenVPNConnectionType::SHARED_KEY:
+ // check if a shared key is selected
+ if (_openvpnWidget->editSharedKey->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("Please provide a valid shared key"));
+ }
+ // check if the shared key file exists
+ else if (!TQFileInfo(_openvpnWidget->editSharedKey->url()).exists())
+ {
+ retval = false;
+ err_msg.append(i18n("Please provide a valid shared key"));
+ }
+
+ // check if local ip is valid
+ if (!TQHostAddress().setAddress(_openvpnWidget->editLocalIP->text()))
+ {
+ retval = false;
+ err_msg.append(i18n("local IP is invalid"));
+ }
+ // check if remote ip is valid
+ if (!TQHostAddress().setAddress(_openvpnWidget->editRemoteIP->text()))
+ {
+ retval = false;
+ err_msg.append(i18n("remote IP is invalid"));
+ }
+
+ break;
+ case OpenVPNConnectionType::PASSWORD:
+ // check if username is suplied
+ if (_openvpnWidget->editUsername->text().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no username provided"));
+ }
+
+ // check if ca file is correct
+ if (_openvpnWidget->editCA->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no CA file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("CA file not valid"));
+ }
+
+ break;
+
+
+ case OpenVPNConnectionType::X509USERPASS:
+ // check if username is suplied
+ if (_openvpnWidget->editUsername->text().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no username provided"));
+ }
+
+ // check if ca file is correct
+ if (_openvpnWidget->editCA->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no CA file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("CA file not valid"));
+ }
+
+ // check if cert file is correct
+ if (_openvpnWidget->editCert->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no CERT file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("CERT file not valid"));
+ }
+
+ // check if key file is correct
+ if (_openvpnWidget->editKey->url().isEmpty())
+ {
+ retval = false;
+ err_msg.append(i18n("no Key file provided"));
+ }
+ else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile())
+ {
+ retval = false;
+ err_msg.append(i18n("Key file not valid"));
+ }
+ break;
+ }
+
+
+ return retval;
+}
+
+/************************************
+* OpenVPNAuthentication
+************************************/
+
+OpenVPNAuthentication::OpenVPNAuthentication(TQWidget* parent, char* name)
+ : VPNAuthenticationWidget(parent, name)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _openvpnAuth = new OpenVPNAuthenticationWidget(this);
+ tqlayout->addWidget(_openvpnAuth);
+}
+
+OpenVPNAuthentication::~OpenVPNAuthentication()
+{
+
+}
+
+void OpenVPNAuthentication::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& properties)
+{
+ // find the connection type property
+ for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
+ {
+ if (it.key() == "connection-type")
+ {
+ _connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt());
+ break;
+ }
+ }
+}
+
+TQMap<TQString, TQString> OpenVPNAuthentication::getPasswords()
+{
+ TQMap<TQString, TQString> pwds;
+ if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS))
+ pwds.insert("password", TQString(_openvpnAuth->editUserPassword->password()));
+ else
+ pwds.insert("no-secret", TQString("true"));
+
+ return pwds;
+}
+
+void OpenVPNAuthentication::setPasswords(TQString name, TQString value) {
+ if (name == TQString("password")) {
+ _openvpnAuth->editUserPassword->erase();
+ _openvpnAuth->editUserPassword->insert(value);
+ }
+}
+
+bool OpenVPNAuthentication::needsUserInteraction()
+{
+ if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS))
+ return true;
+ return false;
+}
+
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h b/knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h
new file mode 100644
index 0000000..c78f524
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h
@@ -0,0 +1,110 @@
+/***************************************************************************
+ *
+ * knetworkmanager-openvpn.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_OPENVPN_H
+#define KNETWORKMANAGER_OPENVPN_H
+
+#include <tqmap.h>
+#include <tqstring.h>
+#include <tqwidget.h>
+#include <tqlayout.h>
+#include <kprocess.h>
+
+#include "knetworkmanager-vpnplugin.h"
+#include "openvpnprop.h"
+#include "openvpnauth.h"
+
+class OpenVPNPlugin : public VPNPlugin
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ OpenVPNPlugin(TQObject*, const char*, const TQStringList&);
+ ~OpenVPNPlugin();
+
+ VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
+ VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
+};
+
+class OpenVPNConnectionType
+{
+ public:
+ enum CONNECTIONTYPE
+ {
+ UNKNOWN = -1
+ , X509 = 0
+ , SHARED_KEY
+ , PASSWORD
+ , X509USERPASS
+ };
+
+ static CONNECTIONTYPE mapString2ConnectionType(int string);
+ static int mapConnectionType2String(CONNECTIONTYPE connectionType);
+};
+
+class OpenVPNConfig : public VPNConfigWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
+ TQMap<TQString, TQString> getVPNProperties();
+ TQStringList getVPNRoutes();
+ bool hasChanged();
+ bool isValid(TQStringList& );
+
+ OpenVPNConfig(TQWidget* parent);
+ ~OpenVPNConfig();
+
+ public slots:
+ void receiveCipherData(KProcess*, char*, int);
+
+ private:
+ OpenVPNConfigWidget* _openvpnWidget;
+
+ void getCipherModes();
+ TQString findOpenVPNBinary();
+
+ protected slots:
+ void languageChange();
+};
+
+class OpenVPNAuthentication : public VPNAuthenticationWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ OpenVPNAuthentication(TQWidget* parent = NULL, char* name = NULL);
+ ~OpenVPNAuthentication();
+ void setVPNData(const TQStringList&, const TQMap<TQString, TQString>&);
+ TQMap<TQString, TQString> getPasswords();
+ void setPasswords(TQString name, TQString value);
+ bool needsUserInteraction();
+
+ private:
+ OpenVPNAuthenticationWidget* _openvpnAuth;
+ OpenVPNConnectionType::CONNECTIONTYPE _connectionType;
+};
+
+#endif /* KNETWORKMANAGER_OPENVPN_H */
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnauth.ui b/knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnauth.ui
new file mode 100644
index 0000000..4cb6578
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnauth.ui
@@ -0,0 +1,80 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>OpenVPNAuthenticationWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>OpenVPNAuthenticationWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>372</width>
+ <height>171</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>OpenVPNAuthentication</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPasswordEdit" row="0" column="1">
+ <property name="name">
+ <cstring>editUserPassword</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnprop.ui b/knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnprop.ui
new file mode 100644
index 0000000..c136050
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/openvpn/src/openvpnprop.ui
@@ -0,0 +1,619 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>OpenVPNConfigWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>OpenVPNConfigWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>667</width>
+ <height>322</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>kTabWidget1</cstring>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Required Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQWidgetStack" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>widgetStack</cstring>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>groupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>X.509</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>editCA2</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>editCert2</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>editKey2</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>CA file</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Certificate</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Key</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>groupBox5_2</cstring>
+ </property>
+ <property name="title">
+ <string>Shared key</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>editSharedKey</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>editLocalIP</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>editRemoteIP</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Shared Key</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Local IP</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Remote IP</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>2</number>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>groupBox5_2_2</cstring>
+ </property>
+ <property name="title">
+ <string>Password</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>editCA3</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>editUsername2</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>CA file</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>3</number>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>groupBox5_3</cstring>
+ </property>
+ <property name="title">
+ <string>X.509 with password authentication</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>editCA</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>CA file</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>editCert</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Certificate</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Key</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>editKey</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>editUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel9_2</cstring>
+ </property>
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>labelConnectionType</cstring>
+ </property>
+ <property name="text">
+ <string>Connection Type</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>cboConnectionType</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Gateway</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3_3</cstring>
+ </property>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>gateway</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>port</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>chkDefaultPort</cstring>
+ </property>
+ <property name="text">
+ <string>Use Default</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Optional Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="7" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>routes</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="6" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkIPAdresses</cstring>
+ </property>
+ <property name="text">
+ <string>Only use VPN Connection for these Addresses (eg: 172.16.0.0/16 10.11.12.0/24)</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkUseTAP</cstring>
+ </property>
+ <property name="text">
+ <string>Use TAP device</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkUseLZO</cstring>
+ </property>
+ <property name="text">
+ <string>Use LZO compression</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkUseTCP</cstring>
+ </property>
+ <property name="text">
+ <string>Use TCP connection</string>
+ </property>
+ </widget>
+ <spacer row="8" column="1">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>chkUseCipher</cstring>
+ </property>
+ <property name="text">
+ <string>Use cipher</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>chkUseTLS</cstring>
+ </property>
+ <property name="text">
+ <string>Use TLS auth</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Direction:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="5" column="1">
+ <property name="name">
+ <cstring>cboDirection</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="4" column="1">
+ <property name="name">
+ <cstring>editTLSAuth</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>cboCipher</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>editCA</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCA2</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCA</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCA3</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCA2</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCA</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCA2</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCA3</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCA3</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCA2</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCA3</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCA</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCert</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCert2</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editCert2</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editCert</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editKey</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editKey2</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editKey2</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editKey</receiver>
+ <slot>setURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editUsername</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editUsername2</receiver>
+ <slot>setText(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>editUsername2</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>editUsername</receiver>
+ <slot>setText(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>chkDefaultPort</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>port</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kTabWidget1</tabstop>
+ <tabstop>chkUseLZO</tabstop>
+ <tabstop>chkUseTAP</tabstop>
+ <tabstop>chkUseTCP</tabstop>
+ <tabstop>chkUseCipher</tabstop>
+ <tabstop>cboCipher</tabstop>
+ <tabstop>chkUseTLS</tabstop>
+ <tabstop>editTLSAuth</tabstop>
+ <tabstop>cboDirection</tabstop>
+ <tabstop>chkIPAdresses</tabstop>
+ <tabstop>routes</tabstop>
+ <tabstop>gateway</tabstop>
+ <tabstop>cboConnectionType</tabstop>
+ <tabstop>editCA2</tabstop>
+ <tabstop>editCert2</tabstop>
+ <tabstop>editKey2</tabstop>
+ <tabstop>editSharedKey</tabstop>
+ <tabstop>editLocalIP</tabstop>
+ <tabstop>editRemoteIP</tabstop>
+ <tabstop>editCA3</tabstop>
+ <tabstop>editUsername2</tabstop>
+ <tabstop>editCA</tabstop>
+ <tabstop>editCert</tabstop>
+ <tabstop>editKey</tabstop>
+ <tabstop>editUsername</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/AUTHORS b/knetworkmanager-0.8/vpn-plugins/pptp/AUTHORS
new file mode 100644
index 0000000..17bdf96
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/AUTHORS
@@ -0,0 +1 @@
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/Makefile.am b/knetworkmanager-0.8/vpn-plugins/pptp/Makefile.am
new file mode 100644
index 0000000..1a0ed41
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = src
+
+service_DATA = knetworkmanager_pptp.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/configure.in.in b/knetworkmanager-0.8/vpn-plugins/pptp/configure.in.in
new file mode 100644
index 0000000..bb2a866
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/configure.in.in
@@ -0,0 +1,5 @@
+KNETWORKMANAGER_PPTP_VERSION=0.1
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_PPTP_VERSION, $KNETWORKMANAGER_PPTP_VERSION, [KNetworkManager PPTP Plugin Version])
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_PPTP_VERSION_STRING, "$KNETWORKMANAGER_PPTP_VERSION", [KNetworkManager PPTP Plugin Version String])
+
+
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/knetworkmanager_pptp.desktop b/knetworkmanager-0.8/vpn-plugins/pptp/knetworkmanager_pptp.desktop
new file mode 100644
index 0000000..883a13e
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/knetworkmanager_pptp.desktop
@@ -0,0 +1,23 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Icon=
+ServiceTypes=KNetworkManager/VPNPlugin
+X-KDE-Library=knetworkmanager_pptp
+X-NetworkManager-Services=pptp
+X-KDE-PluginInfo-Author=Helmut Schaa
+X-KDE-PluginInfo-Name=knetworkmanager_pptp
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=VPNService
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=PPTP
+Name[bn]=পিপিটিপি
+Name[xx]=xxPPTPxx
+Comment=PPTP
+Comment[bn]=পিপিটিপি
+Comment[xx]=xxPPTPxx
+
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am
new file mode 100644
index 0000000..d5d943c
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(PACKAGE_CFLAGS) $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = knetworkmanager_pptp.la
+knetworkmanager_pptp_la_SOURCES = knetworkmanager-pptp.cpp \
+ pptpprop.ui \
+ pptpauth.ui
+noinst_HEADERS = knetworkmanager-pptp.h
+knetworkmanager_pptp_la_LDFLAGS = -module $(all_libraries)
+knetworkmanager_pptp_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake
new file mode 100644
index 0000000..2c8f5b0
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake
@@ -0,0 +1,34 @@
+INCLUDES = $(PACKAGE_CFLAGS) $(all_includes)
+
+# rule for creating tqmoc files
+%.tqmoc.cpp: %.h
+ $(TQMOC) -o $@ $<
+
+# rules for creating .h and .cpp from .ui
+%.cpp: %.ui %.h
+ $(UIC) -tr tr2i18n -pch klocale.h -o $@ -impl $*.h $<
+
+%.h: %.ui
+ $(UIC) -o $@ $<
+
+all_TQMOC = knetworkmanager-vpnc.tqmoc.cpp \
+ vpncauth.tqmoc.cpp \
+ vpncprop.tqmoc.cpp
+
+all_METASOURCES = vpncauth.cpp \
+ vpncprop.cpp
+
+all_IMPLEMENTATIONS = knetworkmanager-vpnc.cpp
+
+kde_module_LTLIBRARIES = knetworkmanager_vpnc.la
+knetworkmanager_vpnc_la_SOURCES = $(all_METASOURCES) $(all_TQMOC) $(all_IMPLEMENTATIONS)
+noinst_HEADERS = knetworkmanager-vpnc.h
+knetworkmanager_vpnc_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN)
+knetworkmanager_vpnc_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+
+service_DATA = knetworkmanager_vpnc.desktop
+servicedir = $(kde_servicesdir)
+
+CLEANFILES = $(all_TQMOC) $(all_METASOURCES)
+
+
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp
new file mode 100644
index 0000000..091b400
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp
@@ -0,0 +1,231 @@
+/***************************************************************************
+ *
+ * knetworkmanager-pptp.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#include <klocale.h>
+#include <tqmessagebox.h>
+#include <tqbutton.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <tqobjectlist.h>
+#include <tqobject.h>
+#include <tqcheckbox.h>
+#include <kpassdlg.h>
+#include <kgenericfactory.h>
+#include <tqlabel.h>
+
+#include "knetworkmanager-pptp.h"
+
+typedef KGenericFactory<PPTPPlugin> PPTPPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( knetworkmanager_pptp, PPTPPluginFactory("knetworkmanager_pptp"));
+
+
+PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args)
+ : VPNPlugin(parent, name, args)
+{
+ KLocale* loc = KGlobal::locale();
+ loc->insertCatalogue("NetworkManager-pptp");
+}
+
+PPTPPlugin::~PPTPPlugin()
+{
+
+}
+
+VPNConfigWidget* PPTPPlugin::CreateConfigWidget(TQWidget* parent)
+{
+ return new PPTPConfig(parent);
+}
+
+VPNAuthenticationWidget* PPTPPlugin::CreateAuthenticationWidget(TQWidget* parent)
+{
+ return new PPTPAuthentication(parent);
+}
+
+
+PPTPConfig::PPTPConfig(TQWidget* parent)
+ : VPNConfigWidget(parent)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _pptpWidget = new PPTPConfigWidget(this);
+ tqlayout->addWidget(_pptpWidget);
+
+ connect(_pptpWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _pptpWidget->routes, TQT_SLOT(setEnabled(bool)));
+
+ this->languageChange();
+}
+
+PPTPConfig::~PPTPConfig()
+{
+
+}
+
+void PPTPConfig::languageChange()
+{
+
+}
+
+void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
+{
+ // fill up our inputfields (only textfields atm)
+ for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
+ {
+ TQString entry = it.key();
+ TQString value = it.data();
+
+ if (entry == "gateway")
+ {
+ _pptpWidget->gateway->setText(value);
+ }
+ else if (entry == "refuse-eap")
+ {
+ _pptpWidget->chk_refuseeap->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "refuse-pap")
+ {
+ _pptpWidget->chk_refusepap->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "refuse-chap")
+ {
+ _pptpWidget->chk_refusechap->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "refuse-mschap")
+ {
+ _pptpWidget->chk_refusemschap->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "refuse-mschapv2")
+ {
+ _pptpWidget->chk_refusemschapv2->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "require-mppe")
+ {
+ _pptpWidget->chk_requiremppe->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "require-mppe-40")
+ {
+ _pptpWidget->chk_requiremppe40->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "require-mppe-128")
+ {
+ _pptpWidget->chk_requiremppe128->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "mppe-stateful")
+ {
+ _pptpWidget->chk_mppestateful->setChecked(value == "yes" || value == "true");
+ }
+ else if (entry == "nodeflate")
+ {
+ _pptpWidget->chk_nodeflate->setChecked(value == "yes" || value == "true");
+ }
+ }
+
+ // set routes
+ if (!routes.empty())
+ {
+ _pptpWidget->chkIPAdresses->setChecked(true);
+ _pptpWidget->routes->setText(routes.join(" "));
+ }
+}
+
+TQMap<TQString, TQString> PPTPConfig::getVPNProperties()
+{
+ // build a StingList of properties
+ TQMap<TQString, TQString> strlist;
+ strlist.insert("gateway", TQString(_pptpWidget->gateway->text()));
+ strlist.insert("refuse-eap", TQString(_pptpWidget->chk_refuseeap->isChecked() ? "yes" : "no"));
+ strlist.insert("refuse-pap", TQString(_pptpWidget->chk_refusepap->isChecked() ? "yes" : "no"));
+ strlist.insert("refuse-chap", TQString(_pptpWidget->chk_refusechap->isChecked() ? "yes" : "no"));
+ strlist.insert("refuse-mschap", TQString(_pptpWidget->chk_refusemschap->isChecked() ? "yes" : "no"));
+ strlist.insert("refuse-mschapv2", TQString(_pptpWidget->chk_refusemschapv2->isChecked() ? "yes" : "no"));
+ strlist.insert("require-mppe", TQString(_pptpWidget->chk_requiremppe->isChecked() ? "yes" : "no"));
+ strlist.insert("require-mppe-40", TQString(_pptpWidget->chk_requiremppe40->isChecked() ? "yes" : "no"));
+ strlist.insert("require-mppe-128", TQString(_pptpWidget->chk_requiremppe128->isChecked() ? "yes" : "no"));
+ strlist.insert("mppe-stateful", TQString(_pptpWidget->chk_mppestateful->isChecked() ? "yes" : "no"));
+ strlist.insert("nodeflate", TQString(_pptpWidget->chk_nodeflate->isChecked() ? "yes" : "no"));
+
+ // Current network-manager-pptp plugin supports bluetooth-gprs,dialup and pptp.
+ // We want a pptp connection.
+ //strlist.insert("ppp-connection-type", "pptp");
+
+ return strlist;
+}
+
+TQStringList PPTPConfig::getVPNRoutes()
+{
+ TQStringList strlist;
+ if(_pptpWidget->chkIPAdresses->isChecked())
+ {
+ strlist = TQStringList::split(" ", _pptpWidget->routes->text());
+ }
+ return strlist;
+
+}
+
+bool PPTPConfig::hasChanged()
+{
+ return true;
+}
+
+bool PPTPConfig::isValid(TQStringList& err_msg)
+{
+ bool retval = true;
+ if(_pptpWidget->gateway->text() == "")
+ {
+ err_msg.append(i18n("At least the gateway has to be supplied."));
+ retval = false;
+ }
+ return retval;
+}
+
+PPTPAuthentication::PPTPAuthentication(TQWidget* parent, char* name)
+ : VPNAuthenticationWidget(parent, name)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _pptpAuth = new PPTPAuthenticationWidget(this);
+ tqlayout->addWidget(_pptpAuth);
+}
+
+PPTPAuthentication::~PPTPAuthentication()
+{
+
+}
+
+TQMap<TQString, TQString> PPTPAuthentication::getPasswords()
+{
+ // network-manager-pptp will fail hard if "CHAP" is not the
+ // first element in the username&password list.
+ TQMap<TQString, TQString> pwds;
+ //pwds.insert("CHAP", "CHAP");
+ pwds.insert("user", TQString(_pptpAuth->username->text()));
+ pwds.insert("password", TQString(_pptpAuth->password->password()));
+ pwds.insert("domain", TQString(_pptpAuth->domain->text()));
+ return pwds;
+}
+
+void PPTPAuthentication::setPasswords(TQString name, TQString value) {
+ if (name == TQString("password")) {
+ _pptpAuth->password->erase();
+ _pptpAuth->password->insert(value);
+ }
+} \ No newline at end of file
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h
new file mode 100644
index 0000000..d703743
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnc.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_PPTP_H
+#define KNETWORKMANAGER_PPTP_H
+
+#include <tqmap.h>
+#include <tqstring.h>
+#include <tqwidget.h>
+#include <tqlayout.h>
+
+#include "knetworkmanager-vpnplugin.h"
+#include "pptpprop.h"
+#include "pptpauth.h"
+
+class PPTPPlugin : public VPNPlugin
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ PPTPPlugin(TQObject*, const char*, const TQStringList&);
+ ~PPTPPlugin();
+
+ VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
+ VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
+};
+
+class PPTPConfig : public VPNConfigWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
+ TQMap<TQString, TQString> getVPNProperties();
+ TQStringList getVPNRoutes();
+ bool hasChanged();
+ bool isValid(TQStringList& );
+
+ PPTPConfig(TQWidget* parent);
+ ~PPTPConfig();
+
+ private:
+ PPTPConfigWidget* _pptpWidget;
+
+ protected slots:
+ void languageChange();
+};
+
+class PPTPAuthentication : public VPNAuthenticationWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL);
+ ~PPTPAuthentication();
+ TQMap<TQString, TQString> getPasswords();
+ void setPasswords(TQString name, TQString value);
+
+ private:
+ PPTPAuthenticationWidget* _pptpAuth;
+};
+
+#endif /* KNETWORKMANAGER_PPTP_H */
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui
new file mode 100644
index 0000000..5388561
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui
@@ -0,0 +1,95 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>PPTPAuthenticationWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>PPTPAuthenticationWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>277</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>PPTPAuthentication</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Domain</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>domain</cstring>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="1" column="1">
+ <property name="name">
+ <cstring>password</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>username</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>username</tabstop>
+ <tabstop>password</tabstop>
+ <tabstop>domain</tabstop>
+</tabstops>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui
new file mode 100644
index 0000000..b57e065
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui
@@ -0,0 +1,244 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>PPTPConfigWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>PPTPConfigWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>535</width>
+ <height>303</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>kTabWidget1</cstring>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Required Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Gateway:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>IPSec_gateway</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>gateway</cstring>
+ </property>
+ </widget>
+ <spacer row="11" column="1">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Optional Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQCheckBox" row="11" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkIPAdresses</cstring>
+ </property>
+ <property name="text">
+ <string>Only use VPN Connection for these Adresses
+(for example: 172.16.0.0/16 10.11.12.0/24)</string>
+ </property>
+ </widget>
+ <spacer row="13" column="0">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="12" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>routes</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>220</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>230</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>chk_refuseeap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse EAP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>chk_refusepap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse PAP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>chk_refusechap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse CHAP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>chk_refusemschap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse MSCHAP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>chk_refusemschapv2</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse MSCHAP v2</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="5" column="0">
+ <property name="name">
+ <cstring>chk_requiremppe</cstring>
+ </property>
+ <property name="text">
+ <string>Require MPPE Encryption</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="6" column="0">
+ <property name="name">
+ <cstring>chk_requiremppe40</cstring>
+ </property>
+ <property name="text">
+ <string>Require MPPE 40-bit Encryption</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="7" column="0">
+ <property name="name">
+ <cstring>chk_requiremppe128</cstring>
+ </property>
+ <property name="text">
+ <string>Require MPPE 128-bit Encryption</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="8" column="0">
+ <property name="name">
+ <cstring>chk_mppestateful</cstring>
+ </property>
+ <property name="text">
+ <string>Use MPPE Stateful Encryption</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="9" column="0">
+ <property name="name">
+ <cstring>chk_nodeflate</cstring>
+ </property>
+ <property name="text">
+ <string>No Deflation</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+
+
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/Makefile.am b/knetworkmanager-0.8/vpn-plugins/strongswan/Makefile.am
new file mode 100644
index 0000000..b47b9cb
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = src
+
+service_DATA = knetworkmanager_strongswan.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/authors b/knetworkmanager-0.8/vpn-plugins/strongswan/authors
new file mode 100644
index 0000000..06c50d3
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/authors
@@ -0,0 +1 @@
+Thomas Kallenberg <[email protected]>, <[email protected]>
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/configure.in.in b/knetworkmanager-0.8/vpn-plugins/strongswan/configure.in.in
new file mode 100644
index 0000000..3591671
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/configure.in.in
@@ -0,0 +1,14 @@
+KNETWORKMANAGER_STRONGSWAN_VERSION=0.1
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_STRONGSWAN_VERSION, $KNETWORKMANAGER_STRONGSWAN_VERSION, [KNetworkManager StrongSwan Plugin Version])
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_STRONGSWAN_VERSION_STRING, "$KNETWORKMANAGER_STRONGSWAN_VERSION", [KNetworkManager StrongSwan Plugin Version String])
+
+PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([TQT dbus bindings missing])
+])
+
+STRONGSWAN_CFLAGS="$DBUS_TQT_CFLAGS"
+STRONGSWAN_LIBS="$DBUS_TQT_LIBS"
+
+AC_SUBST(STRONGSWAN_CFLAGS)
+AC_SUBST(STRONGSWAN_LIBS)
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop b/knetworkmanager-0.8/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop
new file mode 100644
index 0000000..1bdc128
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop
@@ -0,0 +1,21 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Icon=
+ServiceTypes=KNetworkManager/VPNPlugin
+X-KDE-Library=knetworkmanager_strongswan
+X-NetworkManager-Services=strongswan
+X-KDE-PluginInfo-Author=Thomas Kallenberg
+X-KDE-PluginInfo-Name=knetworkmanager_strongswan
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=VPNService
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=StrongSwan
+Name[xx]=xxStrongSwanxx
+Comment=StrongSwan
+Comment[xx]=xxStrongSwanxx
+
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/src/Makefile.am b/knetworkmanager-0.8/vpn-plugins/strongswan/src/Makefile.am
new file mode 100644
index 0000000..df5bfbc
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/src/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(PACKAGE_CFLAGS) $(KNETWORKMANAGER_CFLAGS) $(SSWAN_FLAGS) $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = knetworkmanager_strongswan.la
+knetworkmanager_strongswan_la_SOURCES = knetworkmanager-strongswan.cpp \
+ strongswanprop.ui \
+ strongswanauth.ui
+noinst_HEADERS = knetworkmanager-strongswan.h
+knetworkmanager_strongswan_la_LDFLAGS = -module $(all_libraries)
+knetworkmanager_strongswan_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp b/knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp
new file mode 100644
index 0000000..37cee81
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp
@@ -0,0 +1,234 @@
+/***************************************************************************
+ *
+ * knetworkmanager-strongswan.cpp - A NetworkManager frontend for KDE
+ *
+ * Author: Thomas Kallenberg <[email protected]>, <[email protected]>
+ *
+ * Strongly based on the Code of Helmut Schaa <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#include <klocale.h>
+#include <tqmessagebox.h>
+#include <tqbutton.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <tqobjectlist.h>
+#include <tqobject.h>
+#include <tqcheckbox.h>
+#include <kpassdlg.h>
+#include <kgenericfactory.h>
+#include <tqlabel.h>
+
+#include "knetworkmanager-strongswan.h"
+
+typedef KGenericFactory<StrongswanPlugin> StrongswanPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( knetworkmanager_strongswan, StrongswanPluginFactory("knetworkmanager_strongswan"));
+
+
+StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args)
+ : VPNPlugin(parent, name, args)
+{
+ KLocale* loc = KGlobal::locale();
+ loc->insertCatalogue("NetworkManager-strongswan");
+}
+
+StrongswanPlugin::~StrongswanPlugin()
+{
+
+}
+
+VPNConfigWidget* StrongswanPlugin::CreateConfigWidget(TQWidget* parent)
+{
+ return new StrongswanConfig(parent);
+}
+
+VPNAuthenticationWidget* StrongswanPlugin::CreateAuthenticationWidget(TQWidget* parent)
+{
+ return new StrongswanAuthentication(parent);
+}
+
+
+StrongswanConfig::StrongswanConfig(TQWidget* parent)
+ : VPNConfigWidget(parent)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _strongswanWidget = new StrongswanConfigWidget(this);
+ tqlayout->addWidget(_strongswanWidget);
+
+ /* TODO not sure if we need this here */
+ this->languageChange();
+}
+
+StrongswanConfig::~StrongswanConfig()
+{
+
+}
+
+void StrongswanConfig::languageChange()
+{
+
+}
+
+ // usercert agent password userkey
+StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop)
+{
+ if (prop == 0)
+ return psk;
+ else if (prop == 1)
+ return key;
+ else if (prop == 2)
+ return agent;
+ return UNKNOWN;
+}
+
+int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
+{
+ switch(connType)
+ {
+ case psk:
+ return 0;
+ case key:
+ return 1;
+ case agent:
+ return 2;
+ default:
+ return -1;
+ }
+ return -1;
+}
+
+void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
+{
+ // fill up our inputfields (only textfields atm)
+ for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
+ {
+ TQString entry = it.key();
+ TQString value = it.data();
+
+ if (entry == "gateway")
+ {
+ _strongswanWidget->gateway->setText(value);
+ }
+ else if (entry == "certificate")
+ {
+ _strongswanWidget->certificate->setURL(value);
+ }
+ else if (entry == "username")
+ {
+ _strongswanWidget->username->setText(value);
+ }
+ else if (entry == "method")
+ {
+ StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt());
+ _strongswanWidget->authtype->setCurrentItem(type);
+ }
+ // Options
+ else if (entry == "chkUDPenc")
+ {
+ _strongswanWidget->chkUDPenc->setChecked(value == "true");
+ }
+ else if (entry == "chkIPcomp")
+ {
+ _strongswanWidget->chkIPcomp->setChecked(value == "true");
+ }
+ else if (entry == "chkIPinner")
+ {
+ _strongswanWidget->chkIPinner->setChecked(value == "true");
+ }
+ }
+}
+
+TQMap<TQString, TQString> StrongswanConfig::getVPNProperties()
+{
+ // build a StingList of properties
+ TQMap<TQString, TQString> strlist;
+
+ strlist.insert("gateway", TQString(_strongswanWidget->gateway->text()));
+ strlist.insert("certificate", TQString(_strongswanWidget->certificate->url()));
+ strlist.insert("username", TQString(_strongswanWidget->username->text()));
+ strlist.insert("method",
+ TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem())));
+
+ if (_strongswanWidget->chkUDPenc->isChecked())
+ strlist.insert("encap", TQString("yes"));
+
+ if (_strongswanWidget->chkIPcomp->isChecked())
+ strlist.insert("ipcomp", TQString("yes"));
+
+ if (_strongswanWidget->chkIPinner->isChecked())
+ strlist.insert("virtual", TQString("yes"));
+
+ return strlist;
+}
+
+TQStringList StrongswanConfig::getVPNRoutes()
+{
+ TQStringList strlist;
+ /*if(_strongswanWidget->chkIPAdresses->isChecked())
+ {
+ strlist = TQStringList::split(" ", _strongswanWidget->routes->text());
+ }
+ */
+ return strlist;
+
+}
+
+bool StrongswanConfig::hasChanged()
+{
+ return true;
+}
+
+bool StrongswanConfig::isValid(TQStringList& err_msg)
+{
+ bool retval = true;
+ if(_strongswanWidget->gateway->text() == "" || _strongswanWidget->username->text() == "")
+ {
+ err_msg.append(i18n("At least the gateway and group has to be supplied."));
+ retval = false;
+ }
+ return retval;
+}
+
+StrongswanAuthentication::StrongswanAuthentication(TQWidget* parent, char* name)
+ : VPNAuthenticationWidget(parent, name)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _strongswanAuth = new StrongswanAuthenticationWidget(this);
+ tqlayout->addWidget(_strongswanAuth);
+}
+
+StrongswanAuthentication::~StrongswanAuthentication()
+{
+
+}
+
+TQMap<TQString, TQString> StrongswanAuthentication::getPasswords()
+{
+ TQMap<TQString, TQString> pwds;
+ pwds.insert("user", TQString(_strongswanAuth->username->text()));
+ pwds.insert("password", TQString(_strongswanAuth->password->password()));
+ return pwds;
+}
+
+void StrongswanAuthentication::setPasswords(TQString name, TQString value) {
+ if (name == TQString("password")) {
+ _strongswanAuth->password->erase();
+ _strongswanAuth->password->insert(value);
+ }
+} \ No newline at end of file
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h b/knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h
new file mode 100644
index 0000000..74f82a5
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h
@@ -0,0 +1,99 @@
+/***************************************************************************
+ *
+ * knetworkmanager-strongswan.h - A NetworkManager frontend for KDE
+ *
+ * Author: Thomas Kallenberg <[email protected]>, <[email protected]>
+ *
+ * Strongly based on the Code of Helmut Schaa <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_STRONGSWAN_H
+#define KNETWORKMANAGER_STRONGSWAN_H
+
+#include <tqmap.h>
+#include <tqstring.h>
+#include <tqwidget.h>
+#include <tqlayout.h>
+
+#include "knetworkmanager-vpnplugin.h"
+#include "strongswanprop.h"
+#include "strongswanauth.h"
+
+class StrongswanPlugin : public VPNPlugin
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ StrongswanPlugin(TQObject*, const char*, const TQStringList&);
+ ~StrongswanPlugin();
+
+ VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
+ VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
+};
+
+class StrongswanConnectionType
+{
+ public:
+ enum CONNECTIONTYPE
+ {
+ UNKNOWN = -1
+ , psk = 0
+ , key
+ , agent
+ };
+
+ static CONNECTIONTYPE mapString2ConnectionType(int string);
+ static int mapConnectionType2String(CONNECTIONTYPE connectionType);
+};
+
+class StrongswanConfig : public VPNConfigWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
+ TQMap<TQString, TQString> getVPNProperties();
+ TQStringList getVPNRoutes();
+ bool hasChanged();
+ bool isValid(TQStringList& );
+
+ StrongswanConfig(TQWidget* parent);
+ ~StrongswanConfig();
+
+ private:
+ StrongswanConfigWidget* _strongswanWidget;
+
+ protected slots:
+ void languageChange();
+};
+
+class StrongswanAuthentication : public VPNAuthenticationWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL);
+ ~StrongswanAuthentication();
+ TQMap<TQString, TQString> getPasswords();
+ void setPasswords(TQString name, TQString value);
+
+ private:
+ StrongswanAuthenticationWidget* _strongswanAuth;
+};
+
+#endif /* KNETWORKMANAGER_STRONGSWAN_H */
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanauth.ui b/knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanauth.ui
new file mode 100644
index 0000000..332d3c8
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanauth.ui
@@ -0,0 +1,88 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>StrongswanAuthenticationWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>StrongswanAuthenticationWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>372</width>
+ <height>171</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>StrongswanAuthentication</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>100</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="1" column="1">
+ <property name="name">
+ <cstring>password</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>username</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>130</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanprop.ui b/knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanprop.ui
new file mode 100644
index 0000000..d55c066
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/strongswan/src/strongswanprop.ui
@@ -0,0 +1,236 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>StrongswanConfigWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>StrongswanConfigWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>442</width>
+ <height>260</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>StrongswanConfigWidget</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Required Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;font size="+1"&gt;&lt;b&gt;Gateway&lt;/b&gt;&lt;/font&gt;</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;font size="+1"&gt;&lt;b&gt;Authentication&lt;/b&gt;&lt;/font&gt;</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Method</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Address</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Certificate</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="6" column="1">
+ <item>
+ <property name="text">
+ <string>Key</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>PSK</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Agent</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>authtype</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>username</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>gateway</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>certificate</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer row="7" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Optional Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>chkUDPenc</cstring>
+ </property>
+ <property name="text">
+ <string>Enforce UDP encapsulation</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>chkIPcomp</cstring>
+ </property>
+ <property name="text">
+ <string>Use IP compression</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>chkIPinner</cstring>
+ </property>
+ <property name="text">
+ <string>Request inner IP</string>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>231</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/AUTHORS b/knetworkmanager-0.8/vpn-plugins/vpnc/AUTHORS
new file mode 100644
index 0000000..e0ecfce
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/AUTHORS
@@ -0,0 +1,2 @@
+Thomas Kallenberg <[email protected]> <[email protected]>
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/Makefile.am b/knetworkmanager-0.8/vpn-plugins/vpnc/Makefile.am
new file mode 100644
index 0000000..008e246
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = src
+
+service_DATA = knetworkmanager_vpnc.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/configure.in.in b/knetworkmanager-0.8/vpn-plugins/vpnc/configure.in.in
new file mode 100644
index 0000000..7deec5d
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/configure.in.in
@@ -0,0 +1,14 @@
+KNETWORKMANAGER_VPNC_VERSION=0.1
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_VPNC_VERSION, $KNETWORKMANAGER_VPNC_VERSION, [KNetworkManager VPNC Plugin Version])
+AC_DEFINE_UNQUOTED(KNETWORKMANAGER_VPNC_VERSION_STRING, "$KNETWORKMANAGER_VPNC_VERSION", [KNetworkManager VPNC Plugin Version String])
+
+PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([TQT dbus bindings missing])
+])
+
+VPNC_CFLAGS="$DBUS_TQT_CFLAGS"
+VPNC_LIBS="$DBUS_TQT_LIBS"
+
+AC_SUBST(VPNC_CFLAGS)
+AC_SUBST(VPNC_LIBS)
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop b/knetworkmanager-0.8/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop
new file mode 100644
index 0000000..6b9ce96
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop
@@ -0,0 +1,23 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Icon=
+ServiceTypes=KNetworkManager/VPNPlugin
+X-KDE-Library=knetworkmanager_vpnc
+X-NetworkManager-Services=vpnc
+X-KDE-PluginInfo-Author=Helmut Schaa
+X-KDE-PluginInfo-Name=knetworkmanager_vpnc
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=VPNService
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=VPNC
+Name[bn]=ভিপিএনসি
+Name[xx]=xxVPNCxx
+Comment=VPNC
+Comment[bn]=ভিপিএনসি
+Comment[xx]=xxVPNCxx
+
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/src/Makefile.am b/knetworkmanager-0.8/vpn-plugins/vpnc/src/Makefile.am
new file mode 100644
index 0000000..331b9f6
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/src/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(VPNC_CFLAGS) $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = knetworkmanager_vpnc.la
+knetworkmanager_vpnc_la_SOURCES = knetworkmanager-vpnc.cpp \
+ vpncprop.ui \
+ vpncauth.ui
+noinst_HEADERS = knetworkmanager-vpnc.h
+knetworkmanager_vpnc_la_LDFLAGS = -module $(all_libraries)
+knetworkmanager_vpnc_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp b/knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp
new file mode 100644
index 0000000..526d5d5
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp
@@ -0,0 +1,402 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnc.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <tqmessagebox.h>
+#include <tqbutton.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <tqobjectlist.h>
+#include <tqobject.h>
+#include <tqcheckbox.h>
+#include <kpassdlg.h>
+#include <kgenericfactory.h>
+#include <tqlabel.h>
+#include <string>
+#include <stdio.h>
+
+#include "knetworkmanager-vpnc.h"
+using namespace std;
+
+typedef KGenericFactory<VPNCPlugin> VPNCPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc"));
+
+#define NAT_MODE_CISCO 0
+#define NAT_MODE_NATT 1
+#define NAT_MODE_DISABLED 2
+
+char linedata [2048];
+
+VPNCPlugin::VPNCPlugin(TQObject* parent, const char* name, const TQStringList& args)
+ : VPNPlugin(parent, name, args)
+{
+ KLocale* loc = KGlobal::locale();
+ loc->insertCatalogue("NetworkManager-vpnc");
+}
+
+VPNCPlugin::~VPNCPlugin()
+{
+
+}
+
+VPNConfigWidget* VPNCPlugin::CreateConfigWidget(TQWidget* parent)
+{
+ return new VPNCConfig(parent);
+}
+
+VPNAuthenticationWidget* VPNCPlugin::CreateAuthenticationWidget(TQWidget* parent)
+{
+ return new VPNCAuthentication(parent);
+}
+
+
+VPNCConfig::VPNCConfig(TQWidget* parent)
+ : VPNConfigWidget(parent)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _vpncWidget = new VPNCConfigWidget(this);
+ tqlayout->addWidget(_vpncWidget);
+
+ connect(_vpncWidget->pcfImport, TQT_SIGNAL(clicked()), this, TQT_SLOT( pcfImport()) );
+
+ //connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->Xauth_username, TQT_SLOT(setEnabled(bool)));
+ //connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblUsername, TQT_SLOT(setEnabled(bool)));
+
+ connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->Domain, TQT_SLOT(setEnabled(bool)));
+ connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblDomain, TQT_SLOT(setEnabled(bool)));
+
+ connect(_vpncWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _vpncWidget->routes, TQT_SLOT(setEnabled(bool)));
+
+ connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->nat_keep_alive_interval, TQT_SLOT(setEnabled(bool)));
+ connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblKeepAliveInterval, TQT_SLOT(setEnabled(bool)));
+
+ _vpncWidget->cboNAT->insertItem(i18n("Cisco UDP (default)"), NAT_MODE_CISCO);
+ _vpncWidget->cboNAT->insertItem(i18n("NAT-T"), NAT_MODE_NATT);
+ _vpncWidget->cboNAT->insertItem(i18n("Disabled"), NAT_MODE_DISABLED);
+
+ this->languageChange();
+}
+
+VPNCConfig::~VPNCConfig()
+{
+
+}
+
+void VPNCConfig::languageChange()
+{
+
+}
+
+int VPNCConfig::getFileConfig(char *parameter, char *line) {
+ int i;
+
+ if (strstr(line, parameter) != NULL) {
+ if ((strstr(line, parameter) - line) == 0) {
+ for (i=0; i<(strlen(line)-strlen(parameter));i++) {
+ linedata[i] = line[i+strlen(parameter)];
+ if ((linedata[i] == 10) || (linedata[i] == 13)) {
+ linedata[i] = 0;
+ }
+ }
+ linedata[i-1]=0;
+
+ return 0;
+ }
+ else {
+ return 1;
+ }
+ }
+ else {
+ return 1;
+ }
+}
+
+void VPNCConfig::pcfImport()
+{
+ const TQString& pcf_file = TQString(_vpncWidget->editPCF->url());
+ printf("Asked for PCF import from file %s\n\r", pcf_file.ascii());
+ int i;
+
+ FILE *file = fopen ( pcf_file.ascii(), "r" );
+ if ( file != NULL ) {
+ char line [2048]; // or other suitable maximum line size
+ // read a line
+ while ( fgets ( line, sizeof line, file ) != NULL ) {
+ // Parse the line and update global variables (current line in variable "line")
+ if (getFileConfig("Host=", line) == 0) {
+ //strdup(linedata)
+ printf("Got configuration parameter Host with data %s\n\r", linedata);
+ _vpncWidget->IPSec_gateway->setText(linedata);
+ }
+ if (getFileConfig("GroupName=", line) == 0) {
+ printf("Got configuration parameter GroupName with data %s\n\r", linedata);
+ _vpncWidget->IPSec_ID->setText(linedata);
+ }
+// if (getFileConfig("TcpTunnelingPort=", line) == 0) {
+// printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata);
+// _vpncWidget->IPSec_ID->setText(linedata);
+// }
+ if (getFileConfig("NTDomain=", line) == 0) {
+ if (strlen(linedata) > 0) {
+ printf("Got configuration parameter NTDomain with data %s\n\r", linedata);
+ _vpncWidget->Domain->setText(linedata);
+ _vpncWidget->chkUseDomain->setChecked(true);
+ }
+ }
+ if (getFileConfig("GroupPwd=", line) == 0) {
+ if (strlen(linedata) > 0) {
+ printf("Got configuration parameter GroupPwd with data %s\n\r", linedata);
+ KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").tqarg(linedata));
+ }
+ }
+ if (getFileConfig("enc_GroupPwd=", line) == 0) {
+ if (strlen(linedata) > 0) {
+ printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata);
+
+ // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
+ string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
+ FILE *pipe_decrypt;
+ char decrypted_result[2048];
+ int i;
+
+ decryptcommand.append(linedata);
+ printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
+ if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
+ {
+ printf("Group password decrypt error\n\r");
+ }
+ else {
+ fgets(decrypted_result, 2048, pipe_decrypt);
+ pclose(pipe_decrypt);
+ for (i=0;i<2048;i++) {
+ if (decrypted_result[i] == 0) {
+ decrypted_result[i-1]=0;
+ i=2048;
+ }
+ }
+ printf("Group password decrypt result: '%s'\n\r", decrypted_result);
+ }
+ KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").tqarg(decrypted_result));
+ }
+ }
+ }
+ fclose ( file );
+ }
+ else
+ {
+ //printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii());
+ KMessageBox::error(this, i18n("That configuration file does not exist!"));
+ }
+}
+
+void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
+{
+ // fill up our inputfields (only textfields atm)
+ for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
+ {
+ TQString entry = it.key();
+ TQString value = it.data();
+
+ if (entry == "IPSec gateway")
+ {
+ _vpncWidget->IPSec_gateway->setText(value);
+ }
+ else if (entry == "IPSec ID")
+ {
+ _vpncWidget->IPSec_ID->setText(value);
+ }
+ else if (entry == "Xauth username")
+ {
+ _vpncWidget->Xauth_username->setText(value);
+ //_vpncWidget->chkOverrideUsername->setChecked(true);
+ }
+ else if (entry == "Domain")
+ {
+ _vpncWidget->Domain->setText(value);
+ _vpncWidget->chkUseDomain->setChecked(true);
+ }
+ else if (entry == "NAT-Keepalive packet interval")
+ {
+ _vpncWidget->nat_keep_alive_interval->setText(value);
+ _vpncWidget->chkUseKeepAlive->setChecked(true);
+ }
+ // backwards compatibility
+ else if (entry == "Disable NAT Traversal")
+ {
+ _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
+ }
+ else if (entry == "NAT Traversal Mode")
+ {
+ if (value == "natt")
+ _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_NATT);
+ else if (value == "cisco-udp")
+ _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_CISCO);
+ else if (value == "none")
+ _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
+ else
+ {
+ // FIXME: unknown NAT mode
+ }
+ }
+ else if (entry == "Enable Single DES")
+ {
+ _vpncWidget->chkSingleDES->setChecked(value == "yes" || value == "true");
+ }
+ }
+
+ // set routes
+ if (!routes.empty())
+ {
+ _vpncWidget->chkIPAdresses->setChecked(true);
+ _vpncWidget->routes->setText(routes.join(" "));
+ }
+}
+
+TQMap<TQString, TQString> VPNCConfig::getVPNProperties()
+{
+ // build a StingList of properties
+ TQMap<TQString, TQString> strlist;
+ strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text()));
+ strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text()));
+
+ //if (_vpncWidget->chkOverrideUsername->isChecked())
+ strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text()));
+
+ if (_vpncWidget->chkUseDomain->isChecked())
+ strlist.insert("Domain", TQString(_vpncWidget->Domain->text()));
+
+ if (_vpncWidget->chkUseKeepAlive->isChecked())
+ strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text()));
+
+ switch (_vpncWidget->cboNAT->currentItem())
+ {
+ case NAT_MODE_CISCO:
+ strlist.insert("NAT Traversal Mode", "cisco-udp");
+ break;
+ case NAT_MODE_NATT:
+ strlist.insert("NAT Traversal Mode", "natt");
+ break;
+ case NAT_MODE_DISABLED:
+ default:
+ strlist.insert("NAT Traversal Mode", "none");
+ break;
+ }
+
+ if (_vpncWidget->chkSingleDES->isChecked())
+ strlist.insert("Enable Single DES", "yes");
+ else
+ strlist.insert("Enable Single DES", "no");
+
+ return strlist;
+}
+
+TQStringList VPNCConfig::getVPNRoutes()
+{
+ TQStringList strlist;
+ if(_vpncWidget->chkIPAdresses->isChecked())
+ {
+ strlist = TQStringList::split(" ", _vpncWidget->routes->text());
+ }
+ return strlist;
+
+}
+
+bool VPNCConfig::hasChanged()
+{
+ return true;
+}
+
+bool VPNCConfig::isValid(TQStringList& err_msg)
+{
+ bool retval = true;
+ if(_vpncWidget->IPSec_gateway->text() == "" || _vpncWidget->IPSec_ID->text() == "")
+ {
+ err_msg.append(i18n("At least the gateway and group has to be supplied."));
+ retval = false;
+ }
+ return retval;
+}
+
+VPNCAuthentication::VPNCAuthentication(TQWidget* parent, char* name)
+ : VPNAuthenticationWidget(parent, name)
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _vpncAuth = new VPNCAuthenticationWidget(this);
+ tqlayout->addWidget(_vpncAuth);
+}
+
+VPNCAuthentication::~VPNCAuthentication()
+{
+
+}
+
+TQMap<TQString, TQString> VPNCAuthentication::getPasswords()
+{
+ TQMap<TQString, TQString> pwds;
+ pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password()));
+ if (_vpncAuth->chkObfusticated->isChecked()) {
+ // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
+ string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
+ FILE *pipe_decrypt;
+ char decrypted_result[2048];
+ int i;
+
+ decryptcommand.append(_vpncAuth->editGroupPassword->password());
+ printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
+ if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
+ {
+ printf("Group password decrypt error\n\r");
+ }
+ else {
+ fgets(decrypted_result, 2048, pipe_decrypt);
+ pclose(pipe_decrypt);
+ for (i=0;i<2048;i++) {
+ if (decrypted_result[i] == 0) {
+ decrypted_result[i-1]=0;
+ i=2048;
+ }
+ }
+ printf("Group password decrypt result: '%s'\n\r", decrypted_result);
+ pwds.insert("IPSec secret", TQString(decrypted_result));
+ }
+ }
+ else {
+ pwds.insert("IPSec secret", TQString(_vpncAuth->editGroupPassword->password()));
+ }
+ return pwds;
+}
+
+void VPNCAuthentication::setPasswords(TQString name, TQString value) {
+ if (name == TQString("Xauth password")) {
+ _vpncAuth->editUserPassword->erase();
+ _vpncAuth->editUserPassword->insert(value);
+ }
+ else if (name == TQString("IPSec secret")) {
+ _vpncAuth->editGroupPassword->erase();
+ _vpncAuth->editGroupPassword->insert(value);
+ }
+} \ No newline at end of file
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h b/knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h
new file mode 100644
index 0000000..429bc55
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnc.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * 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
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNC_H
+#define KNETWORKMANAGER_VPNC_H
+
+#include <tqmap.h>
+#include <tqstring.h>
+#include <tqwidget.h>
+#include <tqlayout.h>
+
+#include "knetworkmanager-vpnplugin.h"
+#include "vpncprop.h"
+#include "vpncauth.h"
+
+class VPNCPlugin : public VPNPlugin
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNCPlugin(TQObject*, const char*, const TQStringList&);
+ ~VPNCPlugin();
+
+ VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
+ VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
+};
+
+class VPNCConfig : public VPNConfigWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
+ TQMap<TQString, TQString> getVPNProperties();
+ TQStringList getVPNRoutes();
+ bool hasChanged();
+ bool isValid(TQStringList& );
+
+ VPNCConfig(TQWidget* parent);
+ ~VPNCConfig();
+
+ public slots:
+ void pcfImport();
+
+ private:
+ VPNCConfigWidget* _vpncWidget;
+ int getFileConfig(char *parameter, char *line);
+
+ protected slots:
+ void languageChange();
+};
+
+class VPNCAuthentication : public VPNAuthenticationWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL);
+ ~VPNCAuthentication();
+ TQMap<TQString, TQString> getPasswords();
+ void setPasswords(TQString name, TQString value);
+
+ private:
+ VPNCAuthenticationWidget* _vpncAuth;
+};
+
+#endif /* KNETWORKMANAGER_VPNC_H */
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncauth.ui b/knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncauth.ui
new file mode 100644
index 0000000..4fdf2f1
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncauth.ui
@@ -0,0 +1,68 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>VPNCAuthenticationWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>VPNCAuthenticationWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>372</width>
+ <height>75</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>VPNCAuthentication</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Group Password</string>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="0" column="1">
+ <property name="name">
+ <cstring>editUserPassword</cstring>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="1" column="1">
+ <property name="name">
+ <cstring>editGroupPassword</cstring>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkObfusticated</cstring>
+ </property>
+ <property name="text">
+ <string>Group password is hashed</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncprop.ui b/knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncprop.ui
new file mode 100644
index 0000000..ab2b8fc
--- /dev/null
+++ b/knetworkmanager-0.8/vpn-plugins/vpnc/src/vpncprop.ui
@@ -0,0 +1,279 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>VPNCConfigWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>VPNCConfigWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>667</width>
+ <height>435</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>VPNCConfigWidget</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>kTabWidget1</cstring>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Required Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Gateway</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>IPSec_gateway</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>IPSec_gateway</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>labelGroup</cstring>
+ </property>
+ <property name="text">
+ <string>Group Name</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>IPSec_ID</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>IPSec_ID</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblUsername</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>User Name</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>Xauth_username</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQGroupBox" row="5" column="0" colspan="2">
+ <property name="name">
+ <cstring>groupBox5_3</cstring>
+ </property>
+ <property name="title">
+ <string>Import settings from Cisco PCF file</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>editPCF</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>PCF File</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="0" colspan="2">
+ <property name="name">
+ <cstring>pcfImport</cstring>
+ </property>
+ <property name="text">
+ <string>Import</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="6" column="1">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Optional Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkUseKeepAlive</cstring>
+ </property>
+ <property name="text">
+ <string>Use NAT keep alive packets</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkUseDomain</cstring>
+ </property>
+ <property name="text">
+ <string>Use domain for authentication</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>lblDomain</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Domain</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="5" column="0">
+ <property name="name">
+ <cstring>lblKeepAliveInterval</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Interval</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>nat_keep_alive_interval</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>Domain</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>NAT traversal</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="6" column="1">
+ <property name="name">
+ <cstring>cboNAT</cstring>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkSingleDES</cstring>
+ </property>
+ <property name="text">
+ <string>Enable weak single DES encryption</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="8" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkIPAdresses</cstring>
+ </property>
+ <property name="text">
+ <string>Only use VPN Connection for these Adresses (for example: 172.16.0.0/16 10.11.12.0/24)</string>
+ </property>
+ </widget>
+ <spacer row="10" column="1">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="9" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>routes</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+</includehints>
+</UI>