Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password in file includes newline #136

Closed
jcassee opened this issue Mar 11, 2020 · 1 comment
Closed

Password in file includes newline #136

jcassee opened this issue Mar 11, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jcassee
Copy link

jcassee commented Mar 11, 2020

When creating a password file, most editors will automatically add a trailing newline. This newline is (apparently) included in the password sent to the server. It would be useful if only the characters up to the first newline were used.

Expected behavior

$ echo PASSWORD > password
$ mqtt sub -t topic -pw:file password --debug
Client 'UNKNOWN@SERVER' sending CONNECT MqttConnect{keepAlive=60, cleanStart=true, sessionExpiryInterval=0, simpleAuth=MqttSimpleAuth{username and password}}                                                                                                  
Client 'UNKNOWN@SERVER' received CONNACK MqttConnAck{reasonCode=SUCCESS, sessionPresent=false, assignedClientIdentifier=auto-69615666-347F-F76C-3185-2E278E94D8A5, restrictions=MqttConnAckRestrictions{receiveMaximum=65535, maximumPacketSize=268435460, topicAliasMaximum=10, maximumQos=EXACTLY_ONCE, retainAvailable=true, wildcardSubscriptionAvailable=true, sharedSubscriptionAvailable=true, subscriptionIdentifiersAvailable=true}} 
[...]

Actual behavior

$ echo PASSWORD > password
$ mqtt sub -t topic -pw:file password --debug
Client 'UNKNOWN@SERVER' sending CONNECT MqttConnect{keepAlive=60, cleanStart=true, sessionExpiryInterval=0, simpleAuth=MqttSimpleAuth{username and password}}
Client 'UNKNOWN@SERVER' DISCONNECTED CONNECT failed as CONNACK contained an Error Code: NOT_AUTHORIZED.
CONNECT failed as CONNACK contained an Error Code: NOT_AUTHORIZED.

$ echo -n PASSWORD > password
$ mqtt sub -t topic -pw:file password --debug
Client 'UNKNOWN@SERVER' sending CONNECT MqttConnect{keepAlive=60, cleanStart=true, sessionExpiryInterval=0, simpleAuth=MqttSimpleAuth{username and password}}                                                                                                  
Client 'UNKNOWN@SERVER' received CONNACK MqttConnAck{reasonCode=SUCCESS, sessionPresent=false, assignedClientIdentifier=auto-69615666-347F-F76C-3185-2E278E94D8A5, restrictions=MqttConnAckRestrictions{receiveMaximum=65535, maximumPacketSize=268435460, topicAliasMaximum=10, maximumQos=EXACTLY_ONCE, retainAvailable=true, wildcardSubscriptionAvailable=true, sharedSubscriptionAvailable=true, subscriptionIdentifiersAvailable=true}} 
[...]

To Reproduce

Steps

  1. Create a password file ending in a newline
  2. Try to connect to the MQTT server

Reproducer code

Details

  • Affected MQTT CLI version(s): 1.1.2
  • Used JVM version: 11.0.6 (Ubuntu OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu119.10.1)
@gitseti gitseti added the bug Something isn't working label Mar 13, 2020
@gitseti gitseti self-assigned this Mar 13, 2020
@gitseti gitseti closed this as completed Mar 18, 2020
@jcassee
Copy link
Author

jcassee commented Mar 18, 2020

Thanks, @gitseti!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants