Group :: Networking/Other
RPM: whois
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: whois-5.0.26-alt1.patch
Download
Download
po/da.po | 2 +-
tld_serv_list | 13 ++++++++++---
utils.c | 17 +++++++++++++++--
utils.h | 8 ++++++--
whois.c | 41 +++++++++--------------------------------
5 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/po/da.po b/po/da.po
index 01ce95c..f6af7ee 100644
--- a/po/da.po
+++ b/po/da.po
@@ -1,5 +1,5 @@
# Translation of whois to Danish.
-# Copyright (C) 2001 Simon Richter <Simon.Richter@in.tum.de>, 2004 Adrian
+# Copyright (C) 2001 Simon Richter <Simon.Richter@in.tum.de>, 2004 Adrian
# Bunk <bunk@fs.tum.de>, 2010 Chris Leick <c.leick@vollbio.de>.
# This file is distributed under the same license as the whois package.
# Joe Hansen <joedalton2@yahoo.dk>, 2011, 2013.
diff --git a/tld_serv_list b/tld_serv_list
index 40582a8..2efa5be 100644
--- a/tld_serv_list
+++ b/tld_serv_list
@@ -259,8 +259,15 @@
.re whois.nic.fr
.ro whois.rotld.ro
.rs whois.rnids.rs
+.com.ru whois.nic.ru
.edu.ru whois.informika.ru
-.ru whois.tcinet.ru
+.msk.ru whois.nic.ru
+.net.ru whois.nic.ru
+.nov.ru whois.nic.ru
+.org.ru whois.nic.ru
+.pp.ru whois.nic.ru
+.spb.ru whois.nic.ru
+.ru whois.ripn.net
.rw whois.ricta.org.rw # http://www.ricta.org.rw/
.sa whois.nic.net.sa
.sb whois.coccaregistry.net
@@ -279,7 +286,7 @@
.sr NONE # www.register.sr
#.ss
.st whois.nic.st
-.su whois.tcinet.ru
+.su whois.ripn.net
.sv WEB http://www.svnet.org.sv/
.sx whois.sx
.sy whois.tld.sy
@@ -373,7 +380,7 @@
.xn--mgbx4cd0ab whois.domainregistry.my # Malaysia AW
.xn--o3cw4h whois.thnic.co.th # Thailand
.xn--ogbpf8fl whois.tld.sy # Syria
-.xn--p1ai whois.tcinet.ru # Russian Federation
+.xn--p1ai whois.ripn.net # Russian Federation
.xn--pgbs0dh NONE # Tunisia
.xn--s9brj9c whois.registry.in # India, Punjabi AW
.xn--wgbh1c whois.dotmasr.eg # Egypt
diff --git a/utils.c b/utils.c
index 254bf2a..f7eb6b6 100644
--- a/utils.c
+++ b/utils.c
@@ -20,8 +20,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/* for strdup */
-#define _XOPEN_SOURCE 500
+/* for vasprintf */
+#define _GNU_SOURCE
/* System library */
#include <stdio.h>
@@ -71,6 +71,19 @@ char **merge_args(char *args, char *argv[], int *argc)
return newargs;
}
+char *
+xasprintf(const char *fmt, ...)
+{
+ char *ptr;
+ va_list arg;
+
+ va_start(arg, fmt);
+ if (vasprintf(&ptr, fmt, arg) < 0)
+ err_sys("vasprintf");
+ va_end(arg);
+ return ptr;
+}
+
/* Error routines */
void err_sys(const char *fmt, ...)
{
diff --git a/utils.h b/utils.h
index 0f226ae..2cd5928 100644
--- a/utils.h
+++ b/utils.h
@@ -50,7 +50,11 @@
void *do_nofail(void *ptr, const char *file, const int line);
char **merge_args(char *args, char *argv[], int *argc);
-void err_quit(const char *fmt, ...) NORETURN;
-void err_sys(const char *fmt, ...) NORETURN;
+char *xasprintf(const char *fmt, ...)
+ __attribute__ ((__format__(__printf__, 1, 2)));
+void err_quit(const char *,...)
+ __attribute__ ((__format__ (__printf__, 1, 2))) NORETURN;
+void err_sys(const char *,...)
+ __attribute__ ((__format__ (__printf__, 1, 2))) NORETURN;
#endif
diff --git a/whois.c b/whois.c
index cde55df..a0a4d14 100644
--- a/whois.c
+++ b/whois.c
@@ -622,9 +622,7 @@ const char *do_query(const int sock, const char *query)
int hide = hide_discl;
char *referral_server = NULL;
- temp = malloc(strlen(query) + 2 + 1);
- strcpy(temp, query);
- strcat(temp, "\r\n");
+ temp = xasprintf("%s\r\n", query);
fi = fdopen(sock, "r");
if (write(sock, temp, strlen(temp)) < 0)
@@ -640,8 +638,7 @@ const char *do_query(const int sock, const char *query)
if (sscanf(buf, REFERTO_FORMAT, nh, np, nq) == 3) {
/* XXX we are ignoring the new query string */
- referral_server = malloc(strlen(nh) + 1 + strlen(np) + 1);
- sprintf(referral_server, "%s:%s", nh, np);
+ referral_server = xasprintf("%s:%s", nh, np);
}
}
@@ -686,10 +683,7 @@ const char *query_crsnic(const int sock, const char *query)
char *referral_server = NULL;
int state = 0;
- temp = malloc(strlen(query) + 1 + 2 + 1);
- *temp = '=';
- strcpy(temp + 1, query);
- strcat(temp, "\r\n");
+ temp = xasprintf("=%s\r\n", query);
fi = fdopen(sock, "r");
if (write(sock, temp, strlen(temp)) < 0)
@@ -736,9 +730,7 @@ const char *query_afilias(const int sock, const char *query)
char *referral_server = NULL;
int state = 0;
- temp = malloc(strlen(query) + 2 + 1);
- strcpy(temp, query);
- strcat(temp, "\r\n");
+ temp = xasprintf("%s\r\n", query);
fi = fdopen(sock, "r");
if (write(sock, temp, strlen(temp)) < 0)
@@ -1047,8 +1039,6 @@ void split_server_port(const char *const input,
char *convert_6to4(const char *s)
{
- char *new;
-
#ifdef HAVE_INET_PTON
struct in6_addr ipaddr;
unsigned char *ip;
@@ -1057,8 +1047,7 @@ char *convert_6to4(const char *s)
return strdup("0.0.0.0");
ip = (unsigned char *)&ipaddr;
- new = malloc(sizeof("255.255.255.255"));
- sprintf(new, "%d.%d.%d.%d", *(ip + 2), *(ip + 3), *(ip + 4), *(ip + 5));
+ return xasprintf("%d.%d.%d.%d", *(ip + 2), *(ip + 3), *(ip + 4), *(ip + 5));
#else
int items;
unsigned int a, b;
@@ -1076,17 +1065,12 @@ char *convert_6to4(const char *s)
b = 0;
}
- new = malloc(sizeof("255.255.255.255"));
- sprintf(new, "%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
+ return xasprintf("%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
#endif
-
- return new;
}
char *convert_teredo(const char *s)
{
- char *new;
-
#ifdef HAVE_INET_PTON
struct in6_addr ipaddr;
unsigned char *ip;
@@ -1095,8 +1079,7 @@ char *convert_teredo(const char *s)
return strdup("0.0.0.0");
ip = (unsigned char *)&ipaddr;
- new = malloc(sizeof("255.255.255.255"));
- sprintf(new, "%d.%d.%d.%d", *(ip + 12) ^ 0xff, *(ip + 13) ^ 0xff,
+ return xasprintf("%d.%d.%d.%d", *(ip + 12) ^ 0xff, *(ip + 13) ^ 0xff,
*(ip + 14) ^ 0xff, *(ip + 15) ^ 0xff);
#else
unsigned int a, b;
@@ -1106,16 +1089,12 @@ char *convert_teredo(const char *s)
a ^= 0xffff;
b ^= 0xffff;
- new = malloc(sizeof("255.255.255.255"));
- sprintf(new, "%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
+ return xasprintf("%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
#endif
-
- return new;
}
char *convert_inaddr(const char *s)
{
- char *new;
char *endptr;
unsigned int a, b = 0, c = 0;
@@ -1140,9 +1119,7 @@ char *convert_inaddr(const char *s)
}
}
- new = malloc(sizeof("255.255.255.255"));
- sprintf(new, "%d.%d.%d.0", c, b, a);
- return new;
+ return xasprintf("%d.%d.%d.0", c, b, a);
}
#ifndef HAVE_INET_PTON