NetworkManager r4232 - in trunk: . libnm-util src/vpn-manager system-settings/plugins/keyfile vpn-daemons/openvpn/properties vpn-daemons/openvpn/src vpn-daemons/pptp/auth-dialog vpn-daemons/pptp/properties vpn-daemons/pptp/src vpn-daemons/vpnc/properties vpn-daemons/vpnc/src



Author: tambeti
Date: Wed Oct 29 09:13:40 2008
New Revision: 4232
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4232&view=rev

Log:
2008-10-29  Tambet Ingo  <tambet gmail com>

	Half of it by Dan Williams <dcbw redhat com>

	* libnm-util/libnm-util.ver
	libnm-util/nm-setting-vpn.c
	libnm-util/nm-setting-vpn.h
		- Make properties private and add accessor functions.

	* src/vpn-manager/nm-vpn-connection.c
	src/vpn-manager/nm-vpn-manager.c
	system-settings/plugins/keyfile/reader.c
	vpn-daemons/openvpn/properties/auth-helpers.c
	vpn-daemons/openvpn/properties/import-export.c
	vpn-daemons/openvpn/properties/nm-openvpn.c
	vpn-daemons/openvpn/src/nm-openvpn-service.c
	vpn-daemons/pptp/auth-dialog/main.c
	vpn-daemons/pptp/properties/advanced-dialog.c
	vpn-daemons/pptp/properties/nm-pptp.c
	vpn-daemons/pptp/src/nm-pptp-service.c
	vpn-daemons/vpnc/properties/nm-vpnc.c
	vpn-daemons/vpnc/src/nm-vpnc-service.c
		- Use VPN setting accessors.

Modified:
   trunk/ChangeLog
   trunk/libnm-util/libnm-util.ver
   trunk/libnm-util/nm-setting-vpn.c
   trunk/libnm-util/nm-setting-vpn.h
   trunk/src/vpn-manager/nm-vpn-connection.c
   trunk/src/vpn-manager/nm-vpn-manager.c
   trunk/system-settings/plugins/keyfile/reader.c
   trunk/vpn-daemons/openvpn/properties/auth-helpers.c
   trunk/vpn-daemons/openvpn/properties/import-export.c
   trunk/vpn-daemons/openvpn/properties/nm-openvpn.c
   trunk/vpn-daemons/openvpn/src/nm-openvpn-service.c
   trunk/vpn-daemons/pptp/auth-dialog/main.c
   trunk/vpn-daemons/pptp/properties/advanced-dialog.c
   trunk/vpn-daemons/pptp/properties/nm-pptp.c
   trunk/vpn-daemons/pptp/src/nm-pptp-service.c
   trunk/vpn-daemons/vpnc/properties/nm-vpnc.c
   trunk/vpn-daemons/vpnc/src/nm-vpnc-service.c

Modified: trunk/libnm-util/libnm-util.ver
==============================================================================
--- trunk/libnm-util/libnm-util.ver	(original)
+++ trunk/libnm-util/libnm-util.ver	Wed Oct 29 09:13:40 2008
@@ -130,6 +130,16 @@
 	nm_setting_vpn_error_quark;
 	nm_setting_vpn_get_type;
 	nm_setting_vpn_new;
+	nm_setting_vpn_get_service_type;
+	nm_setting_vpn_get_user_name;
+	nm_setting_vpn_add_data_item;
+	nm_setting_vpn_foreach_data_item;
+	nm_setting_vpn_get_data_item;
+	nm_setting_vpn_remove_data_item;
+	nm_setting_vpn_add_secret;
+	nm_setting_vpn_foreach_secret;
+	nm_setting_vpn_get_secret;
+	nm_setting_vpn_remove_secret;
 	nm_setting_wired_error_get_type;
 	nm_setting_wired_error_quark;
 	nm_setting_wired_get_type;

Modified: trunk/libnm-util/nm-setting-vpn.c
==============================================================================
--- trunk/libnm-util/nm-setting-vpn.c	(original)
+++ trunk/libnm-util/nm-setting-vpn.c	Wed Oct 29 09:13:40 2008
@@ -66,6 +66,36 @@
 
 G_DEFINE_TYPE (NMSettingVPN, nm_setting_vpn, NM_TYPE_SETTING)
 
+#define NM_SETTING_VPN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_VPN, NMSettingVPNPrivate))
+
+typedef struct {
+	char *service_type;
+
+	/* username of the user requesting this connection, thus
+	 * it's really only valid for user connections, and it also
+	 * should never be saved out to persistent config.
+	 */
+	char *user_name;
+
+	/* The hash table is created at setting object
+	 * init time and should not be replaced.  It is
+	 * a char * -> char * mapping, and both the key
+	 * and value are owned by the hash table, and should
+	 * be allocated with functions whose value can be
+	 * freed with g_free().  Should not contain secrets.
+	 */
+	GHashTable *data;
+
+	/* The hash table is created at setting object
+	 * init time and should not be replaced.  It is
+	 * a char * -> char * mapping, and both the key
+	 * and value are owned by the hash table, and should
+	 * be allocated with functions whose value can be
+	 * freed with g_free().  Should contain secrets only.
+	 */
+	GHashTable *secrets;
+} NMSettingVPNPrivate;
+
 enum {
 	PROP_0,
 	PROP_SERVICE_TYPE,
@@ -82,12 +112,104 @@
 	return (NMSetting *) g_object_new (NM_TYPE_SETTING_VPN, NULL);
 }
 
