diff options
Diffstat (limited to 'usr.bin/whois/whois.c')
-rw-r--r-- | usr.bin/whois/whois.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index 177dc5228fa..fe1fa224a66 100644 --- a/usr.bin/whois/whois.c +++ b/usr.bin/whois/whois.c @@ -1,4 +1,4 @@ -/* $OpenBSD: whois.c,v 1.56 2017/07/26 15:48:38 sthen Exp $ */ +/* $OpenBSD: whois.c,v 1.57 2018/06/17 15:34:54 florian Exp $ */ /* * Copyright (c) 1980, 1993 @@ -278,7 +278,8 @@ whois(const char *query, const char *server, const char *port, int flags) * If the TLD is a number, query ARIN, otherwise, use TLD.whois-server.net. * If the domain does not contain '.', check to see if it is an NSI handle * (starts with '!') or a CORE handle (COCO-[0-9]+ or COHO-[0-9]+) or an - * ASN (starts with AS). Fall back to NICHOST for the non-handle case. + * ASN (starts with AS) or IPv6 address (contains ':'). Fall back to + * NICHOST for the non-handle and non-IPv6 case. */ char * choose_server(const char *name, const char *country, char **tofree) @@ -305,6 +306,8 @@ choose_server(const char *name, const char *country, char **tofree) else if ((strncasecmp(name, "AS", 2) == 0) && strtol(name + 2, &ep, 10) > 0 && *ep == '\0') return (MNICHOST); + else if (strchr(name, ':') != NULL) /* IPv6 address */ + return (ANICHOST); else return (NICHOST); } else if (isdigit((unsigned char)*(++qhead))) |