Password cannot contain space character for configuration files (e.g. remote_password for bridge) #150

ralight opened this Issue Apr 28, 2016 · 2 comments


None yet

2 participants

ralight commented Apr 28, 2016

Migrated from

My question was posted on the mailing list and Mikkel Kirkgaard Nielsen digged into to it to find the real bug, he deserves the credit.

Original Post:

I tried to bridge my local mosquitto topics into the Azure IoT topics with a bridge configuration. The Azure Broker bridge connection throws a:

Client test sending CONNECT
Client test received CONNACK
Connection Refused: not authorised.

Error: The connection was refused.

As the password seems to be incorrect. In fact it isn't but it seems that the space inside of the pw breaks the parsing from the mosquitto config file which in the end transfers a wrong pw to the Azure Broker.

I am forced to use a password containing a space for Azure IoT as it is auto generated. There is no way to enclose the password inside of the bridge configuration file.

And an excerpt from the root cause as found by Mikkel:

The space will give you trouble as the code of src/conf.c line 1536
will parse only until the first space after "remote_password", so that
is a no-go.

token = strtok_r(NULL, " ", &saveptr);


below is my bridge config.

connection bridge-SC-to-AzureIoT
cleansession false
start_type automatic

clientid test
remote_password SharedAccessSignature

bridge_insecure false
bridge_protocol_version mqttv311
bridge_capath /etc/ssl/certs
bridge_tls_version tlsv1

notifications false
try_private false

topic # out 0 events/ devices/test/messages/events/
log_dest stdout

log_type debug

The connection through mosquitto_pub worked fine:

mosquitto_pub -d -h -p 8883 -u "" -P "SharedAccessSignature" -i test -m "{"deviceName":"Device1","foobar_lol":10.980438438244164}" -t "devices/test/messages/events/" --tls-version tlsv1 -V mqttv311 --capath /etc/ssl/certs

Thanks in advance.

@ralight ralight added a commit that referenced this issue Apr 28, 2016
@ralight ralight Bridge config parameters can now contain a space
Closes #150.

Thanks to Sebastian Koch and Mikkel Kirkgaard Nielsen.

Bug: #150
ralight commented Apr 28, 2016

Thanks for the report, this error only affects the bridge configuration parameters, I presume because I didn't migrate them to use the "parse string" function because the error string was a different pattern.

@ralight ralight closed this Apr 28, 2016
mikini commented Apr 28, 2016

You're welcome, this must approximate the definition of a quick fix ;).
Hope Sebastian is able to build it.

@ralight ralight added this to the 1.4.9 milestone May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment