diff options
author | 2010-07-12 22:41:13 +0000 | |
---|---|---|
committer | 2010-07-12 22:41:13 +0000 | |
commit | 77154132236f5f4a1bfd8eaa12ed835fb0098e0f (patch) | |
tree | e281c6baca8307522f7692de10ad415571928ee9 /usr.bin/ssh/ssh.c | |
parent | Make ExitOnForwardFailure work with fork-after-authentication ("ssh -f") (diff) | |
download | wireguard-openbsd-77154132236f5f4a1bfd8eaa12ed835fb0098e0f.tar.xz wireguard-openbsd-77154132236f5f4a1bfd8eaa12ed835fb0098e0f.zip |
expand %h to the hostname in ssh_config Hostname options. While this
sounds useless, it is actually handy for working with unqualified
hostnames:
Host *.*
Hostname %h
Host *
Hostname %h.example.org
"I like it" markus@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index e87fb8a0478..2aab1048a31 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.342 2010/07/12 22:38:52 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.343 2010/07/12 22:41:13 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -664,6 +664,11 @@ main(int ac, char **av) options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT; } + if (options.hostname != NULL) { + host = percent_expand(options.hostname, + "h", host, (char *)NULL); + } + if (options.local_command != NULL) { char thishost[NI_MAXHOST]; @@ -673,16 +678,12 @@ main(int ac, char **av) debug3("expanding LocalCommand: %s", options.local_command); cp = options.local_command; options.local_command = percent_expand(cp, "d", pw->pw_dir, - "h", options.hostname? options.hostname : host, - "l", thishost, "n", host, "r", options.user, "p", buf, - "u", pw->pw_name, (char *)NULL); + "h", host, "l", thishost, "n", host, "r", options.user, + "p", buf, "u", pw->pw_name, (char *)NULL); debug3("expanded LocalCommand: %s", options.local_command); xfree(cp); } - if (options.hostname != NULL) - host = options.hostname; - /* force lowercase for hostkey matching */ if (options.host_key_alias != NULL) { for (p = options.host_key_alias; *p; p++) |