+const char *
+nm_setting_vpn_get_service_type (NMSettingVPN *setting)
+{
+	g_return_val_if_fail (NM_IS_SETTING_VPN (setting), NULL);
+
+	return NM_SETTING_VPN_GET_PRIVATE (setting)->service_type;
+}
+
+const char *
+nm_setting_vpn_get_user_name (NMSettingVPN *setting)
+{
+	g_return_val_if_fail (NM_IS_SETTING_VPN (setting), NULL);
+
+	return NM_SETTING_VPN_GET_PRIVATE (setting)->user_name;
+}
+
+void
+nm_setting_vpn_add_data_item (NMSettingVPN *setting,
+                              const char *key,
+                              const char *item)
+{
+	g_return_if_fail (NM_IS_SETTING_VPN (setting));
+
+	g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->data,
+	                     g_strdup (key), g_strdup (item));
+}
+
+const char *
+nm_setting_vpn_get_data_item (NMSettingVPN *setting, const char *key)
+{
+	g_return_val_if_fail (NM_IS_SETTING_VPN (setting), NULL);
+
+	return (const char *) g_hash_table_lookup (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key);
+}
+
+void
+nm_setting_vpn_remove_data_item (NMSettingVPN *setting, const char *key)
+{
+	g_return_if_fail (NM_IS_SETTING_VPN (setting));
+
+	g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key);
+}
+
+void
+nm_setting_vpn_foreach_data_item (NMSettingVPN *setting,
+                                  VPNIterFunc func,
+                                  gpointer user_data)
+{
+	g_return_if_fail (NM_IS_SETTING_VPN (setting));
+
+	g_hash_table_foreach (NM_SETTING_VPN_GET_PRIVATE (setting)->data,
+	                      (GHFunc) func, user_data);
+}
+
+void
+nm_setting_vpn_add_secret (NMSettingVPN *setting,
+                           const char *key,
+                           const char *secret)
+{
+	g_return_if_fail (NM_IS_SETTING_VPN (setting));
+
+	g_hash_table_insert (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets,
+	                     g_strdup (key), g_strdup (secret));
+}
+
+const char *
+nm_setting_vpn_get_secret (NMSettingVPN *setting, const char *key)
+{
+	g_return_val_if_fail (NM_IS_SETTING_VPN (setting), NULL);
+
+	return (const char *) g_hash_table_lookup (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key);
+}
+
+void
+nm_setting_vpn_remove_secret (NMSettingVPN *setting, const char *key)
+{
+	g_return_if_fail (NM_IS_SETTING_VPN (setting));
+
+	g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key);
+}
+
+void
+nm_setting_vpn_foreach_secret (NMSettingVPN *setting,
+                               VPNIterFunc func,
+                               gpointer user_data)
+{
+	g_return_if_fail (NM_IS_SETTING_VPN (setting));
+
+	g_hash_table_foreach (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets,
+	                      (GHFunc) func, user_data);
+}
+
 static gboolean
 verify (NMSetting *setting, GSList *all_settings, GError **error)
 {
-	NMSettingVPN *self = NM_SETTING_VPN (setting);
+	NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
 
-	if (!self->service_type) {
+	if (!priv->service_type) {
 		g_set_error (error,
 		             NM_SETTING_VPN_ERROR,
 		             NM_SETTING_VPN_ERROR_MISSING_PROPERTY,
@@ -95,7 +217,7 @@
 		return FALSE;
 	}
 
-	if (!strlen (self->service_type)) {
+	if (!strlen (priv->service_type)) {
 		g_set_error (error,
 		             NM_SETTING_VPN_ERROR,
 		             NM_SETTING_VPN_ERROR_INVALID_PROPERTY,
@@ -104,7 +226,7 @@
 	}
 
 	/* default username can be NULL, but can't be zero-length */
-	if (self->user_name && !strlen (self->user_name)) {
+	if (priv->user_name && !strlen (priv->user_name)) {
 		g_set_error (error,
 		             NM_SETTING_VPN_ERROR,
 		             NM_SETTING_VPN_ERROR_INVALID_PROPERTY,
@@ -118,13 +240,13 @@
 static void
 update_one_secret (NMSetting *setting, const char *key, GValue *value)
 {
-	NMSettingVPN *self = NM_SETTING_VPN (setting);
+	NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
 
 	g_return_if_fail (key != NULL);
 	g_return_if_fail (value != NULL);
 	g_return_if_fail (G_VALUE_HOLDS_STRING (value));
 
-	g_hash_table_insert (self->secrets, g_strdup (key), g_value_dup_string (value));
+	g_hash_table_insert (priv->secrets, g_strdup (key), g_value_dup_string (value));
 }
 
 static void
@@ -140,21 +262,22 @@
 static void
 nm_setting_vpn_init (NMSettingVPN *setting)
 {
-	g_object_set (setting, NM_SETTING_NAME, NM_SETTING_VPN_SETTING_NAME, NULL);
+	NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
 
-	setting->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-	setting->secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, destroy_one_secret);
+	g_object_set (setting, NM_SETTING_NAME, NM_SETTING_VPN_SETTING_NAME, NULL);
+	priv->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+	priv->secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, destroy_one_secret);
 }
 
 static void
 finalize (GObject *object)
 {
-	NMSettingVPN *self = NM_SETTING_VPN (object);
+	NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (object);
 
-	g_free (self->service_type);
-	g_free (self->user_name);
-	g_hash_table_destroy (self->data);
-	g_hash_table_destroy (self->secrets);
+	g_free (priv->service_type);
+	g_free (priv->user_name);
+	g_hash_table_destroy (priv->data);
+	g_hash_table_destroy (priv->secrets);
 
 	G_OBJECT_CLASS (nm_setting_vpn_parent_class)->finalize (object);
 }
@@ -169,31 +292,31 @@
 set_property (GObject *object, guint prop_id,
 		    const GValue *value, GParamSpec *pspec)
 {
-	NMSettingVPN *setting = NM_SETTING_VPN (object);
+	NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (object);
 	GHashTable *new_hash;
 
 	switch (prop_id) {
 	case PROP_SERVICE_TYPE:
-		g_free (setting->service_type);
-		setting->service_type = g_value_dup_string (value);
+		g_free (priv->service_type);
+		priv->service_type = g_value_dup_string (value);
 		break;
 	case PROP_USER_NAME:
-		g_free (setting->user_name);
-		setting->user_name = g_value_dup_string (value);
+		g_free (priv->user_name);
+		priv->user_name = g_value_dup_string (value);
 		break;
 	case PROP_DATA:
 		/* Must make a deep copy of the hash table here... */
-		g_hash_table_remove_all (setting->data);
+		g_hash_table_remove_all (priv->data);
 		new_hash = g_value_get_boxed (value);
 		if (new_hash)
-			g_hash_table_foreach (new_hash, copy_hash, setting->data);
+			g_hash_table_foreach (new_hash, copy_hash, priv->data);
 		break;
 	case PROP_SECRETS:
 		/* Must make a deep copy of the hash table here... */
-		g_hash_table_remove_all (setting->secrets);
+		g_hash_table_remove_all (priv->secrets);
 		new_hash = g_value_get_boxed (value);
 		if (new_hash)
-			g_hash_table_foreach (new_hash, copy_hash, setting->secrets);
+			g_hash_table_foreach (new_hash, copy_hash, priv->secrets);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -206,19 +329,20 @@
 		    GValue *value, GParamSpec *pspec)
 {
 	NMSettingVPN *setting = NM_SETTING_VPN (object);
+	NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
 
 	switch (prop_id) {
 	case PROP_SERVICE_TYPE:
-		g_value_set_string (value, setting->service_type);
+		g_value_set_string (value, nm_setting_vpn_get_service_type (setting));
 		break;
 	case PROP_USER_NAME:
-		g_value_set_string (value, setting->user_name);
+		g_value_set_string (value, nm_setting_vpn_get_user_name (setting));
 		break;
 	case PROP_DATA:
-		g_value_set_boxed (value, setting->data);
+		g_value_set_boxed (value, priv->data);
 		break;
 	case PROP_SECRETS:
-		g_value_set_boxed (value, setting->secrets);
+		g_value_set_boxed (value, priv->secrets);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -232,6 +356,8 @@
 	GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
 	NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
 
+	g_type_class_add_private (setting_class, sizeof (NMSettingVPNPrivate));
+
 	/* virtual methods */
 	object_class->set_property = set_property;
 	object_class->get_property = get_property;

Modified: trunk/libnm-util/nm-setting-vpn.h
==============================================================================
--- trunk/libnm-util/nm-setting-vpn.h	(original)
+++ trunk/libnm-util/nm-setting-vpn.h	Wed Oct 29 09:13:40 2008
@@ -59,41 +59,41 @@
 
 typedef struct {
 	NMSetting parent;
-
-	char *service_type;
-
-	/* username of the user requesting this connection, thus
-	 * it's really only valid for user connections, and it also
-	 * should never be saved out to persistent config.
-	 */
-	char *user_name;
-
-	/* The hash table is created at setting object
-	 * init time and should not be replaced.  It is
-	 * a char * -> char * mapping, and both the key
-	 * and value are owned by the hash table, and should
-	 * be allocated with functions whose value can be
-	 * freed with g_free().  Should not contain secrets.
-	 */
-	GHashTable *data;
-
-	/* The hash table is created at setting object
-	 * init time and should not be replaced.  It is
-	 * a char * -> char * mapping, and both the key
-	 * and value are owned by the hash table, and should
-	 * be allocated with functions whose value can be
-	 * freed with g_free().  Should contain secrets only.
-	 */
-	GHashTable *secrets;
 } NMSettingVPN;
 
 typedef struct {
 	NMSettingClass parent;
 } NMSettingVPNClass;
 
+typedef void (*VPNIterFunc) (const char *key, const char *value, gpointer user_data);
+
 GType nm_setting_vpn_get_type (void);
 
-NMSetting *nm_setting_vpn_new (void);
+NMSetting        *nm_setting_vpn_new               (void);
+const char       *nm_setting_vpn_get_service_type  (NMSettingVPN *setting);
+const char       *nm_setting_vpn_get_user_name     (NMSettingVPN *setting);
+
+void              nm_setting_vpn_add_data_item     (NMSettingVPN *setting,
+                                                    const char *key,
+                                                    const char *item);
+const char *      nm_setting_vpn_get_data_item     (NMSettingVPN *setting,
+                                                    const char *key);
+void              nm_setting_vpn_remove_data_item  (NMSettingVPN *setting,
+                                                    const char *key);
+void              nm_setting_vpn_foreach_data_item (NMSettingVPN *setting,
+                                                    VPNIterFunc func,
+                                                    gpointer user_data);
+
+void              nm_setting_vpn_add_secret        (NMSettingVPN *setting,
+                                                    const char *key,
+                                                    const char *secret);
+const char *      nm_setting_vpn_get_secret        (NMSettingVPN *setting,
+                                                    const char *key);
+void              nm_setting_vpn_remove_secret     (NMSettingVPN *setting,
+                                                    const char *key);
+void              nm_setting_vpn_foreach_secret    (NMSettingVPN *setting,
+                                                    VPNIterFunc func,
+                                                    gpointer user_data);
 
 G_END_DECLS
 

Modified: trunk/src/vpn-manager/nm-vpn-connection.c
==============================================================================
--- trunk/src/vpn-manager/nm-vpn-connection.c	(original)
+++ trunk/src/vpn-manager/nm-vpn-connection.c	Wed Oct 29 09:13:40 2008
@@ -224,14 +224,14 @@
 	return vpn_connection;
 }
 
-static char *
+static const char *
 nm_vpn_connection_get_service (NMVPNConnection *connection)
 {
 	NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
 	NMSettingVPN *setting;
 
 	setting = (NMSettingVPN *) nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_VPN);
-	return setting->service_type;
+	return nm_setting_vpn_get_service_type (setting);
 }
 
 static void

Modified: trunk/src/vpn-manager/nm-vpn-manager.c
==============================================================================
--- trunk/src/vpn-manager/nm-vpn-manager.c	(original)
+++ trunk/src/vpn-manager/nm-vpn-manager.c	Wed Oct 29 09:13:40 2008
@@ -152,6 +152,7 @@
 	NMVPNService *service;
 	char *path = NULL;
 	NMVPNConnection *vpn;
+	const char *service_type;
 
 	g_return_val_if_fail (NM_IS_VPN_MANAGER (manager), NULL);
 	g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
@@ -181,9 +182,10 @@
 		vpn = NULL;
 	}
 
-	service = nm_vpn_manager_get_service (manager, vpn_setting->service_type);
+	service_type = nm_setting_vpn_get_service_type (vpn_setting);
+	service = nm_vpn_manager_get_service (manager, service_type);
 	if (!service) {
-		service = nm_vpn_service_new (vpn_setting->service_type);
+		service = nm_vpn_service_new (service_type);
 		if (service)
 			nm_vpn_manager_add_service (manager, service);
 	}

Modified: trunk/system-settings/plugins/keyfile/reader.c
==============================================================================
--- trunk/system-settings/plugins/keyfile/reader.c	(original)
+++ trunk/system-settings/plugins/keyfile/reader.c	Wed Oct 29 09:13:40 2008
@@ -310,10 +310,8 @@
 			continue;
 
 		if (NM_IS_SETTING_VPN (setting)) {
-			NMSettingVPN *s_vpn = NM_SETTING_VPN (setting);
-
 			if (strcmp (*iter, NM_SETTING_VPN_SERVICE_TYPE))
-				g_hash_table_insert (s_vpn->data, g_strdup (*iter), g_strdup (value));
+				nm_setting_vpn_add_data_item (NM_SETTING_VPN (setting), *iter, value);
 		}
 		g_free (value);
 	}
@@ -493,8 +491,10 @@
 		char *secret;
 
 		secret = g_key_file_get_string (file, VPN_SECRETS_GROUP, *iter, NULL);
-		if (secret)
-			g_hash_table_insert (s_vpn->secrets, g_strdup (*iter), secret);
+		if (secret) {
+			nm_setting_vpn_add_secret (s_vpn, *iter, secret);
+			g_free (secret);
+		}
 	}
 	g_strfreev (keys);
 }

Modified: trunk/vpn-daemons/openvpn/properties/auth-helpers.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/auth-helpers.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/auth-helpers.c	Wed Oct 29 09:13:40 2008
@@ -75,8 +75,7 @@
 		if (s_vpn) {
 			const char *tmp;
 
-			tmp = g_hash_table_lookup (s_vpn->secrets,
-									   priv_key_password ? NM_OPENVPN_KEY_CERTPASS : NM_OPENVPN_KEY_PASSWORD);
+			tmp = nm_setting_vpn_get_secret (s_vpn, priv_key_password ? NM_OPENVPN_KEY_CERTPASS : NM_OPENVPN_KEY_PASSWORD);
 			if (tmp)
 				password = gnome_keyring_memory_strdup (tmp);
 		}
@@ -161,8 +160,8 @@
 	                                   _("Choose a Certificate Authority certificate..."));
 	g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
 
-	if (s_vpn && s_vpn->data) {
-		value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CA);
+	if (s_vpn) {
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CA);
 		if (value && strlen (value))
 			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
 	}
@@ -180,8 +179,8 @@
 		                                   _("Choose your personal certificate..."));
 		g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
 
-		if (s_vpn && s_vpn->data) {
-			value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CERT);
+		if (s_vpn) {
+			value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CERT);
 			if (value && strlen (value))
 				gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
 		}
@@ -198,8 +197,8 @@
 		                                   _("Choose your private key..."));
 		g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
 
-		if (s_vpn && s_vpn->data) {
-			value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_KEY);
+		if (s_vpn) {
+			value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEY);
 			if (value && strlen (value))
 				gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
 		}
@@ -211,8 +210,8 @@
 		g_free (tmp);
 
 		gtk_size_group_add_widget (group, widget);
-		if (s_vpn && s_vpn->data) {
-			value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_USERNAME);
+		if (s_vpn) {
+			value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_USERNAME);
 			if (value && strlen (value))
 				gtk_entry_set_text (GTK_ENTRY (widget), value);
 		}
@@ -251,16 +250,16 @@
 	                                   _("Choose an OpenVPN static key..."));
 	g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
 
-	if (s_vpn && s_vpn->data) {
-		value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_STATIC_KEY);
+	if (s_vpn) {
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY);
 		if (value && strlen (value))
 			gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
 	}
 
 	store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
 
