Bug #68415 resolveip and mysqlaccess still use gethostbyaddr

Submitted: 18 Feb 2013 15:35
Reporter: Sveta Smirnova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.5.31, 5.6.11, 5.7.1 OS:Any
Assigned to: CPU Architecture:Any

[18 Feb 2013 15:35] Sveta Smirnova
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
[15 Mar 2014 12:16] Daniƫl van Eeden
Looks related to Bug #61750

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.054 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.