Description:
Since version 5.5 MySQL server uses getnameinfo on Windows while resolveip and mysqlaccess still use gethostbyaddr (deprecated)
Only difference between these two functions is "gethostbyaddr is capable of returning a NetBIOS name; getnameinfo is not." (http://msdn.microsoft.com/en-gb/library/windows/desktop/ms738521%28v=vs.85%29.aspx)
This means that if user has NetBIOS name, different or not existent in DNS, she will be able to resolve this name using resolveip/mysqlaccess, but could not connect to MySQL server using this name.
How to repeat:
[sveta@delly mysql-5.5]$ grep -R gethostbyaddr ./extra/resolveip.c
hpaddr = gethostbyaddr((char*) &(taddr), sizeof(struct in_addr),AF_INET);
[sveta@delly mysql-5.5]$ grep -R gethostbyaddr ./scripts/
./scripts/mysqlaccess.sh: my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr($ip, AF_INET);
./scripts/mysqlaccess: my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr($ip, AF_INET);
[sveta@delly mysql-5.5]$ grep -R getnameinfo ./scripts/
[sveta@delly mysql-5.5]$ grep -R gethostbyaddr ./vio
[sveta@delly mysql-5.5]$ grep -R getnameinfo ./vio
./vio/viosocket.c: err_code= vio_getnameinfo(norm_addr, ip_string, ip_string_size, NULL, 0,
./vio/viosocket.c: DBUG_PRINT("error", ("getnameinfo() failed with %d (%s).",
./vio/viosocket.c: err_code= vio_getnameinfo((struct sockaddr *) &vio->remote,
./vio/viosocket.c: DBUG_PRINT("exit", ("getnameinfo() gave error: %s",
./vio/viosocket.c: Checks if the error code, returned by vio_getnameinfo(), means it was the
./vio/viosocket.c: Windows-specific note: getnameinfo() returns WSANO_DATA instead of
./vio/viosocket.c: This is a wrapper for the system getnameinfo(), because different OS
./vio/viosocket.c: differ in the getnameinfo() implementation:
./vio/viosocket.c:int vio_getnameinfo(const struct sockaddr *sa,
./vio/viosocket.c: return getnameinfo(sa, sa_length,
Binary file ./vio/libvio.a matches
Binary file ./vio/CMakeFiles/vio.dir/viosocket.c.o matches
Suggested fix:
Make resolveip and mysqlaccess consistent with server code