You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 😉
The text was updated successfully, but these errors were encountered:
When listening for
MOSQ_EVT_ACL_CHECK
events in a plugin you getevent_data
of typemosquitto_evt_acl_check
which includesproperties
.However, those
properties
are set explicitly toNULL
insidemosquitto_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 theevent_data
there (typemosquitto_evt_message
) will contain the user properties, because they are handled insidehandle_publish
, stored inmsg
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
:Is there a reason why user properties are not handled during subscribe and are being explicitly set to
NULL
insidemosquitto_acl_check
❓I did a quick test: I copied and adjusted the property-handling-code from
handle_publish
tohandle_subscribe
and passed the properties as a new parameter tomosquitto_acl_check
which then adds them to theevent_data
which gets passed to the event listeners listening forMOSQ_EVT_ACL_CHECK
. Seems to work 😉The text was updated successfully, but these errors were encountered: