summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-15 11:30:13 +1100
committerDamien Miller <djm@mindrot.org>2006-03-15 11:30:13 +1100
commit3ec54c7e58eb9724a5d54d3e985992ebecbd7553 (patch)
tree9a7375bf97b372c7c40adf647aeead006fa912c1
parent3fd019ecca7d41702111f926f08e370946cf9060 (diff)
- djm@cvs.openbsd.org 2006/02/12 06:45:34
[ssh.c ssh_config.5] 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@
-rw-r--r--ChangeLog7
-rw-r--r--ssh.c8
-rw-r--r--ssh_config.56
3 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 70cd9042..380b952b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,11 @@
- otto@cvs.openbsd.org 2006/02/11 19:31:18
[atomicio.c]
type correctness; from Ray Lai in PR 5011; ok millert@
+ - djm@cvs.openbsd.org 2006/02/12 06:45:34
+ [ssh.c ssh_config.5]
+ 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@
20060313
- (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong)
@@ -3970,4 +3975,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
-$Id: ChangeLog,v 1.4159 2006/03/15 00:29:51 djm Exp $
+$Id: ChangeLog,v 1.4160 2006/03/15 00:30:13 djm Exp $
diff --git a/ssh.c b/ssh.c
index 5331402e..4a373356 100644
--- a/ssh.c
+++ b/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>
@@ -638,11 +638,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/ssh_config.5 b/ssh_config.5
index 5c94ffc9..5d821a0b 100644
--- a/ssh_config.5
+++ b/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