Connect for a single user/pass combo only works first time

Asked by Tony DiCamillo

In my mosquitto.conf file, I have set "allow_anonymous" to false and set "password_file" to the appropriate file path. Using mosquitto_passwd utility I add the username "myuser" with password "mypass". The first time a client connects using this combination, it is able to connect successfully (CONNACK with return code 0). After disconnecting, in subsequent connect attempts, the CONNACK returns code 5 ("Connection refused: not authorized"). If I create a new user/pass combo and use this it also works the first time. If the client tries to use an invalid user/pass combo CONNACK returns code 4 ("Bad username or password") which indicates that it is performing the password check.

Does anyone have any suggestion of why CONNACK always returns code 5 after the first successful connection?

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Tony DiCamillo
Solved:
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

Hi there,

Which version of mosquitto are you using, and on what platform?

Thanks,

Roger

Revision history for this message
Tony DiCamillo (tdicamillo1) said :
#2

It is mosquitto version 1.3.4 on CentOS 6. (64-bit).

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Tony DiCamillo (tdicamillo1) said :
#4

Still hoping someone can provide some input on this issue...

Revision history for this message
Roger Light (roger.light) said :
#5

Hi Tony,

Sorry for the delay responding, I took a break from email/computers over Christmas.

I've just given this a try and haven't been able to reproduce it using mosquitto 1.3.4 on Ubuntu 14.04, using the command:

 mosquitto_sub -t asdf -u roger -P password -d

then pressing ctrl-c and retrying.

Could you provide the steps that you are taking that reproduces the problem please?

Revision history for this message
Tony DiCamillo (tdicamillo1) said :
#6

Sometimes taking a break and coming back fixes everything. I looked very closely and noticed an issue in my code that slightly changed a portion of the CONNECT message on later attempts. So no mosquitto bug! Thanks.