summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2016-12-01 13:27:58 -0800
committerJeff Forcier <jeff@bitprophet.org>2016-12-01 13:29:06 -0800
commitc2f2b476093e85f926bb659ca23b489647b74390 (patch)
tree2e88dc60c15f8d60daf65f5461bf137a52f971a4
parentcfa81ebd780eb0c7fa82ce5e203f93a459f0318f (diff)
Add some warnings about AcceptEnv to env var setting bits.
Re #398
-rw-r--r--paramiko/channel.py10
-rw-r--r--paramiko/client.py5
-rw-r--r--sites/www/changelog.rst3
3 files changed, 17 insertions, 1 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py
index 7689b266..3b6a59df 100644
--- a/paramiko/channel.py
+++ b/paramiko/channel.py
@@ -292,6 +292,10 @@ class Channel (ClosingContextManager):
This operation is additive - i.e. the current environment is not
reset before the given environment variables are set.
+ .. warning::
+ Servers may silently reject some environment variables; see the
+ warning in `set_environment_variable` for details.
+
:param dict environment:
a dictionary containing the name and respective values to set
:raises SSHException:
@@ -310,6 +314,12 @@ class Channel (ClosingContextManager):
"""
Set the value of an environment variable.
+ .. warning::
+ The server may reject this request depending on its ``AcceptEnv``
+ setting; such rejections will fail silently (which is common client
+ practice for this particular request type). Make sure you
+ understand your server's configuration before using!
+
:param str name: name of the environment variable
:param str value: value of the environment variable
diff --git a/paramiko/client.py b/paramiko/client.py
index 978bde51..40cd5cf2 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -421,6 +421,11 @@ class SSHClient (ClosingContextManager):
:param dict environment:
a dict of shell environment variables, to be merged into the
default environment that the remote command executes within.
+
+ .. warning::
+ Servers may silently reject some environment variables; see the
+ warning in `.Channel.set_environment_variable` for details.
+
:return:
the stdin, stdout, and stderr of the executing command, as a
3-tuple
diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst
index 12fecdc5..3207d8f2 100644
--- a/sites/www/changelog.rst
+++ b/sites/www/changelog.rst
@@ -8,7 +8,8 @@ Changelog
and `Channel.set_environment_variable
<paramiko.channel.Channel.set_environment_variable>` methods) which
implements the ``env`` SSH message type. This means the remote shell
- environment can be set without the use of ``VARNAME=value`` shell tricks.
+ environment can be set without the use of ``VARNAME=value`` shell tricks,
+ provided the server's ``AcceptEnv`` lists the variables you need to set.
Thanks to Philip Lorenz for the pull request.
* :support:`819 backported (>=1.15,<2.0)` Document how lacking ``gmp`` headers
at install time can cause a significant performance hit if you build PyCrypto