From 319dd4b3e66c7390e5a9cda786092cd8ab0bebe0 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Mon, 20 Oct 2014 09:01:13 +0200 Subject: [PATCH] Fix for no db in change_user Fix for no db in change_user --- server/modules/protocol/mysql_common.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/server/modules/protocol/mysql_common.c b/server/modules/protocol/mysql_common.c index c098263c2..7fa0b1967 100644 --- a/server/modules/protocol/mysql_common.c +++ b/server/modules/protocol/mysql_common.c @@ -1110,22 +1110,22 @@ int gw_send_change_user_to_backend( // add the user bytes += strlen(user); - // the NULL + // NULL byte for user string bytes++; // next will be + 1 (scramble_len) + 20 (fixed_scramble) + (dbname + NULL term) + 2 bytes charset - if (curr_passwd != NULL) { - bytes += GW_MYSQL_SCRAMBLE_SIZE; - bytes++; - } else { - bytes++; - } - - if (curr_db != NULL) { - bytes += strlen(curr_db); - bytes++; + if (curr_passwd != NULL) { + bytes += GW_MYSQL_SCRAMBLE_SIZE; } + // 1 byte for scramble_len + bytes++; + + if (curr_db != NULL) { + bytes += strlen(curr_db); + } + // NULL byte for dbname string + bytes++; // the charset bytes += 2;