[network-manager-openconnect] all: add "Reported OS" option
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openconnect] all: add "Reported OS" option
- Date: Wed, 28 Jun 2017 08:14:37 +0000 (UTC)
commit 9fbe2817da437f473cf46205e19c38d273adc600
Author: Dmitrii Sutiagin <f3flight gmail com>
Date: Mon May 1 16:48:00 2017 +0000
all: add "Reported OS" option
https://bugzilla.gnome.org/show_bug.cgi?id=766239
https://bugzilla.gnome.org/show_bug.cgi?id=783846
https://bugzilla.gnome.org/show_bug.cgi?id=782016
auth-dialog/main.c | 5 ++
properties/nm-openconnect-dialog.ui | 83 +++++++++++++++++++++++++++++
properties/nm-openconnect-editor-plugin.c | 12 ++++
properties/nm-openconnect-editor.c | 15 +++++
shared/nm-service-defines.h | 1 +
src/nm-openconnect-service.c | 1 +
6 files changed, 117 insertions(+), 0 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 28929c7..fe4efed 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1025,6 +1025,7 @@ static int get_config (auth_ui_data *ui_data,
char *csd;
char *sslkey, *cert;
char *csd_wrapper;
+ char *reported_os;
char *pem_passphrase_fsid;
char *cafile;
char *token_mode;
@@ -1095,6 +1096,10 @@ static int get_config (auth_ui_data *ui_data,
openconnect_setup_csd(vpninfo, getuid(), 1, OC3DUP (csd_wrapper));
}
+ reported_os = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_REPORTED_OS);
+ if (reported_os && reported_os[0])
+ openconnect_set_reported_os(vpninfo, reported_os);
+
proxy = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_PROXY);
if (proxy && proxy[0] && openconnect_set_http_proxy(vpninfo, OC3DUP (proxy)))
return -EINVAL;
diff --git a/properties/nm-openconnect-dialog.ui b/properties/nm-openconnect-dialog.ui
index dc51f46..0bc6759 100644
--- a/properties/nm-openconnect-dialog.ui
+++ b/properties/nm-openconnect-dialog.ui
@@ -407,6 +407,89 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkAlignment" id="alignment18">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+ <child>
+ <object class="GtkTable" id="table5">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkAlignment" id="alignment19">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+ <child>
+ <object class="GtkEntry" id="reported_os">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"/>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">•</property>
+ <property name="activates_default">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Reported OS:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">reported_os</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="padding">0</property>
diff --git a/properties/nm-openconnect-editor-plugin.c b/properties/nm-openconnect-editor-plugin.c
index 7a03f24..ba8da00 100644
--- a/properties/nm-openconnect-editor-plugin.c
+++ b/properties/nm-openconnect-editor-plugin.c
@@ -179,6 +179,11 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
if (buf)
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_WRAPPER, buf);
+ /* Reported OS */
+ buf = g_key_file_get_string (keyfile, "openconnect", "ReportedOS", NULL);
+ if (buf)
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_REPORTED_OS, buf);
+
/* User Certificate */
buf = g_key_file_get_string (keyfile, "openconnect", "UserCertificate", NULL);
if (buf && strcmp(buf, "(null)"))
@@ -227,6 +232,7 @@ export (NMVpnEditorPlugin *iface,
const char *proxy = NULL;
gboolean csd_enable = FALSE;
const char *csd_wrapper = NULL;
+ const char *reported_os = NULL;
const char *usercert = NULL;
const char *privkey = NULL;
gboolean pem_passphrase_fsid = FALSE;
@@ -280,6 +286,10 @@ export (NMVpnEditorPlugin *iface,
if (value && strlen (value))
csd_wrapper = value;
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_REPORTED_OS);
+ if (value && strlen (value))
+ reported_os = value;
+
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_USERCERT);
if (value && strlen (value))
usercert = value;
@@ -318,6 +328,7 @@ export (NMVpnEditorPlugin *iface,
"Proxy=%s\n"
"CSDEnable=%s\n"
"CSDWrapper=%s\n"
+ "ReportedOS=%s\n"
"UserCertificate=%s\n"
"PrivateKey=%s\n"
"FSID=%s\n"
@@ -331,6 +342,7 @@ export (NMVpnEditorPlugin *iface,
/* Proxy */ proxy ? proxy : "",
/* Cisco Secure Desktop */ csd_enable ? "1" : "0",
/* CSD Wrapper Script */ csd_wrapper ? csd_wrapper : "",
+ /* Reported OS */ reported_os ? reported_os : "",
/* User Certificate */ usercert ? usercert : "",
/* Private Key */ privkey ? privkey : "",
/* FSID */ pem_passphrase_fsid ? "1" : "0",
diff --git a/properties/nm-openconnect-editor.c b/properties/nm-openconnect-editor.c
index b4ad947..2d22e74 100644
--- a/properties/nm-openconnect-editor.c
+++ b/properties/nm-openconnect-editor.c
@@ -373,6 +373,16 @@ init_editor_plugin (OpenconnectEditor *self, NMConnection *connection, GError **
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "reported_os"));
+ if (!widget)
+ return FALSE;
+ if (s_vpn) {
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_REPORTED_OS);
+ if (value)
+ gtk_entry_set_text (GTK_ENTRY (widget), value);
+ }
+ g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
+
if (init_token_ui (self, priv, s_vpn) == FALSE)
return FALSE;
@@ -456,6 +466,11 @@ update_connection (NMVpnEditor *iface,
if (str && strlen (str))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_WRAPPER, str);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "reported_os"));
+ str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ if (str && strlen (str))
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_REPORTED_OS, str);
+
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "token_mode"));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
diff --git a/shared/nm-service-defines.h b/shared/nm-service-defines.h
index 60dfb35..8918573 100644
--- a/shared/nm-service-defines.h
+++ b/shared/nm-service-defines.h
@@ -47,5 +47,6 @@
#define NM_OPENCONNECT_KEY_CSD_WRAPPER "csd_wrapper"
#define NM_OPENCONNECT_KEY_TOKEN_MODE "stoken_source"
#define NM_OPENCONNECT_KEY_TOKEN_SECRET "stoken_string"
+#define NM_OPENCONNECT_KEY_REPORTED_OS "reported_os"
#endif /* __NM_SERVICE_DEFINES_H__ */
diff --git a/src/nm-openconnect-service.c b/src/nm-openconnect-service.c
index 77934aa..ea3b700 100644
--- a/src/nm-openconnect-service.c
+++ b/src/nm-openconnect-service.c
@@ -93,6 +93,7 @@ static const ValidProperty valid_properties[] = {
{ NM_OPENCONNECT_KEY_CSD_WRAPPER, G_TYPE_STRING, 0, 0 },
{ NM_OPENCONNECT_KEY_TOKEN_MODE, G_TYPE_STRING, 0, 0 },
{ NM_OPENCONNECT_KEY_TOKEN_SECRET, G_TYPE_STRING, 0, 0 },
+ { NM_OPENCONNECT_KEY_REPORTED_OS, G_TYPE_STRING, 0, 0 },
{ NULL, G_TYPE_NONE, 0, 0 }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]