Date: Fri, 26 Mar 1999 14:10:09 -0600 (CST) From: Chris Costello <chris@holly.dyndns.org> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/10807: host(1) is broken - multiple options in one arg (-vt) cause a loop of some sort Message-ID: <199903262010.OAA05245@holly.dyndns.org>
index | next in thread | raw e-mail
>Number: 10807
>Category: bin
>Synopsis: host(1) is broken - multiple options in one arg (-vt) cause a loop of some sort
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 26 12:20:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Chris Costello
>Release: FreeBSD 4.0-CURRENT i386
>Organization:
none
>Environment:
FreeBSD 4.0-CURRENT, CVSupped March 25, 1999
>Description:
host -vt hinfo somehost.somedomain nameserver causes host to seem
to go into an infinite loop after calling issetugid() and this appears
to have to do with the somewhat broken option parsing.
>How-To-Repeat:
host -vt hinfo your.favorite.domain [your.nameserver]
>Fix:
--- host.c.orig Fri Mar 26 13:54:17 1999
+++ host.c Fri Mar 26 14:06:59 1999
@@ -168,7 +168,7 @@
main(int c, char **v) {
struct in_addr addr;
struct hostent *hp;
- char *s, *oldcname;
+ char *s, *oldcname, ch;
int inverse = 0, waitmode = 0;
int ncnames;
@@ -179,55 +179,38 @@
fprintf(stderr, "Usage: host [-w] [-v] [-r] [-d] [-t querytype] [-c class] [-a] host [server]\n -w to wait forever until reply\n -v for verbose output\n -r to disable recursive processing\n -d to turn on debugging output\n -t querytype to look for a specific type of information\n -c class to look for non-Internet data\n -a is equivalent to '-v -t *'\n");
exit(1);
}
- while (c > 2 && v[1][0] == '-') {
- if (strcmp (v[1], "-w") == 0) {
+ while ((ch = getopt(c, v, "hwvrdlt:c:a")) != -1)
+ switch (ch) {
+ case 'w':
_res.retry = 1;
_res.retrans = 15;
waitmode = 1;
- v++;
- c--;
- }
- else if (strcmp (v[1], "-r") == 0) {
+ break;
+ case 'r':
_res.options &= ~RES_RECURSE;
- v++;
- c--;
- }
- else if (strcmp (v[1], "-d") == 0) {
+ break;
+ case 'd':
_res.options |= RES_DEBUG;
- v++;
- c--;
- }
- else if (strcmp (v[1], "-v") == 0) {
+ break;
+ case 'v':
verbose = 1;
- v++;
- c--;
- }
- else if (strcmp (v[1], "-l") == 0) {
+ break;
+ case 'l':
list = 1;
- v++;
- c--;
- }
- else if (strncmp (v[1], "-t", 2) == 0) {
- v++;
- c--;
- gettype = parsetype(v[1]);
- v++;
- c--;
- }
- else if (strncmp (v[1], "-c", 2) == 0) {
- v++;
- c--;
- getclass = parseclass(v[1]);
- v++;
- c--;
- }
- else if (strcmp (v[1], "-a") == 0) {
+ break;
+ case 't':
+ gettype = parsetype(optarg);
+ break;
+ case 'c':
+ getclass = parseclass(optarg);
+ break;
+ case 'a':
verbose = 1;
gettype = ns_t_any;
- v++;
- c--;
+ break;
}
- }
+ c -= optind - 1;
+ v += optind - 1;
if (c > 2) {
s = v[2];
server_specified++;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903262010.OAA05245>
