mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 18:54:36 +00:00
2008-09-27 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-gsm.c - (verify): verify GSM network ID git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4118 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
a15af58cdd
commit
33110acba8
|
@ -1,3 +1,8 @@
|
|||
2008-09-27 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-setting-gsm.c
|
||||
- (verify): verify GSM network ID
|
||||
|
||||
2008-09-25 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-setting-gsm.c
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "nm-setting-gsm.h"
|
||||
#include "nm-setting-serial.h"
|
||||
#include "nm-utils.h"
|
||||
|
@ -149,6 +150,30 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->network_id) {
|
||||
guint32 nid_len = strlen (self->network_id);
|
||||
guint32 i;
|
||||
|
||||
/* Accept both 5 and 6 digit MCC/MNC codes */
|
||||
if ((nid_len < 5) || (nid_len > 6)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_GSM_NETWORK_ID);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < nid_len; i++) {
|
||||
if (!isdigit (self->network_id[i])) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
NM_SETTING_GSM_NETWORK_ID);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -328,7 +353,7 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
|
|||
(object_class, PROP_NETWORK_ID,
|
||||
g_param_spec_string (NM_SETTING_GSM_NETWORK_ID,
|
||||
"Network ID",
|
||||
"Network ID",
|
||||
"Network ID (GSM LAI format)",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
|
|
Loading…
Reference in a new issue