[NetworkManager-fortisslvpn] service: add the capability to set the realm



commit 390cc4c56e242010f47acfe8a1a4e7bd7c9784d7
Author: emelenas <emelenas gmail com>
Date:   Mon Jan 7 12:18:08 2019 +0000

    service: add the capability to set the realm
    
    Realms are authentication user groups that can be defined to give
    different access rights to the network.
    
    The realm field needs to be included in the config file, and checked for
    validity. Then, it has to be passed on to openfortivpn in the command line
    arguments with the --realm key.
    
    [lkundrak v3 sk: tidied up whitespace and commit message, removed the
    GtkBuilder part]
    
    https://gitlab.gnome.org/GNOME/NetworkManager-fortisslvpn/merge_requests/6

 shared/nm-fortissl-properties.c | 1 +
 shared/nm-service-defines.h     | 1 +
 src/nm-fortisslvpn-service.c    | 6 ++++++
 3 files changed, 8 insertions(+)
---
diff --git a/shared/nm-fortissl-properties.c b/shared/nm-fortissl-properties.c
index 23a8870..f9713c3 100644
--- a/shared/nm-fortissl-properties.c
+++ b/shared/nm-fortissl-properties.c
@@ -39,6 +39,7 @@ static const ValidProperty valid_properties[] = {
        { NM_FORTISSLVPN_KEY_TRUSTED_CERT,      G_TYPE_STRING, FALSE },
        { NM_FORTISSLVPN_KEY_CERT,              G_TYPE_STRING, FALSE },
        { NM_FORTISSLVPN_KEY_KEY,               G_TYPE_STRING, FALSE },
+       { NM_FORTISSLVPN_KEY_REALM,             G_TYPE_STRING, FALSE },
        { NM_FORTISSLVPN_KEY_PASSWORD"-flags",  G_TYPE_UINT,   FALSE },
        { NM_FORTISSLVPN_KEY_OTP"-flags",       G_TYPE_UINT,   FALSE },
        { NULL }
diff --git a/shared/nm-service-defines.h b/shared/nm-service-defines.h
index 4bec745..449b233 100644
--- a/shared/nm-service-defines.h
+++ b/shared/nm-service-defines.h
@@ -37,5 +37,6 @@
 #define NM_FORTISSLVPN_KEY_CERT              "cert"
 #define NM_FORTISSLVPN_KEY_KEY               "key"
 #define NM_FORTISSLVPN_KEY_TRUSTED_CERT      "trusted-cert"
+#define NM_FORTISSLVPN_KEY_REALM             "realm"
 
 #endif /* __NM_SERVICE_DEFINES_H__ */
diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c
index ed182bb..bc23a7b 100644
--- a/src/nm-fortisslvpn-service.c
+++ b/src/nm-fortisslvpn-service.c
@@ -265,6 +265,12 @@ run_openfortivpn (NMFortisslvpnPlugin *plugin, NMSettingVpn *s_vpn, GError **err
        g_ptr_array_add (argv, (gpointer) g_strdup ("--pppd-plugin"));
        g_ptr_array_add (argv, (gpointer) g_strdup (NM_FORTISSLVPN_PPPD_PLUGIN));
 
+       value = nm_setting_vpn_get_data_item (s_vpn, NM_FORTISSLVPN_KEY_REALM);
+       if (value) {
+               g_ptr_array_add (argv, (gpointer) g_strdup ("--realm"));
+               g_ptr_array_add (argv, (gpointer) g_strdup (value));
+       }
+
        g_ptr_array_add (argv, NULL);
 
        _LOGD ("start %s", (str_tmp = g_strjoinv (" ", (char **) argv->pdata)));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]