Commit ca024a44 authored by Andrius Štikonas's avatar Andrius Štikonas Committed by Jan Grulich
Browse files

Added new option to pick reported OS with openconnect

parent c539786a
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#define NM_OPENCONNECT_KEY_CSD_WRAPPER "csd_wrapper" #define NM_OPENCONNECT_KEY_CSD_WRAPPER "csd_wrapper"
#define NM_OPENCONNECT_KEY_TOKEN_MODE "stoken_source" #define NM_OPENCONNECT_KEY_TOKEN_MODE "stoken_source"
#define NM_OPENCONNECT_KEY_TOKEN_SECRET "stoken_string" #define NM_OPENCONNECT_KEY_TOKEN_SECRET "stoken_string"
#define NM_OPENCONNECT_KEY_REPORTED_OS "reported_os"
#define NM_OPENCONNECT_USER "nm-openconnect" #define NM_OPENCONNECT_USER "nm-openconnect"
......
...@@ -218,6 +218,10 @@ void OpenconnectAuthWidget::readConfig() ...@@ -218,6 +218,10 @@ void OpenconnectAuthWidget::readConfig()
const QString protocol = dataMap[NM_OPENCONNECT_KEY_PROTOCOL]; const QString protocol = dataMap[NM_OPENCONNECT_KEY_PROTOCOL];
openconnect_set_protocol(d->vpninfo, OC3DUP(protocol == "juniper" ? "nc" : protocol.toUtf8().data())); openconnect_set_protocol(d->vpninfo, OC3DUP(protocol == "juniper" ? "nc" : protocol.toUtf8().data()));
} }
if (!dataMap[NM_OPENCONNECT_KEY_REPORTED_OS].isEmpty()) {
const QString reportedOs = dataMap[NM_OPENCONNECT_KEY_REPORTED_OS];
openconnect_set_reported_os(d->vpninfo, reportedOs.toUtf8().data());
}
d->tokenMode = dataMap[NM_OPENCONNECT_KEY_TOKEN_MODE].toUtf8(); d->tokenMode = dataMap[NM_OPENCONNECT_KEY_TOKEN_MODE].toUtf8();
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>418</width> <width>418</width>
<height>488</height> <height>518</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLineEdit" name="leProxy"/> <widget class="QLineEdit" name="leProxy"/>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>CSD Wrapper Script:</string> <string>CSD Wrapper Script:</string>
...@@ -85,14 +85,14 @@ ...@@ -85,14 +85,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="chkAllowTrojan"> <widget class="QCheckBox" name="chkAllowTrojan">
<property name="text"> <property name="text">
<string>Allow Cisco Secure Desktop trojan</string> <string>Allow Cisco Secure Desktop trojan</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="KUrlRequester" name="leCsdWrapperScript"/> <widget class="KUrlRequester" name="leCsdWrapperScript"/>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
...@@ -130,6 +130,58 @@ ...@@ -130,6 +130,58 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Reported OS:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="cmbReportedOs">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>GNU/Linux</string>
</property>
</item>
<item>
<property name="text">
<string>GNU/Linux 64-bit</string>
</property>
</item>
<item>
<property name="text">
<string>Windows</string>
</property>
</item>
<item>
<property name="text">
<string>Mac OS X</string>
</property>
</item>
<item>
<property name="text">
<string>Android</string>
</property>
</item>
<item>
<property name="text">
<string>Apple iOS</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
...@@ -234,7 +286,7 @@ ...@@ -234,7 +286,7 @@
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>KUrlRequester</class> <class>KUrlRequester</class>
<extends>QFrame</extends> <extends>QWidget</extends>
<header>kurlrequester.h</header> <header>kurlrequester.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
......
...@@ -192,10 +192,28 @@ void OpenconnectSettingWidget::loadConfig(const NetworkManager::Setting::Ptr &se ...@@ -192,10 +192,28 @@ void OpenconnectSettingWidget::loadConfig(const NetworkManager::Setting::Ptr &se
cmbProtocolIndex = 2; // paloAlto/GlobalProtect (gp) cmbProtocolIndex = 2; // paloAlto/GlobalProtect (gp)
} }
int cmbReportedOsIndex;
if (dataMap[NM_OPENCONNECT_KEY_REPORTED_OS] == QString()) {
cmbReportedOsIndex = 0;
} else if (dataMap[NM_OPENCONNECT_KEY_REPORTED_OS] == QLatin1String("linux")) {
cmbReportedOsIndex = 1;
} else if (dataMap[NM_OPENCONNECT_KEY_REPORTED_OS] == QLatin1String("linux-64")) {
cmbReportedOsIndex = 2;
} else if (dataMap[NM_OPENCONNECT_KEY_REPORTED_OS] == QLatin1String("win")) {
cmbReportedOsIndex = 3;
} else if (dataMap[NM_OPENCONNECT_KEY_REPORTED_OS] == QLatin1String("mac-intel")) {
cmbReportedOsIndex = 4;
} else if (dataMap[NM_OPENCONNECT_KEY_REPORTED_OS] == QLatin1String("android")) {
cmbReportedOsIndex = 5;
} else {
cmbReportedOsIndex = 6; // apple-ios
}
d->ui.cmbProtocol->setCurrentIndex(cmbProtocolIndex); d->ui.cmbProtocol->setCurrentIndex(cmbProtocolIndex);
d->ui.leGateway->setText(dataMap[NM_OPENCONNECT_KEY_GATEWAY]); d->ui.leGateway->setText(dataMap[NM_OPENCONNECT_KEY_GATEWAY]);
d->ui.leCaCertificate->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_CACERT])); d->ui.leCaCertificate->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_CACERT]));
d->ui.leProxy->setText(dataMap[NM_OPENCONNECT_KEY_PROXY]); d->ui.leProxy->setText(dataMap[NM_OPENCONNECT_KEY_PROXY]);
d->ui.cmbReportedOs->setCurrentIndex(cmbReportedOsIndex);
d->ui.chkAllowTrojan->setChecked(dataMap[NM_OPENCONNECT_KEY_CSD_ENABLE] == "yes"); d->ui.chkAllowTrojan->setChecked(dataMap[NM_OPENCONNECT_KEY_CSD_ENABLE] == "yes");
d->ui.leCsdWrapperScript->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_CSD_WRAPPER])); d->ui.leCsdWrapperScript->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_CSD_WRAPPER]));
d->ui.leUserCert->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_USERCERT])); d->ui.leUserCert->setUrl(QUrl::fromLocalFile(dataMap[NM_OPENCONNECT_KEY_USERCERT]));
...@@ -258,6 +276,30 @@ QVariantMap OpenconnectSettingWidget::setting() const ...@@ -258,6 +276,30 @@ QVariantMap OpenconnectSettingWidget::setting() const
protocol = QLatin1String("gp"); protocol = QLatin1String("gp");
} }
QString reportedOs;
switch (d->ui.cmbReportedOs->currentIndex()) {
case 0:
reportedOs = QString();
break;
case 1:
reportedOs = QLatin1String("linux");
break;
case 2:
reportedOs = QLatin1String("linux-64");
break;
case 3:
reportedOs = QLatin1String("win");
break;
case 4:
reportedOs = QLatin1String("mac-intel");
break;
case 5:
reportedOs = QLatin1String("android");
break;
default:
reportedOs = QLatin1String("apple-ios");
}
data.insert(NM_OPENCONNECT_KEY_PROTOCOL, protocol); data.insert(NM_OPENCONNECT_KEY_PROTOCOL, protocol);
data.insert(QLatin1String(NM_OPENCONNECT_KEY_GATEWAY), d->ui.leGateway->text()); data.insert(QLatin1String(NM_OPENCONNECT_KEY_GATEWAY), d->ui.leGateway->text());
if (d->ui.leCaCertificate->url().isValid()) { if (d->ui.leCaCertificate->url().isValid()) {
...@@ -266,6 +308,7 @@ QVariantMap OpenconnectSettingWidget::setting() const ...@@ -266,6 +308,7 @@ QVariantMap OpenconnectSettingWidget::setting() const
if (!d->ui.leProxy->text().isEmpty()) { if (!d->ui.leProxy->text().isEmpty()) {
data.insert(QLatin1String(NM_OPENCONNECT_KEY_PROXY), d->ui.leProxy->text()); data.insert(QLatin1String(NM_OPENCONNECT_KEY_PROXY), d->ui.leProxy->text());
} }
data.insert(NM_OPENCONNECT_KEY_REPORTED_OS, reportedOs);
data.insert(QLatin1String(NM_OPENCONNECT_KEY_CSD_ENABLE), d->ui.chkAllowTrojan->isChecked() ? "yes" : "no"); data.insert(QLatin1String(NM_OPENCONNECT_KEY_CSD_ENABLE), d->ui.chkAllowTrojan->isChecked() ? "yes" : "no");
if (d->ui.leCsdWrapperScript->url().isValid()) { if (d->ui.leCsdWrapperScript->url().isValid()) {
data.insert(QLatin1String(NM_OPENCONNECT_KEY_CSD_WRAPPER), d->ui.leCsdWrapperScript->url().toLocalFile()); data.insert(QLatin1String(NM_OPENCONNECT_KEY_CSD_WRAPPER), d->ui.leCsdWrapperScript->url().toLocalFile());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment