Fix handling of Re-Synchronization-Info AVP in AIR

Below is an example of a decoded Requested-EUTRAN-Authentication-Info:

  [{
     'Requested-EUTRAN-Authentication-Info',
     [1], %% Number-Of-Requested-Vectors
     [1], %% Immediate-Response-Preferred
     [[ %% Re-Synchronization-Info
       154,153,78,226,63,248,178,208,169,186,215,18,159,150,252,
       103,249,220,169,90,223,249,219,26,172,118,171,193,216,221
     ]],
     [] %% AVP
  }]

As can be seen, the value of Re-Synchronization-Info is not a binary,
but a list, so indeed is_binary(ReSyncInfo) would yeild false.  Use
is_list() instead and convert to binary using list_to_binary().

Change-Id: Ie5eded2f5fb2de01f69d2a9c0e5d70283bf5cbf5
Related: OS#5646
This commit is contained in:
Vadim Yanitskiy 2022-08-18 23:28:41 +07:00
parent 6e28afb504
commit 4b7dcfe66d
1 changed files with 5 additions and 4 deletions

View File

@ -189,10 +189,11 @@ handle_request(#diameter_packet{msg = Req, errors = []}, _SvcName, {_, Caps}) wh
GsupTx1 = #{message_type => send_auth_info_req, imsi => list_to_binary(UserName),
supported_rat_types => [rat_eutran_sgs], current_rat_type => rat_eutran_sgs},
case ReqEU of
#'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info' = ReSyncInfo}
when is_binary(ReSyncInfo) ->
GsupTx2 = #{rand => string:substr(ReSyncInfo, 1, 16),
auts => string:substr(ReSyncInfo, 17)};
#'Requested-EUTRAN-Authentication-Info'{'Re-Synchronization-Info' = [ReSyncInfo]}
when is_list(ReSyncInfo) ->
ReSyncInfoBin = list_to_binary(ReSyncInfo),
GsupTx2 = #{rand => string:substr(ReSyncInfoBin, 1, 16),
auts => string:substr(ReSyncInfoBin, 17)};
_ ->
GsupTx2 = #{}
end,