Commit 1b2c616c authored by Ambroise Rosset's avatar Ambroise Rosset Committed by Jan Grulich
Browse files

Add the hability to tune the VPN useragent with the new function...

Add the hability to tune the VPN useragent with the new function openconnect_set_useragent added in opeconnect v9.0 (libopenconnect 5.8)
parent 261298a0
Pipeline #177185 passed with stage
in 2 minutes and 57 seconds
......@@ -29,6 +29,7 @@
#define NM_OPENCONNECT_KEY_PREVENT_INVALID_CERT "prevent_invalid_cert"
#define NM_OPENCONNECT_KEY_PROTOCOL "protocol"
#define NM_OPENCONNECT_KEY_PROXY "proxy"
#define NM_OPENCONNECT_KEY_USERAGENT "useragent"
#define NM_OPENCONNECT_KEY_CSD_ENABLE "enable_csd_trojan"
#define NM_OPENCONNECT_KEY_CSD_WRAPPER "csd_wrapper"
#define NM_OPENCONNECT_KEY_TOKEN_MODE "stoken_source"
......
......@@ -192,6 +192,12 @@ void OpenconnectAuthWidget::readConfig()
const QByteArray proxy = QFile::encodeName(dataMap[NM_OPENCONNECT_KEY_PROXY]);
openconnect_set_http_proxy(d->vpninfo, OC3DUP(proxy.data()));
}
#if OPENCONNECT_CHECK_VER(5, 8)
if (!dataMap[NM_OPENCONNECT_KEY_USERAGENT].isEmpty()) {
const QByteArray useragent = QFile::encodeName(dataMap[NM_OPENCONNECT_KEY_USERAGENT]);
openconnect_set_useragent(d->vpninfo, OC3DUP(useragent.data()));
}
#endif
if (!dataMap[NM_OPENCONNECT_KEY_USERCERT].isEmpty()) {
const QByteArray crt = QFile::encodeName(dataMap[NM_OPENCONNECT_KEY_USERCERT]);
const QByteArray key = QFile::encodeName(dataMap[NM_OPENCONNECT_KEY_PRIVKEY]);
......
......@@ -75,8 +75,21 @@
<item row="3" column="1">
<widget class="QLineEdit" name="leProxy"/>
</item>
<item row="6" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>User Agent:</string>
</property>
<property name="buddy">
<cstring>leUserAgent</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="leUserAgent"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>CSD Wrapper Script:</string>
</property>
......@@ -85,14 +98,14 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="chkAllowTrojan">
<property name="text">
<string>Allow Cisco Secure Desktop trojan</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="KUrlRequester" name="leCsdWrapperScript"/>
</item>
<item row="0" column="0">
......@@ -135,14 +148,14 @@
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Reported OS:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="cmbReportedOs">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
......
......@@ -318,6 +318,9 @@ QVariantMap OpenconnectSettingWidget::setting() const
if (!d->ui.leProxy->text().isEmpty()) {
data.insert(QLatin1String(NM_OPENCONNECT_KEY_PROXY), d->ui.leProxy->text());
}
if (!d->ui.leUserAgent->text().isEmpty()) {
data.insert(QLatin1String(NM_OPENCONNECT_KEY_USERAGENT), d->ui.leUserAgent->text());
}
data.insert(NM_OPENCONNECT_KEY_REPORTED_OS, reportedOs);
data.insert(QLatin1String(NM_OPENCONNECT_KEY_CSD_ENABLE), d->ui.chkAllowTrojan->isChecked() ? "yes" : "no");
if (d->ui.leCsdWrapperScript->url().isValid()) {
......
Supports Markdown
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