MXS-2011 Immediately de-quote strings
When receiving a command, such as CHANGE MASTER TO MASTER_HOST = '127.0.0.1' ... when the value is extracted, the quotes are removed before the value is returned. Firstly, BLR does not anyway anywhere enforce that quotes are present where they should be and, secondly, BLR currently does de-quoting all over the place and with this change, all those places can be simplified.
This commit is contained in:
@ -5117,7 +5117,20 @@ blr_get_parsed_command_value(char *input)
|
||||
*ptr-- = 0;
|
||||
}
|
||||
|
||||
ret = MXS_STRDUP_A(strstr(value, word));
|
||||
// Remove surrounding quotes.
|
||||
char* p = strstr(value, word);
|
||||
if (*p == '\'' || *p == '"')
|
||||
{
|
||||
char quote = *p;
|
||||
++p;
|
||||
int len = strlen(p);
|
||||
if (len > 0 && p[len - 1] == quote)
|
||||
{
|
||||
p[len - 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ret = MXS_STRDUP_A(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user