Commit ec6e5476 authored by Lamarque Souza's avatar Lamarque Souza
Browse files

Import VPN connections from configuration files. Only VPNC is

implemented so far.
Thanks Rajeesh K Nambiar for implementing this patch.

BUG: 146159
BUG: 182984
REVIEW: 101419
parent 60ce1549
......@@ -40,6 +40,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "connection.h"
#include "settings/vpn.h"
#include "settings/vpnpersistence.h"
VpnPreferences::VpnPreferences(const QVariantList &args, QWidget *parent)
: ConnectionPreferences(args, parent ), m_uiPlugin(0)
......@@ -61,6 +62,25 @@ VpnPreferences::VpnPreferences(const QVariantList &args, QWidget *parent)
kDebug() << error;
}
}
// If additional settings are passed, populate them : data, secretsData and secretsType, connection name
// Connection Name
if (args.count() > 5) {
m_contents->setDefaultName(args[5].toString());
}
Knm::VpnSetting * conSetting = static_cast<Knm::VpnSetting*>(m_connection->setting(Knm::Setting::Vpn));
if (args.count() > 4) {
// Secret Storage Type
conSetting->setSecretsStorageType(Knm::VpnPersistence::stringMapFromStringList(Knm::VpnPersistence::variantMapToStringList(args[4].toMap())));
}
if (args.count() > 3) {
// VPN Secrets
conSetting->setVpnSecrets(args[3].toMap());
}
if (args.count() > 2) {
// VPN connection data
conSetting->setData(Knm::VpnPersistence::stringMapFromStringList(Knm::VpnPersistence::variantMapToStringList(args[2].toMap())));
}
IpV4Widget * ipv4Widget = new IpV4Widget(m_connection, this);
IpV6Widget * ipv6Widget = new IpV6Widget(m_connection, this);
addToTabWidget(ipv4Widget);
......
......@@ -22,6 +22,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#define VPNUIPLUGIN_H
#include <QObject>
#include <QVariant>
#include "settingwidget.h"
......@@ -46,6 +47,9 @@ public:
virtual SettingWidget * widget(Knm::Connection * connection, QWidget * parent = 0) = 0;
virtual SettingWidget * askUser(Knm::Connection * connection, QWidget * parent = 0){ return widget(connection, parent); };
virtual QString suggestedFileName(Knm::Connection *connection) const = 0;
virtual QVariantList importConnectionSettings(const QString &fileName) = 0;
virtual void exportConnectionSettings(Knm::Connection * connection, const QString &fileName) = 0;
private:
class Private;
Private * d;
......
......@@ -22,7 +22,7 @@ set(kcm_networkmanagement_SRCS
kde4_add_ui_files(kcm_networkmanagement_SRCS manageconnectionwidget.ui)
kde4_add_plugin(kcm_networkmanagement ${kcm_networkmanagement_SRCS})
target_link_libraries(kcm_networkmanagement knm_nm knmui knminternals knmservice solidcontrol ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTXML_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY})
target_link_libraries(kcm_networkmanagement knm_nm knmui knminternals knmservice solidcontrol ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTXML_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY} ${KDE4_KIO_LIBS})
macro_ensure_version("4.4.76" ${KDE_VERSION} IS45)
if (IS45)
......
/*
Copyright 2010 Aurélien Gâteau <aurelien.gateau@canonical.com>
Copyright 2011 Rajeesh K Nambiar <rajeeshknambiar@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -32,6 +33,8 @@ AddEditDeleteButtonSet::AddEditDeleteButtonSet(QWidget* parent)
, mAddButton(new KPushButton)
, mEditButton(new KPushButton)
, mDeleteButton(new KPushButton)
, mImportButton(new KPushButton)
, mExportButton(new KPushButton)
, mTree(0)
{
mAddButton->setGuiItem(KGuiItem(i18n("Add..."), "list-add"));
......@@ -42,11 +45,20 @@ AddEditDeleteButtonSet::AddEditDeleteButtonSet(QWidget* parent)
mDeleteButton->setGuiItem(KStandardGuiItem::del());
mDeleteButton->setEnabled(false);
mImportButton->setGuiItem(KGuiItem(i18n("Import"), "arrow-down"));
mExportButton->setGuiItem(KGuiItem(i18n("Export"), "arrow-up"));
mImportButton->setVisible(false);
mExportButton->setVisible(false);
mExportButton->setEnabled(false);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->addWidget(mAddButton);
layout->addWidget(mEditButton);
layout->addWidget(mDeleteButton);
layout->addWidget(mImportButton);
layout->addWidget(mExportButton);
layout->addStretch();
}
......@@ -62,4 +74,5 @@ void AddEditDeleteButtonSet::updateButtons()
bool hasSelection = !mTree->selectedItems().isEmpty();
mEditButton->setEnabled(hasSelection);
mDeleteButton->setEnabled(hasSelection);
mExportButton->setEnabled(hasSelection);
}
/*
Copyright 2010 Aurélien Gâteau <aurelien.gateau@canonical.com>
Copyright 2011 Rajeesh K Nambiar <rajeeshknambiar@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -39,6 +40,8 @@ public:
KPushButton* addButton() const { return mAddButton; }
KPushButton* editButton() const { return mEditButton; }
KPushButton* deleteButton() const { return mDeleteButton; }
KPushButton* importButton() const { return mImportButton; }
KPushButton* exportButton() const { return mExportButton; }
private slots:
void updateButtons();
......@@ -47,6 +50,8 @@ private:
KPushButton* mAddButton;
KPushButton* mEditButton;
KPushButton* mDeleteButton;
KPushButton* mImportButton;
KPushButton* mExportButton;
QTreeWidget* mTree;
};
......
/*
Copyright 2008,2009 Will Stephenson <wstephenson@kde.org>
Copyright 2011 Rajeesh K Nambiar <rajeeshknambiar@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -46,6 +47,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KServiceTypeTrader>
#include <KStandardDirs>
#include <KToolInvocation>
#include <kfiledialog.h>
#include <KUser>
#include <solid/control/networkmanager.h>
#include <solid/control/networkinterface.h>
......@@ -54,6 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "connectionlist.h"
#include "connectionpersistence.h"
#include "connectionprefs.h"
#include "vpnuiplugin.h"
#include "settings/vpn.h"
#include <tooltips.h>
#define ConnectionIdRole Qt::UserRole + 1
......@@ -484,6 +491,93 @@ void ManageConnectionWidget::addClicked()
}
void ManageConnectionWidget::importClicked()
{
//Get the file from which connection is to be imported
QString impFile = KFileDialog::getOpenFileName(KUser().homeDir(),"",this,i18nc("File chooser dialog title for importing VPN","Import VPN connection settings"));
if (impFile.isEmpty())
return;
//Try to import the connection with each VPN plugin found
Knm::Connection * con = 0;
QString pluginError;
KPluginInfo::List vpnServices = KPluginInfo::fromServices(KServiceTypeTrader::self()->query(QLatin1String("NetworkManagement/VpnUiPlugin")));
foreach (const KPluginInfo &pi, vpnServices) {
QString serviceType = pi.service()->property("X-NetworkManager-Services", QVariant::String).toString();
VpnUiPlugin * vpnUi = KServiceTypeTrader::createInstanceFromQuery<VpnUiPlugin>( QString::fromLatin1( "NetworkManagement/VpnUiPlugin" ), QString::fromLatin1( "[X-NetworkManager-Services]=='%1'" ).arg( serviceType ), this, QVariantList(), &pluginError );
if (pluginError.isEmpty()) {
QVariantList conArgs = vpnUi->importConnectionSettings(impFile);
if (!conArgs.isEmpty()) {
conArgs.insert(0, serviceType); //VPN service
con = mEditor->createConnection(false, Knm::Connection::Vpn, conArgs);
}
if (con) {
kDebug() << "VPN Connection pointer is set, connection will be added.";
if (con->scope() == Knm::Connection::User)
saveConnection(con);
else
mSystemSettings->addConnection(con);
updateServiceAndUi(con);
break;
}
}
}
if (!con) {
kDebug() << "VPN import failed";
KMessageBox::error(this, i18n("Could not import VPN connection settings"), i18n("Error"), KMessageBox::Notify) ;
}
}
void ManageConnectionWidget::exportClicked()
{
QTreeWidgetItem * item = selectedItem();
Knm::Connection * con = 0;
QString connectionId = item->data(0, ConnectionIdRole).toString();
Knm::Connection::Type type = (Knm::Connection::Type)item->data(0, ConnectionTypeRole).toUInt();
if (connectionId.isEmpty()) {
kDebug() << "selected item had no connectionId!";
return;
}
Knm::Connection::Scope scope = (Knm::Connection::Scope)item->data(0, ConnectionScopeRole).toUInt();
if (scope == Knm::Connection::User) {
con = new Knm::Connection(QUuid(connectionId), type);
loadConnection(con);
}
else {
//find clicked connection from our connection list
// FIXME: we should create a copy here like above instead of using the original.
con = mConnections->findConnection(connectionId);
}
if (!con) {
kWarning() << "Clicked connection with id" << connectionId << " could not be found in connection list!";
return;
}
QString serviceType = static_cast<Knm::VpnSetting*>(con->setting(Knm::Setting::Vpn))->serviceType();
QString pluginError;
VpnUiPlugin * vpnUi = KServiceTypeTrader::createInstanceFromQuery<VpnUiPlugin>( QString::fromLatin1( "NetworkManagement/VpnUiPlugin" ), QString::fromLatin1( "[X-NetworkManager-Services]=='%1'" ).arg( serviceType ), this, QVariantList(), &pluginError );
if (pluginError.isEmpty()) {
QString expFile = KFileDialog::getSaveFileName(KUser().homeDir().append("/" + vpnUi->suggestedFileName(con)),"",this,i18nc("File chooser dialog title for exporting VPN","Export VPN"));
if (expFile.isEmpty())
return;
vpnUi->exportConnectionSettings(con, expFile);
KMessageBox::information(this, i18n("VPN connection successfully exported"), i18n("Success"), i18n("Do not show again"), KMessageBox::Notify);
}
else {
KMessageBox::error(this, i18n("Could not export VPN connection settings"), i18n("Error"), KMessageBox::Notify);
}
return;
}
void ManageConnectionWidget::loadConnection(Knm::Connection *con)
{
// restore the Connection if possible
......@@ -812,6 +906,11 @@ void ManageConnectionWidget::tabChanged(int index)
mConnEditUi.buttonSetVpn->addButton()->setMenu(mVpnMenu);
}
mConnEditUi.buttonSetVpn->addButton()->setEnabled(!mVpnMenu->isEmpty());
mConnEditUi.buttonSetVpn->importButton()->setEnabled(!mVpnMenu->isEmpty());
mConnEditUi.buttonSetVpn->importButton()->setVisible(!mVpnMenu->isEmpty());
mConnEditUi.buttonSetVpn->exportButton()->setVisible(!mVpnMenu->isEmpty());
connect(mConnEditUi.buttonSetVpn->importButton(),SIGNAL(clicked()),SLOT(importClicked()));
connect(mConnEditUi.buttonSetVpn->exportButton(),SIGNAL(clicked()),SLOT(exportClicked()));
}
}
......@@ -847,7 +946,6 @@ void ManageConnectionWidget::connectionTypeMenuTriggered(QAction* action)
}
}
void ManageConnectionWidget::activeConnectionsChanged()
{
#if 0
......
......@@ -83,6 +83,14 @@ private slots:
* connection subtypes
*/
void tabChanged(int);
/**
* Imports a connection of the selected subtype
*/
void importClicked();
/**
* Exports a connection of the selected subtype
*/
void exportClicked();
/**
* adds a connection of the selected subtype
*/
......
......@@ -44,4 +44,22 @@ SettingWidget * NovellVpnUiPlugin::widget(Knm::Connection * connection, QWidget
return wid;
}
QString NovellVpnUiPlugin::suggestedFileName(Knm::Connection *connection) const
{
// TODO : implement suggested file name
return QString();
}
QVariantList NovellVpnUiPlugin::importConnectionSettings(const QString &fileName)
{
// TODO : import the Novell VPN connection from file and return settings
return QVariantList();
}
void NovellVpnUiPlugin::exportConnectionSettings(Knm::Connection * connection, const QString &fileName)
{
// TODO : export Novell VPN connection to file
return;
}
// vim: sw=4 sts=4 et tw=100
......@@ -37,6 +37,9 @@ public:
NovellVpnUiPlugin(QObject * parent = 0, const QVariantList& = QVariantList());
virtual ~NovellVpnUiPlugin();
SettingWidget * widget(Knm::Connection *, QWidget * parent = 0);
QString suggestedFileName(Knm::Connection *connection) const;
QVariantList importConnectionSettings(const QString &fileName);
void exportConnectionSettings(Knm::Connection * connection, const QString &fileName);
};
#endif // KNM4_NOVELLVPN_H
......@@ -45,4 +45,22 @@ SettingWidget * OpenVpnUiPlugin::widget(Knm::Connection * connection, QWidget *
return wid;
}
QString OpenVpnUiPlugin::suggestedFileName(Knm::Connection *connection) const
{
// TODO : implement suggested file name
return QString();
}
QVariantList OpenVpnUiPlugin::importConnectionSettings(const QString &fileName)
{
// TODO : import the OpenVPN connection from file and return settings
return QVariantList();
}
void OpenVpnUiPlugin::exportConnectionSettings(Knm::Connection * connection, const QString &fileName)
{
// TODO : export the OpenVPN connection to file
return;
}
// vim: sw=4 sts=4 et tw=100
......@@ -37,6 +37,9 @@ public:
OpenVpnUiPlugin(QObject * parent = 0, const QVariantList& = QVariantList());
virtual ~OpenVpnUiPlugin();
SettingWidget * widget(Knm::Connection *, QWidget * parent = 0);
QString suggestedFileName(Knm::Connection *connection) const;
QVariantList importConnectionSettings(const QString &fileName);
void exportConnectionSettings(Knm::Connection * connection, const QString &fileName);
};
#endif // KNM4_OPENVPN_H
......@@ -43,4 +43,22 @@ SettingWidget * PptpUiPlugin::widget(Knm::Connection * connection, QWidget * par
return new PptpSettingWidget(connection, parent);
}
QString PptpUiPlugin::suggestedFileName(Knm::Connection *connection) const
{
// TODO : implement suggested file name
return QString();
}
QVariantList PptpUiPlugin::importConnectionSettings(const QString &fileName)
{
// TODO : import the PPTP connection from file and return settings
return QVariantList();
}
void PptpUiPlugin::exportConnectionSettings(Knm::Connection * connection, const QString &fileName)
{
// TODO : export PPTP connection to file
return;
}
// vim: sw=4 sts=4 et tw=100
......@@ -37,6 +37,9 @@ public:
PptpUiPlugin(QObject * parent = 0, const QVariantList& = QVariantList());
virtual ~PptpUiPlugin();
SettingWidget * widget(Knm::Connection *, QWidget * parent = 0);
QString suggestedFileName(Knm::Connection *connection) const;
QVariantList importConnectionSettings(const QString &fileName);
void exportConnectionSettings(Knm::Connection * connection, const QString &fileName);
};
#endif // KNM4_PPTP_H
......@@ -45,4 +45,22 @@ SettingWidget * StrongswanUiPlugin::widget(Knm::Connection * connection, QWidget
return new StrongswanSettingWidget(connection, parent);
}
QString StrongswanUiPlugin::suggestedFileName(Knm::Connection *connection) const
{
// TODO : implement suggested file name
return QString();
}
QVariantList StrongswanUiPlugin::importConnectionSettings(const QString &fileName)
{
// TODO : import the StrongSwan connection from file and return settings
return QVariantList();
}
void StrongswanUiPlugin::exportConnectionSettings(Knm::Connection * connection, const QString &fileName)
{
// TODO : export StrongSwan connection to file
return;
}
// vim: sw=4 sts=4 et tw=100
......@@ -38,6 +38,9 @@ public:
StrongswanUiPlugin(QObject * parent = 0, const QVariantList& = QVariantList());
virtual ~StrongswanUiPlugin();
SettingWidget * widget(Knm::Connection *, QWidget * parent = 0);
QString suggestedFileName(Knm::Connection *connection) const;
QVariantList importConnectionSettings(const QString &fileName);
void exportConnectionSettings(Knm::Connection * connection, const QString &fileName);
};
#endif // KNM4_STRONGSWAN_H
......@@ -42,8 +42,10 @@
#define NM_VPNC_KEY_NAT_TRAVERSAL_MODE "NAT Traversal Mode"
#define NM_VPNC_KEY_DPD_IDLE_TIMEOUT "DPD idle timeout (our side)"
#define NM_VPNC_KEY_CISCO_UDP_ENCAPS_PORT "Cisco UDP Encapsulation Port"
#define NM_VPNC_KEY_LOCAL_PORT "Local Port"
#define NM_VPNC_NATT_MODE_NATT "natt"
#define NM_VPNC_NATT_MODE_NATT_ALWAYS "force-natt"
#define NM_VPNC_NATT_MODE_NONE "none"
#define NM_VPNC_NATT_MODE_CISCO "cisco-udp"
......
/*
Copyright 2008 Will Stephenson <wstephenson@kde.org>
Copyright 2011 Rajeesh K Nambiar <rajeeshknambiar@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -21,10 +22,56 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "vpnc.h"
#include <KPluginFactory>
#include <KSharedConfig>
#include <KStandardDirs>
#include <KMessageBox>
#include "nm-vpnc-service.h"
#include "vpncwidget.h"
#include "vpncauth.h"
#include "connection.h"
#include "settings/vpnpersistence.h"
#define NM_VPNC_LOCAL_PORT_DEFAULT 500
VpncUiPluginPrivate::VpncUiPluginPrivate()
{
decryptedPasswd.clear();
ciscoDecrypt = 0;
}
VpncUiPluginPrivate::~VpncUiPluginPrivate()
{
if (ciscoDecrypt)
delete ciscoDecrypt;
}
void VpncUiPluginPrivate::gotciscoDecryptOutput()
{
QByteArray output = ciscoDecrypt->readAll();
if (!output.isEmpty()) {
QList<QByteArray> lines = output.split('\n');
if (!lines.isEmpty()) {
decryptedPasswd = QString(lines.first());
}
}
}
void VpncUiPluginPrivate::ciscoDecryptFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
if (exitCode || exitStatus != QProcess::NormalExit)
decryptedPasswd.clear();
delete ciscoDecrypt;
ciscoDecrypt = 0;
}
void VpncUiPluginPrivate::ciscoDecryptError(QProcess::ProcessError pError)
{
if (!pError) {
kDebug() << "Error in executing cisco-decrypt";
KMessageBox::error(0, i18n("Error decrypting the obfuscated password"), i18n("Error"), KMessageBox::Notify);
}
decryptedPasswd.clear();
}
K_PLUGIN_FACTORY( VpncUiPluginFactory, registerPlugin<VpncUiPlugin>(); )
K_EXPORT_PLUGIN( VpncUiPluginFactory( "networkmanagement_vpncui", "libknetworkmanager" ) )
......@@ -49,4 +96,222 @@ SettingWidget * VpncUiPlugin::askUser(Knm::Connection * connection, QWidget * pa
return new VpncAuthWidget(connection, parent);
}
QString VpncUiPlugin::suggestedFileName(Knm::Connection *connection) const
{
return connection->name() + ".pcf";
}
QVariantList VpncUiPlugin::importConnectionSettings(const QString &fileName)
{
kDebug() << "Importing Cisco VPN connection from " << fileName;
VpncUiPluginPrivate * decrPlugin = 0;
QVariantList conSetting;
// NOTE: Cisco VPN pcf files follow ini style matching KConfig files
// http://www.cisco.com/en/US/docs/security/vpn_client/cisco_vpn_client/vpn_client46/administration/guide/vcAch2.html#wp1155033
KSharedConfig::Ptr config = KSharedConfig::openConfig(fileName);
if (!config)
return conSetting;
KConfigGroup cg(config, "main"); // Keys&Values are stored under [main]
if (cg.exists()) {
// Setup cisco-decrypt binary to decrypt the passwords
QStringList decrArgs;
QString ciscoDecryptBinary = KStandardDirs::findExe("cisco-decrypt");
decrPlugin = new VpncUiPluginPrivate();
decrPlugin->ciscoDecrypt = new KProcess(this);
decrPlugin->ciscoDecrypt->setOutputChannelMode(KProcess::OnlyStdoutChannel);
decrPlugin->ciscoDecrypt->setReadChannel(QProcess::StandardOutput);
connect(decrPlugin->ciscoDecrypt, SIGNAL(error(QProcess::ProcessError)), decrPlugin, SLOT(ciscoDecryptError(QProcess::ProcessError)));
connect(decrPlugin->ciscoDecrypt, SIGNAL(finished(int,QProcess::ExitStatus)), decrPlugin, SLOT(ciscoDecryptFinished(int,QProcess::ExitStatus)));
connect(decrPlugin->ciscoDecrypt, SIGNAL(readyReadStandardOutput()), decrPlugin, SLOT(gotciscoDecryptOutput()));
QStringMap data;
QVariantMap secretData;
QStringMap secretsType;
// gateway
data.insert(NM_VPNC_KEY_GATEWAY, cg.readEntry("Host"));
// group name
data.insert(NM_VPNC_KEY_ID, cg.readEntry("GroupName"));
// user password
if (!cg.readEntry("UserPassword").isEmpty()) {
secretData.insert(NM_VPNC_KEY_XAUTH_PASSWORD, cg.readEntry("UserPassword"));
}
else if (!cg.readEntry("enc_UserPassword").isEmpty() && !ciscoDecryptBinary.isEmpty()) {
// Decrypt the password and insert into map
decrArgs.clear();
decrArgs << cg.readEntry("enc_UserPassword");
decrPlugin->ciscoDecrypt->setProgram(ciscoDecryptBinary, decrArgs);
decrPlugin->ciscoDecrypt->start();
if (decrPlugin->ciscoDecrypt->waitForStarted() && decrPlugin->ciscoDecrypt->waitForFinished()) {
secretData.insert(NM_VPNC_KEY_XAUTH_PASSWORD, decrPlugin->decryptedPasswd);
}
}
// Save user password
switch (cg.readEntry("SaveUserPassword").toInt())
{
case 0:
secretsType.insert(NM_VPNC_KEY_XAUTH_PASSWORD, NM_VPN_PW_TYPE_ASK);
break;
case 1:
secretsType.insert(NM_VPNC_KEY_XAUTH_PASSWORD, NM_VPN_PW_TYPE_SAVE);
break;
case 2:
secretsType.insert(NM_VPNC_KEY_XAUTH_PASSWORD, NM_VPN_PW_TYPE_UNUSED);
break;
}
// group password
if (!cg.readEntry("GroupPwd").isEmpty()) {
secretData.insert(NM_VPNC_KEY_SECRET, cg.readEntry("GroupPwd"));
secretsType.insert(NM_VPNC_KEY_SECRET, NM_VPN_PW_TYPE_SAVE);
}
else if (!cg.readEntry("enc_GroupPwd").isEmpty() && !ciscoDecryptBinary.isEmpty()) {
//Decrypt the password and insert into map
decrArgs.clear();
decrArgs << cg.readEntry("enc_GroupPwd");
decrPlugin->ciscoDecrypt->setProgram(ciscoDecryptBinary, decrArgs);
decrPlugin->ciscoDecrypt->start();
if (decrPlugin->ciscoDecrypt->waitForStarted() && decrPlugin->ciscoDecrypt->waitForFinished()) {
secretData.insert(NM_VPNC_KEY_SECRET, decrPlugin->decryptedPasswd);
secretsType.insert(NM_VPNC_KEY_SECRET, NM_VPN_PW_TYPE_SAVE);
}
}
delete decrPlugin;
// Optional settings
// username
data.insert(NM_VPNC_KEY_XAUTH_USER, cg.readEntry("Username"));
// domain
data.insert(NM_VPNC_KEY_DOMAIN, cg.readEntry("NTDomain"));
// encryption
if (!cg.readEntry("SingleDES").isEmpty() && cg.readEntry("SingleDES").toInt() != 0) {
data.insert(NM_VPNC_KEY_SINGLE_DES, QLatin1String("yes"));
}
/* Disable all NAT Traversal if explicit EnableNat=0 exists, otherwise
* default to NAT-T which is newer and standardized. If EnableNat=1, then
* use Cisco-UDP like always; but if the key "X-NM-Use-NAT-T" is set, then
* use NAT-T. If the key "X-NM-Force-NAT-T" is set then force NAT-T always
* on. See vpnc documentation for more information on what the different
* NAT modes are.
*/
// enable NAT
if (cg.readEntry("EnableNat").toInt() == 1) {