plugins/provisioning and mbpi: support for auth NONE
PATCH 4/4 plugins/provisioning and mbpi: support for auth NONE
support of 'none' in file-provisioning and in mbpi. The default authentication method is set to 'none'.
--- plugins/file-provision.c | 7 +++++-- plugins/mbpi.c | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-)
plugins/file-provision.c +5 -2
@@ -93,18 +93,21 @@ static int config_file_provision_get_settings(const char *mcc,if (value !=NULL ) (*settings)[0 ].password = value; - (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_CHAP ; +/* select default authentication method */ + (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_NONE ; + value =g_key_file_get_string (key_file, setting_group,"internet.AuthenticationMethod" ,NULL );if (value !=NULL ) { +if (g_strcmp0 (value,"chap" ) ==0 ) (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_CHAP ;else if (g_strcmp0 (value,"pap" ) ==0 ) (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_PAP ; -else +else if (g_strcmp0 (value,"none" ) !=0 )DBG ("Unknown auth method: %s" , value);g_free (value);
plugins/mbpi.c +4 -1
@@ -148,11 +148,14 @@ static void authentication_start(GMarkupParseContext *context,return ; } +/* select default authentication method */ + *auth_method =OFONO_GPRS_AUTH_METHOD_NONE ; +if (strcmp (text,"chap" ) ==0 ) *auth_method =OFONO_GPRS_AUTH_METHOD_CHAP ;else if (strcmp (text,"pap" ) ==0 ) *auth_method =OFONO_GPRS_AUTH_METHOD_PAP ; -else +else if (strcmp (text,"none" ) !=0 ) mbpi_g_set_error(context, error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, "Unknown authentication method: %s",
Signature · 1 line
2.17.1
Hi Giacinto,
Quoted 14 lines · Giacinto Cifelli
support of 'none' in file-provisioning and in mbpi. The default authentication method is set to 'none'.
--- plugins/file-provision.c | 7 +++++-- plugins/mbpi.c | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-)plugins/file-provision.c +0
-0@@ -93,18 +93,21 @@ static int config_file_provision_get_settings(const char *mcc,if (value !=NULL ) (*settings)[0 ].password = value;
plugins/file-provision.c static int config_file_provision_get_settings(const char *mcc, · line 103
Quoted 10 lines
plugins/file-provision.c +4
-1- (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_CHAP ; +/* select default authentication method */ + (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_NONE ; + value =g_key_file_get_string (key_file, setting_group,"internet.AuthenticationMethod" ,NULL );if (value !=NULL ) { +
Not sure why this is here
Quoted 18 lines
plugins/file-provision.c +1
-1if (g_strcmp0 (value,"chap" ) ==0 ) (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_CHAP ;else if (g_strcmp0 (value,"pap" ) ==0 ) (*settings)[0 ].auth_method =OFONO_GPRS_AUTH_METHOD_PAP ; -else +else if (g_strcmp0 (value,"none" ) !=0 )DBG ("Unknown auth method: %s" , value);g_free (value);plugins/mbpi.c +0
-0@@ -148,11 +148,14 @@ static void authentication_start(GMarkupParseContext *context,return ; }
plugins/mbpi.c static void authentication_start(GMarkupParseContext *context, · line 158
Quoted 10 lines
plugins/mbpi.c +4
-1+/* select default authentication method */ + *auth_method =OFONO_GPRS_AUTH_METHOD_NONE ; +if (strcmp (text,"chap" ) ==0 ) *auth_method =OFONO_GPRS_AUTH_METHOD_CHAP ;else if (strcmp (text,"pap" ) ==0 ) *auth_method =OFONO_GPRS_AUTH_METHOD_PAP ; -else +else if (strcmp (text,"none" ) !=0 )
Please study the serviceproviders.2.dtd which is part of the mobile-broadband-provider-info project. 'none' is not a valid value.
It looks like mbpi assumes that authentication tag can either be omitted, but if present it has to specify chap or pap. So if empty we can probably assume 'none'. Of course there's nothing preventing the entry from having a username/password and no authentication tag. In which case we should assume chap.
Unfortunately authentication_start method might not have all the information available to make the above decisions, so you might need extra fixup code elsewhere to actually sanitize auth_method based on username/password presence.
plugins/mbpi.c static void authentication_start(GMarkupParseContext *context, · line 161
Quoted 4 lines
plugins/mbpi.c +0
-0mbpi_g_set_error(context, error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, "Unknown authentication method: %s",
Regards,
-Denis