mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-08 19:55:47 +00:00
2008-10-26 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com> * libnm-util/libnm-util.ver libnm-util/nm-setting-gsm.c libnm-util/nm-setting-gsm.h - Make properties private and add accessor functions * src/nm-gsm-device.c src/nm-hso-gsm-device.c src/ppp-manager/nm-ppp-manager.c - Use those accessors git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4219 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
41b0e05573
commit
76c366b546
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2008-10-26 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Tambet Ingo <tambet@gmail.com>
|
||||
|
||||
* libnm-util/libnm-util.ver
|
||||
libnm-util/nm-setting-gsm.c
|
||||
libnm-util/nm-setting-gsm.h
|
||||
- Make properties private and add accessor functions
|
||||
|
||||
* src/nm-gsm-device.c
|
||||
src/nm-hso-gsm-device.c
|
||||
src/ppp-manager/nm-ppp-manager.c
|
||||
- Use those accessors
|
||||
|
||||
2008-10-26 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Tambet Ingo <tambet@gmail.com>
|
||||
|
|
|
@ -58,6 +58,15 @@ global:
|
|||
nm_setting_gsm_error_quark;
|
||||
nm_setting_gsm_get_type;
|
||||
nm_setting_gsm_new;
|
||||
nm_setting_gsm_get_number;
|
||||
nm_setting_gsm_get_username;
|
||||
nm_setting_gsm_get_password;
|
||||
nm_setting_gsm_get_apn;
|
||||
nm_setting_gsm_get_network_id;
|
||||
nm_setting_gsm_get_network_type;
|
||||
nm_setting_gsm_get_band;
|
||||
nm_setting_gsm_get_pin;
|
||||
nm_setting_gsm_get_puk;
|
||||
nm_setting_ip4_config_error_get_type;
|
||||
nm_setting_ip4_config_error_quark;
|
||||
nm_setting_ip4_config_get_type;
|
||||
|
|
|
@ -67,6 +67,22 @@ nm_setting_gsm_error_get_type (void)
|
|||
|
||||
G_DEFINE_TYPE (NMSettingGsm, nm_setting_gsm, NM_TYPE_SETTING)
|
||||
|
||||
#define NM_SETTING_GSM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_GSM, NMSettingGsmPrivate))
|
||||
|
||||
typedef struct {
|
||||
char *number; /* For dialing, duh */
|
||||
char *username;
|
||||
char *password;
|
||||
|
||||
char *apn; /* NULL for dynamic */
|
||||
char *network_id; /* for manual registration or NULL for automatic */
|
||||
int network_type; /* One of the NM_GSM_NETWORK_* */
|
||||
int band;
|
||||
|
||||
char *pin;
|
||||
char *puk;
|
||||
} NMSettingGsmPrivate;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_NUMBER,
|
||||
|
@ -97,10 +113,82 @@ find_setting_by_name (gconstpointer a, gconstpointer b)
|
|||
return strcmp (nm_setting_get_name (setting), str);
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_number (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->number;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_username (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->username;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_password (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->password;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_apn (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->apn;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_network_id (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->network_id;
|
||||
}
|
||||
|
||||
int
|
||||
nm_setting_gsm_get_network_type (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), -1);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->network_type;
|
||||
}
|
||||
|
||||
int
|
||||
nm_setting_gsm_get_band (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), -1);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->band;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_pin (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->pin;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_setting_gsm_get_puk (NMSettingGsm *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NULL);
|
||||
|
||||
return NM_SETTING_GSM_GET_PRIVATE (setting)->puk;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||
{
|
||||
NMSettingGsm *self = NM_SETTING_GSM (setting);
|
||||
NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (setting);
|
||||
|
||||
/* Serial connections require a PPP setting */
|
||||
if (all_settings &&
|
||||
|
@ -112,13 +200,13 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!self->number) {
|
||||
if (!priv->number) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_MISSING_PROPERTY,
|
||||
NM_SETTING_GSM_NUMBER);
|
||||
return FALSE;
|
||||
} else if (!strlen (self->number)) {
|
||||
} else if (!strlen (priv->number)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
|
@ -126,7 +214,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->apn && (strlen (self->apn) < 1 || strchr (self->apn, '"'))) {
|
||||
if (priv->apn && (strlen (priv->apn) < 1 || strchr (priv->apn, '"'))) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
|
@ -134,7 +222,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->username && !strlen (self->username)) {
|
||||
if (priv->username && !strlen (priv->username)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
|
@ -142,7 +230,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->password && !strlen (self->password)) {
|
||||
if (priv->password && !strlen (priv->password)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
|
@ -150,8 +238,8 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->network_id) {
|
||||
guint32 nid_len = strlen (self->network_id);
|
||||
if (priv->network_id) {
|
||||
guint32 nid_len = strlen (priv->network_id);
|
||||
guint32 i;
|
||||
|
||||
/* Accept both 5 and 6 digit MCC/MNC codes */
|
||||
|
@ -164,7 +252,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
}
|
||||
|
||||
for (i = 0; i < nid_len; i++) {
|
||||
if (!isdigit (self->network_id[i])) {
|
||||
if (!isdigit (priv->network_id[i])) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_GSM_ERROR,
|
||||
NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
|
||||
|
@ -180,13 +268,13 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
static GPtrArray *
|
||||
need_secrets (NMSetting *setting)
|
||||
{
|
||||
NMSettingGsm *self = NM_SETTING_GSM (setting);
|
||||
NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (setting);
|
||||
GPtrArray *secrets = NULL;
|
||||
|
||||
if (self->password)
|
||||
if (priv->password)
|
||||
return NULL;
|
||||
|
||||
if (self->username) {
|
||||
if (priv->username) {
|
||||
secrets = g_ptr_array_sized_new (1);
|
||||
g_ptr_array_add (secrets, NM_SETTING_GSM_PASSWORD);
|
||||
}
|
||||
|
@ -203,15 +291,15 @@ nm_setting_gsm_init (NMSettingGsm *setting)
|
|||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NMSettingGsm *self = NM_SETTING_GSM (object);
|
||||
NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (object);
|
||||
|
||||
g_free (self->number);
|
||||
g_free (self->username);
|
||||
g_free (self->password);
|
||||
g_free (self->apn);
|
||||
g_free (self->network_id);
|
||||
g_free (self->pin);
|
||||
g_free (self->puk);
|
||||
g_free (priv->number);
|
||||
g_free (priv->username);
|
||||
g_free (priv->password);
|
||||
g_free (priv->apn);
|
||||
g_free (priv->network_id);
|
||||
g_free (priv->pin);
|
||||
g_free (priv->puk);
|
||||
|
||||
G_OBJECT_CLASS (nm_setting_gsm_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -220,42 +308,42 @@ static void
|
|||
set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMSettingGsm *setting = NM_SETTING_GSM (object);
|
||||
NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_NUMBER:
|
||||
g_free (setting->number);
|
||||
setting->number = g_value_dup_string (value);
|
||||
g_free (priv->number);
|
||||
priv->number = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_USERNAME:
|
||||
g_free (setting->username);
|
||||
setting->username = g_value_dup_string (value);
|
||||
g_free (priv->username);
|
||||
priv->username = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_PASSWORD:
|
||||
g_free (setting->password);
|
||||
setting->password = g_value_dup_string (value);
|
||||
g_free (priv->password);
|
||||
priv->password = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_APN:
|
||||
g_free (setting->apn);
|
||||
setting->apn = g_value_dup_string (value);
|
||||
g_free (priv->apn);
|
||||
priv->apn = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_NETWORK_ID:
|
||||
g_free (setting->network_id);
|
||||
setting->network_id = g_value_dup_string (value);
|
||||
g_free (priv->network_id);
|
||||
priv->network_id = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_NETWORK_TYPE:
|
||||
setting->network_type = g_value_get_int (value);
|
||||
priv->network_type = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_BAND:
|
||||
setting->band = g_value_get_int (value);
|
||||
priv->band = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_PIN:
|
||||
g_free (setting->pin);
|
||||
setting->pin = g_value_dup_string (value);
|
||||
g_free (priv->pin);
|
||||
priv->pin = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_PUK:
|
||||
g_free (setting->puk);
|
||||
setting->puk = g_value_dup_string (value);
|
||||
g_free (priv->puk);
|
||||
priv->puk = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -271,31 +359,31 @@ get_property (GObject *object, guint prop_id,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_NUMBER:
|
||||
g_value_set_string (value, setting->number);
|
||||
g_value_set_string (value, nm_setting_gsm_get_number (setting));
|
||||
break;
|
||||
case PROP_USERNAME:
|
||||
g_value_set_string (value, setting->username);
|
||||
g_value_set_string (value, nm_setting_gsm_get_username (setting));
|
||||
break;
|
||||
case PROP_PASSWORD:
|
||||
g_value_set_string (value, setting->password);
|
||||
g_value_set_string (value, nm_setting_gsm_get_password (setting));
|
||||
break;
|
||||
case PROP_APN:
|
||||
g_value_set_string (value, setting->apn);
|
||||
g_value_set_string (value, nm_setting_gsm_get_apn (setting));
|
||||
break;
|
||||
case PROP_NETWORK_ID:
|
||||
g_value_set_string (value, setting->network_id);
|
||||
g_value_set_string (value, nm_setting_gsm_get_network_id (setting));
|
||||
break;
|
||||
case PROP_NETWORK_TYPE:
|
||||
g_value_set_int (value, setting->network_type);
|
||||
g_value_set_int (value, nm_setting_gsm_get_network_type (setting));
|
||||
break;
|
||||
case PROP_BAND:
|
||||
g_value_set_int (value, setting->band);
|
||||
g_value_set_int (value, nm_setting_gsm_get_band (setting));
|
||||
break;
|
||||
case PROP_PIN:
|
||||
g_value_set_string (value, setting->pin);
|
||||
g_value_set_string (value, nm_setting_gsm_get_pin (setting));
|
||||
break;
|
||||
case PROP_PUK:
|
||||
g_value_set_string (value, setting->puk);
|
||||
g_value_set_string (value, nm_setting_gsm_get_puk (setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -309,6 +397,8 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
||||
NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
|
||||
|
||||
g_type_class_add_private (setting_class, sizeof (NMSettingGsmPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->set_property = set_property;
|
||||
object_class->get_property = get_property;
|
||||
|
|
|
@ -73,18 +73,6 @@ enum {
|
|||
|
||||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
||||
char *number; /* For dialing, duh */
|
||||
char *username;
|
||||
char *password;
|
||||
|
||||
char *apn; /* NULL for dynamic */
|
||||
char *network_id; /* for manual registration or NULL for automatic */
|
||||
int network_type; /* One of the NM_GSM_NETWORK_* */
|
||||
int band;
|
||||
|
||||
char *pin;
|
||||
char *puk;
|
||||
} NMSettingGsm;
|
||||
|
||||
typedef struct {
|
||||
|
@ -93,7 +81,16 @@ typedef struct {
|
|||
|
||||
GType nm_setting_gsm_get_type (void);
|
||||
|
||||
NMSetting *nm_setting_gsm_new (void);
|
||||
NMSetting *nm_setting_gsm_new (void);
|
||||
const char *nm_setting_gsm_get_number (NMSettingGsm *setting);
|
||||
const char *nm_setting_gsm_get_username (NMSettingGsm *setting);
|
||||
const char *nm_setting_gsm_get_password (NMSettingGsm *setting);
|
||||
const char *nm_setting_gsm_get_apn (NMSettingGsm *setting);
|
||||
const char *nm_setting_gsm_get_network_id (NMSettingGsm *setting);
|
||||
int nm_setting_gsm_get_network_type (NMSettingGsm *setting);
|
||||
int nm_setting_gsm_get_band (NMSettingGsm *setting);
|
||||
const char *nm_setting_gsm_get_pin (NMSettingGsm *setting);
|
||||
const char *nm_setting_gsm_get_puk (NMSettingGsm *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -154,23 +154,25 @@ real_do_dial (NMGsmDevice *device, guint cid)
|
|||
{
|
||||
NMSettingGsm *setting;
|
||||
char *command;
|
||||
const char *number;
|
||||
const char *responses[] = { "CONNECT", "BUSY", "NO DIAL TONE", "NO CARRIER", NULL };
|
||||
|
||||
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
|
||||
number = nm_setting_gsm_get_number (setting);
|
||||
|
||||
if (cid) {
|
||||
GString *str;
|
||||
|
||||
str = g_string_new ("ATD");
|
||||
if (g_str_has_suffix (setting->number, "#"))
|
||||
str = g_string_append_len (str, setting->number, strlen (setting->number) - 1);
|
||||
if (g_str_has_suffix (number, "#"))
|
||||
str = g_string_append_len (str, number, strlen (number) - 1);
|
||||
else
|
||||
str = g_string_append (str, setting->number);
|
||||
str = g_string_append (str, number);
|
||||
|
||||
g_string_append_printf (str, "***%d#", cid);
|
||||
command = g_string_free (str, FALSE);
|
||||
} else
|
||||
command = g_strconcat ("ATDT", setting->number, NULL);
|
||||
command = g_strconcat ("ATDT", number, NULL);
|
||||
|
||||
modem_wait_for_reply (device, command, 60, responses, responses, dial_done, NULL);
|
||||
g_free (command);
|
||||
|
@ -201,19 +203,22 @@ set_apn (NMGsmDevice *device)
|
|||
NMGsmDevicePrivate *priv = NM_GSM_DEVICE_GET_PRIVATE (device);
|
||||
NMSettingGsm *setting;
|
||||
char *command;
|
||||
const char *apn;
|
||||
const char *responses[] = { "OK", "ERROR", NULL };
|
||||
guint cid = 1;
|
||||
|
||||
priv->reg_tries = 0;
|
||||
|
||||
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
|
||||
if (!setting->apn) {
|
||||
|
||||
apn = nm_setting_gsm_get_apn (setting);
|
||||
if (!apn) {
|
||||
/* APN not set, nothing to do */
|
||||
NM_GSM_DEVICE_GET_CLASS (device)->do_dial (NM_GSM_DEVICE (device), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
command = g_strdup_printf ("AT+CGDCONT=%d,\"IP\",\"%s\"", cid, setting->apn);
|
||||
command = g_strdup_printf ("AT+CGDCONT=%d,\"IP\",\"%s\"", cid, apn);
|
||||
modem_wait_for_reply (device, command, 7, responses, responses, set_apn_done, GUINT_TO_POINTER (cid));
|
||||
g_free (command);
|
||||
}
|
||||
|
@ -281,7 +286,7 @@ manual_registration (NMGsmDevice *device)
|
|||
|
||||
setting = NM_SETTING_GSM (gsm_device_get_setting (device, NM_TYPE_SETTING_GSM));
|
||||
|
||||
command = g_strdup_printf ("AT+COPS=1,2,\"%s\"", setting->network_id);
|
||||
command = g_strdup_printf ("AT+COPS=1,2,\"%s\"", nm_setting_gsm_get_network_id (setting));
|
||||
modem_wait_for_reply (device, command, 15, responses, responses, manual_registration_response, NULL);
|
||||
g_free (command);
|
||||
}
|
||||
|
@ -417,7 +422,7 @@ do_register (NMGsmDevice *device)
|
|||
setting = NM_SETTING_GSM (gsm_device_get_setting (device, NM_TYPE_SETTING_GSM));
|
||||
|
||||
priv->reg_tries = 0;
|
||||
if (setting->network_id)
|
||||
if (nm_setting_gsm_get_network_id (setting))
|
||||
manual_registration (device);
|
||||
else
|
||||
automatic_registration (device);
|
||||
|
@ -507,12 +512,10 @@ enter_pin_done (NMSerialDevice *device,
|
|||
|
||||
switch (secret) {
|
||||
case NM_GSM_SECRET_PIN:
|
||||
g_free (setting->pin);
|
||||
setting->pin = NULL;
|
||||
g_object_set (setting, NM_SETTING_GSM_PIN, NULL, NULL);
|
||||
break;
|
||||
case NM_GSM_SECRET_PUK:
|
||||
g_free (setting->puk);
|
||||
setting->puk = NULL;
|
||||
g_object_set (setting, NM_SETTING_GSM_PUK, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -529,7 +532,7 @@ enter_pin (NMGsmDevice *device, NMGsmSecret secret_type, gboolean retry)
|
|||
NMSettingGsm *setting;
|
||||
NMActRequest *req;
|
||||
NMConnection *connection;
|
||||
char *secret;
|
||||
const char *secret;
|
||||
char *secret_name = NULL;
|
||||
|
||||
req = nm_device_get_act_request (NM_DEVICE (device));
|
||||
|
@ -541,11 +544,9 @@ enter_pin (NMGsmDevice *device, NMGsmSecret secret_type, gboolean retry)
|
|||
|
||||
switch (secret_type) {
|
||||
case NM_GSM_SECRET_PIN:
|
||||
secret = setting->pin;
|
||||
secret_name = NM_SETTING_GSM_PIN;
|
||||
break;
|
||||
case NM_GSM_SECRET_PUK:
|
||||
secret = setting->puk;
|
||||
secret_name = NM_SETTING_GSM_PUK;
|
||||
break;
|
||||
default:
|
||||
|
@ -553,6 +554,7 @@ enter_pin (NMGsmDevice *device, NMGsmSecret secret_type, gboolean retry)
|
|||
return;
|
||||
}
|
||||
|
||||
g_object_get (setting, secret_name, &secret, NULL);
|
||||
if (secret) {
|
||||
char *command;
|
||||
const char *responses[] = { "OK", "ERROR", "ERR", NULL };
|
||||
|
@ -725,10 +727,13 @@ real_connection_secrets_updated (NMDevice *dev,
|
|||
NULL,
|
||||
"missing GSM setting; no secrets could be found.");
|
||||
} else {
|
||||
const char *gsm_username = nm_setting_gsm_get_username (s_gsm);
|
||||
const char *gsm_password = nm_setting_gsm_get_password (s_gsm);
|
||||
|
||||
nm_ppp_manager_update_secrets (ppp_manager,
|
||||
nm_device_get_iface (dev),
|
||||
s_gsm->username ? s_gsm->username : "",
|
||||
s_gsm->password ? s_gsm->password : "",
|
||||
gsm_username ? gsm_username : "",
|
||||
gsm_password ? gsm_password : "",
|
||||
NULL);
|
||||
}
|
||||
return;
|
||||
|
@ -785,7 +790,7 @@ real_get_ppp_name (NMSerialDevice *device, NMActRequest *req)
|
|||
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
|
||||
g_assert (s_gsm);
|
||||
|
||||
return s_gsm->username;
|
||||
return nm_setting_gsm_get_username (s_gsm);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -178,6 +178,8 @@ do_hso_auth (NMHsoGsmDevice *device)
|
|||
NMActRequest *req;
|
||||
const char *responses[] = { "OK", "ERROR", "ERR", NULL };
|
||||
char *command;
|
||||
const char *gsm_username;
|
||||
const char *gsm_password;
|
||||
guint cid;
|
||||
|
||||
req = nm_device_get_act_request (NM_DEVICE (device));
|
||||
|
@ -187,10 +189,13 @@ do_hso_auth (NMHsoGsmDevice *device)
|
|||
|
||||
s_gsm = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
|
||||
|
||||
gsm_username = nm_setting_gsm_get_username (s_gsm);
|
||||
gsm_password = nm_setting_gsm_get_password (s_gsm);
|
||||
|
||||
command = g_strdup_printf ("AT$QCPDPP=%d,1,\"%s\",\"%s\"",
|
||||
cid,
|
||||
s_gsm->password ? s_gsm->password : "",
|
||||
s_gsm->username ? s_gsm->username : "");
|
||||
gsm_password ? gsm_password : "",
|
||||
gsm_username ? gsm_username : "");
|
||||
modem_wait_for_reply (NM_GSM_DEVICE (device), command, 5, responses, responses, hso_auth_done, GUINT_TO_POINTER (cid));
|
||||
g_free (command);
|
||||
}
|
||||
|
|
|
@ -373,8 +373,8 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
|
|||
username = nm_setting_pppoe_get_username (NM_SETTING_PPPOE (setting));
|
||||
password = nm_setting_pppoe_get_password (NM_SETTING_PPPOE (setting));
|
||||
} else if (NM_IS_SETTING_GSM (setting)) {
|
||||
username = NM_SETTING_GSM (setting)->username;
|
||||
password = NM_SETTING_GSM (setting)->password;
|
||||
username = nm_setting_gsm_get_username (NM_SETTING_GSM (setting));
|
||||
password = nm_setting_gsm_get_password (NM_SETTING_GSM (setting));
|
||||
} else if (NM_IS_SETTING_CDMA (setting)) {
|
||||
username = nm_setting_cdma_get_username (NM_SETTING_CDMA (setting));
|
||||
password = nm_setting_cdma_get_password (NM_SETTING_CDMA (setting));
|
||||
|
|
Loading…
Reference in New Issue
Block a user