Fix for no db in change_user

Fix for no db in change_user
This commit is contained in:
MassimilianoPinto 2014-10-20 09:01:13 +02:00
parent f735decd05
commit 319dd4b3e6

View File

@ -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;