Re: Release: 0.7.1



On Sat, 2009-04-18 at 16:49 +0200, Cyril Jaquier wrote:
> I want more user-configurable settings for the vpnc plugin. Like
> --vendor and --pfs. So I could finally connect to Netscreen/Juniper
> firewalls as I used to do with NM 0.6.

Does this work? You have to set 'vendor' and 'pfs' string keys in
gconf-editor manually; adding that to the UI is left as an exercise for
the reader.

If it works and Dan approves of the approach, we'll want want to fix
some of the other options which have spaces (and parentheses) in their
names, too.

diff --git a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
index cd0d903..aee686f 100644
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -57,6 +57,7 @@ typedef struct {
 	GType type;
 	gint int_min;
 	gint int_max;
+	const char *conf_name;
 } ValidProperty;
 
 #define LEGACY_NAT_KEEPALIVE "NAT-Keepalive packet interval"
@@ -67,7 +68,8 @@ static ValidProperty valid_properties[] = {
 	{ NM_VPNC_KEY_XAUTH_USER,            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 },
+	{ NM_VPNC_KEY_PERFECT_FORWARD,       G_TYPE_STRING, 0, 0, "Perfect Forward Secrecy" },
+	{ NM_VPNC_KEY_VENDOR,                G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_APP_VERSION,           G_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_SINGLE_DES,            G_TYPE_BOOLEAN, 0, 0 },
 	{ NM_VPNC_KEY_NO_ENCRYPTION,         G_TYPE_BOOLEAN, 0, 0 },
@@ -317,6 +319,7 @@ static void
 write_one_property (const char *key, const char *value, gpointer user_data)
 {
 	WriteConfigInfo *info = (WriteConfigInfo *) user_data;
+	const char *conf_name = key;
 	GType type = G_TYPE_INVALID;
 	int i;
 
@@ -341,6 +344,8 @@ write_one_property (const char *key, const char *value, gpointer user_data)
 		if (!strcmp (prop.name, (char *) key)) {
   			/* Property is ok */
   			type = prop.type;
+			if (prop.conf_name)
+				conf_name = prop.conf_name;
 			break;
 		}
 	}
@@ -360,10 +365,10 @@ write_one_property (const char *key, const char *value, gpointer user_data)
 		return;
 
 	if (type == G_TYPE_STRING)
-		write_config_option (info->fd, "%s %s\n", (char *) key, (char *) value);
+		write_config_option (info->fd, "%s %s\n", (char *) conf_name, (char *) value);
 	else if (type == G_TYPE_BOOLEAN) {
 		if (!strcmp (value, "yes"))
-			write_config_option (info->fd, "%s\n", (char *) key);
+			write_config_option (info->fd, "%s\n", (char *) conf_name);
 	} else if (type == G_TYPE_INT) {
 		long int tmp_int;
 		char *tmp_str;
@@ -375,7 +380,7 @@ write_one_property (const char *key, const char *value, gpointer user_data)
 		tmp_int = strtol (value, NULL, 10);
 		if (errno == 0) {
 			tmp_str = g_strdup_printf ("%ld", tmp_int);
-			write_config_option (info->fd, "%s %s\n", (char *) key, tmp_str);
+			write_config_option (info->fd, "%s %s\n", (char *) conf_name, tmp_str);
 			g_free (tmp_str);
 		} else {
 			g_set_error (&info->error,
diff --git a/src/nm-vpnc-service.h b/src/nm-vpnc-service.h
index 58282ab..489eeb4 100644
--- a/src/nm-vpnc-service.h
+++ b/src/nm-vpnc-service.h
@@ -46,7 +46,8 @@
 #define NM_VPNC_KEY_XAUTH_PASSWORD_TYPE "xauth-password-type"
 #define NM_VPNC_KEY_DOMAIN "Domain"
 #define NM_VPNC_KEY_DHGROUP "IKE DH Group"
-#define NM_VPNC_KEY_PERFECT_FORWARD "Perfect Forward Secrecy"
+#define NM_VPNC_KEY_PERFECT_FORWARD "pfs"
+#define NM_VPNC_KEY_VENDOR "vendor"
 #define NM_VPNC_KEY_APP_VERSION "Application Version"
 #define NM_VPNC_KEY_SINGLE_DES "Enable Single DES"
 #define NM_VPNC_KEY_NO_ENCRYPTION "Enable no encryption"

-- 
David Woodhouse                            Open Source Technology Centre
David Woodhouse intel com                              Intel Corporation



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