[MDEV-31323] skip-name-resolve=off performs ip_to_hostname lookups on IP based hosts. Created: 2023-05-22  Updated: 2023-05-22

Status: Open
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.4.29
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Daniel Black
Resolution: Unresolved Votes: 0
Labels: None


 Description   

From serg

The server already has checks like

      if (opt_skip_name_resolve &&
          hostname_requires_resolving(host.host.hostname))
      {
        sql_print_warning("'host' entry '%s|%s' "
                        "ignored in --skip-name-resolve mode.",
                         safe_str(host.host.hostname),
                         safe_str(host.db));
        continue;
      }

But ip_to_hostname() is called like

  if (!opt_skip_name_resolve)
  {
    int rc;
 
    rc = ip_to_hostname(addr,
      thd->main_security_ctx.ip,
      &thd->main_security_ctx.host,
      host_errors);

Why not to make it to be, like

if (!opt_skip_name_resove && there_are_hostnames_requiring_resolving)
{
  ...

seems to be an easy thing to do. Then you can enable name resolution by default but it still won't do anything unless there's at least user entry that actually needs it. (edited)

caveat, need to check if enabling name resolution has any visible effects. Like, whether the hostname is shown in logs or in USER() whatever. if it does, you cannot just automatically skip it as above, but then we can add name-resolution=auto mode and make that the default.


Generated at Thu Feb 08 10:22:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.