diff options
author | Lukas Voegl <lvoegl@tdt.de> | 2024-01-19 14:06:15 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2024-01-25 15:17:48 +0000 |
commit | c4eac36484e5b6f7971bfd330ac93c84fd5a33c4 (patch) | |
tree | 0137042ed033f9eb2511654570fefad0c3df4b59 | |
parent | e43d9ea829c220225ef72db32d6d0664c9919b06 (diff) |
cinterion: default to none authentication with no user and password
Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
-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 : ""); |