summaryrefslogtreecommitdiff
path: root/whois.c
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2017-08-22 16:52:56 +0200
committerMarco d'Itri <md@linux.it>2017-08-22 16:52:56 +0200
commit9777e2aa772a970eb9f9c623ced9bf8102562c66 (patch)
treeb96d2589598e0fb9d5ef22f86d528071bb72b08b /whois.c
parent46faeee41e15aaff2e67705e063bc57dbb21321e (diff)
downloadwhois-9777e2aa772a970eb9f9c623ced9bf8102562c66.tar.gz
Do not request domain results for name server queries
If there is more than one dot in the query string then it can only be a name server, so do not restrict the results to domains only.
Diffstat (limited to 'whois.c')
-rw-r--r--whois.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/whois.c b/whois.c
index 53829b6..365d618 100644
--- a/whois.c
+++ b/whois.c
@@ -816,11 +816,17 @@ char *query_crsnic(const int sock, const char *query)
int hide = hide_discl;
char *referral_server = NULL;
int state = 0;
+ int dotscount = 0;
temp = malloc(strlen("domain ") + strlen(query) + 2 + 1);
*temp = '\0';
- if (!strpbrk(query, "=~ "))
+ /* if this has more than one dot then it is a name server */
+ for (p = (char *) query; *p != '\0'; p++)
+ if (*p == '.')
+ dotscount++;
+
+ if (dotscount == 1 && !strpbrk(query, "=~ "))
strcpy(temp, "domain ");
strcat(temp, query);
strcat(temp, "\r\n");