dynsec: Fix missing correlationData for getDefaultACLAccess.

This commit is contained in:
Roger A. Light 2020-11-23 14:06:19 +00:00
parent 3aca8c1d8e
commit d1bf2c0d13
4 changed files with 18 additions and 16 deletions

View File

@ -889,13 +889,12 @@ int dynsec_clients__process_get(cJSON *j_responses, struct mosquitto *context, c
cJSON_AddItemToObject(j_data, "client", j_client);
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "getClient", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);
@ -968,13 +967,12 @@ int dynsec_clients__process_list(cJSON *j_responses, struct mosquitto *context,
i++;
}
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "listClients", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);

View File

@ -731,13 +731,12 @@ int dynsec_groups__process_list(cJSON *j_responses, struct mosquitto *context, c
i++;
}
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "listGroups", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);
@ -794,13 +793,12 @@ int dynsec_groups__process_get(cJSON *j_responses, struct mosquitto *context, cJ
cJSON_AddItemToObject(j_data, "group", j_group);
}
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
dynsec__command_reply(j_responses, context, "getGroup", "Internal error", correlation_data);
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "getGroup", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);
@ -1031,13 +1029,12 @@ int dynsec_groups__process_get_anonymous_group(cJSON *j_responses, struct mosqui
}
}
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
dynsec__command_reply(j_responses, context, "getGroup", "Internal error", correlation_data);
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "getGroup", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);

View File

@ -256,6 +256,15 @@ int dynsec__process_get_default_acl_access(cJSON *j_responses, struct mosquitto
cJSON_AddItemToArray(j_responses, tree);
if(correlation_data){
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "getDefaultACLAccess", "Internal error", correlation_data);
return 1;
}
}
return MOSQ_ERR_SUCCESS;
}

View File

@ -579,13 +579,12 @@ int dynsec_roles__process_list(cJSON *j_responses, struct mosquitto *context, cJ
i++;
}
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "listRoles", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);
@ -813,13 +812,12 @@ int dynsec_roles__process_get(cJSON *j_responses, struct mosquitto *context, cJS
cJSON_AddItemToObject(j_data, "role", j_role);
if(correlation_data){
jtmp = cJSON_CreateString(correlation_data);
jtmp = cJSON_AddStringToObject(tree, "correlationData", correlation_data);
if(jtmp == NULL){
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "getRole", "Internal error", correlation_data);
return 1;
}
cJSON_AddItemToObject(tree, "correlationData", jtmp);
}
cJSON_AddItemToArray(j_responses, tree);