From 26c6662834a0ed748c52044a60ed51b9102e7d54 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 20 May 2007 15:09:42 +1000 Subject: - djm@cvs.openbsd.org 2007/05/17 20:48:13 [sshconnect2.c] fall back to gethostname() when the outgoing connection is not on a socket, such as is the case when ProxyCommand is used. Gives hostbased auth an opportunity to work; bz#616, report and feedback stuart AT kaloram.com; ok markus@ --- sshconnect2.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sshconnect2.c') diff --git a/sshconnect2.c b/sshconnect2.c index dd971a9f9..2b2740154 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.162 2006/08/30 00:06:51 dtucker Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.163 2007/05/17 20:48:13 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -1307,7 +1307,7 @@ userauth_hostbased(Authctxt *authctxt) Sensitive *sensitive = authctxt->sensitive; Buffer b; u_char *signature, *blob; - char *chost, *pkalg, *p; + char *chost, *pkalg, *p, myname[NI_MAXHOST]; const char *service; u_int blen, slen; int ok, i, len, found = 0; @@ -1331,7 +1331,16 @@ userauth_hostbased(Authctxt *authctxt) return 0; } /* figure out a name for the client host */ - p = get_local_name(packet_get_connection_in()); + p = NULL; + if (packet_connection_is_on_socket()) + p = get_local_name(packet_get_connection_in()); + if (p == NULL) { + if (gethostname(myname, sizeof(myname)) == -1) { + verbose("userauth_hostbased: gethostname: %s", + strerror(errno)); + } else + p = xstrdup(myname); + } if (p == NULL) { error("userauth_hostbased: cannot get local ipaddr/name"); key_free(private); -- cgit v1.2.3 From f520ea156782619321d4d5ac2389130615b7eea3 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 20 May 2007 15:11:33 +1000 Subject: - jolan@cvs.openbsd.org 2007/05/17 23:53:41 [sshconnect2.c] djm owes me a vb and a tism cd for breaking ssh compilation --- ChangeLog | 5 ++++- sshconnect2.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'sshconnect2.c') diff --git a/ChangeLog b/ChangeLog index 0c163d497..a28fa8b5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,9 @@ pass received SIGINT from monitor to postauth child so it can clean up properly. bz#1196, patch from senthilkumar_sen AT hotpop.com; ok markus@ + - jolan@cvs.openbsd.org 2007/05/17 23:53:41 + [sshconnect2.c] + djm owes me a vb and a tism cd for breaking ssh compilation 20070509 - (tim) [configure.ac] Bug #1287: Add missing test for ucred.h. @@ -2933,4 +2936,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4667 2007/05/20 05:10:16 dtucker Exp $ +$Id: ChangeLog,v 1.4668 2007/05/20 05:11:33 dtucker Exp $ diff --git a/sshconnect2.c b/sshconnect2.c index 2b2740154..208df078c 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.163 2007/05/17 20:48:13 djm Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.164 2007/05/17 23:53:41 jolan Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -31,6 +31,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3