]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2007/05/17 20:48:13
authordtucker <dtucker>
Sun, 20 May 2007 05:09:42 +0000 (05:09 +0000)
committerdtucker <dtucker>
Sun, 20 May 2007 05:09:42 +0000 (05:09 +0000)
     [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@

ChangeLog
sshconnect2.c

index a735e05125b641ec5a80607cddb70b31bde8c36e..15100fb10ad29f035188a484adb05d9228252ca6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
      input/output buffers past the maximum supported by the buffer API and
      promptly fatal()
      based on patch from Thue Janus Kristensen; feedback & ok dtucker@
+   - 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@
 
 20070509
  - (tim) [configure.ac] Bug #1287: Add missing test for ucred.h.
index dd971a9f9bb4343dd6fc3f0fb13063c9150647ee..2b274015498c23d04155389327d98714afd517bb 100644 (file)
@@ -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);
This page took 0.072617 seconds and 5 git commands to generate.