summaryrefslogtreecommitdiff
path: root/dns.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2009-12-29 21:42:53 +0000
committerColin Watson <cjwatson@debian.org>2009-12-29 21:42:53 +0000
commit87552344215a38d3a2b0d4d63dc151e05978bbe1 (patch)
tree9f4b96055e6ccaa915e8d59d9f2805e9e119371d /dns.c
parenta25ec0b132c44c9e341e08464ff830de06b81126 (diff)
parentef94e5613d37bcbf880f21ee6094e4b1c7683a4c (diff)
import openssh-5.1p1-gsskex-cjwatson-20080722.patch
Diffstat (limited to 'dns.c')
-rw-r--r--dns.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/dns.c b/dns.c
index a89176f88..a7da03fa3 100644
--- a/dns.c
+++ b/dns.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dns.c,v 1.24 2007/01/03 03:01:40 stevesk Exp $ */ 1/* $OpenBSD: dns.c,v 1.25 2008/06/12 00:03:49 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wesley Griffin. All rights reserved. 4 * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -145,11 +145,20 @@ is_numeric_hostname(const char *hostname)
145{ 145{
146 struct addrinfo hints, *ai; 146 struct addrinfo hints, *ai;
147 147
148 /*
149 * We shouldn't ever get a null host but if we do then log an error
150 * and return -1 which stops DNS key fingerprint processing.
151 */
152 if (hostname == NULL) {
153 error("is_numeric_hostname called with NULL hostname");
154 return -1;
155 }
156
148 memset(&hints, 0, sizeof(hints)); 157 memset(&hints, 0, sizeof(hints));
149 hints.ai_socktype = SOCK_DGRAM; 158 hints.ai_socktype = SOCK_DGRAM;
150 hints.ai_flags = AI_NUMERICHOST; 159 hints.ai_flags = AI_NUMERICHOST;
151 160
152 if (getaddrinfo(hostname, "0", &hints, &ai) == 0) { 161 if (getaddrinfo(hostname, NULL, &hints, &ai) == 0) {
153 freeaddrinfo(ai); 162 freeaddrinfo(ai);
154 return -1; 163 return -1;
155 } 164 }