private boolean login(Channel channel, ConnectMessage msg) {
if (msg.isUserFlag()) {
byte[] pwd = null;
if (msg.isPasswordFlag()) {
pwd = msg.getPassword();
<BUG>} else if (!this.allowAnonymous) {
failedCredentials(channel);</BUG>
return false;
}
<BUG>if (!m_authenticator.checkValid(msg.getClientID(), msg.getUsername(), pwd)) {
failedCredentials(channel);</BUG>
return false;

private boolean login(Channel channel, ConnectMessage msg) {
if (msg.isUserFlag()) {
byte[] pwd = null;
if (msg.isPasswordFlag()) {
pwd = msg.getPassword();
} else if (!this.allowAnonymous) {
LOG.error("The client didn't supply any password and MQTT anonymous mode is disabled. MqttClientId = {}.",
msg.getClientID());
failedCredentials(channel);
return false;
