|
|
@ -233,6 +233,21 @@ int mosquitto_acl_check(struct mosquitto_db *db, struct mosquitto *context, cons
|
|
|
|
{
|
|
|
|
{
|
|
|
|
username = context->username;
|
|
|
|
username = context->username;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Check whether the client id or username contains a +, # or / and if
|
|
|
|
|
|
|
|
* so deny access.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Do this check for every message regardless, we have to protect the
|
|
|
|
|
|
|
|
* plugins against possible pattern based attacks.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(username && strpbrk(username, "+#/")){
|
|
|
|
|
|
|
|
_mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous username \"%s\"", username);
|
|
|
|
|
|
|
|
return MOSQ_ERR_ACL_DENIED;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(context->id && strpbrk(context->id, "+#/")){
|
|
|
|
|
|
|
|
_mosquitto_log_printf(NULL, MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous client id \"%s\"", context->id);
|
|
|
|
|
|
|
|
return MOSQ_ERR_ACL_DENIED;
|
|
|
|
|
|
|
|
}
|
|
|
|
return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, username, topic, access);
|
|
|
|
return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, username, topic, access);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|