mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 07:08:11 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -44,24 +44,50 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat
|
|||
|
||||
void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscription_t *authentication_subscription)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == authentication_subscription) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(authentication_subscription->enc_permanent_key);
|
||||
ogs_free(authentication_subscription->protection_parameter_id);
|
||||
OpenAPI_sequence_number_free(authentication_subscription->sequence_number);
|
||||
ogs_free(authentication_subscription->authentication_management_field);
|
||||
ogs_free(authentication_subscription->algorithm_id);
|
||||
ogs_free(authentication_subscription->enc_opc_key);
|
||||
ogs_free(authentication_subscription->enc_topc_key);
|
||||
ogs_free(authentication_subscription->supi);
|
||||
if (authentication_subscription->enc_permanent_key) {
|
||||
ogs_free(authentication_subscription->enc_permanent_key);
|
||||
authentication_subscription->enc_permanent_key = NULL;
|
||||
}
|
||||
if (authentication_subscription->protection_parameter_id) {
|
||||
ogs_free(authentication_subscription->protection_parameter_id);
|
||||
authentication_subscription->protection_parameter_id = NULL;
|
||||
}
|
||||
if (authentication_subscription->sequence_number) {
|
||||
OpenAPI_sequence_number_free(authentication_subscription->sequence_number);
|
||||
authentication_subscription->sequence_number = NULL;
|
||||
}
|
||||
if (authentication_subscription->authentication_management_field) {
|
||||
ogs_free(authentication_subscription->authentication_management_field);
|
||||
authentication_subscription->authentication_management_field = NULL;
|
||||
}
|
||||
if (authentication_subscription->algorithm_id) {
|
||||
ogs_free(authentication_subscription->algorithm_id);
|
||||
authentication_subscription->algorithm_id = NULL;
|
||||
}
|
||||
if (authentication_subscription->enc_opc_key) {
|
||||
ogs_free(authentication_subscription->enc_opc_key);
|
||||
authentication_subscription->enc_opc_key = NULL;
|
||||
}
|
||||
if (authentication_subscription->enc_topc_key) {
|
||||
ogs_free(authentication_subscription->enc_topc_key);
|
||||
authentication_subscription->enc_topc_key = NULL;
|
||||
}
|
||||
if (authentication_subscription->supi) {
|
||||
ogs_free(authentication_subscription->supi);
|
||||
authentication_subscription->supi = NULL;
|
||||
}
|
||||
ogs_free(authentication_subscription);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_subscription_t *authentication_subscription)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (authentication_subscription == NULL) {
|
||||
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [AuthenticationSubscription]");
|
||||
|
|
@ -69,6 +95,10 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (authentication_subscription->authentication_method == OpenAPI_auth_method_NULL) {
|
||||
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [authentication_method]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "authenticationMethod", OpenAPI_auth_method_ToString(authentication_subscription->authentication_method)) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [authentication_method]");
|
||||
goto end;
|
||||
|
|
@ -136,7 +166,7 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_
|
|||
}
|
||||
}
|
||||
|
||||
if (authentication_subscription->n5gc_auth_method) {
|
||||
if (authentication_subscription->n5gc_auth_method != OpenAPI_auth_method_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "n5gcAuthMethod", OpenAPI_auth_method_ToString(authentication_subscription->n5gc_auth_method)) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [n5gc_auth_method]");
|
||||
goto end;
|
||||
|
|
@ -164,82 +194,87 @@ end:
|
|||
OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parseFromJSON(cJSON *authentication_subscriptionJSON)
|
||||
{
|
||||
OpenAPI_authentication_subscription_t *authentication_subscription_local_var = NULL;
|
||||
cJSON *authentication_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "authenticationMethod");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *authentication_method = NULL;
|
||||
OpenAPI_auth_method_e authentication_methodVariable = 0;
|
||||
cJSON *enc_permanent_key = NULL;
|
||||
cJSON *protection_parameter_id = NULL;
|
||||
cJSON *sequence_number = NULL;
|
||||
OpenAPI_sequence_number_t *sequence_number_local_nonprim = NULL;
|
||||
cJSON *authentication_management_field = NULL;
|
||||
cJSON *algorithm_id = NULL;
|
||||
cJSON *enc_opc_key = NULL;
|
||||
cJSON *enc_topc_key = NULL;
|
||||
cJSON *vector_generation_in_hss = NULL;
|
||||
cJSON *n5gc_auth_method = NULL;
|
||||
OpenAPI_auth_method_e n5gc_auth_methodVariable = 0;
|
||||
cJSON *rg_authentication_ind = NULL;
|
||||
cJSON *supi = NULL;
|
||||
authentication_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "authenticationMethod");
|
||||
if (!authentication_method) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [authentication_method]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_auth_method_e authentication_methodVariable;
|
||||
if (!cJSON_IsString(authentication_method)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [authentication_method]");
|
||||
goto end;
|
||||
}
|
||||
authentication_methodVariable = OpenAPI_auth_method_FromString(authentication_method->valuestring);
|
||||
|
||||
cJSON *enc_permanent_key = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "encPermanentKey");
|
||||
|
||||
enc_permanent_key = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "encPermanentKey");
|
||||
if (enc_permanent_key) {
|
||||
if (!cJSON_IsString(enc_permanent_key)) {
|
||||
if (!cJSON_IsString(enc_permanent_key) && !cJSON_IsNull(enc_permanent_key)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [enc_permanent_key]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *protection_parameter_id = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "protectionParameterId");
|
||||
|
||||
protection_parameter_id = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "protectionParameterId");
|
||||
if (protection_parameter_id) {
|
||||
if (!cJSON_IsString(protection_parameter_id)) {
|
||||
if (!cJSON_IsString(protection_parameter_id) && !cJSON_IsNull(protection_parameter_id)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [protection_parameter_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sequence_number = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "sequenceNumber");
|
||||
|
||||
OpenAPI_sequence_number_t *sequence_number_local_nonprim = NULL;
|
||||
sequence_number = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "sequenceNumber");
|
||||
if (sequence_number) {
|
||||
sequence_number_local_nonprim = OpenAPI_sequence_number_parseFromJSON(sequence_number);
|
||||
}
|
||||
|
||||
cJSON *authentication_management_field = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "authenticationManagementField");
|
||||
|
||||
authentication_management_field = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "authenticationManagementField");
|
||||
if (authentication_management_field) {
|
||||
if (!cJSON_IsString(authentication_management_field)) {
|
||||
if (!cJSON_IsString(authentication_management_field) && !cJSON_IsNull(authentication_management_field)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [authentication_management_field]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *algorithm_id = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "algorithmId");
|
||||
|
||||
algorithm_id = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "algorithmId");
|
||||
if (algorithm_id) {
|
||||
if (!cJSON_IsString(algorithm_id)) {
|
||||
if (!cJSON_IsString(algorithm_id) && !cJSON_IsNull(algorithm_id)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [algorithm_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *enc_opc_key = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "encOpcKey");
|
||||
|
||||
enc_opc_key = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "encOpcKey");
|
||||
if (enc_opc_key) {
|
||||
if (!cJSON_IsString(enc_opc_key)) {
|
||||
if (!cJSON_IsString(enc_opc_key) && !cJSON_IsNull(enc_opc_key)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [enc_opc_key]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *enc_topc_key = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "encTopcKey");
|
||||
|
||||
enc_topc_key = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "encTopcKey");
|
||||
if (enc_topc_key) {
|
||||
if (!cJSON_IsString(enc_topc_key)) {
|
||||
if (!cJSON_IsString(enc_topc_key) && !cJSON_IsNull(enc_topc_key)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [enc_topc_key]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *vector_generation_in_hss = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "vectorGenerationInHss");
|
||||
|
||||
vector_generation_in_hss = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "vectorGenerationInHss");
|
||||
if (vector_generation_in_hss) {
|
||||
if (!cJSON_IsBool(vector_generation_in_hss)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [vector_generation_in_hss]");
|
||||
|
|
@ -247,9 +282,7 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *n5gc_auth_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "n5gcAuthMethod");
|
||||
|
||||
OpenAPI_auth_method_e n5gc_auth_methodVariable;
|
||||
n5gc_auth_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "n5gcAuthMethod");
|
||||
if (n5gc_auth_method) {
|
||||
if (!cJSON_IsString(n5gc_auth_method)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [n5gc_auth_method]");
|
||||
|
|
@ -258,8 +291,7 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse
|
|||
n5gc_auth_methodVariable = OpenAPI_auth_method_FromString(n5gc_auth_method->valuestring);
|
||||
}
|
||||
|
||||
cJSON *rg_authentication_ind = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "rgAuthenticationInd");
|
||||
|
||||
rg_authentication_ind = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "rgAuthenticationInd");
|
||||
if (rg_authentication_ind) {
|
||||
if (!cJSON_IsBool(rg_authentication_ind)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [rg_authentication_ind]");
|
||||
|
|
@ -267,10 +299,9 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *supi = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "supi");
|
||||
|
||||
supi = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "supi");
|
||||
if (supi) {
|
||||
if (!cJSON_IsString(supi)) {
|
||||
if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) {
|
||||
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [supi]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -278,23 +309,27 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse
|
|||
|
||||
authentication_subscription_local_var = OpenAPI_authentication_subscription_create (
|
||||
authentication_methodVariable,
|
||||
enc_permanent_key ? ogs_strdup(enc_permanent_key->valuestring) : NULL,
|
||||
protection_parameter_id ? ogs_strdup(protection_parameter_id->valuestring) : NULL,
|
||||
enc_permanent_key && !cJSON_IsNull(enc_permanent_key) ? ogs_strdup(enc_permanent_key->valuestring) : NULL,
|
||||
protection_parameter_id && !cJSON_IsNull(protection_parameter_id) ? ogs_strdup(protection_parameter_id->valuestring) : NULL,
|
||||
sequence_number ? sequence_number_local_nonprim : NULL,
|
||||
authentication_management_field ? ogs_strdup(authentication_management_field->valuestring) : NULL,
|
||||
algorithm_id ? ogs_strdup(algorithm_id->valuestring) : NULL,
|
||||
enc_opc_key ? ogs_strdup(enc_opc_key->valuestring) : NULL,
|
||||
enc_topc_key ? ogs_strdup(enc_topc_key->valuestring) : NULL,
|
||||
authentication_management_field && !cJSON_IsNull(authentication_management_field) ? ogs_strdup(authentication_management_field->valuestring) : NULL,
|
||||
algorithm_id && !cJSON_IsNull(algorithm_id) ? ogs_strdup(algorithm_id->valuestring) : NULL,
|
||||
enc_opc_key && !cJSON_IsNull(enc_opc_key) ? ogs_strdup(enc_opc_key->valuestring) : NULL,
|
||||
enc_topc_key && !cJSON_IsNull(enc_topc_key) ? ogs_strdup(enc_topc_key->valuestring) : NULL,
|
||||
vector_generation_in_hss ? true : false,
|
||||
vector_generation_in_hss ? vector_generation_in_hss->valueint : 0,
|
||||
n5gc_auth_method ? n5gc_auth_methodVariable : 0,
|
||||
rg_authentication_ind ? true : false,
|
||||
rg_authentication_ind ? rg_authentication_ind->valueint : 0,
|
||||
supi ? ogs_strdup(supi->valuestring) : NULL
|
||||
supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL
|
||||
);
|
||||
|
||||
return authentication_subscription_local_var;
|
||||
end:
|
||||
if (sequence_number_local_nonprim) {
|
||||
OpenAPI_sequence_number_free(sequence_number_local_nonprim);
|
||||
sequence_number_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue