Fix for bug 127 and 345 as part of it

Fix for bug 127 and 345 as part of it
http://bugs.skysql.com/show_bug.cgi?id=127
http://bugs.skysql.com/show_bug.cgi?id=345
This commit is contained in:
MassimilianoPinto
2014-02-28 11:29:50 +01:00
parent 9e4a6b3994
commit 78799e505f
10 changed files with 283 additions and 57 deletions

View File

@ -29,6 +29,9 @@
* 24/06/2013 Massimiliano Pinto Added: fetch passwords from service users' hashtable
* 02/09/2013 Massimiliano Pinto Added: session refcount
* 16/12/2013 Massimiliano Pinto Added: client closed socket detection with recv(..., MSG_PEEK)
* 24/02/2014 Massimiliano Pinto Added: on failed authentication a new users' table is loaded with time and frequency limitations
* If current user is authenticated the new users' table will replace the old one
*
*/
#include <skygw_utils.h>
@ -444,6 +447,15 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
username,
stage1_hash);
/* On failed auth try to load users' table from backend database */
if (auth_ret != 0) {
if (!service_refresh_users(dcb->service)) {
/* Try authentication again with new repository data */
/* Note: if no auth client authentication will fail */
auth_ret = gw_check_mysql_scramble_data(dcb, auth_token, auth_token_len, protocol->scramble, sizeof(protocol->scramble), username, stage1_hash);
}
}
/* let's free the auth_token now */
if (auth_token)
free(auth_token);