[network-manager-openvpn/NM_0_8] core/properties: minor cleanups



commit f63d4f89c7b92b5b38ee4cf78307b9c6c9da5cc9
Author: Pablo Castellano <pablog src gnome org>
Date:   Mon Aug 9 11:42:19 2010 -0500

    core/properties: minor cleanups
    
     * Sort alphabetically constants and Makefile.am
     * Added a trailing space to the constants when needed
     * initialize have_sk before
     * fixed typo in tests
     * update .gitignore

 .gitignore                            |    1 +
 properties/import-export.c            |   42 +++++++++++++++-----------------
 properties/tests/conf/Makefile.am     |   12 ++++----
 properties/tests/test-import-export.c |   12 ++++----
 src/nm-openvpn-service.c              |   12 ++++----
 src/nm-openvpn-service.h              |   12 ++++----
 6 files changed, 45 insertions(+), 46 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 69b1c46..66ec7fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 *.lo
 *.la
 *.bz2
+*.swp
 Makefile
 Makefile.in*
 configure
diff --git a/properties/import-export.c b/properties/import-export.c
index a33b1b7..f9731d2 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -43,29 +43,29 @@
 #include "nm-openvpn.h"
 #include "../src/nm-openvpn-service.h"
 
+#define AUTH_TAG "auth "
+#define AUTH_USER_PASS_TAG "auth-user-pass "
+#define CA_TAG "ca "
+#define CERT_TAG "cert "
+#define CIPHER_TAG "cipher "
 #define CLIENT_TAG "client"
-#define TLS_CLIENT_TAG "tls-client"
+#define COMP_TAG "comp-lzo "
 #define DEV_TAG "dev "
+#define FRAGMENT_TAG "fragment "
+#define IFCONFIG_TAG "ifconfig "
+#define KEY_TAG "key "
+#define MSSFIX_TAG "mssfix "
+#define PKCS12_TAG "pkcs12 "
+#define PORT_TAG "port "
 #define PROTO_TAG "proto "
 #define REMOTE_TAG "remote "
-#define CA_TAG "ca"
-#define CERT_TAG "cert"
-#define KEY_TAG "key"
-#define CIPHER_TAG "cipher"
-#define COMP_TAG "comp-lzo"
-#define IFCONFIG_TAG "ifconfig "
-#define SECRET_TAG "secret"
-#define AUTH_USER_PASS_TAG "auth-user-pass"
-#define TLS_AUTH_TAG "tls-auth"
-#define AUTH_TAG "auth "
-#define RENEG_SEC_TAG "reneg-sec"
-#define TLS_REMOTE_TAG "tls-remote"
-#define PORT_TAG "port"
-#define RPORT_TAG "rport"
-#define MSSFIX_TAG "mssfix"
-#define TUNMTU_TAG "tun-mtu"
-#define FRAGMENT_TAG "fragment"
-#define PKCS12_TAG "pkcs12"
+#define RENEG_SEC_TAG "reneg-sec "
+#define RPORT_TAG "rport "
+#define SECRET_TAG "secret "
+#define TLS_AUTH_TAG "tls-auth "
+#define TLS_CLIENT_TAG "tls-client"
+#define TLS_REMOTE_TAG "tls-remote "
+#define TUNMTU_TAG "tun-mtu "
 
 
 static char *
@@ -413,6 +413,7 @@ do_import (const char *path, char **lines, GError **error)
 			                  NM_OPENVPN_KEY_STATIC_KEY_DIRECTION,
 			                  leftover,
 			                  s_vpn);
+			have_sk = TRUE;
 			continue;
 		}
 
@@ -479,9 +480,6 @@ do_import (const char *path, char **lines, GError **error)
 		}
 	}
 
