Merge branch 'master' into wheezy-backports

Conflicts:
	debian/changelog
This commit is contained in:
Marco d'Itri 2014-09-14 13:30:26 +02:00
commit 076f6892ae
9 changed files with 177 additions and 49 deletions

View File

@ -87,7 +87,7 @@
61952 62463 ripe
# catch all: everything else comes from ARIN
1 63487 arin
63488 63999 apnic
63488 64098 apnic
# documentation and private ASN block
64496 65534 ripe

18
debian/changelog vendored
View File

@ -1,3 +1,15 @@
whois (5.2.0) unstable; urgency=medium
* Implemented support for the long RIPE flags.
* "Fixed" some harmless bugs discovered with a Coverity scan.
* Default to whois.ripe.net when using long flags.
* Updated the list of new gTLDs.
* Added a new ASN allocation.
* Added new recovered IPv4 allocations.
* Updated make_version_h.pl to support Debian binNMUs. (Closes: #761318)
-- Marco d'Itri <md@linux.it> Sat, 13 Sep 2014 05:05:16 +0200
whois (5.1.5~bpo70+1) wheezy-backports; urgency=medium
* Rebuilt for wheezy.
@ -42,12 +54,6 @@ whois (5.1.2) unstable; urgency=medium
-- Marco d'Itri <md@linux.it> Fri, 02 May 2014 04:15:08 +0200
whois (5.1.1~deb7u1) proposed-updates; urgency=low
* Rebuilt for wheezy.
-- Marco d'Itri <md@linux.it> Sat, 11 Jan 2014 03:16:43 +0100
whois (5.1.1) unstable; urgency=medium
* Added the servers for 29 "new" gTLDs.

View File

@ -2,11 +2,16 @@
{ 736886784UL, 737411071UL, "whois.apnic.net" },
{ 737476608UL, 738000895UL, "whois.apnic.net" },
{ 738066432UL, 738197503UL, "whois.apnic.net" },
{ 756023296UL, 757071871UL, "whois.arin.net" },
{ 757071872UL, 759169023UL, "whois.arin.net" },
{ 759169024UL, 759238655UL, "whois.apnic.net" },
{ 760217600UL, 761266175UL, "whois.ripe.net" },
{ 761266176UL, 762314751UL, "whois.afrinic.net" },
{ 762314752UL, 763363327UL, "whois.apnic.net" },
{ 763363328UL, 765460479UL, "whois.ripe.net" },
{ 765460480UL, 767557631UL, "whois.lacnic.net" },
{ 767557632UL, 769589247UL, "whois.afrinic.net" },
{ 769654784UL, 770703359UL, "whois.lacnic.net" },
{ 2523594752UL, 2523660287UL, "whois.apnic.net" },
{ 2525036544UL, 2525102079UL, "whois.apnic.net" },
{ 2532442112UL, 2532507647UL, "whois.apnic.net" },

View File

@ -2,17 +2,18 @@
use warnings;
use strict;
use autodie;
my $changelog = $ARGV[0] or die "Usage: $0 debian/changelog\n";
open(my $fh, '<', $changelog) or die "open($changelog): $!";
open(my $fh, '<', $changelog);
my $line = <$fh>;
close($fh) or die "close($changelog): $!";
close($fh);
my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x;
die "Version number not found in $changelog!\n" if not $ver;
$ver =~ s/ ( ~bpo\d+\+\d+ | ~deb\d+.* | ubuntu\d+ | \+dyson\d+ ) $//x;
$ver =~ s/ ( ~bpo\d+\+\d+ | \+b\d+ | ~deb\d+.* | ubuntu\d+ | \+dyson\d+ ) $//x;
# The version number must not deviate from this format or the -V option
# to RIPE-like servers will break. If needed, update the previous regexp.

View File

@ -115,7 +115,7 @@ static const struct crypt_method methods[] = {
};
void generate_salt(char *const buf, const unsigned int len);
void *get_random_bytes(const int len);
void *get_random_bytes(const unsigned int len);
void display_help(int error);
void display_version(void);
void display_methods(void);
@ -351,10 +351,10 @@ int main(int argc, char *argv[])
}
#ifdef RANDOM_DEVICE
void* get_random_bytes(const int count)
void* get_random_bytes(const unsigned int count)
{
char *buf;
int fd;
int fd, bytes_read;
buf = NOFAIL(malloc(count));
fd = open(RANDOM_DEVICE, O_RDONLY);
@ -362,11 +362,13 @@ void* get_random_bytes(const int count)
perror("open(" RANDOM_DEVICE ")");
exit(2);
}
if (read(fd, buf, count) != count) {
if (count < 0)
perror("read(" RANDOM_DEVICE ")");
else
fprintf(stderr, "Short read of %s.\n", RANDOM_DEVICE);
bytes_read = read(fd, buf, count);
if (bytes_read < 0) {
perror("read(" RANDOM_DEVICE ")");
exit(2);
}
if (bytes_read != count) {
fprintf(stderr, "Short read of %s.\n", RANDOM_DEVICE);
exit(2);
}
close(fd);
@ -385,6 +387,7 @@ void generate_salt(char *const buf, const unsigned int len)
for (i = 0; i < len; i++)
buf[i] = valid_salts[entropy[i] % (sizeof valid_salts - 1)];
buf[i] = '\0';
free(entropy);
}
#else /* RANDOM_DEVICE */

