From 3c57e87e071472d32b70090f8a11a9df08c1c461 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 16:03:14 -0500 Subject: Reactivate PPTP plugin --- tdenetworkmanager/vpn-plugins/CMakeLists.txt | 2 +- tdenetworkmanager/vpn-plugins/pptp/AUTHORS | 1 + tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt | 14 ++ .../vpn-plugins/pptp/knetworkmanager_pptp.desktop | 23 -- .../vpn-plugins/pptp/src/CMakeLists.txt | 43 ++++ .../vpn-plugins/pptp/src/knetworkmanager-pptp.cpp | 231 ------------------- .../vpn-plugins/pptp/src/knetworkmanager-pptp.h | 84 ------- .../vpn-plugins/pptp/src/tdenetman-pptp.cpp | 254 +++++++++++++++++++++ .../vpn-plugins/pptp/src/tdenetman-pptp.h | 88 +++++++ .../vpn-plugins/pptp/tdenetman_pptp.desktop | 23 ++ .../vpn-plugins/vpnc/src/tdenetman-vpnc.cpp | 3 +- .../vpn-plugins/vpnc/src/tdenetman-vpnc.h | 2 +- 12 files changed, 426 insertions(+), 342 deletions(-) create mode 100644 tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop create mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp delete mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h create mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp create mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h create mode 100644 tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt index aa31dbf..6e10d60 100644 --- a/tdenetworkmanager/vpn-plugins/CMakeLists.txt +++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt @@ -10,6 +10,6 @@ ################################################# # add_subdirectory( openvpn ) -# add_subdirectory( pptp ) +add_subdirectory( pptp ) # add_subdirectory( strongswan ) add_subdirectory( vpnc ) diff --git a/tdenetworkmanager/vpn-plugins/pptp/AUTHORS b/tdenetworkmanager/vpn-plugins/pptp/AUTHORS index 17bdf96..93dbeb8 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/AUTHORS +++ b/tdenetworkmanager/vpn-plugins/pptp/AUTHORS @@ -1 +1,2 @@ +Timothy Pearson Helmut Schaa , diff --git a/tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt new file mode 100644 index 0000000..323bc89 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( src ) + +install( FILES tdenetman_pptp.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop b/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop deleted file mode 100644 index bbc0b4b..0000000 --- a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop +++ /dev/null @@ -1,23 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Icon= -ServiceTypes=TDENetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_pptp -X-NetworkManager-Services=pptp -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Email=hschaa@suse.de -X-TDE-PluginInfo-Name=knetworkmanager_pptp -X-TDE-PluginInfo-Version=0.1 -X-TDE-PluginInfo-Website= -X-TDE-PluginInfo-Category=VPNService -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=GPL -X-TDE-PluginInfo-EnabledByDefault=false -Name=PPTP -Name[bn]=পিপিটিপি -Name[xx]=xxPPTPxx -Comment=PPTP -Comment[bn]=পিপিটিপি -Comment[xx]=xxPPTPxx - diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt new file mode 100644 index 0000000..fa1c6e0 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( -UQT_NO_ASCII_CAST ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} + ${NM_UTIL_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### tdenetman_pptp (module) ################### + +set( target tdenetman_pptp ) + +set( ${target}_SRCS + tdenetman-pptp.cpp + pptpprop.ui + pptpauth.ui +) + +tde_add_kpart( ${target} AUTOMOC + SOURCES ${${target}_SRCS} + LINK tdeinit_kded-shared tdeinit_tdenetworkmanager-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp deleted file mode 100644 index e8180d1..0000000 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-pptp.cpp - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-pptp.h" - -typedef KGenericFactory 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* layout = new TQVBoxLayout(this, 1, 1); - _pptpWidget = new PPTPConfigWidget(this); - layout->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& properties) -{ - // fill up our inputfields (only textfields atm) - for(TQMap::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 PPTPConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap 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* layout = new TQVBoxLayout(this, 1, 1); - _pptpAuth = new PPTPAuthenticationWidget(this); - layout->addWidget(_pptpAuth); -} - -PPTPAuthentication::~PPTPAuthentication() -{ - -} - -TQMap PPTPAuthentication::getPasswords() -{ - // network-manager-pptp will fail hard if "CHAP" is not the - // first element in the username&password list. - TQMap 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/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h deleted file mode 100644 index c286e16..0000000 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include - -#include "knetworkmanager-vpnplugin.h" -#include "pptpprop.h" -#include "pptpauth.h" - -class PPTPPlugin : public VPNPlugin -{ - Q_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 - - public: - void setVPNData(const TQStringList& routes, const TQMap& properties); - TQMap 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 - - public: - PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL); - ~PPTPAuthentication(); - TQMap getPasswords(); - void setPasswords(TQString name, TQString value); - - private: - PPTPAuthenticationWidget* _pptpAuth; -}; - -#endif /* KNETWORKMANAGER_PPTP_H */ diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp new file mode 100644 index 0000000..3475dd5 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp @@ -0,0 +1,254 @@ +/*************************************************************************** + * + * knetworkmanager-pptp.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-pptp.h" + +typedef KGenericFactory PPTPPluginFactory; +K_EXPORT_COMPONENT_FACTORY(tdenetman_pptp, PPTPPluginFactory("tdenetman_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* layout = new TQVBoxLayout(this, 1, 1); + _pptpWidget = new PPTPConfigWidget(this); + layout->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(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { + m_vpnProperties = properties; + m_vpnSecrets = secrets; + + // fill up our inputfields (only textfields atm) + for(TQMap::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); + TQStringList routesText; + for (TDENetworkSingleRouteConfigurationList::Iterator it = routes.begin(); it != routes.end(); ++it) { + routesText.append(TQString("%1/%2").arg((*it).ipAddress.toString()).arg((*it).networkMask.toCIDRMask())); + } + _pptpWidget->routes->setText(routesText.join(" ")); + } +} + +TDENetworkSettingsMap PPTPConfig::getVPNProperties() { + // Build a list of properties + m_vpnProperties.insert("gateway", TQString(_pptpWidget->gateway->text())); + m_vpnProperties.insert("refuse-eap", TQString(_pptpWidget->chk_refuseeap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-pap", TQString(_pptpWidget->chk_refusepap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-chap", TQString(_pptpWidget->chk_refusechap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-mschap", TQString(_pptpWidget->chk_refusemschap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-mschapv2", TQString(_pptpWidget->chk_refusemschapv2->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("require-mppe", TQString(_pptpWidget->chk_requiremppe->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("require-mppe-40", TQString(_pptpWidget->chk_requiremppe40->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("require-mppe-128", TQString(_pptpWidget->chk_requiremppe128->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("mppe-stateful", TQString(_pptpWidget->chk_mppestateful->isChecked() ? "yes" : "no")); + m_vpnProperties.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. + //m_vpnProperties.insert("ppp-connection-type", "pptp"); + + return m_vpnProperties; +} + +TDENetworkSettingsMap PPTPConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME + + return m_vpnSecrets; +} + +TDENetworkSingleRouteConfigurationList PPTPConfig::getVPNRoutes() +{ + TDENetworkSingleRouteConfigurationList ret; + TQStringList strlist; + if(_pptpWidget->chkIPAdresses->isChecked()) { + strlist = TQStringList::split(" ", _pptpWidget->routes->text()); + } + + for (TQStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it) { + TQStringList pieces = TQStringList::split("/", (*it)); + TDENetworkSingleRouteConfiguration routeconfig; + routeconfig.ipAddress.setAddress(pieces[0]); + if (pieces.count() > 1) { + routeconfig.networkMask.fromCIDRMask(pieces[1].toUInt()); + } + ret.append(routeconfig); + } + + return ret; +} + +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* layout = new TQVBoxLayout(this, 1, 1); + _pptpAuth = new PPTPAuthenticationWidget(this); + layout->addWidget(_pptpAuth); +} + +PPTPAuthentication::~PPTPAuthentication() +{ + +} + +TDENetworkSettingsMap PPTPAuthentication::getPasswords() +{ + // network-manager-pptp will fail hard if "CHAP" is not the + // first element in the username&password list. + TDENetworkSettingsMap 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(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { + _pptpAuth->password->erase(); + _pptpAuth->password->insert(secrets["password"]); + } +} + +#include "tdenetman-pptp.moc" \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h new file mode 100644 index 0000000..6f80300 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h @@ -0,0 +1,88 @@ +/*************************************************************************** + * + * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include + +#include "tdenetman-vpnplugin.h" +#include "pptpprop.h" +#include "pptpauth.h" + +class PPTPPlugin : public VPNPlugin +{ + Q_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 + + public: + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList& ); + + PPTPConfig(TQWidget* parent); + ~PPTPConfig(); + + private: + PPTPConfigWidget* _pptpWidget; + + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + + protected slots: + void languageChange(); +}; + +class PPTPAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + + public: + PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~PPTPAuthentication(); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); + + private: + PPTPAuthenticationWidget* _pptpAuth; +}; + +#endif /* KNETWORKMANAGER_PPTP_H */ diff --git a/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop b/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop new file mode 100644 index 0000000..d5d626c --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop @@ -0,0 +1,23 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Icon= +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_pptp +X-NetworkManager-Services=pptp +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net +X-TDE-PluginInfo-Name=tdenetman_pptp +X-TDE-PluginInfo-Version=0.1 +X-TDE-PluginInfo-Website= +X-TDE-PluginInfo-Category=VPNService +X-TDE-PluginInfo-Depends= +X-TDE-PluginInfo-License=GPL +X-TDE-PluginInfo-EnabledByDefault=false +Name=PPTP +Name[bn]=পিপিটিপি +Name[xx]=xxPPTPxx +Comment=PPTP +Comment[bn]=পিপিটিপি +Comment[xx]=xxPPTPxx + diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp index d060a55..272e05f 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp @@ -44,7 +44,7 @@ using namespace std; typedef KGenericFactory VPNCPluginFactory; -K_EXPORT_COMPONENT_FACTORY( tdenetman_vpnc, VPNCPluginFactory("tdenetman_vpnc")); +K_EXPORT_COMPONENT_FACTORY(tdenetman_vpnc, VPNCPluginFactory("tdenetman_vpnc")); #define NAT_MODE_CISCO 0 #define NAT_MODE_NATT 1 @@ -356,7 +356,6 @@ TDENetworkSingleRouteConfigurationList VPNCConfig::getVPNRoutes() } return ret; - } bool VPNCConfig::hasChanged() diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h index 9d5e6e1..9999140 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h @@ -52,7 +52,7 @@ class VPNCConfig : public VPNConfigWidget Q_OBJECT public: - void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); TDENetworkSettingsMap getVPNProperties(); TDENetworkSettingsMap getVPNSecrets(); TDENetworkSingleRouteConfigurationList getVPNRoutes(); -- cgit v1.2.1