[PATCH] Only use vpn service files ending with .name



Hi,

I hope Alexander is not mad at me for posting an Ubuntu patch on his behalf, but
I think this patch is generally useful, so I'm sending it upstream for
inclusion. (credits go to Alexander Sack).

The patch ensures that NM only uses VPN service files that end with .name.
Reading all files from /etc/NetworkManager/VPN can cause problems e.g. when
rpm/dpkg create "backup" files when the conffiles have been modified.

Cheers,
Michael
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
=== modified file 'src/vpn-manager/nm-vpn-service.c'
--- a/src/vpn-manager/nm-vpn-service.c	2008-08-27 17:22:32 +0000
+++ b/src/vpn-manager/nm-vpn-service.c	2008-11-19 14:15:21 +0000
@@ -63,16 +63,20 @@ find_service_file (const char *name)
 	dir = g_dir_open (VPN_NAME_FILES_DIR, 0, NULL);
 	if (!dir)
 		return NULL;
 
 	while ((fn = g_dir_read_name (dir))) {
 		char *path;
 		gboolean found = FALSE;
 
+		/* only parse filenames that end with .name */
+		if (!g_str_has_suffix (fn, ".name"))
+			continue;
+
 		key_file = g_key_file_new ();
 		path = g_build_filename (VPN_NAME_FILES_DIR, fn, NULL);
 
 		if (g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, NULL)) {
 			gchar *val;
 
 			val = g_key_file_get_string (key_file, VPN_CONNECTION_GROUP, "service", NULL);
 			if (val) {

Attachment: signature.asc
Description: OpenPGP digital signature



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