View File

@ -31,10 +31,13 @@ black
blackfriday
blue
bmw
bnpparibas
boo
boutique
brussels
build
builders
business
buzz
bzh
cab
@ -43,6 +46,7 @@ camp
cancerresearch
capetown
capital
caravan
cards
care
career
@ -51,6 +55,7 @@ cash
catering
center
ceo
cern
cheap
christmas
church
@ -58,6 +63,7 @@ citic
city
claims
cleaning
click
clinic
clothing
club
@ -80,8 +86,11 @@ credit
creditcard
cruises
cuisinella
cymru
dad
dance
dating
day
deals
degree
democrat
@ -89,6 +98,7 @@ dental
dentist
desi
diamonds
diet
digital
direct
directory
@ -96,12 +106,14 @@ discount
dnp
domains
durban
eat
education
email
engineer
engineering
enterprises
equipment
esq
estate
eus
events
@ -120,19 +132,24 @@ flights
florist
foo
foundation
frl
frogans
fund
furniture
futbol
gal
gallery
gbiz
gent
gift
gifts
gives
glass
global
globo
gmail
gmo
gmx
gop
graphics
gratis
@ -144,6 +161,8 @@ guru
hamburg
haus
healthcare
help
here
hiphop
hiv
holdings
@ -151,10 +170,14 @@ holiday
homes
horse
host
hosting
house
how
immo
immobilien
industries
info
ing
ink
institute
insure
@ -183,6 +206,7 @@ link
loans
london
lotto
ltda
luxe
luxury
maison
@ -193,6 +217,7 @@ marketing
media
meet
melbourne
meme
menu
miami
mini
@ -202,10 +227,13 @@ monash
mortgage
moscow
motorcycles
mov
nagoya
navy
net
network
neustar
new
ngo
nhk
ninja
@ -215,12 +243,15 @@ nyc
okinawa
ong
onl
ooo
org
organic
otsuka
ovh
paris
partners
parts
pharmacy
photo
photography
photos
@ -228,12 +259,15 @@ physio
pics
pictures
pink
pizza
place
plumbing
praxi
press
prod
productions
properties
property
pub
qpon
quebec
@ -249,14 +283,18 @@ repair
report
republican
rest
restaurant
reviews
rich
rio
rocks
rodeo
rsvp
ruhr
ryukyu
saarland
sarl
sca
scb
schmidt
schule
@ -281,6 +319,7 @@ surf
surgery
suzuki
systems
tatar
tattoo
tax
technology
@ -290,12 +329,14 @@ tirol
today
tokyo
tools
top
town
toys
trade
training
university
uno
uol
vacations
vegas
ventures
@ -310,6 +351,7 @@ vote
voting
voto
voyage
wales
wang
watch
webcam
@ -319,9 +361,11 @@ whoswho
wien
wiki
williamhill
wme
works
wtc
wtf
xn--1qqw23a
xn--3bst00m
xn--3ds443g
xn--4gbrim
@ -350,9 +394,12 @@ xn--q9jyb4c
xn--rhqv96g
xn--ses554g
xn--unup4y
xn--vhquv
xn--xhq521b
xn--zfr164b
xyz
yachts
yandex
yokohama
youtube
zone

View File

