ALT Linux Bugzilla
– Attachment 21261 Details for
Bug 59004
Поддержка свободного выбора шифров в диалоге расширенных настроек
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Выбор алгоритмов для поля data-ciphers
NetworkManager-openvpn-1.12.5-alt-data-ciphers-picker.patch (text/plain), 5.69 KB, created by
Alexey Volkov
on 2026-05-05 16:37:22 MSK
(
hide
)
Description:
Выбор алгоритмов для поля data-ciphers
Filename:
MIME Type:
Creator:
Alexey Volkov
Created:
2026-05-05 16:37:22 MSK
Size:
5.69 KB
patch
obsolete
>diff --git a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui >index 3136669..b0f4ad3 100644 >--- a/properties/nm-openvpn-dialog.ui >+++ b/properties/nm-openvpn-dialog.ui >@@ -1753,6 +1753,23 @@ config: data-ciphers</property> > <property name="top-attach">2</property> > </packing> > </child> >+ <child> >+ <object class="GtkComboBox" id="data_ciphers_picker"> >+ <property name="visible">True</property> >+ <property name="can-focus">False</property> >+ <property name="tooltip-text" translatable="yes">Select a cipher to append it to the list.</property> >+ <child> >+ <object class="GtkCellRendererText" id="renderer_data_ciphers_picker"/> >+ <attributes> >+ <attribute name="text">0</attribute> >+ </attributes> >+ </child> >+ </object> >+ <packing> >+ <property name="left-attach">2</property> >+ <property name="top-attach">2</property> >+ </packing> >+ </child> > <child> > <object class="GtkLabel" id="label24"> > <property name="visible">True</property> >diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c >index 0f86b7c..27bbcdc 100644 >--- a/properties/nm-openvpn-editor.c >+++ b/properties/nm-openvpn-editor.c >@@ -1564,6 +1564,127 @@ ping_exit_restart_checkbox_toggled_cb (GtkWidget *check, gpointer user_data) > checkbox_toggled_update_widget_cb (check, spin); > } > >+static void >+data_ciphers_filter_cb (GtkEditable *editable, gpointer user_data) >+{ >+ const char *text = gtk_editable_get_text (editable); >+ GString *filtered = g_string_new (NULL); >+ gboolean changed = FALSE; >+ const char *p; >+ >+ for (p = text; *p; p++) { >+ char c = *p; >+ if (g_ascii_isalnum (c) || c == '-' || c == ':') >+ g_string_append_c (filtered, c); >+ else >+ changed = TRUE; >+ } >+ >+ if (changed) { >+ g_signal_handlers_block_by_func (editable, data_ciphers_filter_cb, user_data); >+ gtk_editable_set_text (editable, filtered->str); >+ g_signal_handlers_unblock_by_func (editable, data_ciphers_filter_cb, user_data); >+ } >+ >+ g_string_free (filtered, TRUE); >+} >+ >+static void >+populate_data_ciphers_picker (GtkComboBox *box) >+{ >+ gs_unref_object GtkListStore *store = NULL; >+ GtkTreeIter iter; >+ const char *openvpn_binary; >+ char *argv[3]; >+ >+ store = gtk_list_store_new (1, G_TYPE_STRING); >+ gtk_combo_box_set_model (box, GTK_TREE_MODEL (store)); >+ >+ gtk_list_store_append (store, &iter); >+ gtk_list_store_set (store, &iter, 0, _("â Add cipher â"), -1); >+ >+ openvpn_binary = nm_find_openvpn (); >+ if (openvpn_binary) { >+ gs_free gchar *tmp = NULL; >+ GError *error = NULL; >+ gboolean ignore = TRUE; >+ >+ argv[0] = (char *) openvpn_binary; >+ argv[1] = "--show-ciphers"; >+ argv[2] = NULL; >+ >+ if (g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, &tmp, NULL, NULL, &error)) { >+ gchar **lines = g_strsplit (tmp, "\n", 0); >+ gchar **line; >+ >+ for (line = lines; *line; line++) { >+ char *space; >+ >+ if (!strlen (*line)) { >+ ignore = !ignore; >+ continue; >+ } >+ if (ignore) >+ continue; >+ >+ space = strchr (*line, ' '); >+ if (space) >+ *space = '\0'; >+ >+ if (!strcmp (*line, "none")) >+ continue; >+ >+ if (strlen (*line)) { >+ gtk_list_store_append (store, &iter); >+ gtk_list_store_set (store, &iter, 0, *line, -1); >+ } >+ } >+ g_strfreev (lines); >+ } else { >+ g_warning ("%s: couldn't determine ciphers: %s", __func__, error->message); >+ g_clear_error (&error); >+ } >+ } >+ >+ gtk_combo_box_set_active (box, 0); >+} >+ >+static void >+data_ciphers_picker_changed_cb (GtkComboBox *combo, gpointer user_data) >+{ >+ GtkEditable *entry = GTK_EDITABLE (user_data); >+ GtkTreeModel *model; >+ GtkTreeIter iter; >+ char *cipher = NULL; >+ const char *current; >+ >+ if (gtk_combo_box_get_active (combo) == 0) >+ return; >+ >+ model = gtk_combo_box_get_model (combo); >+ if (!gtk_combo_box_get_active_iter (combo, &iter)) >+ return; >+ >+ gtk_tree_model_get (model, &iter, 0, &cipher, -1); >+ if (!cipher || !*cipher) { >+ g_free (cipher); >+ gtk_combo_box_set_active (combo, 0); >+ return; >+ } >+ >+ current = gtk_editable_get_text (entry); >+ if (current && *current) { >+ gchar *new_text = g_strdup_printf ("%s:%s", current, cipher); >+ gtk_editable_set_text (entry, new_text); >+ g_free (new_text); >+ } else { >+ gtk_editable_set_text (entry, cipher); >+ } >+ g_free (cipher); >+ >+ gtk_combo_box_set_active (combo, 0); >+} >+ > #define TA_DIR_COL_NAME 0 > #define TA_DIR_COL_NUM 1 > >@@ -1766,11 +1887,17 @@ advanced_dialog_new (GHashTable *hash, const char *contype) > value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_CIPHER); > populate_cipher_combo (GTK_COMBO_BOX (widget), value); > >+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "data_ciphers_entry")); >+ g_signal_connect (G_OBJECT (widget), "changed", >+ G_CALLBACK (data_ciphers_filter_cb), NULL); > value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_DATA_CIPHERS); >- if (value && *value) { >- widget = GTK_WIDGET (gtk_builder_get_object (builder, "data_ciphers_entry")); >+ if (value && *value) > gtk_editable_set_text (GTK_EDITABLE (widget), value); >- } >+ >+ combo = GTK_WIDGET (gtk_builder_get_object (builder, "data_ciphers_picker")); >+ populate_data_ciphers_picker (GTK_COMBO_BOX (combo)); >+ g_signal_connect (G_OBJECT (combo), "changed", >+ G_CALLBACK (data_ciphers_picker_changed_cb), widget); > > widget = GTK_WIDGET (gtk_builder_get_object (builder, "data_ciphers_fallback_combo")); > value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_DATA_CIPHERS_FALLBACK);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59004
: 21261 |
21262