]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authordjm@openbsd.org <djm@openbsd.org>
Mon, 8 Feb 2016 23:40:12 +0000 (23:40 +0000)
committerDamien Miller <djm@mindrot.org>
Tue, 9 Feb 2016 05:31:33 +0000 (16:31 +1100)
don't attempt to percent_expand() already-canonicalised
 addresses, avoiding unnecessary failures when attempting to connect to scoped
 IPv6 addresses (that naturally contain '%' characters)

Upstream-ID: f24569cffa1a7cbde5f08dc739a72f4d78aa5c6a

readconf.c

index 2a5620479c7444cbe265488b956c4862228d7575..69d4553af2177284b629dfb178bb116a004e4a75 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.249 2016/01/29 02:54:45 dtucker Exp $ */
+/* $OpenBSD: readconf.c,v 1.250 2016/02/08 23:40:12 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -522,12 +522,15 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
         */
        port = options->port <= 0 ? default_ssh_port() : options->port;
        ruser = options->user == NULL ? pw->pw_name : options->user;
-       if (options->hostname != NULL) {
+       if (post_canon) {
+               host = xstrdup(options->hostname);
+       } else if (options->hostname != NULL) {
                /* NB. Please keep in sync with ssh.c:main() */
                host = percent_expand(options->hostname,
                    "h", host_arg, (char *)NULL);
-       } else
+       } else {
                host = xstrdup(host_arg);
+       }
 
        debug2("checking match for '%s' host %s originally %s",
            cp, host, original_host);