-	if (s_vpn && s_vpn->data) {
-		value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION);
+	if (s_vpn) {
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION);
 		if (value && strlen (value)) {
 			long int tmp;
 
@@ -297,8 +296,8 @@
 	widget = glade_xml_get_widget (xml, "sk_local_address_entry");
 	gtk_size_group_add_widget (group, widget);
 	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (changed_cb), user_data);
-	if (s_vpn && s_vpn->data) {
-		value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_LOCAL_IP);
+	if (s_vpn) {
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_LOCAL_IP);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -437,7 +436,6 @@
 	g_return_if_fail (prefix != NULL);
 	g_return_if_fail (widget_name != NULL);
 	g_return_if_fail (s_vpn != NULL);
-	g_return_if_fail (s_vpn->data != NULL);
 
 	tmp = g_strdup_printf ("%s_%s", prefix, widget_name);
 	widget = glade_xml_get_widget (xml, tmp);
@@ -448,7 +446,7 @@
 		return;
 
 	if (strlen (filename))
-		g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup (filename));
+		nm_setting_vpn_add_data_item (s_vpn, key, filename);
 	
 	g_free (filename);
 }
@@ -471,18 +469,14 @@
 	g_return_if_fail (xml != NULL);
 	g_return_if_fail (prefix != NULL);
 	g_return_if_fail (s_vpn != NULL);
-	g_return_if_fail (s_vpn->data != NULL);
 
 	tmp = g_strdup_printf ("%s_username_entry", prefix);
 	widget = glade_xml_get_widget (xml, tmp);
 	g_free (tmp);
 
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
-	if (str && strlen (str)) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_OPENVPN_KEY_USERNAME),
-		                     g_strdup (str));
-	}
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_USERNAME, str);
 }
 
 gboolean
@@ -512,9 +506,9 @@
 
 			gtk_tree_model_get (model, &iter, SK_DIR_COL_NUM, &direction, -1);
 			if (direction > -1) {
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_STATIC_KEY_DIRECTION),
-				                     g_strdup_printf ("%d", direction));
+				char *tmp = g_strdup_printf ("%d", direction);
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION, tmp);
+				g_free (tmp);
 			}
 		}
 	} else
@@ -733,17 +727,16 @@
 };
 
 static void
-copy_values (gpointer key, gpointer data, gpointer user_data)
+copy_values (const char *key, const char *value, gpointer user_data)
 {
 	GHashTable *hash = (GHashTable *) user_data;
-	const char *value = (const char *) data;
 	const char **i;
 
 	for (i = &advanced_keys[0]; *i; i++) {
-		if (strcmp ((const char *) key, *i))
+		if (strcmp (key, *i))
 			continue;
 
-		g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup (value));
+		g_hash_table_insert (hash, g_strdup (key), g_strdup (value));
 	}
 }
 
@@ -757,9 +750,7 @@
 	hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
 	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
-	if (s_vpn && s_vpn->data)
-		g_hash_table_foreach (s_vpn->data, copy_values, hash);
-
+	nm_setting_vpn_foreach_data_item (s_vpn, copy_values, hash);
 	return hash;
 }
 

Modified: trunk/vpn-daemons/openvpn/properties/import-export.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/import-export.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/import-export.c	Wed Oct 29 09:13:40 2008
@@ -60,11 +60,11 @@
 handle_path_item (const char *line,
                   const char *tag,
                   const char *key,
-                  GHashTable *hash,
+                  NMSettingVPN *s_vpn,
                   const char *path,
                   char **leftover)
 {
-	char *tmp, *file, *unquoted, *p, *full_path;
+	char *tmp, *file, *unquoted, *p, *full_path = NULL;
 	gboolean quoted = FALSE;
 
 	if (leftover)
@@ -110,7 +110,7 @@
 	if (leftover && *file)
 		*leftover = file + 1;
 
-	g_hash_table_insert (hash, g_strdup (key), g_strdup (unquoted));
+	nm_setting_vpn_add_data_item (s_vpn, key, unquoted);
 	g_free (unquoted);
 
 out:
@@ -138,7 +138,7 @@
 }
 
 static void
-handle_direction (const char *tag, const char *key, char *leftover, GHashTable *hash)
+handle_direction (const char *tag, const char *key, char *leftover, NMSettingVPN *s_vpn)
 {
 	glong direction;
 
@@ -153,9 +153,9 @@
 	direction = strtol (leftover, NULL, 10);
 	if (errno == 0) {
 		if (direction == 0)
-			g_hash_table_insert (hash, g_strdup (key), g_strdup ("0"));
+			nm_setting_vpn_add_data_item (s_vpn, key, "0");
 		else if (direction == 1)
-			g_hash_table_insert (hash, g_strdup (key), g_strdup ("1"));
+			nm_setting_vpn_add_data_item (s_vpn, key, "1");
 	} else
 		g_warning ("%s: unknown %s direction '%s'", __func__, tag, leftover);
 }
@@ -179,7 +179,8 @@
 	nm_connection_add_setting (connection, NM_SETTING (s_con));
 
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
-	s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_OPENVPN);
+
+	g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_OPENVPN, NULL);
 	
 	/* Get the default path for ca, cert, key file, these files maybe
 	 * in same path with the configuration file */
@@ -209,9 +210,7 @@
 			if (strstr (*line, "tun")) {
 				/* ignore; default is tun */
 			} else if (strstr (*line, "tap")) {
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_TAP_DEV),
-				                     g_strdup ("yes"));
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_TAP_DEV, "yes");
 			} else
 				g_warning ("%s: unknown dev option '%s'", __func__, *line);
 
@@ -222,9 +221,7 @@
 			if (strstr (*line, "udp")) {
 				/* ignore; udp is default */
 			} else if (strstr (*line, "tcp")) {
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_PROTO_TCP),
-				                     g_strdup ("yes"));
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
 			} else
 				g_warning ("%s: unknown proto option '%s'", __func__, *line);
 
@@ -232,9 +229,7 @@
 		}
 
 		if (!strncmp (*line, COMP_TAG, strlen (COMP_TAG))) {
-			g_hash_table_insert (s_vpn->data,
-			                     g_strdup (NM_OPENVPN_KEY_COMP_LZO),
-			                     g_strdup ("yes"));
+			nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "yes");
 			continue;
 		}
 
@@ -244,9 +239,7 @@
 				continue;
 
 			if (g_strv_length (items) >= 1) {
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_REMOTE),
-				                     g_strdup (items[0]));
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE, items[0]);
 				have_remote = TRUE;
 
 				if (g_strv_length (items) >= 2) {
@@ -255,44 +248,44 @@
 					errno = 0;
 					port = strtol (items[1], NULL, 10);
 					if ((errno == 0) && (port > 0) && (port < 65536)) {
-						g_hash_table_insert (s_vpn->data,
-						                     g_strdup (NM_OPENVPN_KEY_PORT),
-						                     g_strdup_printf ("%d", (guint32) port));
+						char *tmp = g_strdup_printf ("%d", (guint32) port);
+						nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_PORT, tmp);
+						g_free (tmp);
 					} else
 						g_warning ("%s: invalid remote port in option '%s'", __func__, *line);
 				}
 			}
 			g_strfreev (items);
 
-			if (!g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_REMOTE))
+			if (!nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE))
 				g_warning ("%s: unknown remote option '%s'", __func__, *line);
 			continue;
 		}
 
-		if (handle_path_item (*line, CA_TAG, NM_OPENVPN_KEY_CA, s_vpn->data, default_path, NULL))
+		if (handle_path_item (*line, CA_TAG, NM_OPENVPN_KEY_CA, s_vpn, default_path, NULL))
 			continue;
 
-		if (handle_path_item (*line, CERT_TAG, NM_OPENVPN_KEY_CERT, s_vpn->data, default_path, NULL))
+		if (handle_path_item (*line, CERT_TAG, NM_OPENVPN_KEY_CERT, s_vpn, default_path, NULL))
 			continue;
 
-		if (handle_path_item (*line, KEY_TAG, NM_OPENVPN_KEY_KEY, s_vpn->data, default_path, NULL))
+		if (handle_path_item (*line, KEY_TAG, NM_OPENVPN_KEY_KEY, s_vpn, default_path, NULL))
 			continue;
 
 		if (handle_path_item (*line, SECRET_TAG, NM_OPENVPN_KEY_STATIC_KEY,
-		                      s_vpn->data, default_path, &leftover)) {
+		                      s_vpn, default_path, &leftover)) {
 			handle_direction ("secret",
 			                  NM_OPENVPN_KEY_STATIC_KEY_DIRECTION,
 			                  leftover,
-			                  s_vpn->data);
+			                  s_vpn);
 			continue;
 		}
 
 		if (handle_path_item (*line, TLS_AUTH_TAG, NM_OPENVPN_KEY_TA,
-		                      s_vpn->data, default_path, &leftover)) {
+		                      s_vpn, default_path, &leftover)) {
 			handle_direction ("tls-auth",
 			                  NM_OPENVPN_KEY_TA_DIR,
 			                  leftover,
-			                  s_vpn->data);
+			                  s_vpn);
 			continue;
 		}
 
@@ -301,11 +294,9 @@
 			if (!items)
 				continue;
 
-			if (g_strv_length (items)) {
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_CIPHER),
-				                     g_strdup (items[0]));
-			}
+			if (g_strv_length (items))
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_CIPHER, items[0]);
+
 			g_strfreev (items);
 			continue;
 		}
@@ -316,12 +307,8 @@
 				continue;
 
 			if (g_strv_length (items) == 2) {
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_LOCAL_IP),
-				                     g_strdup (items[0]));
-				g_hash_table_insert (s_vpn->data,
-				                     g_strdup (NM_OPENVPN_KEY_REMOTE_IP),
-				                     g_strdup (items[1]));
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_LOCAL_IP, items[0]);
+				nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_IP, items[1]);
 			} else
 				g_warning ("%s: unknown ifconfig option '%s'", __func__, *line);
 			g_strfreev (items);
@@ -332,7 +319,7 @@
 			have_pass = TRUE;
 	}
 
-	if (g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_STATIC_KEY))
+	if (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY))
 		have_sk = TRUE;
 
 	if (!have_client && !have_sk) {
@@ -352,12 +339,12 @@
 	} else {
 		gboolean have_certs = FALSE, have_ca = FALSE;
 
-		if (g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CA))
+		if (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CA))
 			have_ca = TRUE;
 
 		if (   have_ca
-		    && g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CERT)
-		    && g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_KEY))
+		    && nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CERT)
+		    && nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEY))
 			have_certs = TRUE;
 
 		/* Determine connection type */
@@ -374,9 +361,7 @@
 		if (!ctype)
 			ctype = NM_OPENVPN_CONTYPE_TLS;
 
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_OPENVPN_KEY_CONNECTION_TYPE),
-		                     g_strdup (ctype));
+		nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, ctype);
 	}
 
 	g_free (default_path);

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	Wed Oct 29 09:13:40 2008
@@ -285,7 +285,7 @@
 		return FALSE;
 	gtk_size_group_add_widget (priv->group, widget);
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_REMOTE);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
 		if (value)
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -298,8 +298,8 @@
 
 	store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
 
