summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-02-12 06:45:35 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-02-12 06:45:35 +0000
commitb651bd690bf03da48f9dc8ea54d42a74a1452d7b (patch)
tree6dabf6d3ae6a74d690708b6b175653f432d0c94d /usr.bin/ssh
parent558e2fd290b72ee916d2e9fa233f485e94d411f2 (diff)
add a %l expansion code to the ControlPath, which is filled in with the
local hostname at runtime. Requested by henning@ to avoid some problems with /home on NFS; ok dtucker@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/ssh.c8
-rw-r--r--usr.bin/ssh/ssh_config.56
2 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index c01c7ee8f98..e5dcf36c224 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.260 2006/02/10 00:27:13 stevesk Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.261 2006/02/12 06:45:34 djm Exp $");
#include <sys/resource.h>
#include <sys/ioctl.h>
@@ -631,11 +631,15 @@ again:
options.control_path = NULL;
if (options.control_path != NULL) {
+ char me[NI_MAXHOST];
+
+ if (gethostname(me, sizeof(me)) == -1)
+ fatal("gethostname: %s", strerror(errno));
snprintf(buf, sizeof(buf), "%d", options.port);
cp = tilde_expand_filename(options.control_path,
original_real_uid);
options.control_path = percent_expand(cp, "p", buf, "h", host,
- "r", options.user, (char *)NULL);
+ "r", options.user, "l", me, (char *)NULL);
xfree(cp);
}
if (mux_command != 0 && options.control_path == NULL)
diff --git a/usr.bin/ssh/ssh_config.5 b/usr.bin/ssh/ssh_config.5
index 5c94ffc9cdb..5d821a0b16e 100644
--- a/usr.bin/ssh/ssh_config.5
+++ b/usr.bin/ssh/ssh_config.5
@@ -34,7 +34,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: ssh_config.5,v 1.76 2006/01/20 11:21:45 jmc Exp $
+.\" $OpenBSD: ssh_config.5,v 1.77 2006/02/12 06:45:34 djm Exp $
.Dd September 25, 1999
.Dt SSH_CONFIG 5
.Os
@@ -306,6 +306,8 @@ section above or the string
.Dq none
to disable connection sharing.
In the path,
+.Ql %l
+will be substituted by the local host name,
.Ql %h
will be substituted by the target host name,
.Ql %p
@@ -315,7 +317,7 @@ by the remote login username.
It is recommended that any
.Cm ControlPath
used for opportunistic connection sharing include
-all three of these escape sequences.
+at least the last three of these escape sequences (%h, %p and %r).
This ensures that shared connections are uniquely identified.
.It Cm DynamicForward
Specifies that a TCP port on the local machine be forwarded