summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorcmiller@zippy.cornsilk.net <>2008-01-23 11:34:08 -0500
committercmiller@zippy.cornsilk.net <>2008-01-23 11:34:08 -0500
commitc13d726f5d73de5e08e30982742b84c2e94a5efd (patch)
tree3452532e1c14f20f73d9add8e9f71a127f4c92f7 /extra
parent9777809b334330dc4905ba2ae103e80d1a75f8e2 (diff)
downloadmariadb-git-c13d726f5d73de5e08e30982742b84c2e94a5efd.tar.gz
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.
Diffstat (limited to 'extra')
-rw-r--r--extra/resolveip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 1061cafe380..c613f6a8cb6 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -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");