FreeRTOS / coreMQTT-Agent

Implements an MQTT agent (or daemon) task for simple MQTT connection sharing among different threads of execution.
MIT License
29 stars 32 forks source link

MQTT_Connect with zero length password fails assert #79

Closed jondurrant closed 1 year ago

jondurrant commented 1 year ago

MQTT_Connect seems to have an assert within it that fails on zero length password. A zero length password should be valid?

coreMQTT-Agent v1.2.0 coreMQTT current head

AniruddhaKanhere commented 1 year ago

Hello @jondurrant, thank you for bringing this to our attention. We are looking into it and will get back to you soon.

Without a deep dive into the code base, I think coreMQTT does allow 0 length passwords (Is that same as no password?). You can use that by setting the variables like following:

pConnectInfo->pPassword = NULL;
pConnectInfo->passwordLength = 0;
jondurrant commented 1 year ago

Thanks for the response. I've set length to zero but the password actually points to a char array with first value as zero. This worked on v1.1.0 but on v1.2.0 is failing a new assert, deep in coreMQTT.

Jon

On Mon, 19 Dec 2022, 17:47 Aniruddha Kanhere, @.***> wrote:

Hello @jondurrant https://github.com/jondurrant, thank you for bringing this to our attention. We are looking into it and will get back to you soon.

Without a deep dive into the code base, I think coreMQTT does allow 0 length passwords (Is that same as no password?). You can use that by setting the variables like following:

pConnectInfo->pPassword = NULL; pConnectInfo->passwordLength = 0;

— Reply to this email directly, view it on GitHub https://github.com/FreeRTOS/coreMQTT-Agent/issues/79#issuecomment-1358021127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWFSB5CES7TCIMMMG6LKQDWOCNTLANCNFSM6AAAAAATDDI4T4 . You are receiving this because you were mentioned.Message ID: @.***>

jondurrant commented 1 year ago

Closing as found issue is actual that TransportInterface_t.writev is no longer optional and must be provided. This is causing intermittent failures, but an issue ith coreMQTT rather than coreMQTT-Agent.

AniruddhaKanhere commented 1 year ago

Hello @jondurrant, Thank you for root causing the issue (apologies as I was out of office and was unable to reply sooner).

writev is actually optional. You can set that to NULL in case you do not have an implementation for it. It is provided in case a user wants to improve the speed of communication using scatter-gather approach.

jondurrant commented 1 year ago

Thanks Aniruddha

There is a bug in CoreMQTT v2.1.1 which is not initialising the transport structure. So writev is not initialised with some therefore random behaviour. I understand a fix is available in a release candidate.

Jon On Tue, 27 Dec 2022, 17:56 Aniruddha Kanhere, @.***> wrote:

Hello @jondurrant https://github.com/jondurrant, Thank you for root causing the issue (apologies as I was out of office and was unable to reply sooner).

writev is actually optional. You can set that to NULL in case you do not have an implementation for it. It is provided in case a user wants to improve the speed of communication using scatter-gather https://linux.die.net/man/2/writev approach.

— Reply to this email directly, view it on GitHub https://github.com/FreeRTOS/coreMQTT-Agent/issues/79#issuecomment-1366077949, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWFSB4CIMMT3LURBFAEDZDWPMUUTANCNFSM6AAAAAATDDI4T4 . You are receiving this because you were mentioned.Message ID: @.***>