2012-11-06 13:24:54 +00:00
|
|
|
--- iputils-s20121106/Makefile.orig 2012-11-06 14:05:19.000000000 +0100
|
|
|
|
+++ iputils-s20121106/Makefile 2012-11-06 14:06:42.608585629 +0100
|
|
|
|
@@ -62,7 +62,7 @@
|
|
|
|
|
|
|
|
# ping / ping6
|
2010-05-17 12:28:06 +00:00
|
|
|
ping: ping.o ping_common.o
|
2012-11-06 13:24:54 +00:00
|
|
|
- $(LINK.o) $^ $(LIB_CAP) $(LDLIBS) -o $@
|
|
|
|
+ $(LINK.o) $^ -lidn $(LIB_CAP) $(LDLIBS) -o $@
|
2012-10-16 11:19:12 +00:00
|
|
|
ping6: ping6.o ping_common.o
|
2012-11-06 13:24:54 +00:00
|
|
|
$(LINK.o) $^ -lresolv -lcrypto $(LIB_CAP) $(LDLIBS) -o $@
|
|
|
|
ping.o ping6.o ping_common.o: ping_common.h
|
2010-05-17 12:28:06 +00:00
|
|
|
diff -up iputils-s20100418/ping.c.idn iputils-s20100418/ping.c
|
|
|
|
--- iputils-s20100418/ping.c.idn 2010-04-20 16:07:59.038484302 +0200
|
|
|
|
+++ iputils-s20100418/ping.c 2010-04-20 16:07:59.077485007 +0200
|
|
|
|
@@ -58,6 +58,9 @@ char copyright[] =
|
2007-03-27 11:34:20 +00:00
|
|
|
* This program has to run SUID to ROOT to access the ICMP socket.
|
|
|
|
*/
|
|
|
|
|
|
|
|
+#include <idna.h>
|
|
|
|
+#include <locale.h>
|
|
|
|
+
|
|
|
|
#include "ping_common.h"
|
|
|
|
|
2007-08-07 09:14:36 +00:00
|
|
|
#include <netinet/ip.h>
|
2010-05-17 12:28:06 +00:00
|
|
|
@@ -123,6 +126,10 @@ main(int argc, char **argv)
|
|
|
|
char *target, hnamebuf[MAX_HOSTNAMELEN];
|
2007-03-27 11:34:20 +00:00
|
|
|
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
|
|
|
|
|
|
|
|
+ char *idn;
|
|
|
|
+ int rc = 0;
|
|
|
|
+ setlocale(LC_ALL, "");
|
|
|
|
+
|
|
|
|
icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
|
|
|
|
socket_errno = errno;
|
|
|
|
|
2010-05-17 12:28:06 +00:00
|
|
|
@@ -250,13 +257,27 @@ main(int argc, char **argv)
|
2007-03-27 11:34:20 +00:00
|
|
|
if (argc == 1)
|
|
|
|
options |= F_NUMERIC;
|
|
|
|
} else {
|
2010-05-17 12:28:06 +00:00
|
|
|
- hp = gethostbyname(target);
|
2007-03-27 11:34:20 +00:00
|
|
|
+ rc = idna_to_ascii_lz (target, &idn, 0);
|
|
|
|
+ if (rc == IDNA_SUCCESS)
|
|
|
|
+ hp = gethostbyname (idn);
|
|
|
|
+ else {
|
|
|
|
+ fprintf(stderr, "ping: IDN encoding of '%s' failed with error code %d\n", target, rc);
|
|
|
|
+ exit(2);
|
|
|
|
+ }
|
|
|
|
+ free(idn);
|
|
|
|
if (!hp) {
|
|
|
|
fprintf(stderr, "ping: unknown host %s\n", target);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
memcpy(&whereto.sin_addr, hp->h_addr, 4);
|
2010-05-17 12:28:06 +00:00
|
|
|
- strncpy(hnamebuf, hp->h_name, sizeof(hnamebuf) - 1);
|
2007-03-27 11:34:20 +00:00
|
|
|
+ rc = idna_to_unicode_lzlz (hp->h_name, &idn, 0);
|
|
|
|
+ if (rc == IDNA_SUCCESS)
|
|
|
|
+ strncpy(hnamebuf, idn, sizeof(hnamebuf) - 1);
|
|
|
|
+ else {
|
|
|
|
+ fprintf(stderr, "ping: IDN encoding of '%s' failed with error code %d\n", hp->h_name, rc);
|
|
|
|
+ exit(2);
|
|
|
|
+ }
|
|
|
|
+ free(idn);
|
|
|
|
hnamebuf[sizeof(hnamebuf) - 1] = 0;
|
|
|
|
hostname = hnamebuf;
|
|
|
|
}
|
2010-05-17 12:28:06 +00:00
|
|
|
diff -up iputils-s20100418/ping_common.c.idn iputils-s20100418/ping_common.c
|
|
|
|
--- iputils-s20100418/ping_common.c.idn 2010-04-20 16:07:59.039478452 +0200
|
|
|
|
+++ iputils-s20100418/ping_common.c 2010-04-20 16:07:59.069478660 +0200
|
2008-06-03 11:04:03 +00:00
|
|
|
@@ -1,3 +1,5 @@
|
2007-08-07 09:14:36 +00:00
|
|
|
+#include <locale.h>
|
|
|
|
+
|
|
|
|
#include "ping_common.h"
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sched.h>
|
2010-05-17 12:28:06 +00:00
|
|
|
@@ -98,6 +100,7 @@ static void fill(char *patp)
|
2007-08-07 09:14:36 +00:00
|
|
|
|
|
|
|
void common_options(int ch)
|
|
|
|
{
|
|
|
|
+ setlocale(LC_ALL, "C");
|
|
|
|
switch(ch) {
|
|
|
|
case 'a':
|
|
|
|
options |= F_AUDIBLE;
|
2010-05-17 12:28:06 +00:00
|
|
|
@@ -242,6 +245,7 @@ void common_options(int ch)
|
2007-08-07 09:14:36 +00:00
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
+ setlocale(LC_ALL, "");
|
|
|
|
}
|
|
|
|
|