@ -226,7 +226,7 @@
.mv NONE # NIC? www.dhiraagu.com.mv
.mw WEB http://www.registrar.mw/
.mx whois.mx
.my whois.domainregistry.my
.my whois.mynic.my
.mz NONE # NIC? www.uem.mz
.na whois.na-nic.com.na
.nc whois.nc
@ -373,7 +373,7 @@
.xn--mgbbh1a71e whois.inregistry.net # India, Urdu AW
.xn--mgbc0a9azcg NONE # Morocco
.xn--mgberp4a5d4ar whois.nic.net.sa # Saudi Arabia
.xn--mgbx4cd0ab whois.domainregistry.my # Malaysia AW
.xn--mgbx4cd0ab whois.mynic.my # Malaysia AW
.xn--o3cw4h whois.thnic.co.th # Thailand
.xn--ogbpf8fl whois.tld.sy # Syria
.xn--p1ai whois.tcinet.ru # Russian Federation

122
whois.c
View File

@ -71,23 +71,61 @@ int hide_discl = HIDE_DISABLED;
const char *client_tag = IDSTRING;
#ifdef HAVE_GETOPT_LONG
static const struct option longopts[] = {
{"version", no_argument, NULL, 1 },
{"verbose", no_argument, NULL, 2 },
{"help", no_argument, NULL, 3 },
{"server", required_argument, NULL, 'h'},
{"host", required_argument, NULL, 'h'},
{"port", required_argument, NULL, 'p'},
{NULL, 0, NULL, 0 }
};
#else
#ifndef HAVE_GETOPT_LONG
extern char *optarg;
extern int optind;
#endif
int main(int argc, char *argv[])
{
#ifdef HAVE_GETOPT_LONG
const struct option longopts[] = {
/* program flags */
{"version", no_argument, NULL, 1 },
{"verbose", no_argument, NULL, 2 },
{"help", no_argument, NULL, 3 },
{"server", required_argument, NULL, 'h'},
{"host", required_argument, NULL, 'h'},
{"port", required_argument, NULL, 'p'},
/* long RIPE flags */
{"exact", required_argument, NULL, 'x'},
{"all-more", required_argument, NULL, 'M'},
{"one-more", required_argument, NULL, 'm'},
{"all-less", required_argument, NULL, 'L'},
{"one-less", required_argument, NULL, 'l'},
{"reverse-domain", required_argument, NULL, 'd'},
{"irt", required_argument, NULL, 'c'},
{"abuse-contact", no_argument, NULL, 'b'},
{"brief", no_argument, NULL, 'F'},
{"primary-keys", no_argument, NULL, 'K'},
{"persistent-connection", no_argument, NULL, 'k'},
{"no-referenced", no_argument, NULL, 'r'},
{"no-filtering", no_argument, NULL, 'B'},
{"no-grouping", no_argument, NULL, 'G'},
{"select-types", no_argument, NULL, 'T'},
{"all-sources", no_argument, NULL, 'a'},
{"sources", no_argument, NULL, 's'},
{"types", no_argument, NULL, 12 }, /* -q */
{"ripe-version", no_argument, NULL, 12 }, /* -q */
{"list-sources", no_argument, NULL, 12 }, /* -q */
{"template", required_argument, NULL, 't'},
{"ripe-verbose", required_argument, NULL, 'v'},
/* long RIPE flags with no short equivalent */
{"list-versions", no_argument, NULL, 10 },
{"diff-versions", required_argument, NULL, 11 },
{"show-version", required_argument, NULL, 11 },
{"resource", no_argument, NULL, 10 },
{"show-personal", no_argument, NULL, 10 },
{"no-personal", no_argument, NULL, 10 },
{"show-tag-info", no_argument, NULL, 10 },
{"no-tag-info", no_argument, NULL, 10 },
{"filter-tag-include", required_argument, NULL, 11 },
{"filter-tag-exclude", required_argument, NULL, 11 },
{NULL, 0, NULL, 0 }
};
int longindex;
#endif
int ch, nopar = 0, fstringlen = 64;
const char *server = NULL, *port = NULL;
char *qstring, *fstring;
@ -106,7 +144,8 @@ int main(int argc, char *argv[])
argv = merge_args(getenv("WHOIS_OPTIONS"), argv, &argc);
while ((ch = GETOPT_LONGISH(argc, argv,
"abBcdFg:Gh:Hi:KlLmMp:q:rRs:t:T:v:V:x", longopts, 0)) > 0) {
"abBcdFg:Gh:Hi:KlLmMp:q:rRs:t:T:v:V:x",
longopts, &longindex)) > 0) {
/* RIPE flags */
if (strchr(ripeflags, ch)) {
if (strlen(fstring) + 3 > fstringlen) {
@ -127,8 +166,37 @@ int main(int argc, char *argv[])
nopar = 1;
continue;
}
/* program flags */
switch (ch) {
#ifdef HAVE_GETOPT_LONG
/* long RIPE flags with no short equivalent */
case 12:
nopar = 1;
/* fall through */
case 10:
{
int flaglen = 2 + strlen(longopts[longindex].name) + 1;
if (strlen(fstring) + flaglen > fstringlen) {
fstringlen += flaglen;
fstring = realloc(fstring, fstringlen + 1);
}
sprintf(fstring + strlen(fstring), "--%s ",
longopts[longindex].name);
}
break;
case 11:
{
int flaglen = 2 + strlen(longopts[longindex].name) + 1
+ strlen(optarg) + 1;
if (strlen(fstring) + flaglen > fstringlen) {
fstringlen += flaglen;
fstring = realloc(fstring, fstringlen + 1);
}
sprintf(fstring + strlen(fstring), "--%s %s ",
longopts[longindex].name, optarg);
}
break;
#endif
/* program flags */
case 'h':
server = strdup(optarg);
break;
@ -187,8 +255,8 @@ int main(int argc, char *argv[])
if (getenv("WHOIS_HIDE"))
hide_discl = HIDE_NOT_STARTED;
/* -v or -t has been used */
if (!server && !*qstring)
/* -v or -t or long flags have been used */
if (!server && (!*qstring || *fstring))
server = strdup("whois.ripe.net");
if (*qstring) {
@ -392,7 +460,7 @@ char *guess_server(const char *s)
{
unsigned long ip, as32;
unsigned int i;
const char *colon;
const char *colon, *tld;
/* IPv6 address */
if ((colon = strchr(s, ':'))) {
@ -460,16 +528,9 @@ char *guess_server(const char *s)
return strdup(tld_serv[i + 1]);
/* use the default server name for "new" gTLDs */
if (is_new_gtld(s)) {
char *server;
const char *p, *tld = NULL;
for (p = s; *p; p++) /* look for the TLD */
if (*p == '.')
tld = p;
server = malloc(strlen("whois.nic") + strlen(tld) + 1);
strcpy(server, "whois.nic");
if ((tld = is_new_gtld(s))) {
char *server = malloc(strlen("whois.nic.") + strlen(tld) + 1);
strcpy(server, "whois.nic.");
strcat(server, tld);
return(server);
}
@ -779,6 +840,8 @@ char *query_afilias(const int sock, const char *query)
free(temp);
while (fgets(buf, sizeof(buf), fi)) {
/* If multiple attributes are returned then use the first result.
This is not supposed to happen. */
if (state == 0 && strneq(buf, "Domain Name:", 12))
state = 1;
if (state == 1 && strneq(buf, "Whois Server:", 13)) {
@ -787,8 +850,11 @@ char *query_afilias(const int sock, const char *query)
referral_server = strdup(p);
if ((p = strpbrk(referral_server, "\r\n ")))
*p = '\0';
state = 2;
}
/* the output must not be hidden or no data will be shown for
host records and not-existing domains */
if (hide_line(&hide, buf))
continue;
@ -983,13 +1049,13 @@ int domcmp(const char *dom, const char *tld)
return 0;
}
int is_new_gtld(const char *s)
const char *is_new_gtld(const char *s)
{
int i;
for (i = 0; new_gtlds[i]; i++)
if (domcmp(s, new_gtlds[i]))
return 1;
return new_gtlds[i] + 1;
return 0;
}

View File

@ -29,7 +29,7 @@ unsigned long myinet_aton(const char *);
unsigned long asn32_to_long(const char *);
int isasciidigit(const char);
int domcmp(const char *, const char *);
int is_new_gtld(const char *);
const char *is_new_gtld(const char *);
int domfind(const char *, const char *[]);
char *normalize_domain(const char *);
char *convert_6to4(const char *);