[PATCH] Always set an error when nm_connection_verify fails



From: Sjoerd Simons <sjoerd luon net>

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

Signed-off-by: Sjoerd Simons <sjoerd simons collabora co uk>
---
 libnm-util/nm-connection.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index 870fea5..55ba46c 100644
--- a/libnm-util/nm-connection.c
+++ b/libnm-util/nm-connection.c
@@ -443,6 +443,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;
 	}
 
-- 
1.5.6.3



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