Commit b0cff47b5b9e8037fb09e28fcfa082c3d0f96525
1 parent
299557ba
Support lack of subscribe ACL in Mosquitto files
Showing
1 changed file
with
8 additions
and
0 deletions
authplugin.cpp
| ... | ... | @@ -294,6 +294,10 @@ AuthResult Authentication::aclCheck(const std::string &clientid, const std::stri |
| 294 | 294 | |
| 295 | 295 | if (pluginVersion == PluginVersion::MosquittoV2) |
| 296 | 296 | { |
| 297 | + // We have to do this, because Mosquitto plugin v2 has no notion of checking subscribes. | |
| 298 | + if (access == AclAccess::subscribe) | |
| 299 | + return AuthResult::success; | |
| 300 | + | |
| 297 | 301 | int result = acl_check_v2(pluginData, clientid.c_str(), username.c_str(), topic.c_str(), static_cast<int>(access)); |
| 298 | 302 | AuthResult result_ = static_cast<AuthResult>(result); |
| 299 | 303 | |
| ... | ... | @@ -547,6 +551,10 @@ AuthResult Authentication::aclCheckFromMosquittoAclFile(const std::string &clien |
| 547 | 551 | if (this->mosquittoAclFile.empty()) |
| 548 | 552 | return AuthResult::success; |
| 549 | 553 | |
| 554 | + // We have to do this because the Mosquitto ACL file has no notion of checking subscribes. | |
| 555 | + if (access == AclAccess::subscribe) | |
| 556 | + return AuthResult::success; | |
| 557 | + | |
| 550 | 558 | AclGrant ag = access == AclAccess::write ? AclGrant::Write : AclGrant::Read; |
| 551 | 559 | AuthResult result = aclTree.findPermission(subtopics, ag, username, clientid); |
| 552 | 560 | return result; | ... | ... |