Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User properties not available on MOSQ_EVT_ACL_CHECK events #3176

Open
da-mkay opened this issue Dec 2, 2024 · 0 comments
Open

User properties not available on MOSQ_EVT_ACL_CHECK events #3176

da-mkay opened this issue Dec 2, 2024 · 0 comments
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@da-mkay
Copy link

da-mkay commented Dec 2, 2024

When listening for MOSQ_EVT_ACL_CHECK events in a plugin you get event_data of type mosquitto_evt_acl_check which includes properties.
However, those properties are set explicitly to NULL inside mosquitto_acl_check before the event listeners are called. So at the time of the ACL check the plugins have no access to user properties.

In case of a publish-packet the MOSQ_EVT_MESSAGE event is fired after the ACL check. And the event_data there (type mosquitto_evt_message) will contain the user properties, because they are handled inside handle_publish, stored in msg and passed over to the listeners.

In case of a subscribe-packet there is no additional event that gets fired. So inside your plugin you cannot access user properties for subscriptions. But these are part of the MQTT 5 spec.

More interestingly, I found the following comment inside handle_subscribe:

/* Note - User Property not handled */

Is there a reason why user properties are not handled during subscribe and are being explicitly set to NULL inside mosquitto_acl_check

I did a quick test: I copied and adjusted the property-handling-code from handle_publish to handle_subscribe and passed the properties as a new parameter to mosquitto_acl_check which then adds them to the event_data which gets passed to the event listeners listening for MOSQ_EVT_ACL_CHECK. Seems to work 😉

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

No branches or pull requests

1 participant