-	if (s_vpn && s_vpn->data) {
-		contype = g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_CONNECTION_TYPE);
+	if (s_vpn) {
+		contype = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE);
 		if (contype) {
 			if (   strcmp (contype, NM_OPENVPN_CONTYPE_TLS)
 			    && strcmp (contype, NM_OPENVPN_CONTYPE_STATIC_KEY)
@@ -392,10 +392,10 @@
 static void
 hash_copy_advanced (gpointer key, gpointer data, gpointer user_data)
 {
-	GHashTable *hash = (GHashTable *) user_data;
+	NMSettingVPN *s_vpn = NM_SETTING_VPN (user_data);
 	const char *value = (const char *) data;
 
-	g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup (value));
+	nm_setting_vpn_add_data_item (s_vpn, (const char *) key, value);
 }
 
 static const char *
@@ -431,27 +431,22 @@
 		return FALSE;
 
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
-	s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_OPENVPN);
+	g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_OPENVPN, NULL);
 
 	/* Gateway */
 	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-	if (str && strlen (str)) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_OPENVPN_KEY_REMOTE),
-		                     g_strdup (str));
-	}
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE, str);
 
 	auth_type = get_auth_type (priv->xml);
 	if (auth_type) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_OPENVPN_KEY_CONNECTION_TYPE),
-		                     g_strdup (auth_type));
+		nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, auth_type);
 		auth_widget_update_connection (priv->xml, auth_type, s_vpn);
 	}
 
 	if (priv->advanced)
-		g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn->data);
+		g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn);
 
 	nm_connection_add_setting (connection, NM_SETTING (s_vpn));
 	valid = TRUE;

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	Wed Oct 29 09:13:40 2008
@@ -100,6 +100,10 @@
 	{ NM_OPENVPN_KEY_TA,                   G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_TA_DIR,               G_TYPE_INT, 0, 1, FALSE },
 	{ NM_OPENVPN_KEY_USERNAME,             G_TYPE_STRING, 0, 0, FALSE },
+	{ NULL,                                G_TYPE_NONE, FALSE }
+};
+
+static ValidProperty valid_secrets[] = {
 	{ NM_OPENVPN_KEY_PASSWORD,             G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_CERTPASS,             G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_NOSECRET,             G_TYPE_STRING, 0, 0, FALSE },
@@ -123,83 +127,94 @@
 	return TRUE;
 }
 
+typedef struct ValidateInfo {
+	ValidProperty *table;
+	GError **error;
+	gboolean have_items;
+} ValidateInfo;
+
 static void
-validate_one_property (gpointer key, gpointer value, gpointer user_data)
+validate_one_property (const char *key, const char *value, gpointer user_data)
 {
-	GError **error = (GError **) user_data;
+	ValidateInfo *info = (ValidateInfo *) user_data;
 	int i;
 
-	if (*error)
+	if (*(info->error))
 		return;
 
+	info->have_items = TRUE;
+
 	/* 'name' is the setting name; always allowed but unused */
-	if (!strcmp ((char *) key, NM_SETTING_NAME))
+	if (!strcmp (key, NM_SETTING_NAME))
 		return;
 
-	for (i = 0; valid_properties[i].name; i++) {
-		ValidProperty prop = valid_properties[i];
+	for (i = 0; info->table[i].name; i++) {
+		ValidProperty prop = info->table[i];
 		long int tmp;
 
-		if (strcmp (prop.name, (char *) key))
+		if (strcmp (prop.name, key))
 			continue;
 
 		switch (prop.type) {
 		case G_TYPE_STRING:
-			if (!prop.address || validate_address ((const char *) value))
+			if (!prop.address || validate_address (value))
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid address '%s'",
-			             (const char *) key);
+			             key);
 			break;
 		case G_TYPE_INT:
 			errno = 0;
-			tmp = strtol ((char *) value, NULL, 10);
+			tmp = strtol (value, NULL, 10);
 			if (errno == 0 && tmp >= prop.int_min && tmp <= prop.int_max)
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid integer property '%s' or out of range [%d -> %d]",
-			             (const char *) key, prop.int_min, prop.int_max);
+			             key, prop.int_min, prop.int_max);
 			break;
 		case G_TYPE_BOOLEAN:
-			if (!strcmp ((char *) value, "yes") || !strcmp ((char *) value, "no"))
+			if (!strcmp (value, "yes") || !strcmp (value, "no"))
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid boolean property '%s' (not yes or no)",
-			             (const char *) key);
+			             key);
 			break;
 		default:
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "unhandled property '%s' type %s",
-			             (const char *) key, g_type_name (prop.type));
+			             key, g_type_name (prop.type));
 			break;
 		}
 	}
 
 	/* Did not find the property from valid_properties or the type did not match */
-	if (!valid_properties[i].name) {
-		g_set_error (error,
+	if (!info->table[i].name) {
+		g_set_error (info->error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 		             "property '%s' invalid or not supported",
-		             (const char *) key);
+		             key);
 	}
 }
 
 static gboolean
-nm_openvpn_properties_validate (GHashTable *properties, GError **error)
+nm_openvpn_properties_validate (NMSettingVPN *s_vpn, GError **error)
 {
-	if (g_hash_table_size (properties) < 1) {
+	ValidateInfo info = { &valid_properties[0], error, FALSE };
+
+	nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info);
+	if (!info.have_items) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
@@ -208,7 +223,23 @@
 		return FALSE;
 	}
 
-	g_hash_table_foreach (properties, validate_one_property, error);
+	return *error ? FALSE : TRUE;
+}
+
+static gboolean
+nm_openvpn_secrets_validate (NMSettingVPN *s_vpn, GError **error)
+{
+	ValidateInfo info = { &valid_secrets[0], error, FALSE };
+
+	nm_setting_vpn_foreach_secret (s_vpn, validate_one_property, &info);
+	if (!info.have_items) {
+		g_set_error (error,
+		             NM_VPN_PLUGIN_ERROR,
+		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+		             "%s",
+		             "No VPN secrets!");
+		return FALSE;
+	}
 
 	return *error ? FALSE : TRUE;
 }
@@ -262,7 +293,7 @@
                           NMVPNPluginFailure *out_failure)
 {
 	NMOpenvpnPluginIOData *io_data = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin)->io_data;
-	gboolean again = TRUE, success = TRUE;
+	gboolean again = TRUE;
 	char *str = NULL, *auth, *buf;
 	gsize written;
 
@@ -471,11 +502,8 @@
 }
 
 static const char *
-get_connection_type (GHashTable *properties)
+validate_connection_type (const char *ctype)
 {
-	const char *ctype;
-
-	ctype = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CONNECTION_TYPE);
 	if (ctype) {
 		if (   !strcmp (ctype, NM_OPENVPN_CONTYPE_TLS)
 		    || !strcmp (ctype, NM_OPENVPN_CONTYPE_STATIC_KEY)
@@ -483,7 +511,6 @@
 		    || !strcmp (ctype, NM_OPENVPN_CONTYPE_PASSWORD_TLS))
 			return ctype;
 	}
-
 	return NULL;
 }
 
@@ -543,8 +570,7 @@
 
 static gboolean
 nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
-                                 GHashTable *properties,
-                                 GHashTable *secrets,
+                                 NMSettingVPN *s_vpn,
                                  const char *default_username,
                                  GError **error)
 {
@@ -565,7 +591,8 @@
 		return FALSE;
 	}
 
-	connection_type = get_connection_type (properties);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE);
+	connection_type = validate_connection_type (tmp);
 	if (!connection_type) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
@@ -578,13 +605,13 @@
 	args = g_ptr_array_new ();
 	add_openvpn_arg (args, openvpn_binary);
 
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_REMOTE);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
 	if (tmp && strlen (tmp)) {
 		add_openvpn_arg (args, "--remote");
 		add_openvpn_arg (args, tmp);
 	}
 
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_COMP_LZO);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO);
 	if (tmp && !strcmp (tmp, "yes"))
 		add_openvpn_arg (args, "--comp-lzo");
 
@@ -592,7 +619,7 @@
 
 	/* Device, either tun or tap */
 	add_openvpn_arg (args, "--dev");
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_TAP_DEV);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TAP_DEV);
 	if (tmp && !strcmp (tmp, "yes"))
 		add_openvpn_arg (args, "tap");
 	else
@@ -600,7 +627,7 @@
 
 	/* Protocol, either tcp or udp */
 	add_openvpn_arg (args, "--proto");
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_PROTO_TCP);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP);
 	if (tmp && !strcmp (tmp, "yes"))
 		add_openvpn_arg (args, "tcp-client");
 	else
@@ -608,7 +635,7 @@
 
 	/* Port */
 	add_openvpn_arg (args, "--port");
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_PORT);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PORT);
 	if (tmp && strlen (tmp)) {
 		if (!add_openvpn_arg_int (args, tmp)) {
 			g_set_error (error,
@@ -625,19 +652,19 @@
 	}
 
 	/* Cipher */
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CIPHER);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CIPHER);
 	if (tmp && strlen (tmp)) {
 		add_openvpn_arg (args, "--cipher");
 		add_openvpn_arg (args, tmp);
 	}
 
 	/* TA */
-	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_TA);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TA);
 	if (tmp && strlen (tmp)) {
 		add_openvpn_arg (args, "--tls-auth");
 		add_openvpn_arg (args, tmp);
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_TA_DIR);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TA_DIR);
 		if (tmp && strlen (tmp))
 			add_openvpn_arg (args, tmp);
 	}
@@ -677,37 +704,37 @@
 	if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_TLS)) {
 		add_openvpn_arg (args, "--client");
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CA);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CA);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--ca");
 			add_openvpn_arg (args, tmp);
 		}
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CERT);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CERT);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--cert");
 			add_openvpn_arg (args, tmp);
 		}
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_KEY);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEY);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--key");
 			add_openvpn_arg (args, tmp);
 		}
 	} else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_STATIC_KEY);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--secret");
 			add_openvpn_arg (args, tmp);
 
-			tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION);
+			tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION);
 			if (tmp && strlen (tmp))
 				add_openvpn_arg (args, tmp);
 		}
 
 		add_openvpn_arg (args, "--ifconfig");
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_LOCAL_IP);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_LOCAL_IP);
 		if (!tmp) {
 			/* Insufficient data (FIXME: this should really be detected when validating the properties */
 			g_set_error (error,
@@ -720,7 +747,7 @@
 		}
 		add_openvpn_arg (args, tmp);
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_REMOTE_IP);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE_IP);
 		if (!tmp) {
 			/* Insufficient data (FIXME: this should really be detected when validating the properties */
 			g_set_error (error,
@@ -738,7 +765,7 @@
 		/* Use user/path authentication */
 		add_openvpn_arg (args, "--auth-user-pass");
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CA);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CA);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--ca");
 			add_openvpn_arg (args, tmp);
