2007-10-23 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.c libnm-util/nm-setting.h - (nm_setting_verify): new function; verify one setting - (nm_settings_verify_all): rename from nm_settings_verify() - (setting_connection_verify, setting_wireless_verify): allow NULL all_settings * libnm-util/nm-connection.c - (nm_connection_replace_settings, nm_connection_verify, nm_connection_new_from_hash): handle nm_settings_verify() rename git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3011 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2007-10-23 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* libnm-util/nm-setting.c
|
||||||
|
libnm-util/nm-setting.h
|
||||||
|
- (nm_setting_verify): new function; verify one setting
|
||||||
|
- (nm_settings_verify_all): rename from nm_settings_verify()
|
||||||
|
- (setting_connection_verify, setting_wireless_verify): allow NULL
|
||||||
|
all_settings
|
||||||
|
|
||||||
|
* libnm-util/nm-connection.c
|
||||||
|
- (nm_connection_replace_settings, nm_connection_verify,
|
||||||
|
nm_connection_new_from_hash): handle nm_settings_verify() rename
|
||||||
|
|
||||||
2007-10-23 Dan Williams <dcbw@redhat.com>
|
2007-10-23 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/nm-device-802-11-wireless.c
|
* src/nm-device-802-11-wireless.c
|
||||||
|
@@ -147,7 +147,7 @@ nm_connection_replace_settings (NMConnection *connection,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nm_settings_verify (priv->settings)) {
|
if (!nm_settings_verify_all (priv->settings)) {
|
||||||
g_warning ("Settings invalid.");
|
g_warning ("Settings invalid.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ nm_connection_verify (NMConnection *connection)
|
|||||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
||||||
|
|
||||||
priv = NM_CONNECTION_GET_PRIVATE (connection);
|
priv = NM_CONNECTION_GET_PRIVATE (connection);
|
||||||
return nm_settings_verify (priv->settings);
|
return nm_settings_verify_all (priv->settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -486,7 +486,7 @@ nm_connection_new_from_hash (GHashTable *hash)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nm_settings_verify (priv->settings)) {
|
if (!nm_settings_verify_all (priv->settings)) {
|
||||||
g_object_unref (connection);
|
g_object_unref (connection);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,15 @@ nm_setting_populate_from_hash (NMSetting *setting, GHashTable *hash)
|
|||||||
return nm_setting_populate_from_hash_default (setting, hash);
|
return nm_setting_populate_from_hash_default (setting, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_setting_verify (NMSetting *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (setting != NULL, FALSE);
|
||||||
|
|
||||||
|
if (setting->verify_fn)
|
||||||
|
return setting->verify_fn (setting, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gboolean success;
|
gboolean success;
|
||||||
GHashTable *all_settings;
|
GHashTable *all_settings;
|
||||||
@@ -41,11 +50,13 @@ verify_one_setting (gpointer key, gpointer value, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_settings_verify (GHashTable *all_settings)
|
nm_settings_verify_all (GHashTable *all_settings)
|
||||||
{
|
{
|
||||||
gpointer p;
|
gpointer p;
|
||||||
VerifySettingsInfo info;
|
VerifySettingsInfo info;
|
||||||
|
|
||||||
|
g_return_val_if_fail (all_settings != NULL, FALSE);
|
||||||
|
|
||||||
/* First, make sure there's at least 'connection' setting */
|
/* First, make sure there's at least 'connection' setting */
|
||||||
p = g_hash_table_lookup (all_settings, NM_SETTING_CONNECTION);
|
p = g_hash_table_lookup (all_settings, NM_SETTING_CONNECTION);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@@ -574,7 +585,7 @@ setting_connection_verify (NMSetting *setting, GHashTable *all_settings)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Make sure the corresponding 'type' item is present */
|
/* Make sure the corresponding 'type' item is present */
|
||||||
if (!g_hash_table_lookup (all_settings, self->type))
|
if (all_settings && !g_hash_table_lookup (all_settings, self->type))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -815,7 +826,9 @@ setting_wireless_verify (NMSetting *setting, GHashTable *all_settings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->security && !g_hash_table_lookup (all_settings, self->security)) {
|
if ( self->security
|
||||||
|
&& all_settings
|
||||||
|
&& !g_hash_table_lookup (all_settings, self->security)) {
|
||||||
g_warning ("Invalid or missing security");
|
g_warning ("Invalid or missing security");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -66,8 +66,10 @@ struct _NMSetting {
|
|||||||
NMSettingDestroyFn destroy_fn;
|
NMSettingDestroyFn destroy_fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gboolean nm_settings_verify_all (GHashTable *all_settings);
|
||||||
|
|
||||||
gboolean nm_setting_populate_from_hash (NMSetting *setting, GHashTable *hash);
|
gboolean nm_setting_populate_from_hash (NMSetting *setting, GHashTable *hash);
|
||||||
gboolean nm_settings_verify (GHashTable *all_settings);
|
gboolean nm_setting_verify (NMSetting *setting);
|
||||||
GHashTable *nm_setting_to_hash (NMSetting *setting);
|
GHashTable *nm_setting_to_hash (NMSetting *setting);
|
||||||
gboolean nm_setting_update_secrets (NMSetting *setting, GHashTable *secrets);
|
gboolean nm_setting_update_secrets (NMSetting *setting, GHashTable *secrets);
|
||||||
GPtrArray * nm_setting_need_secrets (NMSetting *setting);
|
GPtrArray * nm_setting_need_secrets (NMSetting *setting);
|
||||||
|
Reference in New Issue
Block a user