[
https://issues.apache.org/jira/browse/SSHD-1308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17623338#comment-17623338
]
dgü commented on SSHD-1308:
---------------------------
Hello!
{quote}How can the client tell that the server ignored the variable ?
{quote}
It's just a wording in a client side. Server may ignore or not ignore by doing
something internally. Anyway, whatever server does, it means it looks ignored
in client perspective.
I passed some environment variables by
{_}ClientSession#createExecChannel(command,null,env){_}. But, the environment
variables were not passed to the remote command.
{quote}Which means it would be a +custom+ implementation that will work only
with your client and server.
{quote}
Unfortunately, I can not be agree. If an argument of a client call is refused
by a server, client application must be notified by a message such as _setting
environment variable is not allowed_ instead of success.
As a workaround, I pass environment variables to command line as below:
For UNIX:
{code:java}
sh -c 'KEY1=VAL1 KEY2=VAL2 '/tmp/mycommand' 'arg1' 'arg2''{code}
For Windows:
{code:java}
cmd /c "SET KEY1=VAL1&&SET KEY2=VAL2&&"c:/myprogram" "arg1" "arg2""{code}
> No exception is thrown if setting environment variable is ignored by SSH
> server
> -------------------------------------------------------------------------------
>
> Key: SSHD-1308
> URL: https://issues.apache.org/jira/browse/SSHD-1308
> Project: MINA SSHD
> Issue Type: Improvement
> Affects Versions: 2.9.1
> Environment: Java 8
> Reporter: dgü
> Priority: Major
>
> Hello!
> If an environment variable set by
> _org.apache.sshd.client.session.ClientSession#createExecChannel(command,null,env)_
> is ignored by SSH server and exit code returns 0, then this may cause
> unexpected behaviour in client application.
> For example, client application may do different tasks when an environment
> variable is set and not set. In both cases, client application may return 0.
> Client application may assume that it worked successfully. But, indeed its
> environment variable is ignored and worked as if environment variable is not
> set.
> is it possible throw an exception if setting environment variable is ignored
> by SSH server ?
> Thanks in advance...
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]