@@ -746,19 +773,19 @@
 	} else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) {
 		add_openvpn_arg (args, "--client");
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CA);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CA);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--ca");
 			add_openvpn_arg (args, tmp);
 		}
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_CERT);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CERT);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--cert");
 			add_openvpn_arg (args, tmp);
 		}
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_KEY);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEY);
 		if (tmp && strlen (tmp)) {
 			add_openvpn_arg (args, "--key");
 			add_openvpn_arg (args, tmp);
@@ -805,16 +832,16 @@
 
 		io_data = g_new0 (NMOpenvpnPluginIOData, 1);
 
-		tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_USERNAME);
+		tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_USERNAME);
 		io_data->username = tmp ? g_strdup (tmp) : NULL;
 		/* Use the default username if it wasn't overridden by the user */
 		if (!io_data->username && default_username)
 			io_data->username = g_strdup (default_username);
 
-		tmp = g_hash_table_lookup (secrets, NM_OPENVPN_KEY_PASSWORD);
+		tmp = nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_PASSWORD);
 		io_data->password = tmp ? g_strdup (tmp) : NULL;
 
-		tmp = g_hash_table_lookup (secrets, NM_OPENVPN_KEY_CERTPASS);
+		tmp = nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_CERTPASS);
 		io_data->priv_key_pass = tmp ? g_strdup (tmp) : NULL;
 
 		priv->io_data = io_data;
@@ -832,6 +859,8 @@
 {
 	NMSettingVPN *s_vpn;
 	const char *connection_type;
+	const char *user_name;
+	const char *tmp;
 
 	s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
 	if (!s_vpn) {
@@ -843,12 +872,14 @@
 		return FALSE;
 	}
 
-	connection_type = get_connection_type (s_vpn->data);
+	user_name = nm_setting_vpn_get_user_name (s_vpn);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE);
+	connection_type = validate_connection_type (tmp);
 
 	/* Need a username for any password-based connection types */
 	if (   !strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)
 	    || !strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD)) {
-		if (!s_vpn->user_name && !g_hash_table_lookup (s_vpn->data, NM_OPENVPN_KEY_USERNAME)) {
+		if (!user_name && !nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_USERNAME)) {
 			g_set_error (error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
@@ -858,22 +889,18 @@
 		}
 	}
 
-	/* Validate the properties and secrets */
-	if (!nm_openvpn_properties_validate (s_vpn->data, error))
+	/* Validate the properties */
+	if (!nm_openvpn_properties_validate (s_vpn, error))
 		return FALSE;
 
 	/* Static Key doesn't need secrets; the rest do */
 	if (strcmp (connection_type, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
-		if (!nm_openvpn_properties_validate (s_vpn->secrets, error))
+		if (!nm_openvpn_secrets_validate (s_vpn, error))
 			return FALSE;
 	}
 
 	/* Finally try to start OpenVPN */
-	if (!nm_openvpn_start_openvpn_binary (NM_OPENVPN_PLUGIN (plugin),
-	                                      s_vpn->data,
-	                                      s_vpn->secrets,
-	                                      s_vpn->user_name,
-	                                      error))
+	if (!nm_openvpn_start_openvpn_binary (NM_OPENVPN_PLUGIN (plugin), s_vpn, user_name, error))
 		return FALSE;
 
 	return TRUE;
@@ -888,6 +915,7 @@
 	NMSettingVPN *s_vpn;
 	const char *connection_type;
 	gboolean need_secrets = FALSE;
+	const char *tmp;
 
 	g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE);
 	g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
@@ -902,21 +930,23 @@
 		return FALSE;
 	}
 
-	connection_type = get_connection_type (s_vpn->data);
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE);
+	connection_type = validate_connection_type (tmp);
+
 	if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD_TLS)) {
 		/* Will require a password and maybe private key password */
-		if (!g_hash_table_lookup (s_vpn->secrets, NM_OPENVPN_KEY_CERTPASS))
+		if (!nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_CERTPASS))
 			need_secrets = TRUE;
 
-		if (!g_hash_table_lookup (s_vpn->secrets, NM_OPENVPN_KEY_PASSWORD))
+		if (!nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_PASSWORD))
 			need_secrets = TRUE;
 	} else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_PASSWORD)) {
 		/* Will require a password */
-		if (!g_hash_table_lookup (s_vpn->secrets, NM_OPENVPN_KEY_PASSWORD))
+		if (!nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_PASSWORD))
 			need_secrets = TRUE;
 	} else if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_TLS)) {
 		/* May require private key password */
-		if (!g_hash_table_lookup (s_vpn->secrets, NM_OPENVPN_KEY_CERTPASS))
+		if (!nm_setting_vpn_get_secret (s_vpn, NM_OPENVPN_KEY_CERTPASS))
 			need_secrets = TRUE;
 	}
 

Modified: trunk/vpn-daemons/pptp/auth-dialog/main.c
==============================================================================
--- trunk/vpn-daemons/pptp/auth-dialog/main.c	(original)
+++ trunk/vpn-daemons/pptp/auth-dialog/main.c	Wed Oct 29 09:13:40 2008
@@ -171,7 +171,7 @@
 
 	if (password) {
 		memset (password, 0, strlen (password));
-		g_free (password);
+		gnome_keyring_memory_free (password);
 	}
 	exit_status = 0;
 

Modified: trunk/vpn-daemons/pptp/properties/advanced-dialog.c
==============================================================================
--- trunk/vpn-daemons/pptp/properties/advanced-dialog.c	(original)
+++ trunk/vpn-daemons/pptp/properties/advanced-dialog.c	Wed Oct 29 09:13:40 2008
@@ -70,16 +70,15 @@
 };
 
 static void
-copy_values (gpointer key, gpointer data, gpointer user_data)
+copy_values (const char *key, const char *value, gpointer user_data)
 {
 	GHashTable *hash = (GHashTable *) user_data;
 	const char **i;
 
 	for (i = &advanced_keys[0]; *i; i++) {
-		if (strcmp ((const char *) key, *i))
+		if (strcmp (key, *i))
 			continue;
-
-		g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup ((const char *) data));
+		g_hash_table_insert (hash, g_strdup (key), g_strdup (value));
 	}
 }
 
@@ -93,9 +92,7 @@
 	hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
 	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
-	if (s_vpn && s_vpn->data)
-		g_hash_table_foreach (s_vpn->data, copy_values, hash);
-
+	nm_setting_vpn_foreach_data_item (s_vpn, copy_values, hash);
 	return hash;
 }
 

Modified: trunk/vpn-daemons/pptp/properties/nm-pptp.c
==============================================================================
--- trunk/vpn-daemons/pptp/properties/nm-pptp.c	(original)
+++ trunk/vpn-daemons/pptp/properties/nm-pptp.c	Wed Oct 29 09:13:40 2008
@@ -128,8 +128,6 @@
 	PptpPluginUiWidgetPrivate *priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
 	GtkWidget *widget;
 	const char *str;
-	GtkTreeModel *model;
-	GtkTreeIter iter;
 
 	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
@@ -153,8 +151,6 @@
 static void
 advanced_dialog_close_cb (GtkWidget *dialog, gpointer user_data)
 {
-	PptpPluginUiWidget *self = PPTP_PLUGIN_UI_WIDGET (user_data);
-
 	gtk_widget_hide (dialog);
 	/* gtk_widget_destroy() will remove the window from the window group */
 	gtk_widget_destroy (dialog);
@@ -189,7 +185,7 @@
 {
 	PptpPluginUiWidget *self = PPTP_PLUGIN_UI_WIDGET (user_data);
 	PptpPluginUiWidgetPrivate *priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
-	GtkWidget *dialog, *toplevel, *widget;
+	GtkWidget *dialog, *toplevel;
 
 	toplevel = gtk_widget_get_toplevel (priv->widget);
 	g_return_if_fail (GTK_WIDGET_TOPLEVEL (toplevel));
@@ -251,7 +247,7 @@
 		if (s_vpn) {
 			const gchar *tmp = NULL;
 
-			tmp = g_hash_table_lookup (s_vpn->secrets, password_type);
+			tmp = nm_setting_vpn_get_secret (s_vpn, password_type);
 			if (tmp)
 				password = gnome_keyring_memory_strdup (tmp);
 		}
@@ -299,9 +295,6 @@
 	PptpPluginUiWidgetPrivate *priv = PPTP_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
 	NMSettingVPN *s_vpn;
 	GtkWidget *widget;
-	GtkListStore *store;
-	GtkTreeIter iter;
-	int active = -1;
 	const char *value;
 
 	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
@@ -313,7 +306,7 @@
 		return FALSE;
 	gtk_size_group_add_widget (priv->group, widget);
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_GATEWAY);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_GATEWAY);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -324,7 +317,7 @@
 		return FALSE;
 	gtk_size_group_add_widget (priv->group, widget);
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_USER);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_USER);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -335,7 +328,7 @@
 		return FALSE;
 	gtk_size_group_add_widget (priv->group, widget);
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_DOMAIN);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_DOMAIN);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -367,9 +360,9 @@
 static void
 hash_copy_advanced (gpointer key, gpointer data, gpointer user_data)
 {
-	GHashTable *hash = (GHashTable *) user_data;
+	NMSettingVPN *s_vpn = NM_SETTING_VPN (user_data);
 
-	g_hash_table_insert (hash, g_strdup ((const char *) key), g_strdup ((const char *) data));
+	nm_setting_vpn_add_data_item (s_vpn, (const char *) key, (const char *) data);
 }
 
 static gboolean
@@ -382,41 +375,38 @@
 	NMSettingVPN *s_vpn;
 	GtkWidget *widget;
 	const char *str;
-	GtkTreeModel *model;
-	GtkTreeIter iter;
 	gboolean valid = FALSE;
 
 	if (!check_validity (self, error))
 		return FALSE;
 
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
-	s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_PPTP);
+	g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_PPTP, NULL);
 
 	/* Gateway */
 	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (str && strlen (str))
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_PPTP_KEY_GATEWAY), g_strdup (str));
+		nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_GATEWAY, str);
 
 	/* Username */
 	widget = glade_xml_get_widget (priv->xml, "user_entry");
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (str && strlen (str))
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_PPTP_KEY_USER), g_strdup (str));
+		nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_USER, str);
 
 	/* Domain */
 	widget = glade_xml_get_widget (priv->xml, "domain_entry");
 	str = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (str && strlen (str))
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_PPTP_KEY_DOMAIN), g_strdup (str));
+		nm_setting_vpn_add_data_item (s_vpn, NM_PPTP_KEY_DOMAIN, str);
 
 	if (priv->advanced)
-		g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn->data);
+		g_hash_table_foreach (priv->advanced, hash_copy_advanced, s_vpn);
 
 	nm_connection_add_setting (connection, NM_SETTING (s_vpn));
 	valid = TRUE;
 
-done:
 	return valid;
 }
 

Modified: trunk/vpn-daemons/pptp/src/nm-pptp-service.c
==============================================================================
--- trunk/vpn-daemons/pptp/src/nm-pptp-service.c	(original)
+++ trunk/vpn-daemons/pptp/src/nm-pptp-service.c	Wed Oct 29 09:13:40 2008
@@ -239,7 +239,7 @@
 	memset (priv->password, 0, sizeof (priv->password));
 
 	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
