|
|
|
@ -819,6 +819,7 @@ int dynsec_roles__process_add_acl(cJSON *j_responses, struct mosquitto *context,
|
|
|
|
|
struct dynsec__role *role;
|
|
|
|
|
cJSON *jtmp;
|
|
|
|
|
struct dynsec__acl **acllist, *acl;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
if(json_get_string(command, "rolename", &rolename, false) != MOSQ_ERR_SUCCESS){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "addRoleACL", "Invalid/missing rolename", correlation_data);
|
|
|
|
@ -854,6 +855,14 @@ int dynsec_roles__process_add_acl(cJSON *j_responses, struct mosquitto *context,
|
|
|
|
|
|
|
|
|
|
jtmp = cJSON_GetObjectItem(command, "topic");
|
|
|
|
|
if(jtmp && cJSON_IsString(jtmp)){
|
|
|
|
|
rc = mosquitto_sub_topic_check(jtmp->valuestring);
|
|
|
|
|
if(rc == MOSQ_ERR_INVAL){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "addRoleACL", "ACL topic not valid UTF-8", correlation_data);
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(rc == MOSQ_ERR_MALFORMED_UTF8){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "addRoleACL", "Invalid ACL topic", correlation_data);
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}
|
|
|
|
|
topic = mosquitto_strdup(jtmp->valuestring);
|
|
|
|
|
if(topic == NULL){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "addRoleACL", "Internal error", correlation_data);
|
|
|
|
@ -898,6 +907,7 @@ int dynsec_roles__process_remove_acl(cJSON *j_responses, struct mosquitto *conte
|
|
|
|
|
struct dynsec__acl **acllist, *acl;
|
|
|
|
|
char *topic;
|
|
|
|
|
cJSON *jtmp;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
if(json_get_string(command, "rolename", &rolename, false) != MOSQ_ERR_SUCCESS){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "createRole", "Invalid/missing rolename", correlation_data);
|
|
|
|
@ -935,6 +945,14 @@ int dynsec_roles__process_remove_acl(cJSON *j_responses, struct mosquitto *conte
|
|
|
|
|
dynsec__command_reply(j_responses, context, "removeRoleACL", "Invalid/missing topic", correlation_data);
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
rc = mosquitto_sub_topic_check(jtmp->valuestring);
|
|
|
|
|
if(rc == MOSQ_ERR_INVAL){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "removeRoleACL", "ACL topic not valid UTF-8", correlation_data);
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(rc == MOSQ_ERR_MALFORMED_UTF8){
|
|
|
|
|
dynsec__command_reply(j_responses, context, "removeRoleACL", "Invalid ACL topic", correlation_data);
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HASH_FIND(hh, *acllist, topic, strlen(topic), acl);
|
|
|
|
|
if(acl){
|
|
|
|
|