NetworkManager r3281 - in trunk/vpn-daemons/openvpn: . properties src



Author: dcbw
Date: Thu Jan 31 18:13:01 2008
New Revision: 3281
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3281&view=rev

Log:
2008-01-31  Dan Williams  <dcbw redhat com>

	Patch from Robert Hughes <rhughes smgf org>

	* src/nm-openvpn-service.c
	  properties/nm-openvpn.c
		- Make 'port' an integer, not a uint



Modified:
   trunk/vpn-daemons/openvpn/ChangeLog
   trunk/vpn-daemons/openvpn/properties/nm-openvpn.c
   trunk/vpn-daemons/openvpn/src/nm-openvpn-service.c

Modified: trunk/vpn-daemons/openvpn/properties/nm-openvpn.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/nm-openvpn.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/nm-openvpn.c	Thu Jan 31 18:13:01 2008
@@ -224,18 +224,6 @@
 	return value;
 }
 
-static GValue *
-uint_to_gvalue (guint u)
-{
-	GValue *value;
-
-	value = g_slice_new0 (GValue);
-	g_value_init (value, G_TYPE_UINT);
-	g_value_set_uint (value, u);
-
-	return value;
-}
-
 static void
 impl_fill_connection (NetworkManagerVpnUI *self, NMConnection *connection)
 {
@@ -302,7 +290,7 @@
 
 	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_TAP_DEV), bool_to_gvalue (use_tap));
 	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_REMOTE), str_to_gvalue (remote));
-	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_PORT), uint_to_gvalue ((guint) atoi (port)));
+	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_PORT), int_to_gvalue ((guint) atoi (port)));
 	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_PROTO_TCP), bool_to_gvalue (use_tcp));
 	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_CA), str_to_gvalue (ca));
 	g_hash_table_insert (properties, g_strdup(NM_OPENVPN_KEY_CERT), str_to_gvalue (cert));
@@ -373,7 +361,7 @@
 	if (!strcmp (name, NM_OPENVPN_KEY_REMOTE))
 		gtk_entry_set_text (impl->w_remote, g_value_get_string (value));
 	else if (!strcmp (name, NM_OPENVPN_KEY_PORT)) {
-		char *port = g_strdup_printf ("%u", g_value_get_uint (value));
+		char *port = g_strdup_printf ("%d", g_value_get_int (value));
 		gtk_entry_set_text (impl->w_port, port);
 		g_free (port);
 	} else if (!strcmp (name, NM_OPENVPN_KEY_CA))
@@ -468,7 +456,7 @@
 
 
 /** Checks if port is an integer and
- *  less than 65 
+ *  less than 65536
  */
 static gboolean
 check_port (const char *port)
@@ -1337,7 +1325,7 @@
 	FILE *f;
 	const char *connection_type = "";
 	const char *remote = "";
-	guint port = 1194;
+	gint port = 1194;
 	gboolean tap_dev = FALSE;
 	gboolean proto_tcp = FALSE;
 	const char *ca = "";
@@ -1369,7 +1357,7 @@
 
 	val = (GValue *) g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_PORT);
 	if (val)
-		port = g_value_get_uint (val);
+		port = g_value_get_int (val);
 
 	val = (GValue *) g_hash_table_lookup (s_vpn_props->data, NM_OPENVPN_KEY_TAP_DEV);
 	if (val)
@@ -1468,7 +1456,7 @@
 			    "description=%s\n"
 			    "connection-type=%s\n"
 			    "remote=%s\n"
-			    "port=%u\n"
+			    "port=%d\n"
 			    "dev=%s\n"
 			    "proto=%s\n"
 			    "ca=%s\n"

Modified: trunk/vpn-daemons/openvpn/src/nm-openvpn-service.c
==============================================================================
--- trunk/vpn-daemons/openvpn/src/nm-openvpn-service.c	(original)
+++ trunk/vpn-daemons/openvpn/src/nm-openvpn-service.c	Thu Jan 31 18:13:01 2008
@@ -91,7 +91,7 @@
 	{ NM_OPENVPN_KEY_TAP_DEV,         G_TYPE_BOOLEAN },
 	{ NM_OPENVPN_KEY_KEY,             G_TYPE_STRING },
 	{ NM_OPENVPN_KEY_LOCAL_IP,        G_TYPE_STRING },
-	{ NM_OPENVPN_KEY_PORT,            G_TYPE_UINT },
+	{ NM_OPENVPN_KEY_PORT,            G_TYPE_INT },
 	{ NM_OPENVPN_KEY_PROTO_TCP,       G_TYPE_BOOLEAN },
 	{ NM_OPENVPN_KEY_REMOTE,          G_TYPE_STRING },
 	{ NM_OPENVPN_KEY_REMOTE_IP,       G_TYPE_STRING },
@@ -419,7 +419,7 @@
 	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_PORT);
 	if (tmp)
 		/* The string here is leaked, big deal. */
-		g_ptr_array_add (openvpn_argv, g_strdup_printf ("%u", g_value_get_uint ((GValue *) tmp)));
+		g_ptr_array_add (openvpn_argv, g_strdup_printf ("%u", g_value_get_int ((GValue *) tmp)));
 	else
 		/* Default to IANA assigned port 1194 */
 		g_ptr_array_add (openvpn_argv, (GValue *) "1194");



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