|
Lines 77-82
Link Here
|
| 77 |
#define WHOIS_INIC_FALLBACK 0x02 |
77 |
#define WHOIS_INIC_FALLBACK 0x02 |
| 78 |
#define WHOIS_QUICK 0x04 |
78 |
#define WHOIS_QUICK 0x04 |
| 79 |
|
79 |
|
|
|
80 |
const char *ip_whois[] = { RNICHOST, PNICHOST, NULL }; |
| 81 |
|
| 80 |
static void usage(void); |
82 |
static void usage(void); |
| 81 |
static void whois(char *, struct addrinfo *, int); |
83 |
static void whois(char *, struct addrinfo *, int); |
| 82 |
|
84 |
|
|
Lines 208-214
Link Here
|
| 208 |
FILE *sfi, *sfo; |
210 |
FILE *sfi, *sfo; |
| 209 |
struct addrinfo hints, *res2; |
211 |
struct addrinfo hints, *res2; |
| 210 |
char *buf, *nhost, *p; |
212 |
char *buf, *nhost, *p; |
| 211 |
int nomatch, error, s; |
213 |
int i, nomatch, error, s; |
| 212 |
size_t len; |
214 |
size_t len; |
| 213 |
|
215 |
|
| 214 |
for (; res; res = res->ai_next) { |
216 |
for (; res; res = res->ai_next) { |
|
Lines 234-246
Link Here
|
| 234 |
while (len && isspace(buf[len - 1])) |
236 |
while (len && isspace(buf[len - 1])) |
| 235 |
buf[--len] = '\0'; |
237 |
buf[--len] = '\0'; |
| 236 |
|
238 |
|
| 237 |
if ((flags & WHOIS_RECURSE) && nhost == NULL && |
239 |
if ((flags & WHOIS_RECURSE) && nhost == NULL) { |
| 238 |
(p = strstr(buf, WHOIS_SERVER_ID)) != NULL) { |
240 |
p = strstr(buf, WHOIS_SERVER_ID); |
| 239 |
p += sizeof(WHOIS_SERVER_ID) - 1; |
241 |
if (p != NULL) { |
| 240 |
if ((len = strcspn(p, " \t\n\r")) != 0) { |
242 |
p += sizeof(WHOIS_SERVER_ID) - 1; |
| 241 |
asprintf(&nhost, "%s", p); |
243 |
if ((len = strcspn(p, " \t\n\r")) != 0) { |
| 242 |
if (nhost == NULL) |
244 |
asprintf(&nhost, "%s", p); |
| 243 |
err(1, "asprintf()"); |
245 |
if (nhost == NULL) |
|
|
246 |
err(1, "asprintf()"); |
| 247 |
} |
| 248 |
} else { |
| 249 |
for (i = 0; ip_whois[i] != NULL; i++) { |
| 250 |
if (strstr(buf, ip_whois[i]) == NULL) |
| 251 |
continue; |
| 252 |
nhost = strdup(ip_whois[i]); |
| 253 |
if (nhost == NULL) |
| 254 |
err(1, "strdup()"); |
| 255 |
} |
| 244 |
} |
256 |
} |
| 245 |
} |
257 |
} |