[gnome-control-center] sharing: screen sharing password should be limited to 8 bytes
- From: Jonh Wendell <jwendell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] sharing: screen sharing password should be limited to 8 bytes
- Date: Wed, 26 Jun 2013 13:54:41 +0000 (UTC)
commit d996cb86b774cb5c3658a5d5be64f55d6e8248d3
Author: Jonh Wendell <jonh wendell intel com>
Date: Wed Jun 26 09:07:14 2013 -0300
sharing: screen sharing password should be limited to 8 bytes
vino (and vnc protocol) only recognizes the 8 first bytes. also,
vinagre, gnome vnc client limits its entries to 8 bytes as well.
https://bugzilla.gnome.org/show_bug.cgi?id=703002
panels/sharing/cc-sharing-panel.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index b66d6a8..07ba70a 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -862,6 +862,38 @@ screen_sharing_show_cb (GtkWidget *widget, CcSharingPanel *self)
FALSE);
}
+#define MAX_PASSWORD_SIZE 8
+static void
+screen_sharing_password_insert_text_cb (GtkEditable *editable,
+ gchar *new_text,
+ gint new_text_length,
+ gpointer position,
+ gpointer user_data)
+{
+ int l, available_size;
+
+ l = gtk_entry_buffer_get_bytes (gtk_entry_get_buffer (GTK_ENTRY (editable)));
+
+ if (l + new_text_length <= MAX_PASSWORD_SIZE)
+ return;
+
+ g_signal_stop_emission_by_name (editable, "insert-text");
+ gtk_widget_error_bell (GTK_WIDGET (editable));
+
+ available_size = g_utf8_strlen (new_text, MAX_PASSWORD_SIZE - l);
+ if (available_size == 0)
+ return;
+
+ g_signal_handlers_block_by_func (editable,
+ (gpointer) screen_sharing_password_insert_text_cb,
+ user_data);
+ gtk_editable_insert_text (editable, new_text, available_size, position);
+ g_signal_handlers_unblock_by_func (editable,
+ (gpointer) screen_sharing_password_insert_text_cb,
+ user_data);
+}
+#undef MAX_PASSWORD_SIZE
+
static void
cc_sharing_panel_setup_screen_sharing_dialog (CcSharingPanel *self)
{
@@ -922,6 +954,10 @@ cc_sharing_panel_setup_screen_sharing_dialog (CcSharingPanel *self)
/* make sure the password entry is hidden by default */
g_signal_connect (priv->screen_sharing_dialog, "show",
G_CALLBACK (screen_sharing_show_cb), self);
+
+ /* accept at most 8 bytes in password entry */
+ g_signal_connect (WID ("remote-control-password-entry"), "insert-text",
+ G_CALLBACK (screen_sharing_password_insert_text_cb), self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]