[PATCH] Expand tilde for UNIX domain socket forwards.

Lauri Võsandi lauri.vosandi at gmail.com
Tue Aug 18 04:23:13 AEST 2015


---
 channels.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/channels.c b/channels.c
index a84b487..396e192 100644
--- a/channels.c
+++ b/channels.c
@@ -3014,10 +3014,14 @@ channel_setup_fwd_listener_streamlocal(int type, struct Forward *fwd,
 
 	debug3("%s: type %d path %s", __func__, type, fwd->listen_path);
 
+	/* Expand home directory if necessary */
+	char *expanded_path = tilde_expand_filename(fwd->listen_path, getuid());
+
 	/* Start a Unix domain listener. */
 	omask = umask(fwd_opts->streamlocal_bind_mask);
-	sock = unix_listener(fwd->listen_path, SSH_LISTEN_BACKLOG,
+	sock = unix_listener(expanded_path, SSH_LISTEN_BACKLOG,
 	    fwd_opts->streamlocal_bind_unlink);
+	free(expanded_path);
 	umask(omask);
 	if (sock < 0)
 		return 0;
-- 
1.9.1



More information about the openssh-unix-dev mailing list