bearer-properties: Match UNKNOWN auth to CHAP for loose comparison

MBIM and QMI fallback to CHAP when a username or password is present
but no authentication type was provided. Consider CHAP==UNKNOWN when
using loose comparison.
This commit is contained in:
Andrew Lassalle
2022-03-09 12:02:35 -08:00
committed by Aleksander Morgado
parent d5805002c1
commit 9793378870

View File

@@ -871,9 +871,13 @@ cmp_allowed_auth (MMBearerAllowedAuth a,
if (a == b) if (a == b)
return TRUE; return TRUE;
/* Additional loose match UNKNOWN == NONE */ /* Additional loose match UNKNOWN == NONE */
/* MBIM and QMI fallback to CHAP when a username or password is present,
but no authentication type was provided */
if (flags & MM_BEARER_PROPERTIES_CMP_FLAGS_LOOSE) { if (flags & MM_BEARER_PROPERTIES_CMP_FLAGS_LOOSE) {
if ((a == MM_BEARER_ALLOWED_AUTH_UNKNOWN && b == MM_BEARER_ALLOWED_AUTH_NONE) || if ((a == MM_BEARER_ALLOWED_AUTH_UNKNOWN && b == MM_BEARER_ALLOWED_AUTH_NONE) ||
(b == MM_BEARER_ALLOWED_AUTH_UNKNOWN && a == MM_BEARER_ALLOWED_AUTH_NONE)) (b == MM_BEARER_ALLOWED_AUTH_UNKNOWN && a == MM_BEARER_ALLOWED_AUTH_NONE) ||
(a == MM_BEARER_ALLOWED_AUTH_UNKNOWN && b == MM_BEARER_ALLOWED_AUTH_CHAP) ||
(b == MM_BEARER_ALLOWED_AUTH_UNKNOWN && a == MM_BEARER_ALLOWED_AUTH_CHAP) )
return TRUE; return TRUE;
} }
return FALSE; return FALSE;