1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Bug#27427: resolveip fails on hostnames with a leading digit

Patch by Kasper Dupont.  No CLA required for this size of patch.

"resolveip" program produces incorrect result if given a hostname
starting with a digit.  Someone seems to have thought that names 
can not have digits at the beginning.

Instead, use the resolver library to work out the rules of hostnames, 
as it will undoubtedly be better at it than we are.
This commit is contained in:
cmiller@zippy.cornsilk.net
2008-01-23 11:34:08 -05:00
parent 9777809b33
commit c13d726f5d
2 changed files with 6 additions and 2 deletions

View File

@@ -116,11 +116,13 @@ int main(int argc, char **argv)
while (argc--)
{
struct in_addr addr;
ip = *argv++;
if (my_isdigit(&my_charset_latin1,ip[0]))
/* Not compatible with IPv6! Probably should use getnameinfo(). */
if (inet_aton(ip, &addr) != 0)
{
taddr = inet_addr(ip);
taddr= addr.s_addr;
if (taddr == htonl(INADDR_BROADCAST))
{
puts("Broadcast");