Commit a9d32010 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix MDEV-13239 Suppress the restriction about no blanks

around , and = in the OPTION_LIST.
  modified:   storage/connect/ha_connect.cc
parent 7542aff6
...@@ -1036,26 +1036,43 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def) ...@@ -1036,26 +1036,43 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
return (char*)def; return (char*)def;
char key[16], val[256]; char key[16], val[256];
char *pk, *pv, *pn; char *pv, *pn, *pk= (char*)oplist;
PCSZ opval= def; PCSZ opval= def;
int n; int n;
for (pk= (char*)oplist; pk; pk= ++pn) { while (*pk == ' ')
pk++;
for (; pk; pk= pn) {
pn= strchr(pk, ','); pn= strchr(pk, ',');
pv= strchr(pk, '='); pv= strchr(pk, '=');
if (pv && (!pn || pv < pn)) { if (pv && (!pn || pv < pn)) {
n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1); n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
memcpy(key, pk, n); memcpy(key, pk, n);
while (n && key[n - 1] == ' ')
n--;
key[n]= 0; key[n]= 0;
pv++;
while(*(++pv) == ' ') ;
n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1); n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
memcpy(val, pv, n); memcpy(val, pv, n);
val[n]= 0;
while (n && val[n - 1] == ' ')
n--;
val[n]= 0;
} else { } else {
n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1); n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
memcpy(key, pk, n); memcpy(key, pk, n);
key[n]= 0;
while (n && key[n - 1] == ' ')
n--;
key[n]= 0;
val[0]= 0; val[0]= 0;
} // endif pv } // endif pv
...@@ -1065,6 +1082,7 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def) ...@@ -1065,6 +1082,7 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
} else if (!pn) } else if (!pn)
break; break;
while (*(++pn) == ' ') ;
} // endfor pk } // endfor pk
return opval; return opval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment