Commit 358cfd6c authored by unknown's avatar unknown
Browse files

Better bug fix for #5569: "Incorrect "Access Denied" error with SAME login DIFFERENT host"

This fixes also the reverse lookup bug introduced by the previous patch



mysql-test/t/group_by.test:
  Remove empty line
vio/viosocket.c:
  Added function comment
parent 4c21a10f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -455,4 +455,3 @@ select min(a) is null from t1;
select min(a) is null or null from t1;
select 1 and min(a) is null from t1;
drop table t1;
+13 −10
Original line number Diff line number Diff line
@@ -504,8 +504,6 @@ check_connections(THD *thd)
  DBUG_PRINT("info",("New connection received on %s",
			vio_description(net->vio)));

  vio_in_addr(net->vio,&thd->remote.sin_addr);

  if (!thd->host)                           // If TCP/IP connection
  {
    char ip[30];
@@ -515,6 +513,7 @@ check_connections(THD *thd)
    if (!(thd->ip = my_strdup(ip,MYF(0))))
      return (ER_OUT_OF_RESOURCES);
    thd->host_or_ip=thd->ip;
    vio_in_addr(net->vio, &thd->remote.sin_addr);
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
    /* Fast local hostname resolve for Win32 */
    if (!strcmp(thd->ip,"127.0.0.1"))
@@ -524,6 +523,7 @@ check_connections(THD *thd)
    }
    else
#endif
    {
      if (!(specialflag & SPECIAL_NO_RESOLVE))
      {
        thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
@@ -536,6 +536,7 @@ check_connections(THD *thd)
        if (connect_errors > max_connect_errors)
          return(ER_HOST_IS_BLOCKED);
      }
    }
    DBUG_PRINT("info",("Host: %s  ip: %s",
		       thd->host ? thd->host : "unknown host",
		       thd->ip ? thd->ip : "unknown ip"));
@@ -547,6 +548,8 @@ check_connections(THD *thd)
    DBUG_PRINT("info",("Host: %s",thd->host));
    thd->host_or_ip= thd->host;
    thd->ip= 0;
    /* Reset sin_addr */
    bzero((char*) &thd->remote, sizeof(thd->remote));
  }
  vio_keepalive(net->vio, TRUE);

+12 −0
Original line number Diff line number Diff line
@@ -291,6 +291,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
}


/*
  Get in_addr for a TCP/IP connection

  SYNOPSIS
    vio_in_addr()
    vio		vio handle
    in		put in_addr here

  NOTES
    one must call vio_peer_addr() before calling this one
*/

void vio_in_addr(Vio *vio, struct in_addr *in)
{
  DBUG_ENTER("vio_in_addr");