Fix to bug 562 (http://bugs.mariadb.com/show_bug.cgi?id=562)
mysql_client.c: Changed the error message and, in the case of a failed auth while using a password, set the first byte to 1 in dcb->data->client_sha1
This commit is contained in:
@ -488,6 +488,10 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
|
|||||||
if (auth_ret == 0)
|
if (auth_ret == 0)
|
||||||
{
|
{
|
||||||
dcb->user = strdup(client_data->user);
|
dcb->user = strdup(client_data->user);
|
||||||
|
}else if(auth_token_len > 0)
|
||||||
|
{
|
||||||
|
/**User was using a password, add a notification for that*/
|
||||||
|
stage1_hash[0] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return auth_ret;
|
return auth_ret;
|
||||||
@ -654,12 +658,22 @@ int gw_read_client_event(
|
|||||||
protocol->owner_dcb->fd,
|
protocol->owner_dcb->fd,
|
||||||
pthread_self())));
|
pthread_self())));
|
||||||
|
|
||||||
|
|
||||||
|
char errstr [256];
|
||||||
|
MYSQL_session *mysqlsession = dcb->data;
|
||||||
|
|
||||||
|
sprintf(errstr,
|
||||||
|
"Access denied for user '%s'@'%s' (using password: %s)",
|
||||||
|
mysqlsession->user,
|
||||||
|
dcb->remote,
|
||||||
|
mysqlsession->client_sha1[0] > 0 ? "YES":"NO");
|
||||||
|
|
||||||
/** Send ERR 1045 to client */
|
/** Send ERR 1045 to client */
|
||||||
mysql_send_auth_error(
|
mysql_send_auth_error(
|
||||||
dcb,
|
dcb,
|
||||||
2,
|
2,
|
||||||
0,
|
0,
|
||||||
"Authorization failed");
|
errstr);
|
||||||
|
|
||||||
dcb_close(dcb);
|
dcb_close(dcb);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user