summaryrefslogtreecommitdiff
path: root/mux.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-06-09 03:01:12 +0000
committerDamien Miller <djm@mindrot.org>2018-06-09 13:11:00 +1000
commit7082bb58a2eb878d23ec674587c742e5e9673c36 (patch)
treeca7c8ddb616358d96279fdbfd5986328f48a1821 /mux.c
parent3b9798bda15bd3f598f5ef07595d64e23504da91 (diff)
upstream: add a SetEnv directive to ssh_config that allows setting
environment variables for the remote session (subject to the server accepting them) refactor SendEnv to remove the arbitrary limit of variable names. ok markus@ OpenBSD-Commit-ID: cfbb00d9b0e10c1ffff1d83424351fd961d1f2be
Diffstat (limited to 'mux.c')
-rw-r--r--mux.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mux.c b/mux.c
index c591cb154..8433cd8e5 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.70 2018/06/06 18:22:41 djm Exp $ */ 1/* $OpenBSD: mux.c,v 1.71 2018/06/09 03:01:12 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -1852,9 +1852,9 @@ mux_client_request_session(int fd)
1852{ 1852{
1853 Buffer m; 1853 Buffer m;
1854 char *e, *term; 1854 char *e, *term;
1855 u_int i, rid, sid, esid, exitval, type, exitval_seen; 1855 u_int rid, sid, esid, exitval, type, exitval_seen;
1856 extern char **environ; 1856 extern char **environ;
1857 int devnull, rawmode; 1857 int i, devnull, rawmode;
1858 1858
1859 debug3("%s: entering", __func__); 1859 debug3("%s: entering", __func__);
1860 1860
@@ -1889,14 +1889,16 @@ mux_client_request_session(int fd)
1889 buffer_put_cstring(&m, term == NULL ? "" : term); 1889 buffer_put_cstring(&m, term == NULL ? "" : term);
1890 buffer_put_string(&m, buffer_ptr(&command), buffer_len(&command)); 1890 buffer_put_string(&m, buffer_ptr(&command), buffer_len(&command));
1891 1891
1892 /* Pass environment */
1892 if (options.num_send_env > 0 && environ != NULL) { 1893 if (options.num_send_env > 0 && environ != NULL) {
1893 /* Pass environment */
1894 for (i = 0; environ[i] != NULL; i++) { 1894 for (i = 0; environ[i] != NULL; i++) {
1895 if (env_permitted(environ[i])) { 1895 if (env_permitted(environ[i])) {
1896 buffer_put_cstring(&m, environ[i]); 1896 buffer_put_cstring(&m, environ[i]);
1897 } 1897 }
1898 } 1898 }
1899 } 1899 }
1900 for (i = 0; i < options.num_setenv; i++)
1901 buffer_put_cstring(&m, options.setenv[i]);
1900 1902
1901 if (mux_client_write_packet(fd, &m) != 0) 1903 if (mux_client_write_packet(fd, &m) != 0)
1902 fatal("%s: write packet: %s", __func__, strerror(errno)); 1904 fatal("%s: write packet: %s", __func__, strerror(errno));