summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authorHarin Vadodaria <harin.vadodaria@oracle.com>2012-06-19 13:54:31 +0530
committerHarin Vadodaria <harin.vadodaria@oracle.com>2012-06-19 13:54:31 +0530
commit59b4c55b511ea7b1253fb2cf32c6459fbd6835a2 (patch)
tree1ffdc732ba8adc673ce9698fecc0cc8a7d9057e7 /sql/hostname.cc
parentbd223999dcd20f67a087ba1dadeecd41a0c5622f (diff)
parent61e428eb846e820ba0764932d1604859e53abe52 (diff)
downloadmariadb-git-59b4c55b511ea7b1253fb2cf32c6459fbd6835a2.tar.gz
Bug#11753779: MAX_CONNECT_ERRORS WORKS ONLY WHEN 1ST
INC_HOST_ERRORS() IS CALLED. Description: Merge from MySQL 5.1 to MySQL 5.5 Reverting patch 3869 for bug#11753779
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r--sql/hostname.cc56
1 files changed, 2 insertions, 54 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 6d464580faf..d34df68587c 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -366,14 +366,6 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
err_code= vio_getnameinfo(ip, hostname_buffer, NI_MAXHOST, NULL, 0,
NI_NAMEREQD);
- /* BEGIN : DEBUG */
- DBUG_EXECUTE_IF("addr_fake_ipv4",
- {
- strcpy(hostname_buffer, "santa.claus.ipv4.example.com");
- err_code= 0;
- };);
- /* END : DEBUG */
-
if (err_code)
{
// NOTE: gai_strerror() returns a string ending by a dot.
@@ -446,12 +438,6 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
DBUG_RETURN(err_status);
}
- /*
- To avoid crashing the server in DBUG_EXECUTE_IF,
- Define a variable which depicts state of addr_info_list.
- */
- bool free_addr_info_list= false;
-
/* Get IP-addresses for the resolved host name (FCrDNS technique). */
struct addrinfo hints;
@@ -466,42 +452,6 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
(const char *) hostname_buffer));
err_code= getaddrinfo(hostname_buffer, NULL, &hints, &addr_info_list);
- if (err_code == 0)
- free_addr_info_list= true;
-
- /* BEGIN : DEBUG */
- DBUG_EXECUTE_IF("addr_fake_ipv4",
- {
- if (free_addr_info_list)
- freeaddrinfo(addr_info_list);
-
- struct sockaddr_in *debug_addr;
- static struct sockaddr_in debug_sock_addr[2];
- static struct addrinfo debug_addr_info[2];
- /* Simulating ipv4 192.0.2.5 */
- debug_addr= & debug_sock_addr[0];
- debug_addr->sin_family= AF_INET;
- debug_addr->sin_addr.s_addr= inet_addr("192.0.2.5");
-
- /* Simulating ipv4 192.0.2.4 */
- debug_addr= & debug_sock_addr[1];
- debug_addr->sin_family= AF_INET;
- debug_addr->sin_addr.s_addr= inet_addr("192.0.2.4");
-
- debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0];
- debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in);
- debug_addr_info[0].ai_next= & debug_addr_info[1];
-
- debug_addr_info[1].ai_addr= (struct sockaddr*) & debug_sock_addr[1];
- debug_addr_info[1].ai_addrlen= sizeof (struct sockaddr_in);
- debug_addr_info[1].ai_next= NULL;
-
- addr_info_list= & debug_addr_info[0];
- err_code= 0;
- free_addr_info_list= false;
- };);
-
- /* END : DEBUG */
if (err_code == EAI_NONAME)
{
@@ -554,8 +504,7 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
{
DBUG_PRINT("error", ("Out of memory."));
- if (free_addr_info_list)
- freeaddrinfo(addr_info_list);
+ freeaddrinfo(addr_info_list);
DBUG_RETURN(TRUE);
}
@@ -589,8 +538,7 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
/* Free the result of getaddrinfo(). */
- if (free_addr_info_list)
- freeaddrinfo(addr_info_list);
+ freeaddrinfo(addr_info_list);
/* Add an entry for the IP to the cache. */