From 7082bb58a2eb878d23ec674587c742e5e9673c36 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Sat, 9 Jun 2018 03:01:12 +0000 Subject: 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 --- mux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'mux.c') diff --git a/mux.c b/mux.c index c591cb15..8433cd8e 100644 --- a/mux.c +++ b/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.70 2018/06/06 18:22:41 djm Exp $ */ +/* $OpenBSD: mux.c,v 1.71 2018/06/09 03:01:12 djm Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -1852,9 +1852,9 @@ mux_client_request_session(int fd) { Buffer m; char *e, *term; - u_int i, rid, sid, esid, exitval, type, exitval_seen; + u_int rid, sid, esid, exitval, type, exitval_seen; extern char **environ; - int devnull, rawmode; + int i, devnull, rawmode; debug3("%s: entering", __func__); @@ -1889,14 +1889,16 @@ mux_client_request_session(int fd) buffer_put_cstring(&m, term == NULL ? "" : term); buffer_put_string(&m, buffer_ptr(&command), buffer_len(&command)); + /* Pass environment */ if (options.num_send_env > 0 && environ != NULL) { - /* Pass environment */ for (i = 0; environ[i] != NULL; i++) { if (env_permitted(environ[i])) { buffer_put_cstring(&m, environ[i]); } } } + for (i = 0; i < options.num_setenv; i++) + buffer_put_cstring(&m, options.setenv[i]); if (mux_client_write_packet(fd, &m) != 0) fatal("%s: write packet: %s", __func__, strerror(errno)); -- cgit v1.2.1