diff options
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index dd971a9f9..208df078c 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.164 2007/05/17 23:53:41 jolan Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -31,6 +31,7 @@ | |||
31 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
32 | 32 | ||
33 | #include <errno.h> | 33 | #include <errno.h> |
34 | #include <netdb.h> | ||
34 | #include <pwd.h> | 35 | #include <pwd.h> |
35 | #include <signal.h> | 36 | #include <signal.h> |
36 | #include <stdarg.h> | 37 | #include <stdarg.h> |
@@ -1307,7 +1308,7 @@ userauth_hostbased(Authctxt *authctxt) | |||
1307 | Sensitive *sensitive = authctxt->sensitive; | 1308 | Sensitive *sensitive = authctxt->sensitive; |
1308 | Buffer b; | 1309 | Buffer b; |
1309 | u_char *signature, *blob; | 1310 | u_char *signature, *blob; |
1310 | char *chost, *pkalg, *p; | 1311 | char *chost, *pkalg, *p, myname[NI_MAXHOST]; |
1311 | const char *service; | 1312 | const char *service; |
1312 | u_int blen, slen; | 1313 | u_int blen, slen; |
1313 | int ok, i, len, found = 0; | 1314 | int ok, i, len, found = 0; |
@@ -1331,7 +1332,16 @@ userauth_hostbased(Authctxt *authctxt) | |||
1331 | return 0; | 1332 | return 0; |
1332 | } | 1333 | } |
1333 | /* figure out a name for the client host */ | 1334 | /* figure out a name for the client host */ |
1334 | p = get_local_name(packet_get_connection_in()); | 1335 | p = NULL; |
1336 | if (packet_connection_is_on_socket()) | ||
1337 | p = get_local_name(packet_get_connection_in()); | ||
1338 | if (p == NULL) { | ||
1339 | if (gethostname(myname, sizeof(myname)) == -1) { | ||
1340 | verbose("userauth_hostbased: gethostname: %s", | ||
1341 | strerror(errno)); | ||
1342 | } else | ||
1343 | p = xstrdup(myname); | ||
1344 | } | ||
1335 | if (p == NULL) { | 1345 | if (p == NULL) { |
1336 | error("userauth_hostbased: cannot get local ipaddr/name"); | 1346 | error("userauth_hostbased: cannot get local ipaddr/name"); |
1337 | key_free(private); | 1347 | key_free(private); |