|
|
|
@ -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"
|