=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/ssh.c,v retrieving revision 1.342 retrieving revision 1.343 diff -u -r1.342 -r1.343 --- src/usr.bin/ssh/ssh.c 2010/07/12 22:38:52 1.342 +++ src/usr.bin/ssh/ssh.c 2010/07/12 22:41:13 1.343 @@ -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 * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -664,6 +664,11 @@ 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,15 +678,11 @@ 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) {