summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--ssh.c15
-rw-r--r--ssh_config.58
3 files changed, 26 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 50073141f..f652e6183 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,18 @@
10 [ssh.c] 10 [ssh.c]
11 Make ExitOnForwardFailure work with fork-after-authentication ("ssh -f") 11 Make ExitOnForwardFailure work with fork-after-authentication ("ssh -f")
12 for protocol 2. ok markus@ 12 for protocol 2. ok markus@
13 - djm@cvs.openbsd.org 2010/07/12 22:41:13
14 [ssh.c ssh_config.5]
15 expand %h to the hostname in ssh_config Hostname options. While this
16 sounds useless, it is actually handy for working with unqualified
17 hostnames:
18
19 Host *.*
20 Hostname %h
21 Host *
22 Hostname %h.example.org
23
24 "I like it" markus@
13 25
1420100714 2620100714
15 - (tim) [contrib/redhat/openssh.spec] Bug 1796: Test for skip_x11_askpass 27 - (tim) [contrib/redhat/openssh.spec] Bug 1796: Test for skip_x11_askpass
diff --git a/ssh.c b/ssh.c
index e6073af7b..61fe10df0 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.342 2010/07/12 22:38:52 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.343 2010/07/12 22:41:13 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -679,6 +679,11 @@ main(int ac, char **av)
679 options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT; 679 options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT;
680 } 680 }
681 681
682 if (options.hostname != NULL) {
683 host = percent_expand(options.hostname,
684 "h", host, (char *)NULL);
685 }
686
682 if (options.local_command != NULL) { 687 if (options.local_command != NULL) {
683 char thishost[NI_MAXHOST]; 688 char thishost[NI_MAXHOST];
684 689
@@ -688,16 +693,12 @@ main(int ac, char **av)
688 debug3("expanding LocalCommand: %s", options.local_command); 693 debug3("expanding LocalCommand: %s", options.local_command);
689 cp = options.local_command; 694 cp = options.local_command;
690 options.local_command = percent_expand(cp, "d", pw->pw_dir, 695 options.local_command = percent_expand(cp, "d", pw->pw_dir,
691 "h", options.hostname? options.hostname : host, 696 "h", host, "l", thishost, "n", host, "r", options.user,
692 "l", thishost, "n", host, "r", options.user, "p", buf, 697 "p", buf, "u", pw->pw_name, (char *)NULL);
693 "u", pw->pw_name, (char *)NULL);
694 debug3("expanded LocalCommand: %s", options.local_command); 698 debug3("expanded LocalCommand: %s", options.local_command);
695 xfree(cp); 699 xfree(cp);
696 } 700 }
697 701
698 if (options.hostname != NULL)
699 host = options.hostname;
700
701 /* force lowercase for hostkey matching */ 702 /* force lowercase for hostkey matching */
702 if (options.host_key_alias != NULL) { 703 if (options.host_key_alias != NULL) {
703 for (p = options.host_key_alias; *p; p++) 704 for (p = options.host_key_alias; *p; p++)
diff --git a/ssh_config.5 b/ssh_config.5
index 531a60b5e..e7bb21ebb 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -34,8 +34,8 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: ssh_config.5,v 1.135 2010/06/26 00:57:07 jmc Exp $ 37.\" $OpenBSD: ssh_config.5,v 1.136 2010/07/12 22:41:13 djm Exp $
38.Dd $Mdocdate: June 26 2010 $ 38.Dd $Mdocdate: July 12 2010 $
39.Dt SSH_CONFIG 5 39.Dt SSH_CONFIG 5
40.Os 40.Os
41.Sh NAME 41.Sh NAME
@@ -537,6 +537,10 @@ or for multiple servers running on a single host.
537.It Cm HostName 537.It Cm HostName
538Specifies the real host name to log into. 538Specifies the real host name to log into.
539This can be used to specify nicknames or abbreviations for hosts. 539This can be used to specify nicknames or abbreviations for hosts.
540If the hostname contains the character sequence
541.Ql %h ,
542then this will be replaced with the host name specified on the commandline
543(this is useful for manipulating unqualified names).
540The default is the name given on the command line. 544The default is the name given on the command line.
541Numeric IP addresses are also permitted (both on the command line and in 545Numeric IP addresses are also permitted (both on the command line and in
542.Cm HostName 546.Cm HostName