-	if (!s_vpn || !s_vpn->secrets || !s_vpn->data) {
+	if (!s_vpn) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
@@ -249,8 +249,9 @@
 	}
 
 	/* Username; try PPTP specific username first, then generic username */
-	username = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_USER);
+	username = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_USER);
 	if (username && strlen (username)) {
+		/* FIXME: This check makes about 0 sense. */
 		if (!username || !strlen (username)) {
 			g_set_error (error,
 			             NM_VPN_PLUGIN_ERROR,
@@ -260,7 +261,7 @@
 			return FALSE;
 		}
 	} else {
-		username = s_vpn->user_name;
+		username = nm_setting_vpn_get_user_name (s_vpn);
 		if (!username || !strlen (username)) {
 			g_set_error (error,
 			             NM_VPN_PLUGIN_ERROR,
@@ -271,7 +272,7 @@
 		}
 	}
 
-	password = g_hash_table_lookup (s_vpn->secrets, NM_PPTP_KEY_PASSWORD);
+	password = nm_setting_vpn_get_secret (s_vpn, NM_PPTP_KEY_PASSWORD);
 	if (!password || !strlen (password)) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
@@ -281,7 +282,7 @@
 		return FALSE;
 	}
 
-	domain = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_DOMAIN);
+	domain = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_DOMAIN);
 	if (domain && strlen (domain))
 		memcpy (priv->domain, domain, strlen (domain));
 
@@ -373,7 +374,6 @@
 static ValidProperty valid_properties[] = {
 	{ NM_PPTP_KEY_GATEWAY,           G_TYPE_STRING, TRUE },
 	{ NM_PPTP_KEY_USER,              G_TYPE_STRING, FALSE },
-	{ NM_PPTP_KEY_PASSWORD,          G_TYPE_STRING, FALSE },
 	{ NM_PPTP_KEY_DOMAIN,            G_TYPE_STRING, FALSE },
 	{ NM_PPTP_KEY_REFUSE_EAP,        G_TYPE_BOOLEAN, FALSE },
 	{ NM_PPTP_KEY_REFUSE_PAP,        G_TYPE_BOOLEAN, FALSE },
@@ -392,6 +392,11 @@
 	{ NULL,                          G_TYPE_NONE,   FALSE }
 };
 
+static ValidProperty valid_secrets[] = {
+	{ NM_PPTP_KEY_PASSWORD,          G_TYPE_STRING, FALSE },
+	{ NULL,                          G_TYPE_NONE,   FALSE }
+};
+
 static gboolean
 validate_gateway (const char *gateway)
 {
@@ -410,88 +415,97 @@
 	return TRUE;
 }
 
+typedef struct ValidateInfo {
+	ValidProperty *table;
+	GError **error;
+	gboolean have_items;
+} ValidateInfo;
+
 static void
-validate_one_property (gpointer key, gpointer value, gpointer user_data)
+validate_one_property (const char *key, const char *value, gpointer user_data)
 {
-	GError **error = (GError **) user_data;
+	ValidateInfo *info = (ValidateInfo *) user_data;
 	int i;
 
-	if (*error)
+	if (*(info->error))
 		return;
 
+	info->have_items = TRUE;
+
 	/* 'name' is the setting name; always allowed but unused */
-	if (!strcmp ((char *) key, NM_SETTING_NAME))
+	if (!strcmp (key, NM_SETTING_NAME))
 		return;
 
-	for (i = 0; valid_properties[i].name; i++) {
-		ValidProperty prop = valid_properties[i];
+	for (i = 0; info->table[i].name; i++) {
+		ValidProperty prop = info->table[i];
 		long int tmp;
 
-		if (strcmp (prop.name, (char *) key))
+		if (strcmp (prop.name, key))
 			continue;
 
 		switch (prop.type) {
 		case G_TYPE_STRING:
 			if (   !strcmp (prop.name, NM_PPTP_KEY_GATEWAY)
 			    && !validate_gateway (value)) {
-				g_set_error (error,
+				g_set_error (info->error,
 				             NM_VPN_PLUGIN_ERROR,
 				             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 				             "invalid gateway '%s'",
-				             (const char *) key);
+				             key);
 				return;
 			}
 			return; /* valid */
 		case G_TYPE_UINT:
 			errno = 0;
-			tmp = strtol ((char *) value, NULL, 10);
+			tmp = strtol (value, NULL, 10);
 			if (errno == 0)
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid integer property '%s'",
-			             (const char *) key);
+			             key);
 			break;
 		case G_TYPE_BOOLEAN:
-			if (!strcmp ((char *) value, "yes") || !strcmp ((char *) value, "no"))
+			if (!strcmp (value, "yes") || !strcmp (value, "no"))
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid boolean property '%s' (not yes or no)",
-			             (const char *) key);
+			             key);
 			break;
 		default:
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "unhandled property '%s' type %s",
-			             (const char *) key, g_type_name (prop.type));
+			             key, g_type_name (prop.type));
 			break;
 		}
 	}
 
 	/* Did not find the property from valid_properties or the type did not match */
-	if (!valid_properties[i].name) {
-		g_set_error (error,
+	if (!info->table[i].name) {
+		g_set_error (info->error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 		             "property '%s' invalid or not supported",
-		             (const char *) key);
+		             key);
 	}
 }
 
 static gboolean
-nm_pptp_properties_validate (GHashTable *properties,
-                             gboolean check_required,
+nm_pptp_properties_validate (NMSettingVPN *s_vpn,
                              GError **error)
 {
+	ValidateInfo info = { &valid_properties[0], error, FALSE };
 	int i;
 
-	if (g_hash_table_size (properties) < 1) {
+	nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info);
+	if (!info.have_items) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
@@ -500,34 +514,49 @@
 		return FALSE;
 	}
 
-	g_hash_table_foreach (properties, validate_one_property, error);
 	if (*error)
 		return FALSE;
 
-	if (check_required) {
-		/* Ensure required properties exist */
-		for (i = 0; valid_properties[i].name; i++) {
-			ValidProperty prop = valid_properties[i];
-			const char *value;
-
-			if (!prop.required)
-				continue;
-
-			value = g_hash_table_lookup (properties, prop.name);
-			if (!value || !strlen (value)) {
-				g_set_error (error,
-				             NM_VPN_PLUGIN_ERROR,
-				             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
-				             "Missing required option '%s'.",
-				             prop.name);
-				return FALSE;
-			}
+	/* Ensure required properties exist */
+	for (i = 0; valid_properties[i].name; i++) {
+		ValidProperty prop = valid_properties[i];
+		const char *value;
+
+		if (!prop.required)
+			continue;
+
+		value = nm_setting_vpn_get_data_item (s_vpn, prop.name);
+		if (!value || !strlen (value)) {
+			g_set_error (error,
+			             NM_VPN_PLUGIN_ERROR,
+			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+			             "Missing required option '%s'.",
+			             prop.name);
+			return FALSE;
 		}
 	}
 
 	return TRUE;
 }
 
+static gboolean
+nm_pptp_secrets_validate (NMSettingVPN *s_vpn, GError **error)
+{
+	ValidateInfo info = { &valid_secrets[0], error, FALSE };
+
+	nm_setting_vpn_foreach_secret (s_vpn, validate_one_property, &info);
+	if (!info.have_items) {
+		g_set_error (error,
+		             NM_VPN_PLUGIN_ERROR,
+		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+		             "%s",
+		             "No VPN secrets!");
+		return FALSE;
+	}
+
+	return *error ? FALSE : TRUE;
+}
+
 static void
 pppd_watch_cb (GPid pid, gint status, gpointer user_data)
 {
@@ -650,7 +679,6 @@
 	GPtrArray *args = NULL;
 	const char *value, *pptp_binary;
 	char *ipparam, *tmp;
-	gboolean set = FALSE;
 
 	pptp_binary = nm_find_pptp ();
 	if (!pptp_binary) {
@@ -666,7 +694,7 @@
 	g_ptr_array_add (args, (gpointer) g_strdup (pppd));
 
 	/* PPTP options */
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_GATEWAY);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_GATEWAY);
 	if (!value || !strlen (value)) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
@@ -692,55 +720,55 @@
 	g_ptr_array_add (args, (gpointer) g_strdup ("noipdefault"));
 	g_ptr_array_add (args, (gpointer) g_strdup ("nodefaultroute"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_EAP);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REFUSE_EAP);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("refuse-eap"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_PAP);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REFUSE_PAP);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("refuse-pap"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_CHAP);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REFUSE_CHAP);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("refuse-chap"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_MSCHAP);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REFUSE_MSCHAP);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("refuse-mschap"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REFUSE_MSCHAPV2);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REFUSE_MSCHAPV2);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("refuse-mschap-v2"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REQUIRE_MPPE);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REQUIRE_MPPE);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("require-mppe"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REQUIRE_MPPE_40);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REQUIRE_MPPE_40);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("require-mppe-40"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_REQUIRE_MPPE_128);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_REQUIRE_MPPE_128);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("require-mppe-128"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_MPPE_STATEFUL);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_MPPE_STATEFUL);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("mppe-stateful"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_NOBSDCOMP);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_NOBSDCOMP);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("nobsdcomp"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_NODEFLATE);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_NODEFLATE);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("nodeflate"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_NO_VJ_COMP);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_NO_VJ_COMP);
 	if (value && !strcmp (value, "yes"))
 		g_ptr_array_add (args, (gpointer) g_strdup ("novj"));
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_LCP_ECHO_FAILURE);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_LCP_ECHO_FAILURE);
 	if (value && strlen (value)) {
 		long int tmp_int;
 
@@ -760,7 +788,7 @@
 		g_ptr_array_add (args, (gpointer) g_strdup ("0"));
 	}
 
