Fixed false positives in SHOW SHARDS detection.

This commit is contained in:
Markus Makela
2015-07-03 13:59:25 +03:00
parent 5964a68143
commit a9e0a52b9e

View File

@ -4419,7 +4419,7 @@ static sescmd_cursor_t* backend_ref_get_sescmd_cursor (
bool detect_show_shards(GWBUF* query) bool detect_show_shards(GWBUF* query)
{ {
bool rval = false; bool rval = false;
char* querystr; char *querystr,*tok,*sptr;
if(query == NULL) if(query == NULL)
{ {
@ -4438,9 +4438,12 @@ bool detect_show_shards(GWBUF* query)
return false; return false;
} }
if(strcasestr(querystr,"show shards") != NULL) tok = strtok_r(querystr," ",&sptr);
if(tok && strcasecmp(tok,"show") == 0)
{ {
rval = true; tok = strtok_r(NULL," ",&sptr);
if(tok && strcasecmp(tok,"shards") == 0)
rval = true;
} }
free(querystr); free(querystr);