- djm@cvs.openbsd.org 2011/05/06 21:18:02
[ssh.c ssh_config.5] add a %L expansion (short-form of the local host name) for ControlPath; sync some more expansions with LocalCommand; ok markus@
This commit is contained in:
parent
d2ac5d74b4
commit
dfc85fa181
|
@ -19,6 +19,10 @@
|
||||||
set traffic class for IPv6 traffic as we do for IPv4 TOS;
|
set traffic class for IPv6 traffic as we do for IPv4 TOS;
|
||||||
patch from lionel AT mamane.lu via Colin Watson in bz#1855;
|
patch from lionel AT mamane.lu via Colin Watson in bz#1855;
|
||||||
ok markus@
|
ok markus@
|
||||||
|
- djm@cvs.openbsd.org 2011/05/06 21:18:02
|
||||||
|
[ssh.c ssh_config.5]
|
||||||
|
add a %L expansion (short-form of the local host name) for ControlPath;
|
||||||
|
sync some more expansions with LocalCommand; ok markus@
|
||||||
|
|
||||||
20110510
|
20110510
|
||||||
- (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix
|
- (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix
|
||||||
|
|
28
ssh.c
28
ssh.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ssh.c,v 1.357 2011/04/17 22:42:42 djm Exp $ */
|
/* $OpenBSD: ssh.c,v 1.358 2011/05/06 21:18:02 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
|
@ -222,6 +222,7 @@ main(int ac, char **av)
|
||||||
{
|
{
|
||||||
int i, r, opt, exit_status, use_syslog;
|
int i, r, opt, exit_status, use_syslog;
|
||||||
char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg;
|
char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg;
|
||||||
|
char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
int dummy, timeout_ms;
|
int dummy, timeout_ms;
|
||||||
|
@ -701,17 +702,19 @@ main(int ac, char **av)
|
||||||
"h", host, (char *)NULL);
|
"h", host, (char *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.local_command != NULL) {
|
if (gethostname(thishost, sizeof(thishost)) == -1)
|
||||||
char thishost[NI_MAXHOST];
|
fatal("gethostname: %s", strerror(errno));
|
||||||
|
strlcpy(shorthost, thishost, sizeof(shorthost));
|
||||||
|
shorthost[strcspn(thishost, ".")] = '\0';
|
||||||
|
snprintf(portstr, sizeof(portstr), "%d", options.port);
|
||||||
|
|
||||||
if (gethostname(thishost, sizeof(thishost)) == -1)
|
if (options.local_command != NULL) {
|
||||||
fatal("gethostname: %s", strerror(errno));
|
|
||||||
snprintf(buf, sizeof(buf), "%d", options.port);
|
|
||||||
debug3("expanding LocalCommand: %s", options.local_command);
|
debug3("expanding LocalCommand: %s", options.local_command);
|
||||||
cp = options.local_command;
|
cp = options.local_command;
|
||||||
options.local_command = percent_expand(cp, "d", pw->pw_dir,
|
options.local_command = percent_expand(cp, "d", pw->pw_dir,
|
||||||
"h", host, "l", thishost, "n", host_arg, "r", options.user,
|
"h", host, "l", thishost, "n", host_arg, "r", options.user,
|
||||||
"p", buf, "u", pw->pw_name, (char *)NULL);
|
"p", portstr, "u", pw->pw_name, "L", shorthost,
|
||||||
|
(char *)NULL);
|
||||||
debug3("expanded LocalCommand: %s", options.local_command);
|
debug3("expanded LocalCommand: %s", options.local_command);
|
||||||
xfree(cp);
|
xfree(cp);
|
||||||
}
|
}
|
||||||
|
@ -735,16 +738,13 @@ main(int ac, char **av)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.control_path != NULL) {
|
if (options.control_path != NULL) {
|
||||||
char thishost[NI_MAXHOST];
|
|
||||||
|
|
||||||
if (gethostname(thishost, sizeof(thishost)) == -1)
|
|
||||||
fatal("gethostname: %s", strerror(errno));
|
|
||||||
snprintf(buf, sizeof(buf), "%d", options.port);
|
|
||||||
cp = tilde_expand_filename(options.control_path,
|
cp = tilde_expand_filename(options.control_path,
|
||||||
original_real_uid);
|
original_real_uid);
|
||||||
xfree(options.control_path);
|
xfree(options.control_path);
|
||||||
options.control_path = percent_expand(cp, "p", buf, "h", host,
|
options.control_path = percent_expand(cp, "h", host,
|
||||||
"r", options.user, "l", thishost, (char *)NULL);
|
"l", thishost, "n", host_arg, "r", options.user,
|
||||||
|
"p", portstr, "u", pw->pw_name, "L", shorthost,
|
||||||
|
(char *)NULL);
|
||||||
xfree(cp);
|
xfree(cp);
|
||||||
}
|
}
|
||||||
if (muxclient_command != 0 && options.control_path == NULL)
|
if (muxclient_command != 0 && options.control_path == NULL)
|
||||||
|
|
17
ssh_config.5
17
ssh_config.5
|
@ -33,8 +33,8 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $OpenBSD: ssh_config.5,v 1.146 2010/12/08 04:02:47 djm Exp $
|
.\" $OpenBSD: ssh_config.5,v 1.147 2011/05/06 21:18:02 djm Exp $
|
||||||
.Dd $Mdocdate: December 8 2010 $
|
.Dd $Mdocdate: May 6 2011 $
|
||||||
.Dt SSH_CONFIG 5
|
.Dt SSH_CONFIG 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -305,14 +305,21 @@ section above or the string
|
||||||
.Dq none
|
.Dq none
|
||||||
to disable connection sharing.
|
to disable connection sharing.
|
||||||
In the path,
|
In the path,
|
||||||
|
.Ql %L
|
||||||
|
will be substituted by the first component of the local host name,
|
||||||
.Ql %l
|
.Ql %l
|
||||||
will be substituted by the local host name,
|
will be substituted by the local host name (including any domain name),
|
||||||
.Ql %h
|
.Ql %h
|
||||||
will be substituted by the target host name,
|
will be substituted by the target host name,
|
||||||
|
.Ql %h
|
||||||
|
will be substituted by original target host name specified on the commandline,
|
||||||
.Ql %p
|
.Ql %p
|
||||||
the port, and
|
the port,
|
||||||
.Ql %r
|
.Ql %r
|
||||||
by the remote login username.
|
by the remote login username, and
|
||||||
|
.Ql %u
|
||||||
|
by the username of the user running
|
||||||
|
.Xr ssh 1 .
|
||||||
It is recommended that any
|
It is recommended that any
|
||||||
.Cm ControlPath
|
.Cm ControlPath
|
||||||
used for opportunistic connection sharing include
|
used for opportunistic connection sharing include
|
||||||
|
|
Loading…
Reference in New Issue