MCPcopy Create free account
hub / github.com/MariaDB/server / get_auth

Method get_auth

sql/sql_acl.cc:1419–1463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1417 LEX_CSTRING& name() const override { return MYSQL_TABLE_NAME[USER_TABLE]; }
1418
1419 int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const override
1420 {
1421 size_t array_len;
1422 const char *array;
1423 int vl;
1424 const char *v;
1425
1426 if (get_value("auth_or", JSV_ARRAY, &array, &array_len))
1427 {
1428 u->alloc_auth(root, 1);
1429 return get_auth1(thd, root, u, 0);
1430 }
1431
1432 if (json_get_array_item(array, array + array_len, (int)array_len,
1433 &v, &vl) != JSV_NOTHING)
1434 return 1;
1435 u->alloc_auth(root, vl);
1436 for (uint i=0; i < u->nauth; i++)
1437 {
1438 if (json_get_array_item(array, array + array_len, i, &v, &vl) != JSV_OBJECT)
1439 return 1;
1440
1441 const char *p, *a;
1442 int pl, al;
1443 switch (json_get_object_key(v, v + vl, "plugin", &p, &pl)) {
1444 case JSV_STRING: u->auth[i].plugin.str= strmake_root(root, p, pl);
1445 u->auth[i].plugin.length= pl;
1446 break;
1447 case JSV_NOTHING: if (get_auth1(thd, root, u, i))
1448 return 1;
1449 else
1450 continue;
1451 default: return 1;
1452 }
1453 switch (json_get_object_key(v, v + vl, "authentication_string", &a, &al)) {
1454 case JSV_NOTHING: u->auth[i].auth_string= empty_clex_str;
1455 break;
1456 case JSV_STRING: u->auth[i].auth_string.str= strmake_root(root, a, al);
1457 u->auth[i].auth_string.length= al;
1458 break;
1459 default: return 1;
1460 }
1461 }
1462 return 0;
1463 }
1464
1465 int get_auth1(THD *thd, MEM_ROOT *root, ACL_USER *u, uint n) const
1466 {

Callers 1

acl_loadFunction · 0.45

Calls 5

json_get_array_itemFunction · 0.85
json_get_object_keyFunction · 0.85
strmake_rootFunction · 0.85
alloc_authMethod · 0.80
get_valueFunction · 0.50

Tested by

no test coverage detected