-	value = g_hash_table_lookup (s_vpn->data, NM_PPTP_KEY_LCP_ECHO_INTERVAL);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_LCP_ECHO_INTERVAL);
 	if (value && strlen (value)) {
 		long int tmp_int;
 
@@ -890,10 +918,10 @@
 	s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
 	g_assert (s_vpn);
 
-	if (!nm_pptp_properties_validate (s_vpn->data, TRUE, error))
+	if (!nm_pptp_properties_validate (s_vpn, error))
 		return FALSE;
 
-	if (!nm_pptp_properties_validate (s_vpn->secrets, FALSE, error))
+	if (!nm_pptp_secrets_validate (s_vpn, error))
 		return FALSE;
 
 	/* Start our pppd plugin helper service */
@@ -937,16 +965,8 @@
 	g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
 
 	s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
-	if (!s_vpn || !s_vpn->secrets) {
-        g_set_error (error,
-		             NM_VPN_PLUGIN_ERROR,
-		             NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
-		             "%s",
-		             "Could not process the request because the VPN connection settings were invalid.");
-		return FALSE;
-	}
 
-	if (!g_hash_table_lookup (s_vpn->secrets, NM_PPTP_KEY_PASSWORD)) {
+	if (!nm_setting_vpn_get_secret (s_vpn, NM_PPTP_KEY_PASSWORD)) {
 		*setting_name = NM_SETTING_VPN_SETTING_NAME;
 		return TRUE;
 	}

Modified: trunk/vpn-daemons/vpnc/properties/nm-vpnc.c
==============================================================================
--- trunk/vpn-daemons/vpnc/properties/nm-vpnc.c	(original)
+++ trunk/vpn-daemons/vpnc/properties/nm-vpnc.c	Wed Oct 29 09:13:40 2008
@@ -177,11 +177,11 @@
 		if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM) {
 			s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
 			if (s_vpn) {
-				tmp = g_hash_table_lookup (s_vpn->secrets, NM_VPNC_KEY_XAUTH_PASSWORD);
+				tmp = nm_setting_vpn_get_secret (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD);
 				if (tmp)
 					password = gnome_keyring_memory_strdup (tmp);
 
-				tmp = g_hash_table_lookup (s_vpn->secrets, NM_VPNC_KEY_SECRET);
+				tmp = nm_setting_vpn_get_secret (s_vpn, NM_VPNC_KEY_SECRET);
 				if (tmp)
 					group_password = gnome_keyring_memory_strdup (tmp);
 			}
@@ -245,7 +245,7 @@
 	GtkWidget *widget;
 	GtkListStore *store;
 	GtkTreeIter iter;
-	char *value;
+	const char *value;
 	int active = -1;
 	const char *natt_mode = NULL;
 
@@ -257,7 +257,7 @@
 	g_return_val_if_fail (widget != NULL, FALSE);
 	gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_GATEWAY);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_GATEWAY);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -267,7 +267,7 @@
 	g_return_val_if_fail (widget != NULL, FALSE);
 	gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_ID);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_ID);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -285,7 +285,7 @@
 	gtk_list_store_append (store, &iter);
 	gtk_list_store_set (store, &iter, 0, _("Weak (use with caution)"), -1);
 	if (s_vpn && (active < 0)) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_SINGLE_DES);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_SINGLE_DES);
 		if (value && !strcmp (value, "yes"))
 			active = 1;
 	}
@@ -293,7 +293,7 @@
 	gtk_list_store_append (store, &iter);
 	gtk_list_store_set (store, &iter, 0, _("None (completely insecure)"), -1);
 	if (s_vpn && (active < 0)) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_NO_ENCRYPTION);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_NO_ENCRYPTION);
 		if (value && !strcmp (value, "yes"))
 			active = 2;
 	}
@@ -307,7 +307,7 @@
 	g_return_val_if_fail (widget != NULL, FALSE);
 	gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_XAUTH_USER);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -317,7 +317,7 @@
 	g_return_val_if_fail (widget != NULL, FALSE);
 	gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget));
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DOMAIN);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_DOMAIN);
 		if (value && strlen (value))
 			gtk_entry_set_text (GTK_ENTRY (widget), value);
 	}
@@ -326,7 +326,7 @@
 	active = -1;
 	store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
 	if (s_vpn)
-		natt_mode = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_NAT_TRAVERSAL_MODE);
+		natt_mode = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE);
 
 	gtk_list_store_append (store, &iter);
 	gtk_list_store_set (store, &iter, 0, _("NAT-T (default)"), 1, NM_VPNC_NATT_MODE_NATT, -1);
@@ -360,7 +360,7 @@
 	widget = glade_xml_get_widget (priv->xml, "disable_dpd_checkbutton");
 	g_return_val_if_fail (widget != NULL, FALSE);
 	if (s_vpn) {
-		value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DPD_IDLE_TIMEOUT);
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT);
 		if (value) {
 			long int tmp;
 
@@ -412,53 +412,37 @@
 		return FALSE;
 
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
-	s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_VPNC);
+	g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_VPNC, NULL);
 
 	/* Gateway */
 	widget = glade_xml_get_widget (priv->xml, "gateway_entry");
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-	if (str && strlen (str)) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_GATEWAY),
-		                     g_strdup (str));
-	}
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_GATEWAY, str);
 
 	/* Group name */
 	widget = glade_xml_get_widget (priv->xml, "group_entry");
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-	if (str && strlen (str)) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_ID),
-		                     g_strdup (str));
-	}
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_ID, str);
 
 	widget = glade_xml_get_widget (priv->xml, "user_entry");
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-	if (str && strlen (str)) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_XAUTH_USER),
-		                     g_strdup (str));
-	}
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER, str);
 
 	widget = glade_xml_get_widget (priv->xml, "domain_entry");
 	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-	if (str && strlen (str)) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_DOMAIN),
-		                     g_strdup (str));
-	}
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DOMAIN, str);
 
 	widget = glade_xml_get_widget (priv->xml, "encryption_combo");
 	switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) {
 	case ENC_TYPE_WEAK:
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_SINGLE_DES),
-		                     g_strdup ("yes"));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_SINGLE_DES, "yes");
 		break;
 	case ENC_TYPE_NONE:
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_NO_ENCRYPTION),
-		                     g_strdup ("yes"));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_NO_ENCRYPTION, "yes");
 		break;
 	case ENC_TYPE_SECURE:
 	default:
@@ -471,29 +455,22 @@
 		const char *mode;
 
 		gtk_tree_model_get (model, &iter, 1, &mode, -1);
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE),
-		                     g_strdup (mode));
-	} else {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE),
-		                     g_strdup (NM_VPNC_NATT_MODE_NATT));
-	}
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE, mode);
+	} else
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE, NM_VPNC_NATT_MODE_NATT);
 	
 	widget = glade_xml_get_widget (priv->xml, "disable_dpd_checkbutton");
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
-		g_hash_table_insert (s_vpn->data,
-		                     g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT),
-		                     g_strdup ("0"));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT, "0");
 	} else {
 		/* If DPD was disabled and now the user wishes to enable it, just
 		 * don't pass the DPD_IDLE_TIMEOUT option to vpnc and thus use the
 		 * default DPD idle time.  Otherwise keep the original DPD idle timeout.
 		 */
 		if (priv->orig_dpd_timeout >= 10) {
-			g_hash_table_insert (s_vpn->data,
-			                     g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT),
-			                     g_strdup_printf ("%d", priv->orig_dpd_timeout));
+			char *tmp = g_strdup_printf ("%d", priv->orig_dpd_timeout);
+			nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT, tmp);
+			g_free (tmp);
 		}
 	}
 
@@ -504,20 +481,14 @@
 		/* User password */
 		widget = glade_xml_get_widget (priv->xml, "user_password_entry");
 		str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-		if (str && strlen (str)) {
-			g_hash_table_insert (s_vpn->secrets,
-			                     g_strdup (NM_VPNC_KEY_XAUTH_PASSWORD),
-			                     g_strdup (str));
-		}
+		if (str && strlen (str))
+			nm_setting_vpn_add_secret (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD, str);
 
 		/* Group password */
 		widget = glade_xml_get_widget (priv->xml, "group_password_entry");
 		str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-		if (str && strlen (str)) {
-			g_hash_table_insert (s_vpn->secrets,
-			                     g_strdup (NM_VPNC_KEY_SECRET),
-			                     g_strdup (str));
-		}
+		if (str && strlen (str))
+			nm_setting_vpn_add_secret (s_vpn, NM_VPNC_KEY_SECRET, str);
 	}
 
 	nm_connection_add_setting (connection, NM_SETTING (s_vpn));
@@ -728,7 +699,7 @@
 	nm_connection_add_setting (connection, NM_SETTING (s_con));
 
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
-	s_vpn->service_type = g_strdup (VPNC_PLUGIN_SERVICE);
+	g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_VPNC, NULL);
 	nm_connection_add_setting (connection, NM_SETTING (s_vpn));
 
 	/* Connection name */
@@ -743,7 +714,7 @@
 
 	/* Gateway */
 	if ((buf = pcf_file_lookup_value (pcf, "main", "Host")))
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_GATEWAY), g_strdup (buf));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_GATEWAY, buf);
 	else {
 		g_set_error (error, 0, 0, "does not look like a %s VPN connection (no Host)",
 		             VPNC_PLUGIN_NAME);
@@ -753,7 +724,7 @@
 
 	/* Group name */
 	if ((buf = pcf_file_lookup_value (pcf, "main", "GroupName")))
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_ID), g_strdup (buf));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_ID, buf);
 	else {
 		g_set_error (error, 0, 0, "does not look like a %s VPN connection (no GroupName)",
 		             VPNC_PLUGIN_NAME);
@@ -766,23 +737,23 @@
 	buf = pcf_file_lookup_value (pcf, "main", "UserName");
 	have_value = buf == NULL ? FALSE : strlen (buf) > 0;
 	if (have_value)
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_XAUTH_USER), g_strdup (buf));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER, buf);
 
 	buf = pcf_file_lookup_value (pcf, "main", "NTDomain");
 	have_value = buf == NULL ? FALSE : strlen (buf) > 0;
 	if (have_value)
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_DOMAIN), g_strdup (buf));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DOMAIN, buf);
 
 	buf = pcf_file_lookup_value (pcf, "main", "SingleDES");
 	have_value = (buf == NULL ? FALSE : strcmp (buf, "0") != 0);
 	if (have_value)
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_SINGLE_DES), g_strdup ("yes"));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_SINGLE_DES, "yes");
 
 	/* Default is enabled, only disabled if explicit EnableNat=0 exists */
 	buf = pcf_file_lookup_value (pcf, "main", "EnableNat");
 	have_value = (buf ? strncmp (buf, "0", 1) == 0 : FALSE);
 	if (have_value)
-		g_hash_table_insert (s_vpn->data, g_strdup (NM_VPNC_KEY_NAT_TRAVERSAL_MODE), g_strdup (NM_VPNC_NATT_MODE_NATT));
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE, NM_VPNC_NATT_MODE_NATT);
 
 	if ((buf = pcf_file_lookup_value (pcf, "main", "PeerTimeout"))) {
 		long int val;
@@ -790,9 +761,9 @@
 		errno = 0;
 		val = strtol (buf, NULL, 10);
 		if ((errno == 0) && ((val == 0) || ((val >= 10) && (val <= 86400)))) {
-			g_hash_table_insert (s_vpn->data,
-			                     g_strdup (NM_VPNC_KEY_DPD_IDLE_TIMEOUT),
-			                     g_strdup_printf ("%d", (gint) val));
+			char *tmp = g_strdup_printf ("%d", (gint) val);
+			nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT, tmp);
+			g_free (tmp);
 		}
 	}
 
@@ -855,10 +826,6 @@
 	s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
 
 	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
