nickvsnetworking / pyhss

Python HSS / Diameter Server
GNU Affero General Public License v3.0
66 stars 56 forks source link

sqn should be mandatory for uac object or set to 0 per default causing issues when not set on AIR #204

Open killdashnine opened 4 weeks ago

killdashnine commented 4 weeks ago

When creating a uac object via the API, 'sqn' is not mandatory, resulting in a 'null' value in the database if ommitted:

image

Subsequently when getting AIR comes in, the following exception occurs as there is no 'None' check before casting:

[08/21/2024 18:00:16] [ERROR] Traceback (most recent call last): File "/pyhss/lib/diameter.py", line 1818, in Answer_16777251_318 vector_dict = self.database.Get_Vectors_AuC(subscriber_details['auc_id'], "air", plmn=plmn) File "/pyhss/lib/database.py", line 1572, in Get_Vectors_AuC rand, xres, autn, kasme = S6a_crypt.generate_eutran_vector(key_data['ki'], key_data['opc'], key_data['amf'], key_data['sqn'], kwargs['plmn']) File "/pyhss/lib/S6a_crypt.py", line 37, in generate_eutran_vector sqn = int(sqn) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

I'd also expect an error response on the AIR when the TypeError is thrown but there is no response to the diameter request seen.

Alternative would be to do a 'null' check before casting to int.