[network-manager-applet] connection-editor: fix VLAN parent interface name validation
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] connection-editor: fix VLAN parent interface name validation
- Date: Sun, 7 Oct 2012 19:33:35 +0000 (UTC)
commit 1c3294c9e129ee90c2cf9ba6cd707bcfd69b44a9
Author: Dan Winship <danw gnome org>
Date: Sun Oct 7 15:33:22 2012 -0400
connection-editor: fix VLAN parent interface name validation
src/connection-editor/page-vlan.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index a2b478c..3e5537b 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -510,14 +510,17 @@ ui_to_setting (CEPageVlan *self)
const char *parent_iface = NULL, *parent_uuid = NULL;
const char *slave_type;
const char *iface;
+ char *tmp_parent_iface = NULL;
GType hwtype;
gboolean mtu_set;
int mtu;
parent_id = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent));
- if (parent_id == -1)
+ if (parent_id == -1) {
parent_iface = gtk_entry_get_text (priv->parent_entry);
- else {
+ tmp_parent_iface = g_strndup (parent_iface, strcspn (parent_iface, " "));
+ parent_iface = tmp_parent_iface;
+ } else {
parent = priv->parents[parent_id];
if (parent->connection)
parent_uuid = nm_connection_get_uuid (parent->connection);
@@ -586,6 +589,8 @@ ui_to_setting (CEPageVlan *self)
priv->s_hw = NULL;
}
}
+
+ g_free (tmp_parent_iface);
}
static gboolean
@@ -596,12 +601,18 @@ validate (CEPage *page, NMConnection *connection, GError **error)
gboolean invalid = FALSE;
GByteArray *ignore;
int parent_id;
- const char *parent_iface;
+ const char *parent;
+ char *parent_iface;
parent_id = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->parent));
if (parent_id == -1) {
- parent_iface = gtk_entry_get_text (priv->parent_entry);
- if (!nm_utils_iface_valid_name (parent_iface))
+ gboolean valid;
+
+ parent = gtk_entry_get_text (priv->parent_entry);
+ parent_iface = g_strndup (parent, strcspn (parent, " "));
+ valid = nm_utils_iface_valid_name (parent_iface);
+ g_free (parent_iface);
+ if (!valid)
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]