|
|
|
@ -69,35 +69,35 @@ VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* par
|
|
|
|
|
/************************************
|
|
|
|
|
* OpenVPNConnectionType
|
|
|
|
|
************************************/
|
|
|
|
|
OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop)
|
|
|
|
|
OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(TQString prop)
|
|
|
|
|
{
|
|
|
|
|
if (prop == 0)
|
|
|
|
|
if (prop == "tls")
|
|
|
|
|
return X509;
|
|
|
|
|
else if (prop == 1)
|
|
|
|
|
else if (prop == "static-key")
|
|
|
|
|
return SHARED_KEY;
|
|
|
|
|
else if (prop == 2)
|
|
|
|
|
else if (prop == "password")
|
|
|
|
|
return PASSWORD;
|
|
|
|
|
else if (prop == 3)
|
|
|
|
|
else if (prop == "password-tls")
|
|
|
|
|
return X509USERPASS;
|
|
|
|
|
return UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
|
|
|
|
|
TQString OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
|
|
|
|
|
{
|
|
|
|
|
switch(connType)
|
|
|
|
|
{
|
|
|
|
|
case X509:
|
|
|
|
|
return 0;
|
|
|
|
|
return "tls";
|
|
|
|
|
case SHARED_KEY:
|
|
|
|
|
return 1;
|
|
|
|
|
return "static-key";
|
|
|
|
|
case PASSWORD:
|
|
|
|
|
return 2;
|
|
|
|
|
return "password";
|
|
|
|
|
case X509USERPASS:
|
|
|
|
|
return 3;
|
|
|
|
|
return "password-tls";
|
|
|
|
|
default:
|
|
|
|
|
return -1;
|
|
|
|
|
return TQString::null;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
return TQString::null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************************
|
|
|
|
@ -201,7 +201,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
|
|
|
|
|
|
|
|
|
|
if (entry == "connection-type")
|
|
|
|
|
{
|
|
|
|
|
OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt());
|
|
|
|
|
OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value);
|
|
|
|
|
_openvpnWidget->cboConnectionType->setCurrentItem(type);
|
|
|
|
|
_openvpnWidget->widgetStack->raiseWidget(type);
|
|
|
|
|
}
|
|
|
|
@ -221,9 +221,13 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
|
|
|
|
|
_openvpnWidget->chkDefaultPort->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "proto" || entry == "proto-tcp")
|
|
|
|
|
else if (entry == "proto")
|
|
|
|
|
{
|
|
|
|
|
_openvpnWidget->chkUseTCP->setChecked( value == "yes");
|
|
|
|
|
_openvpnWidget->chkUseTCP->setChecked(value == "yes");
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "proto-tcp")
|
|
|
|
|
{
|
|
|
|
|
_openvpnWidget->chkUseTCP->setChecked(value == "yes");
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "ca")
|
|
|
|
|
{
|
|
|
|
@ -244,7 +248,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "comp-lzo")
|
|
|
|
|
{
|
|
|
|
|
_openvpnWidget->chkUseLZO->setChecked(value == "true");
|
|
|
|
|
_openvpnWidget->chkUseLZO->setChecked(value == "yes");
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "shared-key" || entry == "static-key")
|
|
|
|
|
{
|
|
|
|
@ -262,8 +266,8 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
|
|
|
|
|
{
|
|
|
|
|
_openvpnWidget->editRemoteIP->setText(value);
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "dev" || entry == "tap-dev") {
|
|
|
|
|
_openvpnWidget->chkUseTAP->setChecked(value == "true");
|
|
|
|
|
else if (entry == "tap-dev") {
|
|
|
|
|
_openvpnWidget->chkUseTAP->setChecked(value == "yes");
|
|
|
|
|
}
|
|
|
|
|
else if (entry == "ta")
|
|
|
|
|
{
|
|
|
|
@ -295,7 +299,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
|
|
|
|
|
TDENetworkSettingsMap OpenVPNConfig::getVPNProperties()
|
|
|
|
|
{
|
|
|
|
|
// Build a list of properties
|
|
|
|
|
m_vpnProperties.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem())));
|
|
|
|
|
m_vpnProperties.insert("connection-type", OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem()));
|
|
|
|
|
m_vpnProperties.insert("remote", TQString(_openvpnWidget->gateway->text()));
|
|
|
|
|
|
|
|
|
|
// port is not necessary
|
|
|
|
@ -318,10 +322,10 @@ TDENetworkSettingsMap OpenVPNConfig::getVPNProperties()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_openvpnWidget->chkUseLZO->isChecked()) {
|
|
|
|
|
m_vpnProperties.insert("comp-lzo", TQString("true"));
|
|
|
|
|
m_vpnProperties.insert("comp-lzo", TQString("yes"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_vpnProperties.insert("comp-lzo", TQString("false"));
|
|
|
|
|
m_vpnProperties.insert("comp-lzo", TQString("no"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_vpnProperties.insert("static-key", TQString(_openvpnWidget->editSharedKey->url()));
|
|
|
|
@ -330,12 +334,17 @@ TDENetworkSettingsMap OpenVPNConfig::getVPNProperties()
|
|
|
|
|
m_vpnProperties.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text()));
|
|
|
|
|
|
|
|
|
|
if (_openvpnWidget->chkUseTAP->isChecked()) {
|
|
|
|
|
m_vpnProperties.insert("tap-dev", "true");
|
|
|
|
|
m_vpnProperties.insert("proto-tcp", "true");
|
|
|
|
|
m_vpnProperties.insert("tap-dev", "yes");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_vpnProperties.insert("tap-dev", "no");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_openvpnWidget->chkUseTCP->isChecked()) {
|
|
|
|
|
m_vpnProperties.insert("proto-tcp", "yes");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_vpnProperties.insert("tap-dev", "false");
|
|
|
|
|
m_vpnProperties.insert("proto-tcp", "false");
|
|
|
|
|
m_vpnProperties.insert("proto-tcp", "no");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_openvpnWidget->chkUseTLS->isChecked()) {
|
|
|
|
@ -569,7 +578,7 @@ void OpenVPNAuthentication::setVPNData(TDENetworkSingleRouteConfigurationList& /
|
|
|
|
|
{
|
|
|
|
|
if (it.key() == "connection-type")
|
|
|
|
|
{
|
|
|
|
|
_connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt());
|
|
|
|
|
_connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|