[network-manager-vpnc/NETWORKMANAGER_0_7] allow missing description in pcf file during import
- From: Dan Williams <dcbw src gnome org>
- To: svn-commits-list gnome org
- Subject: [network-manager-vpnc/NETWORKMANAGER_0_7] allow missing description in pcf file during import
- Date: Mon, 4 May 2009 13:38:52 -0400 (EDT)
commit 4e04bfb4877f23ec14ac298a9ff7a63f1e7eaa5d
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Mon May 4 13:38:38 2009 -0400
allow missing description in pcf file during import
---
properties/nm-vpnc.c | 16 +++++-----------
properties/pcf-file.c | 4 ++++
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index 44a8b8e..0d084e5 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -980,7 +980,7 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
pcf = pcf_file_load (path);
if (!pcf) {
- g_set_error (error, 0, 0, "does not look like a %s VPN connection",
+ g_set_error (error, 0, 0, "does not look like a %s VPN connection (parse failed)",
VPNC_PLUGIN_NAME);
return NULL;
}
@@ -996,16 +996,6 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- /* Connection name */
- if (pcf_file_lookup_string (pcf, "main", "Description", &buf))
- g_object_set (s_con, NM_SETTING_CONNECTION_ID, buf, NULL);
- else {
- g_set_error (error, 0, 0, "does not look like a %s VPN connection (parse failed)",
- VPNC_PLUGIN_NAME);
- g_object_unref (connection);
- return NULL;
- }
-
/* Gateway */
if (pcf_file_lookup_string (pcf, "main", "Host", &buf))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_GATEWAY, buf);
@@ -1028,6 +1018,10 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
/* Optional settings */
+ /* Connection name */
+ if (pcf_file_lookup_string (pcf, "main", "Description", &buf))
+ g_object_set (s_con, NM_SETTING_CONNECTION_ID, buf, NULL);
+
if (pcf_file_lookup_string (pcf, "main", "UserName", &buf))
nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_XAUTH_USER, buf);
diff --git a/properties/pcf-file.c b/properties/pcf-file.c
index cff0844..9922527 100644
--- a/properties/pcf-file.c
+++ b/properties/pcf-file.c
@@ -125,6 +125,10 @@ pcf_file_load (const char *fname)
g_hash_table_insert (group, entry->key, entry);
}
}
+
+ /* Contains a main section? */
+ if (!g_hash_table_lookup (pcf, "main"))
+ goto fail;
fclose (fo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]