[network-manager-vpnc] import/export: fix DHGroup pcf parameter 1, 2, 5 <---> dh1, dh2, dh5



commit 1cdf7d19943d1bb470b4ccbff1cd0512b94e4795
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Fri Jan 14 12:49:50 2011 +0100

    import/export: fix DHGroup pcf parameter 1,2,5 <---> dh1,dh2,dh5

 properties/nm-vpnc.c                  |   15 ++++++++++-----
 properties/tests/test-import-export.c |    3 ++-
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index 4999a03..e647ef8 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -6,7 +6,7 @@
  *
  * Copyright (C) 2005 David Zeuthen, <davidz redhat com>
  * Copyright (C) 2005 - 2008 Dan Williams, <dcbw redhat com>
- * Copyright (C) 2005 - 2010 Red Hat, Inc.
+ * Copyright (C) 2005 - 2011 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1132,8 +1132,12 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
 	}
 
 	if (pcf_file_lookup_string (pcf, "main", "DHGroup", &buf)) {
-		if (!strcmp (buf, "1") || !strcmp (buf, "2") || !strcmp (buf, "5"))
-			nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DHGROUP, buf);
+		if (!strcmp (buf, "1") || !strcmp (buf, "2") || !strcmp (buf, "5")) {
+			char *tmp;
+			tmp = g_strdup_printf ("dh%s", buf);
+			nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DHGROUP, tmp);
+			g_free (tmp);
+		}
 	}
 
 	if (pcf_file_lookup_string (pcf, "main", "X-NM-Routes", &buf))
@@ -1261,8 +1265,9 @@ export (NMVpnPluginUiInterface *iface,
 		peertimeout = value;
 
 	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_DHGROUP);
-	if (value && strlen (value))
-		dhgroup = value;
+	if (value && strlen (value)) {
+		dhgroup = (value[0] == 'd' && value[1] == 'h') ? value + 2 : NULL;
+	}
 
 	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
 	if (value && strlen (value)) {
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 390675b..f9a6719 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -1,6 +1,7 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * Copyright (C) 2009 Dan Williams, <dcbw redhat com>
+ * Copyright (C) 2009 - 2011 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -87,7 +88,7 @@ static Item basic_items[] = {
 	{ NM_VPNC_KEY_XAUTH_USER,            "bsmith" },
 	{ NM_VPNC_KEY_XAUTH_PASSWORD_TYPE,   NM_VPNC_PW_TYPE_SAVE },
 	{ NM_VPNC_KEY_DOMAIN,                "COMPANY" },
-	{ NM_VPNC_KEY_DHGROUP,               "2" },
+	{ NM_VPNC_KEY_DHGROUP,               "dh2" },
 	{ NM_VPNC_KEY_PERFECT_FORWARD,       NULL },
 	{ NM_VPNC_KEY_APP_VERSION,           NULL },
 	{ NM_VPNC_KEY_SINGLE_DES,            NULL },



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