cinterion: default to none authentication with no user and password

Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
This commit is contained in:
Lukas Voegl
2024-01-25 15:17:48 +00:00
committed by Aleksander Morgado
parent e43d9ea829
commit c4eac36484
@@ -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 : "");