jpmens / mosquitto-auth-plug

Authentication plugin for Mosquitto with multiple back-ends (MySQL, Redis, CDB, SQLite3)
Other
824 stars 496 forks source link

Issue subscribing with wildcard in MongoDB and maybe MySQL #405

Closed whendonkiesfly closed 5 years ago

whendonkiesfly commented 5 years ago

I'm using the latest auth plug with the addition of tobyzxj's pull request along with Mosquitto 1.5.8 and I think I found an issue in the validation of subscription topic filters. It looks like the intention of mosquitto_topic_matches_sub is to determine whether a topic matches a topic filter and not whether a topic filter matches a topic filter. According to Roger Light, topics do not have wild cards and topic filters may have wildcards. I say that only because I didn't not differentiate between the two and maybe others don't either. The result of this is that mosquitto_topic_matches_sub returns an error if the topic passed to it has a wildcard causing any subscription with a wildcard to fail.

whendonkiesfly commented 5 years ago

I made pull request #406 to fix this problem. I created a new function to do the checking correctly, but only added it in the Mongo backend.