FreeBSD Bugzilla – Attachment 12139 Details for
Bug 23635
[PATCH] whois(1) enhancement - smarter whois-servers.net lookups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.83 KB, created by
Phil Homewood
on 2000-12-19 00:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Phil Homewood
Created:
2000-12-19 00:50:01 UTC
Size:
1.83 KB
patch
obsolete
>--- usr.bin/whois/whois.c.orig Sat Jul 15 17:29:31 2000 >+++ usr.bin/whois/whois.c Tue Dec 19 10:26:21 2000 >@@ -84,6 +84,7 @@ > { > int ch, i, j, error; > int use_qnichost, flags; >+ int found = 0; > char *host; > char *qnichost; > struct addrinfo hints, *res; >@@ -160,29 +161,42 @@ > free(qnichost); > qnichost = NULL; > } >- for (i = j = 0; (*argv)[i]; i++) { >- if ((*argv)[i] == '.') { >- j = i; >- } >+ for (i = 0; (*argv)[i]; i++); >+ if (i <= 1) { >+ errx(EX_NOHOST, >+ "Can't search for the null string."); > } >- if (j != 0) { >- qnichost = (char *) calloc(i - j + 1 + >- strlen(QNICHOST_TAIL), sizeof(char)); >- if (!qnichost) { >- err(1, "calloc"); >+ if (*argv[i] == '.') i--; >+ for (j = 0; (*argv)[j]; j++) { >+ if (((*argv)[j] == '.') && !found) { >+ qnichost = (char *) calloc(i - j + 1 + >+ strlen(QNICHOST_TAIL), >+ sizeof(char)); >+ if (!qnichost) { >+ err(1, "calloc"); >+ } >+ strcpy(qnichost, *argv + j + 1); >+ strcat(qnichost, QNICHOST_TAIL); >+ >+ memset(&hints, 0, sizeof(hints)); >+ hints.ai_flags = 0; >+ hints.ai_family = AF_UNSPEC; >+ hints.ai_socktype = SOCK_STREAM; >+ error = getaddrinfo(qnichost, "whois", >+ &hints, &res); >+ if (error == 0) { >+ found = 1; >+ } else { >+ free(qnichost); >+ qnichost = NULL; >+ } > } >- strcpy(qnichost, *argv + j + 1); >- strcat(qnichost, QNICHOST_TAIL); > >- memset(&hints, 0, sizeof(hints)); >- hints.ai_flags = 0; >- hints.ai_family = AF_UNSPEC; >- hints.ai_socktype = SOCK_STREAM; >- error = getaddrinfo(qnichost, "whois", >- &hints, &res); >- if (error != 0) >- errx(EX_NOHOST, "%s: %s", qnichost, >- gai_strerror(error)); >+ } >+ if (!found) { >+ errx(EX_NOHOST, >+ "Cannot locate whois server for %s", >+ *argv); > } > } > if (!qnichost) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 23635
: 12139