From 441c9f0207681f071e353357511255bc16b4ded0 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Date: Mon, 10 Sep 2012 14:32:34 -0500
Subject: Start work on vpnc plugin

---
 tdenetworkmanager/CMakeLists.txt                   |   2 +-
 tdenetworkmanager/vpn-plugins/CMakeLists.txt       |  15 +
 tdenetworkmanager/vpn-plugins/vpnc/AUTHORS         |   1 +
 tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt  |  14 +
 .../vpn-plugins/vpnc/knetworkmanager_vpnc.desktop  |  23 --
 .../vpn-plugins/vpnc/src/CMakeLists.txt            |  43 +++
 .../vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp  | 402 --------------------
 .../vpn-plugins/vpnc/src/knetworkmanager-vpnc.h    |  90 -----
 .../vpn-plugins/vpnc/src/tdenetman-vpnc.cpp        | 403 +++++++++++++++++++++
 .../vpn-plugins/vpnc/src/tdenetman-vpnc.h          |  90 +++++
 .../vpn-plugins/vpnc/tdenetman_vpnc.desktop        |  23 ++
 11 files changed, 590 insertions(+), 516 deletions(-)
 create mode 100644 tdenetworkmanager/vpn-plugins/CMakeLists.txt
 create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt
 delete mode 100644 tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop
 create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt
 delete mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp
 delete mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h
 create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp
 create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h
 create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop

diff --git a/tdenetworkmanager/CMakeLists.txt b/tdenetworkmanager/CMakeLists.txt
index 1938a55..af12c8d 100644
--- a/tdenetworkmanager/CMakeLists.txt
+++ b/tdenetworkmanager/CMakeLists.txt
@@ -11,7 +11,7 @@
 
 add_subdirectory( pics )
 add_subdirectory( src )
-# add_subdirectory( vpn-plugins )
+add_subdirectory( vpn-plugins )
 # add_subdirectory( po )
 
 install( FILES tdenetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} )
diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt
new file mode 100644
index 0000000..aa31dbf
--- /dev/null
+++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt
@@ -0,0 +1,15 @@
+#################################################
+#
+#  (C) 2012 Timothy Pearson
+#  kb9vqf (AT) pearsoncomputing.net
+#
+#  Improvements and feedback are welcome
+#
+#  This file is released under GPL >= 2
+#
+#################################################
+
+# add_subdirectory( openvpn )
+# add_subdirectory( pptp )
+# add_subdirectory( strongswan )
+add_subdirectory( vpnc )
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS b/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS
index e0ecfce..676305e 100644
--- a/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS
+++ b/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS
@@ -1,2 +1,3 @@
+Timothy Pearson <kb9vqf@pearsoncomputing.net>
 Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
 Thomas Kallenberg <tkallenb@hsr.ch> <thomas@no-more-secrets.ch>
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt
new file mode 100644
index 0000000..d865ba9
--- /dev/null
+++ b/tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt
@@ -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_vpnc.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop b/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop
deleted file mode 100644
index fd7d07c..0000000
--- a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop
+++ /dev/null
@@ -1,23 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Type=Service
-Icon=
-ServiceTypes=TDENetworkManager/VPNPlugin
-X-TDE-Library=knetworkmanager_vpnc
-X-NetworkManager-Services=vpnc
-X-TDE-PluginInfo-Author=Helmut Schaa
-X-TDE-PluginInfo-Email=hschaa@suse.de
-X-TDE-PluginInfo-Name=knetworkmanager_vpnc
-X-TDE-PluginInfo-Version=0.1
-X-TDE-PluginInfo-Website=
-X-TDE-PluginInfo-Category=VPNService
-X-TDE-PluginInfo-Depends=
-X-TDE-PluginInfo-License=GPL
-X-TDE-PluginInfo-EnabledByDefault=false
-Name=VPNC
-Name[bn]=ভিপিএনসি
-Name[xx]=xxVPNCxx
-Comment=VPNC
-Comment[bn]=ভিপিএনসি
-Comment[xx]=xxVPNCxx
-
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt
new file mode 100644
index 0000000..25bd8ea
--- /dev/null
+++ b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt
@@ -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_vpnc (module) ###################
+
+set( target tdenetman_vpnc )
+
+set( ${target}_SRCS
+  tdenetman-vpnc.cpp
+  vpncprop.ui
+  vpncauth.ui
+)
+
+tde_add_kpart( ${target} AUTOMOC
+  SOURCES ${${target}_SRCS}
+  LINK tdeinit_kded-shared
+  DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp
deleted file mode 100644
index 9804256..0000000
--- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-vpnc.cpp - A NetworkManager frontend for TDE 
- *
- * Copyright (C) 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- * Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- **************************************************************************/
-
-#include <klocale.h>
-#include <kmessagebox.h>
-#include <tqmessagebox.h>
-#include <tqbutton.h>
-#include <kcombobox.h>
-#include <klineedit.h>
-#include <kurlrequester.h>
-#include <tqobjectlist.h>
-#include <tqobject.h>
-#include <tqcheckbox.h>
-#include <kpassdlg.h>
-#include <kgenericfactory.h>
-#include <tqlabel.h>
-#include <string>
-#include <stdio.h>
-
-#include "knetworkmanager-vpnc.h"
-using namespace std;
-
-typedef KGenericFactory<VPNCPlugin> VPNCPluginFactory;
-K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc"));
-
-#define NAT_MODE_CISCO 0
-#define NAT_MODE_NATT 1
-#define NAT_MODE_DISABLED 2
-
-char linedata [2048];
-
-VPNCPlugin::VPNCPlugin(TQObject* parent, const char* name, const TQStringList& args) 
-	: VPNPlugin(parent, name, args)
-{
-	KLocale* loc = KGlobal::locale();
-	loc->insertCatalogue("NetworkManager-vpnc");
-}
-
-VPNCPlugin::~VPNCPlugin()
-{
-
-}
-
-VPNConfigWidget* VPNCPlugin::CreateConfigWidget(TQWidget* parent)
-{
-	return new VPNCConfig(parent);
-}
-
-VPNAuthenticationWidget* VPNCPlugin::CreateAuthenticationWidget(TQWidget* parent)
-{
-	return new VPNCAuthentication(parent);
-}
-
-
-VPNCConfig::VPNCConfig(TQWidget* parent)
-	: VPNConfigWidget(parent)
-{
-	TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
-	_vpncWidget = new VPNCConfigWidget(this);
-	layout->addWidget(_vpncWidget);
-
-	connect(_vpncWidget->pcfImport, TQT_SIGNAL(clicked()), this, TQT_SLOT( pcfImport()) );	
-
-	//connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->Xauth_username, TQT_SLOT(setEnabled(bool)));
-	//connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblUsername, TQT_SLOT(setEnabled(bool)));
-
-	connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->Domain, TQT_SLOT(setEnabled(bool)));
-	connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblDomain, TQT_SLOT(setEnabled(bool)));
-
-	connect(_vpncWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _vpncWidget->routes, TQT_SLOT(setEnabled(bool)));
-
-	connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->nat_keep_alive_interval, TQT_SLOT(setEnabled(bool)));
-	connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblKeepAliveInterval, TQT_SLOT(setEnabled(bool)));
-
-	_vpncWidget->cboNAT->insertItem(i18n("Cisco UDP (default)"), NAT_MODE_CISCO);
-	_vpncWidget->cboNAT->insertItem(i18n("NAT-T"), NAT_MODE_NATT);
-	_vpncWidget->cboNAT->insertItem(i18n("Disabled"), NAT_MODE_DISABLED);
-
-	this->languageChange();
-}
-
-VPNCConfig::~VPNCConfig()
-{
-
-}
-
-void VPNCConfig::languageChange()
-{
-
-}
-
-int VPNCConfig::getFileConfig(char *parameter, char *line) {
-	int i;
-
-	if (strstr(line, parameter) != NULL) {
-		if ((strstr(line, parameter) - line) == 0) {
-			for (i=0; i<(strlen(line)-strlen(parameter));i++) {
-				linedata[i] = line[i+strlen(parameter)];
-				if ((linedata[i] == 10) || (linedata[i] == 13)) {
-					linedata[i] = 0;
-				}
-			}
-			linedata[i-1]=0;
-
-			return 0;
-		}
-		else {
-			return 1;
-		}
-	}
-	else {
-		return 1;
-	}
-}
-
-void VPNCConfig::pcfImport()
-{
-	const TQString& pcf_file = TQString(_vpncWidget->editPCF->url());
-	printf("Asked for PCF import from file %s\n\r", pcf_file.ascii());
-	int i;
-
-	FILE *file = fopen ( pcf_file.ascii(), "r" );
-	if ( file != NULL ) {
-		char line [2048];	// or other suitable maximum line size
-		// read a line
-		while ( fgets ( line, sizeof line, file ) != NULL ) {
-			// Parse the line and update global variables (current line in variable "line")
-			if (getFileConfig("Host=", line) == 0) {
-				//strdup(linedata)
-				printf("Got configuration parameter Host with data %s\n\r", linedata);
-				_vpncWidget->IPSec_gateway->setText(linedata);
-			}
-			if (getFileConfig("GroupName=", line) == 0) {
-				printf("Got configuration parameter GroupName with data %s\n\r", linedata);
-				_vpncWidget->IPSec_ID->setText(linedata);
-			}
-// 			if (getFileConfig("TcpTunnelingPort=", line) == 0) {
-// 				printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata);
-// 				_vpncWidget->IPSec_ID->setText(linedata);
-// 			}
-			if (getFileConfig("NTDomain=", line) == 0) {
-				if (strlen(linedata) > 0) {
-					printf("Got configuration parameter NTDomain with data %s\n\r", linedata);
-					_vpncWidget->Domain->setText(linedata);
-					_vpncWidget->chkUseDomain->setChecked(true);
-				}
-			}
-			if (getFileConfig("GroupPwd=", line) == 0) {
-				if (strlen(linedata) > 0) {
-					printf("Got configuration parameter GroupPwd with data %s\n\r", linedata);
-					KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(linedata));
-				}
-			}
-			if (getFileConfig("enc_GroupPwd=", line) == 0) {
-				if (strlen(linedata) > 0) {
-					printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata);
-
-					// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
-					string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
-					FILE *pipe_decrypt;
-					char decrypted_result[2048];
-					int i;
-			
-					decryptcommand.append(linedata);
-					printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
-					if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
-					{
-						printf("Group password decrypt error\n\r");
-					}
-					else {
-						fgets(decrypted_result, 2048, pipe_decrypt);
-						pclose(pipe_decrypt);
-						for (i=0;i<2048;i++) {
-							if (decrypted_result[i] == 0) {
-								decrypted_result[i-1]=0;
-								i=2048;
-							}
-						}
-						printf("Group password decrypt result: '%s'\n\r", decrypted_result);
-					}
-					KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(decrypted_result));
-				}
-			}
-		}
-		fclose ( file );
-	}
-	else
-	{
-		//printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii());
-		KMessageBox::error(this, i18n("That configuration file does not exist!"));
-	}
-}
-
-void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
-{
-	// fill up our inputfields (only textfields atm)
-	for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
-	{
-		TQString entry = it.key();
-		TQString value = it.data();
-
-		if (entry == "IPSec gateway")
-		{
-			_vpncWidget->IPSec_gateway->setText(value);
-		}
-		else if (entry == "IPSec ID")
-		{
-			_vpncWidget->IPSec_ID->setText(value);
-		}
-		else if (entry == "Xauth username")
-		{
-			_vpncWidget->Xauth_username->setText(value);
-			//_vpncWidget->chkOverrideUsername->setChecked(true);
-		}
-		else if (entry == "Domain")
-		{
-			_vpncWidget->Domain->setText(value);
-			_vpncWidget->chkUseDomain->setChecked(true);
-		}
-		else if (entry == "NAT-Keepalive packet interval")
-		{
-			_vpncWidget->nat_keep_alive_interval->setText(value);
-			_vpncWidget->chkUseKeepAlive->setChecked(true);
-		}
-		// backwards compatibility
-		else if (entry == "Disable NAT Traversal")
-		{
-			_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
-		}
-		else if (entry == "NAT Traversal Mode")
-		{
-			if (value == "natt")
-				_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_NATT);
-			else if (value == "cisco-udp")
-				_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_CISCO);
-			else if (value == "none")
-				_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
-			else
-			{
-				// FIXME: unknown NAT mode
-			}
-		}
-		else if (entry == "Enable Single DES")
-		{
-			_vpncWidget->chkSingleDES->setChecked(value == "yes" || value == "true");
-		}
-	}
-
-	// set routes
-	if (!routes.empty())
-	{
-		_vpncWidget->chkIPAdresses->setChecked(true);
-		_vpncWidget->routes->setText(routes.join(" "));
-	}
-}
-
-TQMap<TQString, TQString> VPNCConfig::getVPNProperties()
-{
-	// build a StingList of properties
-	TQMap<TQString, TQString> strlist;
-	strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text()));
-	strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text()));
-
-	//if (_vpncWidget->chkOverrideUsername->isChecked())
-		strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text()));
-
-	if (_vpncWidget->chkUseDomain->isChecked())
-		strlist.insert("Domain", TQString(_vpncWidget->Domain->text()));
-	
-	if (_vpncWidget->chkUseKeepAlive->isChecked())
-		strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text()));
-
-	switch (_vpncWidget->cboNAT->currentItem())
-	{
-		case NAT_MODE_CISCO:
-			strlist.insert("NAT Traversal Mode", "cisco-udp");
-			break;
-		case NAT_MODE_NATT:
-			strlist.insert("NAT Traversal Mode", "natt");
-			break;
-		case NAT_MODE_DISABLED:
-		default:
-			strlist.insert("NAT Traversal Mode", "none");
-			break;
-	}
-
-	if (_vpncWidget->chkSingleDES->isChecked())
-		strlist.insert("Enable Single DES", "yes");
-	else
-		strlist.insert("Enable Single DES", "no");
-
-	return strlist;
-}
-
-TQStringList VPNCConfig::getVPNRoutes()
-{
-	TQStringList strlist;
-	if(_vpncWidget->chkIPAdresses->isChecked())
-	{
-		strlist = TQStringList::split(" ", _vpncWidget->routes->text());
-	}
-	return strlist;
-
-}
-
-bool VPNCConfig::hasChanged()
-{
-	return true;
-}
-
-bool VPNCConfig::isValid(TQStringList& err_msg)
-{
-	bool retval = true;
-	if(_vpncWidget->IPSec_gateway->text() == "" || _vpncWidget->IPSec_ID->text() == "")
-	{
-		err_msg.append(i18n("At least the gateway and group has to be supplied."));
-		retval = false;
-	}
-	return retval;
-}
-
-VPNCAuthentication::VPNCAuthentication(TQWidget* parent, char* name)
-	: VPNAuthenticationWidget(parent, name)
-{
-	TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
-	_vpncAuth = new VPNCAuthenticationWidget(this);
-	layout->addWidget(_vpncAuth);
-}
-
-VPNCAuthentication::~VPNCAuthentication()
-{
-
-}
-
-TQMap<TQString, TQString> VPNCAuthentication::getPasswords()
-{
-	TQMap<TQString, TQString> pwds;
-	pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password()));
-	if (_vpncAuth->chkObfusticated->isChecked()) {
-		// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
-		string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
-		FILE *pipe_decrypt;
-		char decrypted_result[2048];
-		int i;
-
-		decryptcommand.append(_vpncAuth->editGroupPassword->password());
-		printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
-		if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
-		{
-			printf("Group password decrypt error\n\r");
-		}
-		else {
-			fgets(decrypted_result, 2048, pipe_decrypt);
-			pclose(pipe_decrypt);
-			for (i=0;i<2048;i++) {
-				if (decrypted_result[i] == 0) {
-					decrypted_result[i-1]=0;
-					i=2048;
-				}
-			}
-			printf("Group password decrypt result: '%s'\n\r", decrypted_result);
-			pwds.insert("IPSec secret", TQString(decrypted_result));
-		}
-	}
-	else {
-		pwds.insert("IPSec secret", TQString(_vpncAuth->editGroupPassword->password()));
-	}
-	return pwds;
-}
-
-void VPNCAuthentication::setPasswords(TQString name, TQString value) {
-	if (name == TQString("Xauth password")) {
-		_vpncAuth->editUserPassword->erase();
-		_vpncAuth->editUserPassword->insert(value);
-	}
-	else if (name == TQString("IPSec secret")) {
-		_vpncAuth->editGroupPassword->erase();
-		_vpncAuth->editGroupPassword->insert(value);
-	}
-}
\ No newline at end of file
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h
deleted file mode 100644
index 0b3b23c..0000000
--- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE 
- *
- * Copyright (C) 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- * Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- **************************************************************************/
-
-#ifndef KNETWORKMANAGER_VPNC_H
-#define KNETWORKMANAGER_VPNC_H
-
-#include <tqmap.h>
-#include <tqstring.h>
-#include <tqwidget.h>
-#include <tqlayout.h>
-
-#include "knetworkmanager-vpnplugin.h"
-#include "vpncprop.h"
-#include "vpncauth.h"
-
-class VPNCPlugin : public VPNPlugin
-{
-	Q_OBJECT
-  
-	public:
-		VPNCPlugin(TQObject*, const char*, const TQStringList&);
-		~VPNCPlugin();
-
-		VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
-		VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
-};
-
-class VPNCConfig : public VPNConfigWidget
-{
-	Q_OBJECT
-
-	public:
-		void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&);
-		TDENetworkSettingsMap getVPNProperties();
-		TDENetworkSettingsMap getVPNSecrets();
-		TQStringList getVPNRoutes();
-		bool hasChanged();
-		bool isValid(TQStringList&);
-
-		VPNCConfig(TQWidget* parent);
-		~VPNCConfig();
-
-	public slots:
-		void pcfImport();
-
-	private:
-		VPNCConfigWidget*   _vpncWidget;
-		int getFileConfig(char *parameter, char *line);
-
-	protected slots:
-		void languageChange();
-};
-
-class VPNCAuthentication : public VPNAuthenticationWidget
-{
-	Q_OBJECT
-
-	public:
-		VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL);
-		~VPNCAuthentication();
-		TDENetworkSettingsMap getPasswords();
-		void setPasswords(TDENetworkSettingsMap secrets);
-
-	private:
-		VPNCAuthenticationWidget* _vpncAuth;
-};
-
-#endif /* KNETWORKMANAGER_VPNC_H */
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp
new file mode 100644
index 0000000..aff389b
--- /dev/null
+++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp
@@ -0,0 +1,403 @@
+/***************************************************************************
+ *
+ * tdenetman-vpnc.cpp - A NetworkManager frontend for TDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ * Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
+ *
+ * Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
+ * Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ **************************************************************************/
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <tqmessagebox.h>
+#include <tqbutton.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <tqobjectlist.h>
+#include <tqobject.h>
+#include <tqcheckbox.h>
+#include <kpassdlg.h>
+#include <kgenericfactory.h>
+#include <tqlabel.h>
+#include <string>
+#include <stdio.h>
+
+#include "tdenetman-vpnc.h"
+using namespace std;
+
+typedef KGenericFactory<VPNCPlugin> VPNCPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc"));
+
+#define NAT_MODE_CISCO 0
+#define NAT_MODE_NATT 1
+#define NAT_MODE_DISABLED 2
+
+char linedata [2048];
+
+VPNCPlugin::VPNCPlugin(TQObject* parent, const char* name, const TQStringList& args) 
+	: VPNPlugin(parent, name, args)
+{
+	KLocale* loc = KGlobal::locale();
+	loc->insertCatalogue("NetworkManager-vpnc");
+}
+
+VPNCPlugin::~VPNCPlugin()
+{
+
+}
+
+VPNConfigWidget* VPNCPlugin::CreateConfigWidget(TQWidget* parent)
+{
+	return new VPNCConfig(parent);
+}
+
+VPNAuthenticationWidget* VPNCPlugin::CreateAuthenticationWidget(TQWidget* parent)
+{
+	return new VPNCAuthentication(parent);
+}
+
+
+VPNCConfig::VPNCConfig(TQWidget* parent)
+	: VPNConfigWidget(parent)
+{
+	TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
+	_vpncWidget = new VPNCConfigWidget(this);
+	layout->addWidget(_vpncWidget);
+
+	connect(_vpncWidget->pcfImport, TQT_SIGNAL(clicked()), this, TQT_SLOT( pcfImport()) );	
+
+	//connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->Xauth_username, TQT_SLOT(setEnabled(bool)));
+	//connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblUsername, TQT_SLOT(setEnabled(bool)));
+
+	connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->Domain, TQT_SLOT(setEnabled(bool)));
+	connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblDomain, TQT_SLOT(setEnabled(bool)));
+
+	connect(_vpncWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _vpncWidget->routes, TQT_SLOT(setEnabled(bool)));
+
+	connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->nat_keep_alive_interval, TQT_SLOT(setEnabled(bool)));
+	connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblKeepAliveInterval, TQT_SLOT(setEnabled(bool)));
+
+	_vpncWidget->cboNAT->insertItem(i18n("Cisco UDP (default)"), NAT_MODE_CISCO);
+	_vpncWidget->cboNAT->insertItem(i18n("NAT-T"), NAT_MODE_NATT);
+	_vpncWidget->cboNAT->insertItem(i18n("Disabled"), NAT_MODE_DISABLED);
+
+	this->languageChange();
+}
+
+VPNCConfig::~VPNCConfig()
+{
+
+}
+
+void VPNCConfig::languageChange()
+{
+
+}
+
+int VPNCConfig::getFileConfig(char *parameter, char *line) {
+	int i;
+
+	if (strstr(line, parameter) != NULL) {
+		if ((strstr(line, parameter) - line) == 0) {
+			for (i=0; i<(strlen(line)-strlen(parameter));i++) {
+				linedata[i] = line[i+strlen(parameter)];
+				if ((linedata[i] == 10) || (linedata[i] == 13)) {
+					linedata[i] = 0;
+				}
+			}
+			linedata[i-1]=0;
+
+			return 0;
+		}
+		else {
+			return 1;
+		}
+	}
+	else {
+		return 1;
+	}
+}
+
+void VPNCConfig::pcfImport()
+{
+	const TQString& pcf_file = TQString(_vpncWidget->editPCF->url());
+	printf("Asked for PCF import from file %s\n\r", pcf_file.ascii());
+	int i;
+
+	FILE *file = fopen ( pcf_file.ascii(), "r" );
+	if ( file != NULL ) {
+		char line [2048];	// or other suitable maximum line size
+		// read a line
+		while ( fgets ( line, sizeof line, file ) != NULL ) {
+			// Parse the line and update global variables (current line in variable "line")
+			if (getFileConfig("Host=", line) == 0) {
+				//strdup(linedata)
+				printf("Got configuration parameter Host with data %s\n\r", linedata);
+				_vpncWidget->IPSec_gateway->setText(linedata);
+			}
+			if (getFileConfig("GroupName=", line) == 0) {
+				printf("Got configuration parameter GroupName with data %s\n\r", linedata);
+				_vpncWidget->IPSec_ID->setText(linedata);
+			}
+// 			if (getFileConfig("TcpTunnelingPort=", line) == 0) {
+// 				printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata);
+// 				_vpncWidget->IPSec_ID->setText(linedata);
+// 			}
+			if (getFileConfig("NTDomain=", line) == 0) {
+				if (strlen(linedata) > 0) {
+					printf("Got configuration parameter NTDomain with data %s\n\r", linedata);
+					_vpncWidget->Domain->setText(linedata);
+					_vpncWidget->chkUseDomain->setChecked(true);
+				}
+			}
+			if (getFileConfig("GroupPwd=", line) == 0) {
+				if (strlen(linedata) > 0) {
+					printf("Got configuration parameter GroupPwd with data %s\n\r", linedata);
+					KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(linedata));
+				}
+			}
+			if (getFileConfig("enc_GroupPwd=", line) == 0) {
+				if (strlen(linedata) > 0) {
+					printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata);
+
+					// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
+					string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
+					FILE *pipe_decrypt;
+					char decrypted_result[2048];
+					int i;
+
+					decryptcommand.append(linedata);
+					printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
+					if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
+					{
+						printf("Group password decrypt error\n\r");
+					}
+					else {
+						fgets(decrypted_result, 2048, pipe_decrypt);
+						pclose(pipe_decrypt);
+						for (i=0;i<2048;i++) {
+							if (decrypted_result[i] == 0) {
+								decrypted_result[i-1]=0;
+								i=2048;
+							}
+						}
+						printf("Group password decrypt result: '%s'\n\r", decrypted_result);
+					}
+					KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(decrypted_result));
+				}
+			}
+		}
+		fclose ( file );
+	}
+	else
+	{
+		//printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii());
+		KMessageBox::error(this, i18n("That configuration file does not exist!"));
+	}
+}
+
+void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
+{
+	// fill up our inputfields (only textfields atm)
+	for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
+	{
+		TQString entry = it.key();
+		TQString value = it.data();
+
+		if (entry == "IPSec gateway")
+		{
+			_vpncWidget->IPSec_gateway->setText(value);
+		}
+		else if (entry == "IPSec ID")
+		{
+			_vpncWidget->IPSec_ID->setText(value);
+		}
+		else if (entry == "Xauth username")
+		{
+			_vpncWidget->Xauth_username->setText(value);
+			//_vpncWidget->chkOverrideUsername->setChecked(true);
+		}
+		else if (entry == "Domain")
+		{
+			_vpncWidget->Domain->setText(value);
+			_vpncWidget->chkUseDomain->setChecked(true);
+		}
+		else if (entry == "NAT-Keepalive packet interval")
+		{
+			_vpncWidget->nat_keep_alive_interval->setText(value);
+			_vpncWidget->chkUseKeepAlive->setChecked(true);
+		}
+		// backwards compatibility
+		else if (entry == "Disable NAT Traversal")
+		{
+			_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
+		}
+		else if (entry == "NAT Traversal Mode")
+		{
+			if (value == "natt")
+				_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_NATT);
+			else if (value == "cisco-udp")
+				_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_CISCO);
+			else if (value == "none")
+				_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
+			else
+			{
+				// FIXME: unknown NAT mode
+			}
+		}
+		else if (entry == "Enable Single DES")
+		{
+			_vpncWidget->chkSingleDES->setChecked(value == "yes" || value == "true");
+		}
+	}
+
+	// set routes
+	if (!routes.empty())
+	{
+		_vpncWidget->chkIPAdresses->setChecked(true);
+		_vpncWidget->routes->setText(routes.join(" "));
+	}
+}
+
+TQMap<TQString, TQString> VPNCConfig::getVPNProperties()
+{
+	// build a StingList of properties
+	TQMap<TQString, TQString> strlist;
+	strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text()));
+	strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text()));
+
+	//if (_vpncWidget->chkOverrideUsername->isChecked())
+		strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text()));
+
+	if (_vpncWidget->chkUseDomain->isChecked())
+		strlist.insert("Domain", TQString(_vpncWidget->Domain->text()));
+
+	if (_vpncWidget->chkUseKeepAlive->isChecked())
+		strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text()));
+
+	switch (_vpncWidget->cboNAT->currentItem())
+	{
+		case NAT_MODE_CISCO:
+			strlist.insert("NAT Traversal Mode", "cisco-udp");
+			break;
+		case NAT_MODE_NATT:
+			strlist.insert("NAT Traversal Mode", "natt");
+			break;
+		case NAT_MODE_DISABLED:
+		default:
+			strlist.insert("NAT Traversal Mode", "none");
+			break;
+	}
+
+	if (_vpncWidget->chkSingleDES->isChecked())
+		strlist.insert("Enable Single DES", "yes");
+	else
+		strlist.insert("Enable Single DES", "no");
+
+	return strlist;
+}
+
+TQStringList VPNCConfig::getVPNRoutes()
+{
+	TQStringList strlist;
+	if(_vpncWidget->chkIPAdresses->isChecked())
+	{
+		strlist = TQStringList::split(" ", _vpncWidget->routes->text());
+	}
+	return strlist;
+
+}
+
+bool VPNCConfig::hasChanged()
+{
+	return true;
+}
+
+bool VPNCConfig::isValid(TQStringList& err_msg)
+{
+	bool retval = true;
+	if(_vpncWidget->IPSec_gateway->text() == "" || _vpncWidget->IPSec_ID->text() == "")
+	{
+		err_msg.append(i18n("At least the gateway and group has to be supplied."));
+		retval = false;
+	}
+	return retval;
+}
+
+VPNCAuthentication::VPNCAuthentication(TQWidget* parent, char* name)
+	: VPNAuthenticationWidget(parent, name)
+{
+	TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
+	_vpncAuth = new VPNCAuthenticationWidget(this);
+	layout->addWidget(_vpncAuth);
+}
+
+VPNCAuthentication::~VPNCAuthentication()
+{
+
+}
+
+TQMap<TQString, TQString> VPNCAuthentication::getPasswords()
+{
+	TQMap<TQString, TQString> pwds;
+	pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password()));
+	if (_vpncAuth->chkObfusticated->isChecked()) {
+		// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
+		string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
+		FILE *pipe_decrypt;
+		char decrypted_result[2048];
+		int i;
+
+		decryptcommand.append(_vpncAuth->editGroupPassword->password());
+		printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
+		if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
+		{
+			printf("Group password decrypt error\n\r");
+		}
+		else {
+			fgets(decrypted_result, 2048, pipe_decrypt);
+			pclose(pipe_decrypt);
+			for (i=0;i<2048;i++) {
+				if (decrypted_result[i] == 0) {
+					decrypted_result[i-1]=0;
+					i=2048;
+				}
+			}
+			printf("Group password decrypt result: '%s'\n\r", decrypted_result);
+			pwds.insert("IPSec secret", TQString(decrypted_result));
+		}
+	}
+	else {
+		pwds.insert("IPSec secret", TQString(_vpncAuth->editGroupPassword->password()));
+	}
+	return pwds;
+}
+
+void VPNCAuthentication::setPasswords(TQString name, TQString value) {
+	if (name == TQString("Xauth password")) {
+		_vpncAuth->editUserPassword->erase();
+		_vpncAuth->editUserPassword->insert(value);
+	}
+	else if (name == TQString("IPSec secret")) {
+		_vpncAuth->editGroupPassword->erase();
+		_vpncAuth->editGroupPassword->insert(value);
+	}
+}
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h
new file mode 100644
index 0000000..0b3b23c
--- /dev/null
+++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE 
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
+ * Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNC_H
+#define KNETWORKMANAGER_VPNC_H
+
+#include <tqmap.h>
+#include <tqstring.h>
+#include <tqwidget.h>
+#include <tqlayout.h>
+
+#include "knetworkmanager-vpnplugin.h"
+#include "vpncprop.h"
+#include "vpncauth.h"
+
+class VPNCPlugin : public VPNPlugin
+{
+	Q_OBJECT
+  
+	public:
+		VPNCPlugin(TQObject*, const char*, const TQStringList&);
+		~VPNCPlugin();
+
+		VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
+		VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
+};
+
+class VPNCConfig : public VPNConfigWidget
+{
+	Q_OBJECT
+
+	public:
+		void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&);
+		TDENetworkSettingsMap getVPNProperties();
+		TDENetworkSettingsMap getVPNSecrets();
+		TQStringList getVPNRoutes();
+		bool hasChanged();
+		bool isValid(TQStringList&);
+
+		VPNCConfig(TQWidget* parent);
+		~VPNCConfig();
+
+	public slots:
+		void pcfImport();
+
+	private:
+		VPNCConfigWidget*   _vpncWidget;
+		int getFileConfig(char *parameter, char *line);
+
+	protected slots:
+		void languageChange();
+};
+
+class VPNCAuthentication : public VPNAuthenticationWidget
+{
+	Q_OBJECT
+
+	public:
+		VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL);
+		~VPNCAuthentication();
+		TDENetworkSettingsMap getPasswords();
+		void setPasswords(TDENetworkSettingsMap secrets);
+
+	private:
+		VPNCAuthenticationWidget* _vpncAuth;
+};
+
+#endif /* KNETWORKMANAGER_VPNC_H */
diff --git a/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop b/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop
new file mode 100644
index 0000000..64ad398
--- /dev/null
+++ b/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop
@@ -0,0 +1,23 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Icon=
+ServiceTypes=TDENetworkManager/VPNPlugin
+X-TDE-Library=tdenetman_vpnc
+X-NetworkManager-Services=vpnc
+X-TDE-PluginInfo-Author=Timothy Pearson
+X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net
+X-TDE-PluginInfo-Name=tdenetman_vpnc
+X-TDE-PluginInfo-Version=0.1
+X-TDE-PluginInfo-Website=
+X-TDE-PluginInfo-Category=VPNService
+X-TDE-PluginInfo-Depends=
+X-TDE-PluginInfo-License=GPL
+X-TDE-PluginInfo-EnabledByDefault=false
+Name=VPNC
+Name[bn]=ভিপিএনসি
+Name[xx]=xxVPNCxx
+Comment=VPNC
+Comment[bn]=ভিপিএনসি
+Comment[xx]=xxVPNCxx
+
-- 
cgit v1.2.3

