|
|
|
@ -35,10 +35,10 @@
|
|
|
|
|
#include <kgenericfactory.h>
|
|
|
|
|
#include <tqlabel.h>
|
|
|
|
|
|
|
|
|
|
#include "knetworkmanager-strongswan.h"
|
|
|
|
|
#include "tdenetman-strongswan.h"
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@ -85,7 +85,7 @@ void StrongswanConfig::languageChange()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// usercert agent password userkey
|
|
|
|
|
// usercert agent password userkey
|
|
|
|
|
StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop)
|
|
|
|
|
{
|
|
|
|
|
if (prop == 0)
|
|
|
|
@ -113,8 +113,11 @@ int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
|
|
|
|
|
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)
|
|
|
|
|
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
|
|
|
|
|
TQMap<TQString, TQString> strlist;
|
|
|
|
|
// Build a list of properties
|
|
|
|
|
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()));
|
|
|
|
|
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->chkIPcomp->isChecked()) {
|
|
|
|
|
m_vpnProperties.insert("ipcomp", TQString("yes"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_vpnProperties.remove("ipcomp");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkUDPenc->isChecked())
|
|
|
|
|
strlist.insert("encap", TQString("yes"));
|
|
|
|
|
if (_strongswanWidget->chkIPinner->isChecked()) {
|
|
|
|
|
m_vpnProperties.insert("virtual", TQString("yes"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_vpnProperties.remove("virtual");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkIPcomp->isChecked())
|
|
|
|
|
strlist.insert("ipcomp", TQString("yes"));
|
|
|
|
|
return m_vpnProperties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_strongswanWidget->chkIPinner->isChecked())
|
|
|
|
|
strlist.insert("virtual", TQString("yes"));
|
|
|
|
|
TDENetworkSettingsMap StrongswanConfig::getVPNSecrets() {
|
|
|
|
|
// Build a list of secrets
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
|
|
return strlist;
|
|
|
|
|
return m_vpnSecrets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQStringList StrongswanConfig::getVPNRoutes()
|
|
|
|
|
TDENetworkSingleRouteConfigurationList StrongswanConfig::getVPNRoutes()
|
|
|
|
|
{
|
|
|
|
|
TDENetworkSingleRouteConfigurationList ret;
|
|
|
|
|
#if 0
|
|
|
|
|
TQStringList strlist;
|
|
|
|
|
/*if(_strongswanWidget->chkIPAdresses->isChecked())
|
|
|
|
|
{
|
|
|
|
|
if(_strongswanWidget->chkIPAdresses->isChecked()) {
|
|
|
|
|
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;
|
|
|
|
|
pwds.insert("user", TQString(_strongswanAuth->username->text()));
|
|
|
|
@ -226,9 +257,11 @@ TQMap<TQString, TQString> StrongswanAuthentication::getPasswords()
|
|
|
|
|
return pwds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StrongswanAuthentication::setPasswords(TQString name, TQString value) {
|
|
|
|
|
if (name == TQString("password")) {
|
|
|
|
|
void StrongswanAuthentication::setPasswords(TDENetworkSettingsMap secrets) {
|
|
|
|
|
if (secrets.contains("password")) {
|
|
|
|
|
_strongswanAuth->password->erase();
|
|
|
|
|
_strongswanAuth->password->insert(value);
|
|
|
|
|
_strongswanAuth->password->insert(secrets["password"]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include "tdenetman-strongswan.moc"
|