eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.14k stars 724 forks source link

publish return code always 0, even if failure with access denied in restricted topic #715

Open call-me-matt opened 1 year ago

call-me-matt commented 1 year ago

I would like to detect if a publish message has been sent or rejected by the broker when restricting access with ACL.

expected: return code 135 if access denied

as-is: return code is always 0 - even if the message is not published by the broker because of ACL denial.

I am using mqtt v5 and qos1,

properties=Properties(PacketTypes.PUBLISH)
properties.MessageExpiryInterval=5 # retain messages for x seconds
ret = self.__mqtt_client.publish(restricted_data, payload, retain=1, qos=1, properties=properties)
ret.wait_for_publish()
print(ret.is_published()) # always True
print (f" RET={ret.rc}") # always 0

Tested with nodejs mqtt library, and saw an authorization error - so the broker works as expected.

call-me-matt commented 1 year ago

oh, there is already a pull request! https://github.com/eclipse/paho.mqtt.python/pull/656 please merge, this is very necessary

dgbarmac commented 1 year ago

Hi. I am also experiencing a similar situation. The return code of the publish function is always 0, even if the topic does not exist. I reinforce that this correction is very necessary.

jayzym commented 1 year ago

Hi, would just like to reiterate that this is feature is critical for QOS 2 applications. Please fix soon!

AlejandroPOcz commented 1 year ago

Same here! hopefully, it will be resolved soon. I'll be watching 👀

kevin-hardy commented 1 year ago

This is a critical bug that is forcing us to verify manually what should be an automated process.

polarhub commented 1 year ago

We have the same issue, please merge / release a fix soon!

jzjz12 commented 12 months ago

Hi we are getting the issue issue. It's important to us. Please merge it soon!