Fix incorrect handling of anonymous bridges on the local broker.

Thanks to Jan-Piet Mens.
pull/211/merge
Roger A. Light 11 years ago
parent 0d1cb339a8
commit 8e7736b78e

@ -1,3 +1,10 @@
1.3.3 - 20140801
================
Broker:
- Fix incorrect handling of anonymous bridges on the local broker.
1.3.2 - 20140713
================

@ -162,19 +162,24 @@ int mqtt3_bridge_connect(struct mosquitto_db *db, struct mosquitto *context)
mqtt3_db_messages_delete(context);
}
rc = mosquitto_unpwd_check(db, context->bridge->local_username, context->bridge->local_password);
switch(rc){
case MOSQ_ERR_SUCCESS:
break;
case MOSQ_ERR_AUTH:
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id);
return rc;
case MOSQ_ERR_UNKNOWN:
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s returned application error in authorisation.", context->id);
return rc;
default:
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Unknown error in authentication for bridge %s.", context->id);
return rc;
if(context->bridge->local_username){
rc = mosquitto_unpwd_check(db, context->bridge->local_username, context->bridge->local_password);
switch(rc){
case MOSQ_ERR_SUCCESS:
break;
case MOSQ_ERR_AUTH:
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id);
return rc;
case MOSQ_ERR_UNKNOWN:
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s returned application error in authorisation.", context->id);
return rc;
default:
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Unknown error in authentication for bridge %s.", context->id);
return rc;
}
}else if(!db->config->allow_anonymous){
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s requires a username on local broker.", context->id);
return MOSQ_ERR_AUTH;
}
/* Delete all local subscriptions even for clean_session==false. We don't

Loading…
Cancel
Save