|
|
|
@ -62,8 +62,19 @@ int mosquitto_auth_acl_check(void *user_data, const char *clientid, const char *
|
|
|
|
|
(void)clientid;
|
|
|
|
|
(void)topic;
|
|
|
|
|
|
|
|
|
|
if(!strcmp(username, "readonly") && access == MOSQ_ACL_READ){
|
|
|
|
|
if(access != MOSQ_ACL_READ && access != MOSQ_ACL_WRITE){
|
|
|
|
|
return MOSQ_ERR_ACL_DENIED;
|
|
|
|
|
}else if(username && !strcmp(username, "readonly") && access == MOSQ_ACL_READ){
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|
}else if(username && !strcmp(username, "readwrite")){
|
|
|
|
|
if((!strcmp(topic, "readonly") && access == MOSQ_ACL_READ)
|
|
|
|
|
|| !strcmp(topic, "writeable")){
|
|
|
|
|
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|
}else{
|
|
|
|
|
return MOSQ_ERR_ACL_DENIED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
return MOSQ_ERR_ACL_DENIED;
|
|
|
|
|
}
|
|
|
|
@ -75,7 +86,7 @@ int mosquitto_auth_unpwd_check(void *user_data, const char *username, const char
|
|
|
|
|
|
|
|
|
|
if(!strcmp(username, "test-username") && password && !strcmp(password, "cnwTICONIURW")){
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|
}else if(!strcmp(username, "readonly")){
|
|
|
|
|
}else if(!strcmp(username, "readonly") || !strcmp(username, "readwrite")){
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|
}else if(!strcmp(username, "test-username@v2")){
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|