|
|
@ -35,10 +35,10 @@
|
|
|
|
#include <kgenericfactory.h>
|
|
|
|
#include <kgenericfactory.h>
|
|
|
|
#include <tqlabel.h>
|
|
|
|
#include <tqlabel.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "knetworkmanager-strongswan.h"
|
|
|
|
#include "tdenetman-strongswan.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef KGenericFactory<StrongswanPlugin> StrongswanPluginFactory;
|
|
|
|
typedef KGenericFactory<StrongswanPlugin> StrongswanPluginFactory;
|
|
|
|
K_EXPORT_COMPONENT_FACTORY( knetworkmanager_strongswan, StrongswanPluginFactory("knetworkmanager_strongswan"));
|
|
|
|
K_EXPORT_COMPONENT_FACTORY( tdenetman_strongswan, StrongswanPluginFactory("tdenetman_strongswan"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args)
|
|
|
|
StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args)
|
|
|
@ -85,7 +85,7 @@ void StrongswanConfig::languageChange()
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// usercert agent password userkey
|
|
|
|
// usercert agent password userkey
|
|
|
|
StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop)
|
|
|
|
StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (prop == 0)
|
|
|
|
if (prop == 0)
|
|
|
@ -113,8 +113,11 @@ int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
|
|
|
|
void StrongswanConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
m_vpnProperties = properties;
|
|
|
|
|
|
|
|
m_vpnSecrets = secrets;
|
|
|
|
|
|
|
|
|
|
|
|
// fill up our inputfields (only textfields atm)
|
|
|
|
// fill up our inputfields (only textfields atm)
|
|
|
|
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
|
|
|
|
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -154,38 +157,66 @@ void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap<TQStri
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQString> StrongswanConfig::getVPNProperties()
|
|
|
|
TDENetworkSettingsMap StrongswanConfig::getVPNProperties()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// build a StingList of properties
|
|
|
|
// Build a list of properties
|
|
|
|
TQMap<TQString, TQString> strlist;
|
|
|
|
m_vpnProperties.insert("gateway", TQString(_strongswanWidget->gateway->text()));
|
|
|
|
|
|
|
|
m_vpnProperties.insert("certificate", TQString(_strongswanWidget->certificate->url()));
|
|
|
|
|
|
|
|
m_vpnProperties.insert("username", TQString(_strongswanWidget->username->text()));
|
|
|
|
|
|
|
|
m_vpnProperties.insert("method", TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem())));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkUDPenc->isChecked()) {
|
|
|
|
|
|
|
|
m_vpnProperties.insert("encap", TQString("yes"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
m_vpnProperties.remove("encap");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
strlist.insert("gateway", TQString(_strongswanWidget->gateway->text()));
|
|
|
|
if (_strongswanWidget->chkIPcomp->isChecked()) {
|
|
|
|
strlist.insert("certificate", TQString(_strongswanWidget->certificate->url()));
|
|
|
|
m_vpnProperties.insert("ipcomp", TQString("yes"));
|
|
|
|
strlist.insert("username", TQString(_strongswanWidget->username->text()));
|
|
|
|
}
|
|
|
|
strlist.insert("method",
|
|
|
|
else {
|
|
|
|
TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem())));
|
|
|
|
m_vpnProperties.remove("ipcomp");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkUDPenc->isChecked())
|
|
|
|
if (_strongswanWidget->chkIPinner->isChecked()) {
|
|
|
|
strlist.insert("encap", TQString("yes"));
|
|
|
|
m_vpnProperties.insert("virtual", TQString("yes"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
m_vpnProperties.remove("virtual");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkIPcomp->isChecked())
|
|
|
|
return m_vpnProperties;
|
|
|
|
strlist.insert("ipcomp", TQString("yes"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkIPinner->isChecked())
|
|
|
|
TDENetworkSettingsMap StrongswanConfig::getVPNSecrets() {
|
|
|
|
strlist.insert("virtual", TQString("yes"));
|
|
|
|
// Build a list of secrets
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
|
|
|
|
return strlist;
|
|
|
|
return m_vpnSecrets;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList StrongswanConfig::getVPNRoutes()
|
|
|
|
TDENetworkSingleRouteConfigurationList StrongswanConfig::getVPNRoutes()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
TDENetworkSingleRouteConfigurationList ret;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
TQStringList strlist;
|
|
|
|
TQStringList strlist;
|
|
|
|
/*if(_strongswanWidget->chkIPAdresses->isChecked())
|
|
|
|
if(_strongswanWidget->chkIPAdresses->isChecked()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
strlist = TQStringList::split(" ", _strongswanWidget->routes->text());
|
|
|
|
strlist = TQStringList::split(" ", _strongswanWidget->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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -218,7 +249,7 @@ StrongswanAuthentication::~StrongswanAuthentication()
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQString> StrongswanAuthentication::getPasswords()
|
|
|
|
TDENetworkSettingsMap StrongswanAuthentication::getPasswords()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQMap<TQString, TQString> pwds;
|
|
|
|
TQMap<TQString, TQString> pwds;
|
|
|
|
pwds.insert("user", TQString(_strongswanAuth->username->text()));
|
|
|
|
pwds.insert("user", TQString(_strongswanAuth->username->text()));
|
|
|
@ -226,9 +257,11 @@ TQMap<TQString, TQString> StrongswanAuthentication::getPasswords()
|
|
|
|
return pwds;
|
|
|
|
return pwds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void StrongswanAuthentication::setPasswords(TQString name, TQString value) {
|
|
|
|
void StrongswanAuthentication::setPasswords(TDENetworkSettingsMap secrets) {
|
|
|
|
if (name == TQString("password")) {
|
|
|
|
if (secrets.contains("password")) {
|
|
|
|
_strongswanAuth->password->erase();
|
|
|
|
_strongswanAuth->password->erase();
|
|
|
|
_strongswanAuth->password->insert(value);
|
|
|
|
_strongswanAuth->password->insert(secrets["password"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "tdenetman-strongswan.moc"
|