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 5190b07e5..a28b06502 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> |
@@ -1406,7 +1407,7 @@ userauth_hostbased(Authctxt *authctxt) | |||
1406 | Sensitive *sensitive = authctxt->sensitive; | 1407 | Sensitive *sensitive = authctxt->sensitive; |
1407 | Buffer b; | 1408 | Buffer b; |
1408 | u_char *signature, *blob; | 1409 | u_char *signature, *blob; |
1409 | char *chost, *pkalg, *p; | 1410 | char *chost, *pkalg, *p, myname[NI_MAXHOST]; |
1410 | const char *service; | 1411 | const char *service; |
1411 | u_int blen, slen; | 1412 | u_int blen, slen; |
1412 | int ok, i, len, found = 0; | 1413 | int ok, i, len, found = 0; |
@@ -1430,7 +1431,16 @@ userauth_hostbased(Authctxt *authctxt) | |||
1430 | return 0; | 1431 | return 0; |
1431 | } | 1432 | } |
1432 | /* figure out a name for the client host */ | 1433 | /* figure out a name for the client host */ |
1433 | p = get_local_name(packet_get_connection_in()); | 1434 | p = NULL; |
1435 | if (packet_connection_is_on_socket()) | ||
1436 | p = get_local_name(packet_get_connection_in()); | ||
1437 | if (p == NULL) { | ||
1438 | if (gethostname(myname, sizeof(myname)) == -1) { | ||
1439 | verbose("userauth_hostbased: gethostname: %s", | ||
1440 | strerror(errno)); | ||
1441 | } else | ||
1442 | p = xstrdup(myname); | ||
1443 | } | ||
1434 | if (p == NULL) { | 1444 | if (p == NULL) { |
1435 | error("userauth_hostbased: cannot get local ipaddr/name"); | 1445 | error("userauth_hostbased: cannot get local ipaddr/name"); |
1436 | key_free(private); | 1446 | key_free(private); |