summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2010-04-24 12:59:57 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2010-04-24 12:59:57 +0000
commit507cd65c6c291606b1978ef3a4280933dc1c5e76 (patch)
treef629e45690993b64fbd1bf2227e47eea7506eaae /usr.sbin
parentbe39cd45250a7ec890a238f2806710455bb6a1f2 (diff)
Fix breakage of dig's -p option introduced when support for
parsing the [host]:port syntax in resolv.conf was added. Patch by Nathan Rickerby <rickerby () gmail ! com>. Prodded by jmc, OK djm krw
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bind/bin/dig/dighost.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c
index 5bd12185713..315c45cd15e 100644
--- a/usr.sbin/bind/bin/dig/dighost.c
+++ b/usr.sbin/bind/bin/dig/dighost.c
@@ -118,7 +118,7 @@ isc_boolean_t
showsearch = ISC_FALSE,
qr = ISC_FALSE,
is_dst_up = ISC_FALSE;
-in_port_t port = 53;
+in_port_t port = 0;
unsigned int timeout = 0;
unsigned int extrabytes;
isc_mem_t *mctx = NULL;
@@ -2191,7 +2191,14 @@ send_tcp_connect(dig_query_t *query) {
l = query->lookup;
query->waiting_connect = ISC_TRUE;
query->lookup->current_query = query;
- servport = query->servport > 0 ? query->servport : NAMESERVER_PORT;
+
+ if (port != 0)
+ servport = port;
+ else if (query->servport != 0)
+ servport = query->servport;
+ else
+ servport = NAMESERVER_PORT;
+
get_address(query->servname, servport, &query->sockaddr);
if (specified_source &&
@@ -2266,8 +2273,14 @@ send_udp(dig_query_t *query) {
if (!query->recv_made) {
/* XXX Check the sense of this, need assertion? */
query->waiting_connect = ISC_FALSE;
- servport = query->servport > 0 ?
- query->servport : NAMESERVER_PORT;
+
+ if (port != 0)
+ servport = port;
+ else if (query->servport != 0)
+ servport = query->servport;
+ else
+ servport = NAMESERVER_PORT;
+
get_address(query->servname, servport, &query->sockaddr);
result = isc_socket_create(socketmgr,