mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 13:20:08 +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
|
|
@ -38,28 +38,57 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_create(
|
|||
|
||||
void OpenAPI_authentication_info_free(OpenAPI_authentication_info_t *authentication_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == authentication_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(authentication_info->supi_or_suci);
|
||||
ogs_free(authentication_info->serving_network_name);
|
||||
OpenAPI_resynchronization_info_free(authentication_info->resynchronization_info);
|
||||
ogs_free(authentication_info->pei);
|
||||
OpenAPI_trace_data_free(authentication_info->trace_data);
|
||||
ogs_free(authentication_info->udm_group_id);
|
||||
ogs_free(authentication_info->routing_indicator);
|
||||
OpenAPI_list_for_each(authentication_info->cell_cag_info, node) {
|
||||
ogs_free(node->data);
|
||||
if (authentication_info->supi_or_suci) {
|
||||
ogs_free(authentication_info->supi_or_suci);
|
||||
authentication_info->supi_or_suci = NULL;
|
||||
}
|
||||
if (authentication_info->serving_network_name) {
|
||||
ogs_free(authentication_info->serving_network_name);
|
||||
authentication_info->serving_network_name = NULL;
|
||||
}
|
||||
if (authentication_info->resynchronization_info) {
|
||||
OpenAPI_resynchronization_info_free(authentication_info->resynchronization_info);
|
||||
authentication_info->resynchronization_info = NULL;
|
||||
}
|
||||
if (authentication_info->pei) {
|
||||
ogs_free(authentication_info->pei);
|
||||
authentication_info->pei = NULL;
|
||||
}
|
||||
if (authentication_info->trace_data) {
|
||||
OpenAPI_trace_data_free(authentication_info->trace_data);
|
||||
authentication_info->trace_data = NULL;
|
||||
}
|
||||
if (authentication_info->udm_group_id) {
|
||||
ogs_free(authentication_info->udm_group_id);
|
||||
authentication_info->udm_group_id = NULL;
|
||||
}
|
||||
if (authentication_info->routing_indicator) {
|
||||
ogs_free(authentication_info->routing_indicator);
|
||||
authentication_info->routing_indicator = NULL;
|
||||
}
|
||||
if (authentication_info->cell_cag_info) {
|
||||
OpenAPI_list_for_each(authentication_info->cell_cag_info, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(authentication_info->cell_cag_info);
|
||||
authentication_info->cell_cag_info = NULL;
|
||||
}
|
||||
if (authentication_info->supported_features) {
|
||||
ogs_free(authentication_info->supported_features);
|
||||
authentication_info->supported_features = NULL;
|
||||
}
|
||||
OpenAPI_list_free(authentication_info->cell_cag_info);
|
||||
ogs_free(authentication_info->supported_features);
|
||||
ogs_free(authentication_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_authentication_info_convertToJSON(OpenAPI_authentication_info_t *authentication_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (authentication_info == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [AuthenticationInfo]");
|
||||
|
|
@ -67,11 +96,19 @@ cJSON *OpenAPI_authentication_info_convertToJSON(OpenAPI_authentication_info_t *
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!authentication_info->supi_or_suci) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [supi_or_suci]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "supiOrSuci", authentication_info->supi_or_suci) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [supi_or_suci]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!authentication_info->serving_network_name) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [serving_network_name]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "servingNetworkName", authentication_info->serving_network_name) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [serving_network_name]");
|
||||
goto end;
|
||||
|
|
@ -125,19 +162,17 @@ cJSON *OpenAPI_authentication_info_convertToJSON(OpenAPI_authentication_info_t *
|
|||
}
|
||||
|
||||
if (authentication_info->cell_cag_info) {
|
||||
cJSON *cell_cag_info = cJSON_AddArrayToObject(item, "cellCagInfo");
|
||||
if (cell_cag_info == NULL) {
|
||||
cJSON *cell_cag_infoList = cJSON_AddArrayToObject(item, "cellCagInfo");
|
||||
if (cell_cag_infoList == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *cell_cag_info_node;
|
||||
OpenAPI_list_for_each(authentication_info->cell_cag_info, cell_cag_info_node) {
|
||||
if (cJSON_AddStringToObject(cell_cag_info, "", (char*)cell_cag_info_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(authentication_info->cell_cag_info, node) {
|
||||
if (cJSON_AddStringToObject(cell_cag_infoList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_convertToJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (authentication_info->is_n5gc_ind) {
|
||||
|
|
@ -161,91 +196,96 @@ end:
|
|||
OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON *authentication_infoJSON)
|
||||
{
|
||||
OpenAPI_authentication_info_t *authentication_info_local_var = NULL;
|
||||
cJSON *supi_or_suci = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "supiOrSuci");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *supi_or_suci = NULL;
|
||||
cJSON *serving_network_name = NULL;
|
||||
cJSON *resynchronization_info = NULL;
|
||||
OpenAPI_resynchronization_info_t *resynchronization_info_local_nonprim = NULL;
|
||||
cJSON *pei = NULL;
|
||||
cJSON *trace_data = NULL;
|
||||
OpenAPI_trace_data_t *trace_data_local_nonprim = NULL;
|
||||
cJSON *udm_group_id = NULL;
|
||||
cJSON *routing_indicator = NULL;
|
||||
cJSON *cell_cag_info = NULL;
|
||||
OpenAPI_list_t *cell_cag_infoList = NULL;
|
||||
cJSON *n5gc_ind = NULL;
|
||||
cJSON *supported_features = NULL;
|
||||
supi_or_suci = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "supiOrSuci");
|
||||
if (!supi_or_suci) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [supi_or_suci]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(supi_or_suci)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [supi_or_suci]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *serving_network_name = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "servingNetworkName");
|
||||
serving_network_name = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "servingNetworkName");
|
||||
if (!serving_network_name) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [serving_network_name]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(serving_network_name)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [serving_network_name]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *resynchronization_info = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "resynchronizationInfo");
|
||||
|
||||
OpenAPI_resynchronization_info_t *resynchronization_info_local_nonprim = NULL;
|
||||
resynchronization_info = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "resynchronizationInfo");
|
||||
if (resynchronization_info) {
|
||||
resynchronization_info_local_nonprim = OpenAPI_resynchronization_info_parseFromJSON(resynchronization_info);
|
||||
}
|
||||
|
||||
cJSON *pei = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "pei");
|
||||
|
||||
pei = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "pei");
|
||||
if (pei) {
|
||||
if (!cJSON_IsString(pei)) {
|
||||
if (!cJSON_IsString(pei) && !cJSON_IsNull(pei)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [pei]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "traceData");
|
||||
|
||||
OpenAPI_trace_data_t *trace_data_local_nonprim = NULL;
|
||||
trace_data = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "traceData");
|
||||
if (trace_data) {
|
||||
trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data);
|
||||
}
|
||||
|
||||
cJSON *udm_group_id = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "udmGroupId");
|
||||
|
||||
udm_group_id = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "udmGroupId");
|
||||
if (udm_group_id) {
|
||||
if (!cJSON_IsString(udm_group_id)) {
|
||||
if (!cJSON_IsString(udm_group_id) && !cJSON_IsNull(udm_group_id)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [udm_group_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *routing_indicator = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "routingIndicator");
|
||||
|
||||
routing_indicator = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "routingIndicator");
|
||||
if (routing_indicator) {
|
||||
if (!cJSON_IsString(routing_indicator)) {
|
||||
if (!cJSON_IsString(routing_indicator) && !cJSON_IsNull(routing_indicator)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [routing_indicator]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *cell_cag_info = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "cellCagInfo");
|
||||
|
||||
OpenAPI_list_t *cell_cag_infoList;
|
||||
cell_cag_info = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "cellCagInfo");
|
||||
if (cell_cag_info) {
|
||||
cJSON *cell_cag_info_local;
|
||||
if (!cJSON_IsArray(cell_cag_info)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
cell_cag_infoList = OpenAPI_list_create();
|
||||
cJSON *cell_cag_info_local = NULL;
|
||||
if (!cJSON_IsArray(cell_cag_info)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(cell_cag_info_local, cell_cag_info) {
|
||||
if (!cJSON_IsString(cell_cag_info_local)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(cell_cag_infoList, ogs_strdup(cell_cag_info_local->valuestring));
|
||||
}
|
||||
cell_cag_infoList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(cell_cag_info_local, cell_cag_info) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(cell_cag_info_local)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(cell_cag_infoList, ogs_strdup(cell_cag_info_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *n5gc_ind = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "n5gcInd");
|
||||
|
||||
n5gc_ind = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "n5gcInd");
|
||||
if (n5gc_ind) {
|
||||
if (!cJSON_IsBool(n5gc_ind)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [n5gc_ind]");
|
||||
|
|
@ -253,10 +293,9 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON *
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "supportedFeatures");
|
||||
|
||||
supported_features = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "supportedFeatures");
|
||||
if (supported_features) {
|
||||
if (!cJSON_IsString(supported_features)) {
|
||||
if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) {
|
||||
ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [supported_features]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -266,18 +305,33 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON *
|
|||
ogs_strdup(supi_or_suci->valuestring),
|
||||
ogs_strdup(serving_network_name->valuestring),
|
||||
resynchronization_info ? resynchronization_info_local_nonprim : NULL,
|
||||
pei ? ogs_strdup(pei->valuestring) : NULL,
|
||||
pei && !cJSON_IsNull(pei) ? ogs_strdup(pei->valuestring) : NULL,
|
||||
trace_data ? trace_data_local_nonprim : NULL,
|
||||
udm_group_id ? ogs_strdup(udm_group_id->valuestring) : NULL,
|
||||
routing_indicator ? ogs_strdup(routing_indicator->valuestring) : NULL,
|
||||
udm_group_id && !cJSON_IsNull(udm_group_id) ? ogs_strdup(udm_group_id->valuestring) : NULL,
|
||||
routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL,
|
||||
cell_cag_info ? cell_cag_infoList : NULL,
|
||||
n5gc_ind ? true : false,
|
||||
n5gc_ind ? n5gc_ind->valueint : 0,
|
||||
supported_features ? ogs_strdup(supported_features->valuestring) : NULL
|
||||
supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL
|
||||
);
|
||||
|
||||
return authentication_info_local_var;
|
||||
end:
|
||||
if (resynchronization_info_local_nonprim) {
|
||||
OpenAPI_resynchronization_info_free(resynchronization_info_local_nonprim);
|
||||
resynchronization_info_local_nonprim = NULL;
|
||||
}
|
||||
if (trace_data_local_nonprim) {
|
||||
OpenAPI_trace_data_free(trace_data_local_nonprim);
|
||||
trace_data_local_nonprim = NULL;
|
||||
}
|
||||
if (cell_cag_infoList) {
|
||||
OpenAPI_list_for_each(cell_cag_infoList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(cell_cag_infoList);
|
||||
cell_cag_infoList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue