diff options
author | Sergei Golubchik <serg@mariadb.org> | 2023-03-10 18:14:45 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-03-10 22:04:09 +0100 |
commit | 8145b308b02ee7ee657851c1faee49c7b7ebf511 (patch) | |
tree | dd86f77b08ab41a22caa66aad667d0b1e972e41f /sql | |
parent | 2ac832838fd04e22645df6cf6fe8959b44c3853d (diff) | |
download | mariadb-git-8145b308b02ee7ee657851c1faee49c7b7ebf511.tar.gz |
MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade to 10.4
convert empty host.db to "%", just as it's done for host.hostname
(in update_hostname())
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_acl.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 54ad81f94ce..4bb16e3248d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2437,6 +2437,8 @@ static bool acl_load(THD *thd, const Grant_tables& tables) "possible to remove this privilege using REVOKE.", host.host.hostname, host.db); } + else if (!host.db) + host.db= const_cast<char*>(host_not_specified.str); host.access= host_table.get_access(); host.access= fix_rights_for_db(host.access); host.sort= get_magic_sort("hd", host.host.hostname, host.db); @@ -2445,8 +2447,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables) { sql_print_warning("'host' entry '%s|%s' " "ignored in --skip-name-resolve mode.", - safe_str(host.host.hostname), - safe_str(host.db)); + host.host.hostname, host.db); continue; } #ifndef TO_BE_REMOVED @@ -3533,7 +3534,7 @@ ulong acl_get(const char *host, const char *ip, ACL_HOST *acl_host=dynamic_element(&acl_hosts,i,ACL_HOST*); if (compare_hostname(&acl_host->host,host,ip)) { - if (!acl_host->db || !wild_compare(db,acl_host->db,db_is_pattern)) + if (!wild_compare(db, acl_host->db, db_is_pattern)) { host_access=acl_host->access; // Fully specified. Take it break; |