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

SIGHUP disconnects bridge connection #1942

Closed
ghost opened this issue Dec 11, 2020 · 1 comment
Closed

SIGHUP disconnects bridge connection #1942

ghost opened this issue Dec 11, 2020 · 1 comment
Milestone

Comments

@ghost
Copy link

ghost commented Dec 11, 2020

It was noticed that bridge connections will always be dropped when running "killall -SIGHUP mosquitto". Studying my config, it seems like this only happens when I am NOT setting allow_anonymous to true. (default it is false)

Problem is following block

if(!allow_anonymous && !context->username){

		if(!allow_anonymous && !context->username){
			mosquitto__set_state(context, mosq_cs_disconnecting);
			do_disconnect(db, context, MOSQ_ERR_AUTH);
			continue;
		}

Of course, a bridge doesn't have a username and as I said, allow_anonymous is false. So mosquitto_security_apply_default will just kick my bridge all the time

If I am just setting a remote_username (to some random value) then following section of code will kick my bridge connection

/* Username/password check only if the identity/subject check not used */

		/* Username/password check only if the identity/subject check not used */
			if(mosquitto_unpwd_check(db, context, context->username, context->password) != MOSQ_ERR_SUCCESS){
				mosquitto__set_state(context, mosq_cs_disconnecting);
				do_disconnect(db, context, MOSQ_ERR_AUTH);
				continue;
			}

I think both miss a !context->is_bridge && at the beginning

ralight added a commit that referenced this issue Dec 17, 2020
Closes #1942. Thanks to charlemagnelasse.
@ralight
Copy link
Contributor

ralight commented Dec 17, 2020

Thanks for the report, I agree with your general suggestion and it should now be fixed and will be part of 2.0.3 shortly.

@ralight ralight added this to the 2.0.3 milestone Dec 17, 2020
fAuernigg pushed a commit to fAuernigg/mosquitto that referenced this issue Jan 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant