[patch] Fix crash when connection settings aren't set



Hi,

  If a service providing connections has aconnection without connection settings  NM crashes because the respective error doesn't get set. (And the error
  handling code assumes it is set)

  See attached patch

  Sjoerd
-- 
Nothing is but what is not.
commit 46f629321cd64e6c76f178ddcdbffb7fc27d9078
Author: Sjoerd Simons <sjoerd luon net>
Date:   Thu Jun 19 12:55:44 2008 +0100

    Set the error if the settings don't contain a 'connection' substree. Prevents a crash in code assuming the error is set

diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index 082dd7d..4c3662f 100644
--- a/libnm-util/nm-connection.c
+++ b/libnm-util/nm-connection.c
@@ -412,6 +412,10 @@ nm_connection_verify (NMConnection *connection, GError **error)
 	connection_setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
 	if (!connection_setting) {
 		g_warning ("'connection' setting not present.");
+		g_set_error (error,
+			NM_TYPE_SETTING_CONNECTION_ERROR,
+			NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY,
+			NM_SETTING_CONNECTION_SETTING_NAME);
 		return FALSE;
 	}
 


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