[NetworkManager-fortisslvpn] service: add support for cert-only authentication
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-fortisslvpn] service: add support for cert-only authentication
- Date: Sun, 14 Feb 2021 10:01:00 +0000 (UTC)
commit 7e401f583581ae5bb68434b4765b2cc64239f9bb
Author: Kamus Hadenes <kamushadenes hyadesinc com>
Date: Thu Mar 26 15:16:42 2020 -0300
service: add support for cert-only authentication
[lkundrak v3 sk: tidied up a bit]
https://gitlab.gnome.org/GNOME/NetworkManager-fortisslvpn/-/merge_requests/14
src/nm-fortisslvpn-service.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c
index 9af823d..707447e 100644
--- a/src/nm-fortisslvpn-service.c
+++ b/src/nm-fortisslvpn-service.c
@@ -390,21 +390,24 @@ get_credentials (NMSettingVpn *s_vpn,
const char **otp,
GError **error)
{
+ const char *cert;
+
+ cert = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_CERT);
+
/* Username; try SSLVPN specific username first, then generic username */
*username = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_USER);
- if (!*username || !strlen (*username)) {
+ if (!*username || !strlen (*username))
*username = nm_setting_vpn_get_user_name (s_vpn);
- if (!*username || !strlen (*username)) {
- g_set_error_literal (error,
- NM_VPN_PLUGIN_ERROR,
- NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
- _("Missing VPN username."));
- return FALSE;
- }
+ if (!cert && (!*username || !strlen (*username))) {
+ g_set_error_literal (error,
+ NM_VPN_PLUGIN_ERROR,
+ NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
+ _("Missing VPN username."));
+ return FALSE;
}
*password = nm_setting_vpn_get_secret (s_vpn, NM_FORTISSLVPN_KEY_PASSWORD);
- if (!*password || !strlen (*password)) {
+ if (!cert && (!*password || !strlen (*password))) {
g_set_error_literal (error,
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
@@ -458,7 +461,8 @@ real_connect (NMVpnServicePlugin *plugin, NMConnection *connection, GError **err
"password = %s"
"%s%s"
"%s%s\n",
- username, password,
+ username ? username : "",
+ password ? password : "",
realm ? "\nrealm = " : "", realm ? realm : "",
otp ? "\notp = " : "", otp ? otp : "");
old_umask = umask (0077);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]