summaryrefslogtreecommitdiff
path: root/ssh.c
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 /ssh.c
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@
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c8
1 files changed, 6 insertions, 2 deletions
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)