From 68294479032d9f864b35dfbae894b3b428910178 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 4 Oct 2007 14:09:59 +0000 Subject: [PATCH] 2007-10-04 Dan Williams * libnm-util/nm-setting.c - (nm_settings_verify): use #defines when possible rather than strings - (setting_connection_verify): ensure that 'name' and 'type' are valid - (setting_vpn_verify): tighter validity check on 'service_type' git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2932 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 +++++++ libnm-util/nm-setting.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f44156dc8e..a7c586fb20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-04 Dan Williams + + * libnm-util/nm-setting.c + - (nm_settings_verify): use #defines when possible rather than strings + - (setting_connection_verify): ensure that 'name' and 'type' are valid + - (setting_vpn_verify): tighter validity check on 'service_type' + 2007-10-04 Dan Williams * libnm-glib/nm-settings.c diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 5e76371c76..73532dc686 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -34,7 +34,7 @@ nm_settings_verify (GHashTable *all_settings) VerifySettingsInfo info; /* First, make sure there's at least 'connection' setting */ - p = g_hash_table_lookup (all_settings, "connection"); + p = g_hash_table_lookup (all_settings, NM_SETTING_CONNECTION); if (!p) { g_warning ("'connection' setting not present."); return FALSE; @@ -458,6 +458,12 @@ setting_connection_verify (NMSetting *setting, GHashTable *all_settings) { NMSettingConnection *self = (NMSettingConnection *) setting; + if (!self->name || !strlen (self->name)) + return FALSE; + + if (!self->type || !strlen (self->type)) + return FALSE; + /* Make sure the corresponding 'type' item is present */ if (!g_hash_table_lookup (all_settings, self->type)) return FALSE; @@ -1246,7 +1252,7 @@ setting_vpn_verify (NMSetting *setting, GHashTable *all_settings) { NMSettingVPN *self = (NMSettingVPN *) setting; - if (!self->service_type) + if (!self->service_type || !strlen (self->service_type)) return FALSE; return TRUE;