-	if (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY))
-		have_sk = TRUE;
-
 	if (!have_client && !have_sk) {
 		g_set_error (error,
 		             OPENVPN_PLUGIN_UI_ERROR,
diff --git a/properties/tests/conf/Makefile.am b/properties/tests/conf/Makefile.am
index 6823fa9..aa4e425 100644
--- a/properties/tests/conf/Makefile.am
+++ b/properties/tests/conf/Makefile.am
@@ -1,12 +1,12 @@
 EXTRA_DIST = \
-	password.conf \
-	tls.ovpn \
 	iso885915.ovpn \
-	static.key \
-	static.ovpn \
+	password.conf \
+	pkcs12.ovpn \
 	port.ovpn \
 	rport.ovpn \
-	tun-opts.conf \
-	pkcs12.ovpn
+	static.key \
+	static.ovpn \
+	tls.ovpn \
+	tun-opts.conf
 
 
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 77ee420..b36f556 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -223,7 +223,7 @@ test_password_export (NMVpnPluginUiInterface *plugin, const char *dir)
 	/* Now re-import it and compare the connections to ensure they are the same */
 	reimported = get_basic_connection ("password-export", plugin, dir, PASSWORD_EXPORTED_NAME);
 	ret = unlink (path);
-	ASSERT (connection != NULL, "password-export", "failed to re-import connection");
+	ASSERT (reimported != NULL, "password-export", "failed to re-import connection");
 
 	/* Clear secrets first, since they don't get exported, and thus would
 	 * make the connection comparison below fail.
@@ -338,7 +338,7 @@ test_tls_export (NMVpnPluginUiInterface *plugin, const char *dir)
 	/* Now re-import it and compare the connections to ensure they are the same */
 	reimported = get_basic_connection ("tls-export", plugin, dir, TLS_EXPORTED_NAME);
 	ret = unlink (path);
-	ASSERT (connection != NULL, "tls-export", "failed to re-import connection");
+	ASSERT (reimported != NULL, "tls-export", "failed to re-import connection");
 
 	/* Clear secrets first, since they don't get exported, and thus would
 	 * make the connection comparison below fail.
@@ -447,7 +447,7 @@ test_pkcs12_export (NMVpnPluginUiInterface *plugin, const char *dir)
 	/* Now re-import it and compare the connections to ensure they are the same */
 	reimported = get_basic_connection ("pkcs12-export", plugin, dir, PKCS12_EXPORTED_NAME);
 	ret = unlink (path);
-	ASSERT (connection != NULL, "pkcs12-export", "failed to re-import connection");
+	ASSERT (reimported != NULL, "pkcs12-export", "failed to re-import connection");
 
 	/* Clear secrets first, since they don't get exported, and thus would
 	 * make the connection comparison below fail.
@@ -590,7 +590,7 @@ test_static_key_export (NMVpnPluginUiInterface *plugin, const char *dir)
 	/* Now re-import it and compare the connections to ensure they are the same */
 	reimported = get_basic_connection ("static-key-export", plugin, dir, STATIC_KEY_EXPORTED_NAME);
 	ret = unlink (path);
-	ASSERT (connection != NULL, "static-key-export", "failed to re-import connection");
+	ASSERT (reimported != NULL, "static-key-export", "failed to re-import connection");
 
 	/* Clear secrets first, since they don't get exported, and thus would
 	 * make the connection comparison below fail.
@@ -669,7 +669,7 @@ test_port_export (NMVpnPluginUiInterface *plugin,
 	/* Now re-import it and compare the connections to ensure they are the same */
 	reimported = get_basic_connection (detail, plugin, dir, exported_name);
 	ret = unlink (path);
-	ASSERT (connection != NULL, detail, "failed to re-import connection");
+	ASSERT (reimported != NULL, detail, "failed to re-import connection");
 
 	/* Clear secrets first, since they don't get exported, and thus would
 	 * make the connection comparison below fail.
@@ -732,7 +732,7 @@ test_tun_opts_export (NMVpnPluginUiInterface *plugin, const char *dir)
 	/* Now re-import it and compare the connections to ensure they are the same */
 	reimported = get_basic_connection ("tunopts-export", plugin, dir, TUNOPTS_EXPORTED_NAME);
 	ret = unlink (path);
-	ASSERT (connection != NULL, "tunopts-export", "failed to re-import connection");
+	ASSERT (reimported != NULL, "tunopts-export", "failed to re-import connection");
 
 	/* Clear secrets first, since they don't get exported, and thus would
 	 * make the connection comparison below fail.
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index aada7db..d2c0f4b 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -89,24 +89,24 @@ static ValidProperty valid_properties[] = {
 	{ NM_OPENVPN_KEY_CERT,                 G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_CIPHER,               G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_COMP_LZO,             G_TYPE_BOOLEAN, 0, 0, FALSE },
-	{ NM_OPENVPN_KEY_MSSFIX,               G_TYPE_BOOLEAN, 0, 0, FALSE },
-	{ NM_OPENVPN_KEY_TUNNEL_MTU,           G_TYPE_INT, 0, G_MAXINT, FALSE },
-	{ NM_OPENVPN_KEY_FRAGMENT_SIZE,        G_TYPE_INT, 0, G_MAXINT, FALSE },
 	{ NM_OPENVPN_KEY_CONNECTION_TYPE,      G_TYPE_STRING, 0, 0, FALSE },
-	{ NM_OPENVPN_KEY_TAP_DEV,              G_TYPE_BOOLEAN, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_FRAGMENT_SIZE,        G_TYPE_INT, 0, G_MAXINT, FALSE },
 	{ NM_OPENVPN_KEY_KEY,                  G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_LOCAL_IP,             G_TYPE_STRING, 0, 0, TRUE },
+	{ NM_OPENVPN_KEY_MSSFIX,               G_TYPE_BOOLEAN, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_PROTO_TCP,            G_TYPE_BOOLEAN, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_PORT,                 G_TYPE_INT, 1, 65535, FALSE },
 	{ NM_OPENVPN_KEY_REMOTE,               G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_REMOTE_IP,            G_TYPE_STRING, 0, 0, TRUE },
+	{ NM_OPENVPN_KEY_RENEG_SECONDS,        G_TYPE_INT, 0, G_MAXINT, FALSE },
 	{ NM_OPENVPN_KEY_STATIC_KEY,           G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_STATIC_KEY_DIRECTION, G_TYPE_INT, 0, 1, FALSE },
 	{ 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 },
-	{ NM_OPENVPN_KEY_RENEG_SECONDS,        G_TYPE_INT, 0, G_MAXINT, FALSE },
+	{ NM_OPENVPN_KEY_TAP_DEV,              G_TYPE_BOOLEAN, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_TLS_REMOTE,	       G_TYPE_STRING, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_TUNNEL_MTU,           G_TYPE_INT, 0, G_MAXINT, FALSE },
+	{ NM_OPENVPN_KEY_USERNAME,             G_TYPE_STRING, 0, 0, FALSE },
 	{ NULL,                                G_TYPE_NONE, FALSE }
 };
 
diff --git a/src/nm-openvpn-service.h b/src/nm-openvpn-service.h
index f9678f1..f1e3f0d 100644
--- a/src/nm-openvpn-service.h
+++ b/src/nm-openvpn-service.h
@@ -43,22 +43,22 @@
 #define NM_OPENVPN_KEY_CERT "cert"
 #define NM_OPENVPN_KEY_CIPHER "cipher"
 #define NM_OPENVPN_KEY_COMP_LZO "comp-lzo"
-#define NM_OPENVPN_KEY_MSSFIX "mssfix"
-#define NM_OPENVPN_KEY_TUNNEL_MTU "tunnel-mtu"
-#define NM_OPENVPN_KEY_FRAGMENT_SIZE "fragment-size"
 #define NM_OPENVPN_KEY_CONNECTION_TYPE "connection-type"
-#define NM_OPENVPN_KEY_TAP_DEV "tap-dev"
+#define NM_OPENVPN_KEY_FRAGMENT_SIZE "fragment-size"
 #define NM_OPENVPN_KEY_KEY "key"
-#define NM_OPENVPN_KEY_LOCAL_IP "local-ip"
-#define NM_OPENVPN_KEY_PROTO_TCP "proto-tcp"
+#define NM_OPENVPN_KEY_LOCAL_IP "local-ip" /* ??? */
+#define NM_OPENVPN_KEY_MSSFIX "mssfix"
 #define NM_OPENVPN_KEY_PORT "port"
+#define NM_OPENVPN_KEY_PROTO_TCP "proto-tcp"
 #define NM_OPENVPN_KEY_REMOTE "remote"
 #define NM_OPENVPN_KEY_REMOTE_IP "remote-ip"
 #define NM_OPENVPN_KEY_STATIC_KEY "static-key"
 #define NM_OPENVPN_KEY_STATIC_KEY_DIRECTION "static-key-direction"
 #define NM_OPENVPN_KEY_TA "ta"
 #define NM_OPENVPN_KEY_TA_DIR "ta-dir"
+#define NM_OPENVPN_KEY_TUNNEL_MTU "tunnel-mtu"
 #define NM_OPENVPN_KEY_USERNAME "username"
+#define NM_OPENVPN_KEY_TAP_DEV "tap-dev"
 #define NM_OPENVPN_KEY_TLS_REMOTE "tls-remote"
 
 #define NM_OPENVPN_KEY_PASSWORD "password"



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