summaryrefslogtreecommitdiff
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 70cd90426..380b952b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,11 @@
69 - otto@cvs.openbsd.org 2006/02/11 19:31:18 69 - otto@cvs.openbsd.org 2006/02/11 19:31:18
70 [atomicio.c] 70 [atomicio.c]
71 type correctness; from Ray Lai in PR 5011; ok millert@ 71 type correctness; from Ray Lai in PR 5011; ok millert@
72 - djm@cvs.openbsd.org 2006/02/12 06:45:34
73 [ssh.c ssh_config.5]
74 add a %l expansion code to the ControlPath, which is filled in with the
75 local hostname at runtime. Requested by henning@ to avoid some problems
76 with /home on NFS; ok dtucker@
72 77
7320060313 7820060313
74 - (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong) 79 - (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong)
@@ -3970,4 +3975,4 @@
3970 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 3975 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
3971 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 3976 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
3972 3977
3973$Id: ChangeLog,v 1.4159 2006/03/15 00:29:51 djm Exp $ 3978$Id: ChangeLog,v 1.4160 2006/03/15 00:30:13 djm Exp $
diff --git a/ssh.c b/ssh.c
index 5331402e5..4a373356f 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.260 2006/02/10 00:27:13 stevesk Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.261 2006/02/12 06:45:34 djm Exp $");
44 44
45#include <sys/resource.h> 45#include <sys/resource.h>
46#include <sys/ioctl.h> 46#include <sys/ioctl.h>
@@ -638,11 +638,15 @@ again:
638 options.control_path = NULL; 638 options.control_path = NULL;
639 639
640 if (options.control_path != NULL) { 640 if (options.control_path != NULL) {
641 char me[NI_MAXHOST];
642
643 if (gethostname(me, sizeof(me)) == -1)
644 fatal("gethostname: %s", strerror(errno));
641 snprintf(buf, sizeof(buf), "%d", options.port); 645 snprintf(buf, sizeof(buf), "%d", options.port);
642 cp = tilde_expand_filename(options.control_path, 646 cp = tilde_expand_filename(options.control_path,
643 original_real_uid); 647 original_real_uid);
644 options.control_path = percent_expand(cp, "p", buf, "h", host, 648 options.control_path = percent_expand(cp, "p", buf, "h", host,
645 "r", options.user, (char *)NULL); 649 "r", options.user, "l", me, (char *)NULL);
646 xfree(cp); 650 xfree(cp);
647 } 651 }
648 if (mux_command != 0 && options.control_path == NULL) 652 if (mux_command != 0 && options.control_path == NULL)
diff --git a/ssh_config.5 b/ssh_config.5
index 5c94ffc9c..5d821a0b1 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -34,7 +34,7 @@
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.76 2006/01/20 11:21:45 jmc Exp $ 37.\" $OpenBSD: ssh_config.5,v 1.77 2006/02/12 06:45:34 djm Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSH_CONFIG 5 39.Dt SSH_CONFIG 5
40.Os 40.Os
@@ -306,6 +306,8 @@ section above or the string
306.Dq none 306.Dq none
307to disable connection sharing. 307to disable connection sharing.
308In the path, 308In the path,
309.Ql %l
310will be substituted by the local host name,
309.Ql %h 311.Ql %h
310will be substituted by the target host name, 312will be substituted by the target host name,
311.Ql %p 313.Ql %p
@@ -315,7 +317,7 @@ by the remote login username.
315It is recommended that any 317It is recommended that any
316.Cm ControlPath 318.Cm ControlPath
317used for opportunistic connection sharing include 319used for opportunistic connection sharing include
318all three of these escape sequences. 320at least the last three of these escape sequences (%h, %p and %r).
319This ensures that shared connections are uniquely identified. 321This ensures that shared connections are uniquely identified.
320.It Cm DynamicForward 322.It Cm DynamicForward
321Specifies that a TCP port on the local machine be forwarded 323Specifies that a TCP port on the local machine be forwarded