| 1496 | } |
| 1497 | |
| 1498 | bool set_auth(const ACL_USER &u) const override |
| 1499 | { |
| 1500 | size_t array_len; |
| 1501 | const char *array; |
| 1502 | if (u.nauth == 1 && get_value("auth_or", JSV_ARRAY, &array, &array_len)) |
| 1503 | return set_auth1(u, 0); |
| 1504 | |
| 1505 | StringBuffer<JSON_SIZE> json(m_table->field[2]->charset()); |
| 1506 | bool top_done = false; |
| 1507 | json.append('['); |
| 1508 | for (uint i=0; i < u.nauth; i++) |
| 1509 | { |
| 1510 | ACL_USER::AUTH * const auth= u.auth + i; |
| 1511 | if (i) |
| 1512 | json.append(','); |
| 1513 | json.append('{'); |
| 1514 | if (!top_done && |
| 1515 | (auth->plugin.str == native_password_plugin_name.str || |
| 1516 | auth->plugin.str == old_password_plugin_name.str || |
| 1517 | i == u.nauth - 1)) |
| 1518 | { |
| 1519 | if (set_auth1(u, i)) |
| 1520 | return 1; |
| 1521 | top_done= true; |
| 1522 | } |
| 1523 | else |
| 1524 | { |
| 1525 | json.append(STRING_WITH_LEN("\"plugin\":")); |
| 1526 | if (append_str_value(&json, auth->plugin)) |
| 1527 | return 1; |
| 1528 | if (auth->auth_string.length) |
| 1529 | { |
| 1530 | json.append(STRING_WITH_LEN(",\"authentication_string\":")); |
| 1531 | if (append_str_value(&json, auth->auth_string)) |
| 1532 | return 1; |
| 1533 | } |
| 1534 | } |
| 1535 | json.append('}'); |
| 1536 | } |
| 1537 | json.append(']'); |
| 1538 | return set_value("auth_or", json.ptr(), json.length(), false) == JSV_BAD_JSON; |
| 1539 | } |
| 1540 | bool set_auth1(const ACL_USER &u, uint i) const |
| 1541 | { |
| 1542 | return set_str_value("plugin", |