mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 09:04:55 +00:00
2008-08-04 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-cdma.c libnm-util/nm-setting-gsm.c - (verify): validate username & password if they exist - (need_secrets): if username given, require a password too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3892 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
b3c09d38d5
commit
e2aa087281
|
@ -1,3 +1,10 @@
|
|||
2008-08-04 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-setting-cdma.c
|
||||
libnm-util/nm-setting-gsm.c
|
||||
- (verify): validate username & password if they exist
|
||||
- (need_secrets): if username given, require a password too
|
||||
|
||||
2008-08-04 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/dnsmasq-manager/nm-dnsmasq-manager.c
|
||||
|
|
|
@ -117,9 +117,42 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->username && !strlen (self->username)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_CDMA_ERROR,
|
||||
NM_SETTING_CDMA_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_CDMA_USERNAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->password && !strlen (self->password)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_CDMA_ERROR,
|
||||
NM_SETTING_CDMA_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_CDMA_PASSWORD);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
need_secrets (NMSetting *setting)
|
||||
{
|
||||
NMSettingCdma *self = NM_SETTING_CDMA (setting);
|
||||
GPtrArray *secrets = NULL;
|
||||
|
||||
if (self->password)
|
||||
return NULL;
|
||||
|
||||
if (self->username) {
|
||||
secrets = g_ptr_array_sized_new (1);
|
||||
g_ptr_array_add (secrets, NM_SETTING_CDMA_PASSWORD);
|
||||
}
|
||||
|
||||
return secrets;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_setting_cdma_init (NMSettingCdma *setting)
|
||||
{
|
||||
|
@ -196,6 +229,7 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class)
|
|||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
parent_class->verify = verify;
|
||||
parent_class->need_secrets = need_secrets;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
|
|
|
@ -133,9 +133,42 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->username && !strlen (self->username)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_GSM_USERNAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->password && !strlen (self->password)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_GSM_USERNAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
need_secrets (NMSetting *setting)
|
||||
{
|
||||
NMSettingGsm *self = NM_SETTING_GSM (setting);
|
||||
GPtrArray *secrets = NULL;
|
||||
|
||||
if (self->password)
|
||||
return NULL;
|
||||
|
||||
if (self->username) {
|
||||
secrets = g_ptr_array_sized_new (1);
|
||||
g_ptr_array_add (secrets, NM_SETTING_GSM_PASSWORD);
|
||||
}
|
||||
|
||||
return secrets;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_setting_gsm_init (NMSettingGsm *setting)
|
||||
{
|
||||
|
@ -256,6 +289,7 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
|
|||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
parent_class->verify = verify;
|
||||
parent_class->need_secrets = need_secrets;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
|
|
Loading…
Reference in a new issue