summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index dd971a9f9..2b2740154 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect2.c,v 1.162 2006/08/30 00:06:51 dtucker Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.163 2007/05/17 20:48:13 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -1307,7 +1307,7 @@ userauth_hostbased(Authctxt *authctxt)
1307 Sensitive *sensitive = authctxt->sensitive; 1307 Sensitive *sensitive = authctxt->sensitive;
1308 Buffer b; 1308 Buffer b;
1309 u_char *signature, *blob; 1309 u_char *signature, *blob;
1310 char *chost, *pkalg, *p; 1310 char *chost, *pkalg, *p, myname[NI_MAXHOST];
1311 const char *service; 1311 const char *service;
1312 u_int blen, slen; 1312 u_int blen, slen;
1313 int ok, i, len, found = 0; 1313 int ok, i, len, found = 0;
@@ -1331,7 +1331,16 @@ userauth_hostbased(Authctxt *authctxt)
1331 return 0; 1331 return 0;
1332 } 1332 }
1333 /* figure out a name for the client host */ 1333 /* figure out a name for the client host */
1334 p = get_local_name(packet_get_connection_in()); 1334 p = NULL;
1335 if (packet_connection_is_on_socket())
1336 p = get_local_name(packet_get_connection_in());
1337 if (p == NULL) {
1338 if (gethostname(myname, sizeof(myname)) == -1) {
1339 verbose("userauth_hostbased: gethostname: %s",
1340 strerror(errno));
1341 } else
1342 p = xstrdup(myname);
1343 }
1335 if (p == NULL) { 1344 if (p == NULL) {
1336 error("userauth_hostbased: cannot get local ipaddr/name"); 1345 error("userauth_hostbased: cannot get local ipaddr/name");
1337 key_free(private); 1346 key_free(private);