Reactivate PPTP plugin

pull/1/head
Timothy Pearson 12 years ago
parent 0fa003ad69
commit 3c57e87e07

@ -10,6 +10,6 @@
#################################################
# add_subdirectory( openvpn )
# add_subdirectory( pptp )
add_subdirectory( pptp )
# add_subdirectory( strongswan )
add_subdirectory( vpnc )

@ -1 +1,2 @@
Timothy Pearson <kb9vqf@pearsoncomputing.net>
Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>

@ -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} )

@ -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}
)

@ -35,10 +35,10 @@
#include <kgenericfactory.h>
#include <tqlabel.h>
#include "knetworkmanager-pptp.h"
#include "tdenetman-pptp.h"
typedef KGenericFactory<PPTPPlugin> PPTPPluginFactory;
K_EXPORT_COMPONENT_FACTORY( knetworkmanager_pptp, PPTPPluginFactory("knetworkmanager_pptp"));
K_EXPORT_COMPONENT_FACTORY(tdenetman_pptp, PPTPPluginFactory("tdenetman_pptp"));
PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args)
@ -86,8 +86,10 @@ void PPTPConfig::languageChange()
}
void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
{
void PPTPConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) {
m_vpnProperties = properties;
m_vpnSecrets = secrets;
// fill up our inputfields (only textfields atm)
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
@ -144,42 +146,61 @@ void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQ
if (!routes.empty())
{
_pptpWidget->chkIPAdresses->setChecked(true);
_pptpWidget->routes->setText(routes.join(" "));
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(" "));
}
}
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"));
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.
//strlist.insert("ppp-connection-type", "pptp");
//m_vpnProperties.insert("ppp-connection-type", "pptp");
return m_vpnProperties;
}
return strlist;
TDENetworkSettingsMap PPTPConfig::getVPNSecrets() {
// Build a list of secrets
// FIXME
return m_vpnSecrets;
}
TQStringList PPTPConfig::getVPNRoutes()
TDENetworkSingleRouteConfigurationList PPTPConfig::getVPNRoutes()
{
TDENetworkSingleRouteConfigurationList ret;
TQStringList strlist;
if(_pptpWidget->chkIPAdresses->isChecked())
{
if(_pptpWidget->chkIPAdresses->isChecked()) {
strlist = TQStringList::split(" ", _pptpWidget->routes->text());
}
return strlist;
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()
@ -211,11 +232,11 @@ PPTPAuthentication::~PPTPAuthentication()
}
TQMap<TQString, TQString> PPTPAuthentication::getPasswords()
TDENetworkSettingsMap PPTPAuthentication::getPasswords()
{
// network-manager-pptp will fail hard if "CHAP" is not the
// first element in the username&password list.
TQMap<TQString, TQString> pwds;
TDENetworkSettingsMap pwds;
//pwds.insert("CHAP", "CHAP");
pwds.insert("user", TQString(_pptpAuth->username->text()));
pwds.insert("password", TQString(_pptpAuth->password->password()));
@ -223,9 +244,11 @@ TQMap<TQString, TQString> PPTPAuthentication::getPasswords()
return pwds;
}
void PPTPAuthentication::setPasswords(TQString name, TQString value) {
if (name == TQString("password")) {
void PPTPAuthentication::setPasswords(TDENetworkSettingsMap secrets) {
if (secrets.contains("password")) {
_pptpAuth->password->erase();
_pptpAuth->password->insert(value);
_pptpAuth->password->insert(secrets["password"]);
}
}
#include "tdenetman-pptp.moc"

@ -30,7 +30,7 @@
#include <tqwidget.h>
#include <tqlayout.h>
#include "knetworkmanager-vpnplugin.h"
#include "tdenetman-vpnplugin.h"
#include "pptpprop.h"
#include "pptpauth.h"
@ -51,9 +51,10 @@ class PPTPConfig : public VPNConfigWidget
Q_OBJECT
public:
void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
TQMap<TQString, TQString> getVPNProperties();
TQStringList getVPNRoutes();
void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets);
TDENetworkSettingsMap getVPNProperties();
TDENetworkSettingsMap getVPNSecrets();
TDENetworkSingleRouteConfigurationList getVPNRoutes();
bool hasChanged();
bool isValid(TQStringList& );
@ -63,6 +64,9 @@ class PPTPConfig : public VPNConfigWidget
private:
PPTPConfigWidget* _pptpWidget;
TDENetworkSettingsMap m_vpnProperties;
TDENetworkSettingsMap m_vpnSecrets;
protected slots:
void languageChange();
};
@ -74,8 +78,8 @@ class PPTPAuthentication : public VPNAuthenticationWidget
public:
PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL);
~PPTPAuthentication();
TQMap<TQString, TQString> getPasswords();
void setPasswords(TQString name, TQString value);
TDENetworkSettingsMap getPasswords();
void setPasswords(TDENetworkSettingsMap secrets);
private:
PPTPAuthenticationWidget* _pptpAuth;

@ -3,11 +3,11 @@ Encoding=UTF-8
Type=Service
Icon=
ServiceTypes=TDENetworkManager/VPNPlugin
X-TDE-Library=knetworkmanager_pptp
X-TDE-Library=tdenetman_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-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

@ -356,7 +356,6 @@ TDENetworkSingleRouteConfigurationList VPNCConfig::getVPNRoutes()
}
return ret;
}
bool VPNCConfig::hasChanged()

@ -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();

Loading…
Cancel
Save