-	if (!s_vpn || !s_vpn->data) {
-		g_set_error (error, 0, 0, "connection was incomplete");
-		return FALSE;
-	}
 
 	f = fopen (path, "w");
 	if (!f) {
@@ -866,7 +833,7 @@
 		return FALSE;
 	}
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_GATEWAY);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_GATEWAY);
 	if (value && strlen (value))
 		gateway = value;
 	else {
@@ -874,7 +841,7 @@
 		goto done;
 	}
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_ID);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_ID);
 	if (value && strlen (value))
 		groupname = value;
 	else {
@@ -882,23 +849,23 @@
 		goto done;
 	}
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_XAUTH_USER);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER);
 	if (value && strlen (value))
 		username = value;
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DOMAIN);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_DOMAIN);
 	if (value && strlen (value))
 		domain =  value;
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_SINGLE_DES);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_SINGLE_DES);
 	if (value && !strcmp (value, "yes"))
 		singledes = TRUE;
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_NAT_TRAVERSAL_MODE);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE);
 	if (value && strlen (value) && strcmp (value, NM_VPNC_NATT_MODE_NONE))
 		enablenat = TRUE;
 
-	value = g_hash_table_lookup (s_vpn->data, NM_VPNC_KEY_DPD_IDLE_TIMEOUT);
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT);
 	if (value && strlen (value))
 		peertimeout = value;
 

Modified: trunk/vpn-daemons/vpnc/src/nm-vpnc-service.c
==============================================================================
--- trunk/vpn-daemons/vpnc/src/nm-vpnc-service.c	(original)
+++ trunk/vpn-daemons/vpnc/src/nm-vpnc-service.c	Wed Oct 29 09:13:40 2008
@@ -45,9 +45,7 @@
 static ValidProperty valid_properties[] = {
 	{ NM_VPNC_KEY_GATEWAY,               G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_ID,                    G_TYPE_STRING, 0, 0 },
-	{ NM_VPNC_KEY_SECRET,                G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_XAUTH_USER,            G_TYPE_STRING, 0, 0 },
-	{ NM_VPNC_KEY_XAUTH_PASSWORD,        G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_DOMAIN,                G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_DHGROUP,               G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_PERFECT_FORWARD,       G_TYPE_STRING, 0, 0 },
@@ -62,24 +60,38 @@
 	{ NULL,                              G_TYPE_NONE, 0, 0 }
 };
 
+static ValidProperty valid_secrets[] = {
+	{ NM_VPNC_KEY_SECRET,                G_TYPE_STRING, 0, 0 },
+	{ NM_VPNC_KEY_XAUTH_PASSWORD,        G_TYPE_STRING, 0, 0 },
+	{ NULL,                              G_TYPE_NONE, 0, 0 }
+};
+
+typedef struct ValidateInfo {
+	ValidProperty *table;
+	GError **error;
+	gboolean have_items;
+} ValidateInfo;
+
 static void
-validate_one_property (gpointer key, gpointer value, gpointer user_data)
+validate_one_property (const char *key, const char *value, gpointer user_data)
 {
-	GError **error = (GError **) user_data;
+	ValidateInfo *info = (ValidateInfo *) user_data;
 	int i;
 
-	if (*error)
+	if (*(info->error))
 		return;
 
+	info->have_items = TRUE;
+
 	/* 'name' is the setting name; always allowed but unused */
-	if (!strcmp ((char *) key, NM_SETTING_NAME))
+	if (!strcmp (key, NM_SETTING_NAME))
 		return;
 
-	for (i = 0; valid_properties[i].name; i++) {
-		ValidProperty prop = valid_properties[i];
+	for (i = 0; info->table[i].name; i++) {
+		ValidProperty prop = info->table[i];
 		long int tmp;
 
-		if (strcmp (prop.name, (char *) key))
+		if (strcmp (prop.name, key))
 			continue;
 
 		switch (prop.type) {
@@ -87,50 +99,53 @@
 			return; /* valid */
 		case G_TYPE_INT:
 			errno = 0;
-			tmp = strtol ((char *) value, NULL, 10);
+			tmp = strtol (value, NULL, 10);
 			if (errno == 0 && tmp >= prop.int_min && tmp <= prop.int_max)
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid integer property '%s' or out of range [%d -> %d]",
-			             (const char *) key, prop.int_min, prop.int_max);
+			             key, prop.int_min, prop.int_max);
 			break;
 		case G_TYPE_BOOLEAN:
-			if (!strcmp ((char *) value, "yes") || !strcmp ((char *) value, "no"))
+			if (!strcmp (value, "yes") || !strcmp (value, "no"))
 				return; /* valid */
 
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "invalid boolean property '%s' (not yes or no)",
-			             (const char *) key);
+			             key);
 			break;
 		default:
-			g_set_error (error,
+			g_set_error (info->error,
 			             NM_VPN_PLUGIN_ERROR,
 			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 			             "unhandled property '%s' type %s",
-			             (const char *) key, g_type_name (prop.type));
+			             key, g_type_name (prop.type));
 			break;
 		}
 	}
 
 	/* Did not find the property from valid_properties or the type did not match */
-	if (!valid_properties[i].name) {
-		g_set_error (error,
+	if (!info->table[i].name) {
+		g_set_error (info->error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
 		             "property '%s' invalid or not supported",
-		             (const char *) key);
+		             key);
 	}
 }
 
 static gboolean
-nm_vpnc_properties_validate (GHashTable *properties, GError **error)
+nm_vpnc_properties_validate (NMSettingVPN *s_vpn, GError **error)
 {
-	if (g_hash_table_size (properties) < 1) {
+	ValidateInfo info = { &valid_properties[0], error, FALSE };
+
+	nm_setting_vpn_foreach_data_item (s_vpn, validate_one_property, &info);
+	if (!info.have_items) {
 		g_set_error (error,
 		             NM_VPN_PLUGIN_ERROR,
 		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
@@ -139,7 +154,23 @@
 		return FALSE;
 	}
 
-	g_hash_table_foreach (properties, validate_one_property, error);
+	return *error ? FALSE : TRUE;
+}
+
+static gboolean
+nm_vpnc_secrets_validate (NMSettingVPN *s_vpn, GError **error)
+{
+	ValidateInfo info = { &valid_secrets[0], error, FALSE };
+
+	nm_setting_vpn_foreach_secret (s_vpn, validate_one_property, &info);
+	if (!info.have_items) {
+		g_set_error (error,
+		             NM_VPN_PLUGIN_ERROR,
+		             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+		             "%s",
+		             "No VPN secrets!");
+		return FALSE;
+	}
 
 	return *error ? FALSE : TRUE;
 }
@@ -257,7 +288,7 @@
 } WriteConfigInfo;
 
 static void
-write_one_property (gpointer key, gpointer value, gpointer user_data)
+write_one_property (const char *key, const char *value, gpointer user_data)
 {
 	WriteConfigInfo *info = (WriteConfigInfo *) user_data;
 	GType type = G_TYPE_INVALID;
@@ -271,8 +302,19 @@
 		ValidProperty prop = valid_properties[i];
 
 		if (!strcmp (prop.name, (char *) key)) {
-			/* Property is ok */
-			type = prop.type;
+  			/* Property is ok */
+  			type = prop.type;
+			break;
+		}
+	}
+
+	/* Try the valid secrets table */
+	for (i = 0; type == G_TYPE_INVALID && valid_secrets[i].name; i++) {
+		ValidProperty prop = valid_secrets[i];
+
+		if (!strcmp (prop.name, (char *) key)) {
+  			/* Property is ok */
+  			type = prop.type;
 			break;
 		}
 	}
@@ -319,14 +361,15 @@
 
 static gboolean
 nm_vpnc_config_write (gint vpnc_fd,
-                      const char *default_user_name,
-                      GHashTable *properties,
-                      GHashTable *secrets,
+                      NMSettingVPN *s_vpn,
                       GError **error)
 {
 	WriteConfigInfo *info;
-	const char *props_user_name;
+	const char *props_username;
 	const char *props_natt_mode;
+	const char *default_username;
+
+	default_username = nm_setting_vpn_get_user_name (s_vpn);
 
 	write_config_option (vpnc_fd, "Script " NM_VPNC_HELPER_PATH "\n");
 
@@ -335,17 +378,17 @@
 	                     NM_VPNC_UDP_ENCAPSULATION_PORT);
 
 	/* Fill username if it's not present */
-	props_user_name = g_hash_table_lookup (properties, NM_VPNC_KEY_XAUTH_USER);
-	if (   default_user_name
-	    && strlen (default_user_name)
-	    && (!props_user_name || !strlen (props_user_name))) {
+	props_username = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER);
+	if (   default_username
+	    && strlen (default_username)
+	    && (!props_username || !strlen (props_username))) {
 		write_config_option (vpnc_fd,
 		                     NM_VPNC_KEY_XAUTH_USER " %s\n",
-		                     default_user_name);
+		                     default_username);
 	}
 	
 	/* Use NAT-T by default */
-	props_natt_mode = g_hash_table_lookup (properties, NM_VPNC_KEY_NAT_TRAVERSAL_MODE);
+	props_natt_mode = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_NAT_TRAVERSAL_MODE);
 	if (!props_natt_mode || !strlen (props_natt_mode)) {
 		write_config_option (vpnc_fd,
 		                     NM_VPNC_KEY_NAT_TRAVERSAL_MODE " %s\n",
@@ -354,8 +397,8 @@
 
 	info = g_malloc0 (sizeof (WriteConfigInfo));
 	info->fd = vpnc_fd;
-	g_hash_table_foreach (properties, write_one_property, info);
-	g_hash_table_foreach (secrets, write_one_property, info);
+	nm_setting_vpn_foreach_data_item (s_vpn, write_one_property, info);
+	nm_setting_vpn_foreach_secret (s_vpn, write_one_property, info);
 	*error = info->error;
 	g_free (info);
 
@@ -373,16 +416,17 @@
 
 	s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
 	g_assert (s_vpn);
-	if (!nm_vpnc_properties_validate (s_vpn->data, error))
+
+	if (!nm_vpnc_properties_validate (s_vpn, error))
 		goto out;
-	if (!nm_vpnc_properties_validate (s_vpn->secrets, error))
+	if (!nm_vpnc_secrets_validate (s_vpn, error))
 		goto out;
 
 	vpnc_fd = nm_vpnc_start_vpnc_binary (NM_VPNC_PLUGIN (plugin), error);
 	if (vpnc_fd < 0)
 		goto out;
 
-	if (!nm_vpnc_config_write (vpnc_fd, s_vpn->user_name, s_vpn->data, s_vpn->secrets, error))
+	if (!nm_vpnc_config_write (vpnc_fd, s_vpn, error))
 		goto out;
 
 	success = TRUE;
@@ -416,11 +460,11 @@
 
 	// FIXME: there are some configurations where both passwords are not
 	// required.  Make sure they work somehow.
-	if (!g_hash_table_lookup (s_vpn->secrets, NM_VPNC_KEY_SECRET)) {
+	if (!nm_setting_vpn_get_secret (s_vpn, NM_VPNC_KEY_SECRET)) {
 		*setting_name = NM_SETTING_VPN_SETTING_NAME;
 		return TRUE;
 	}
-	if (!g_hash_table_lookup (s_vpn->secrets, NM_VPNC_KEY_XAUTH_PASSWORD)) {
+	if (!nm_setting_vpn_get_secret (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD)) {
 		*setting_name = NM_SETTING_VPN_SETTING_NAME;
 		return TRUE;
 	}



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