mbpi: support for auth NONE

support of 'none' in mbpi:
the default method remains CHAP, but it is overridden by NONE after
parsing the entire key for the apn and detecting no username/password
This commit is contained in:
Giacinto Cifelli 2018-10-06 07:45:19 +02:00 committed by Denis Kenzior
parent a5aa268747
commit a5bdf48ca7
1 changed files with 6 additions and 0 deletions

View File

@ -325,6 +325,8 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
ap->apn = g_strdup(apn);
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
ap->proto = OFONO_GPRS_PROTO_IP;
/* pre-select default authentication method */
ap->auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
g_markup_parse_context_push(context, &apn_parser, ap);
@ -395,6 +397,10 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
if (ap == NULL)
return;
/* select authentication method NONE if fit */
if (!ap->username || !ap->password)
ap->auth_method = OFONO_GPRS_AUTH_METHOD_NONE;
if (gsm->allow_duplicates == FALSE) {
GSList *l;