dynsec: Return group not found on getGroup.

This commit is contained in:
Roger A. Light 2020-11-28 00:34:53 +00:00
parent ad8cf9fc03
commit c303c67461
2 changed files with 9 additions and 0 deletions

View File

@ -778,6 +778,10 @@ int dynsec_groups__process_get(cJSON *j_responses, struct mosquitto *context, cJ
return MOSQ_ERR_NOMEM;
}
cJSON_AddItemToObject(j_data, "group", j_group);
}else{
cJSON_Delete(tree);
dynsec__command_reply(j_responses, context, "getGroup", "Group not found", correlation_data);
return MOSQ_ERR_NOMEM;
}
cJSON_AddItemToArray(j_responses, tree);

View File

@ -258,6 +258,10 @@ get_group2_response = {'responses': [{'command': 'getGroup', 'error': 'Invalid/m
#get_group3_command = { 'commands': [{'command': 'getGroup', 'groupname':5}] }
#get_group3_response = {'responses': [{'command': 'getGroup', 'error': 'Invalid/missing groupname'}]}
# Group not found
get_group4_command = { 'commands': [{'command': 'getGroup', 'groupname':"missing"}] }
get_group4_response = {'responses': [{'command': 'getGroup', 'error': 'Group not found'}]}
# ==========================================================================
# Set anon group
# ==========================================================================
@ -396,6 +400,7 @@ try:
command_check(sock, get_group1_command, get_group1_response, "1")
command_check(sock, get_group2_command, get_group2_response, "2")
#command_check(sock, get_group3_command, get_group3_response, "3")
command_check(sock, get_group4_command, get_group4_response, "4")
command_check(sock, set_anon_group1_command, set_anon_group1_response, "1")
command_check(sock, set_anon_group2_command, set_anon_group2_response, "2")