Commit ce91de02 authored by Johan Ouwerkerk's avatar Johan Ouwerkerk
Browse files

Fix importing key-direction from *.ovpn files

Summary:
It is possible for key-direction to be specified *after* <tls-auth>.
Previously the code always expected it to be defined before, with this
change *.ovpn files that define it after should also be imported correctly.

Reviewers: jgrulich!

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D29781
parent 847aaf3b
......@@ -531,6 +531,19 @@ NMVariantMapMap OpenVpnUiPlugin::importConnectionSettings(const QString &fileNam
KMessageBox::information(nullptr, i18n("Invalid argument in option: %1", line));
key_direction = -1;
}
// `key-direction` may also be specified *after* the <tls-auth> etc. block in an *.ovpn file
if (key_direction > -1) {
if (dataMap.contains(QLatin1String(NM_OPENVPN_KEY_TA))
&& !dataMap.contains(QLatin1String(NM_OPENVPN_KEY_TA_DIR))) {
dataMap.insert(QLatin1String(NM_OPENVPN_KEY_TA_DIR), QString().setNum(key_direction));
}
if (dataMap.contains(QLatin1String(NM_OPENVPN_KEY_KEY))
&& !dataMap.contains(QLatin1String(NM_OPENVPN_KEY_STATIC_KEY_DIRECTION))) {
dataMap.insert(QLatin1String(NM_OPENVPN_KEY_STATIC_KEY_DIRECTION), QString().setNum(key_direction));
}
}
continue;
}
......
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