diff options
Diffstat (limited to 'src/plugins/cinterion/mm-modem-helpers-cinterion.c')
-rw-r--r-- | src/plugins/cinterion/mm-modem-helpers-cinterion.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/cinterion/mm-modem-helpers-cinterion.c b/src/plugins/cinterion/mm-modem-helpers-cinterion.c index 8af032b1..7c16fc4f 100644 --- a/src/plugins/cinterion/mm-modem-helpers-cinterion.c +++ b/src/plugins/cinterion/mm-modem-helpers-cinterion.c @@ -1817,6 +1817,19 @@ mm_cinterion_build_auth_string (gpointer log_object, has_passwd = (passwd && passwd[0]); encoded_auth = parse_auth_type (auth); + /* No explicit auth type requested? */ + if (encoded_auth == BEARER_CINTERION_AUTH_UNKNOWN) { + if (!has_user && !has_passwd) { + /* If no user/passwd given, default to 'none' */ + mm_obj_dbg (log_object, "APN user/password and authentication type not given: defaulting to 'none'"); + encoded_auth = BEARER_CINTERION_AUTH_NONE; + } else { + /* If user/passwd given, default to CHAP (more common than PAP) */ + mm_obj_dbg (log_object, "APN user/password given but no authentication type explicitly requested: defaulting to 'CHAP'"); + encoded_auth = BEARER_CINTERION_AUTH_CHAP; + } + } + /* When 'none' requested, we won't require user/password */ if (encoded_auth == BEARER_CINTERION_AUTH_NONE) { if (has_user || has_passwd) @@ -1826,17 +1839,6 @@ mm_cinterion_build_auth_string (gpointer log_object, return g_strdup_printf ("^SGAUTH=%u,%d", cid, encoded_auth); } - /* No explicit auth type requested? */ - if (encoded_auth == BEARER_CINTERION_AUTH_UNKNOWN) { - /* If no user/passwd given, do nothing */ - if (!has_user && !has_passwd) - return NULL; - - /* If user/passwd given, default to CHAP (more common than PAP) */ - mm_obj_dbg (log_object, "APN user/password given but no authentication type explicitly requested: defaulting to 'CHAP'"); - encoded_auth = BEARER_CINTERION_AUTH_CHAP; - } - quoted_user = mm_port_serial_at_quote_string (user ? user : ""); quoted_passwd = mm_port_serial_at_quote_string (passwd ? passwd : ""); |