espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
603 stars 255 forks source link

mqtt_msg: Allow set zero length username if password is set (IDFGH-4591) #183

Closed AxelLin closed 3 years ago

AxelLin commented 3 years ago

Some cloud server (e.g. exosite) takes empty username with password. Current esp-mqtt implementation does not allow such setting, fix it.

Current users may already consider strlen(info->username) == 0 case as don't set username. To avoid breaking existing behavior, this patch only set zero length username when password is set.

Signed-off-by: Axel Lin axel.lin@ingics.com

AxelLin commented 3 years ago

@david-cermak Any chance to review this PR? (It's a bug fix for us, otherwise the mqtt can not connect to exosite due to password without username.)

david-cermak commented 3 years ago

@AxelLin Sorry, I've missed this PR. Thanks for contributing!

PS: Will correct the spec number before merge.