mirror of https://github.com/wolfSSL/wolfssh.git
use childFd when not handling a forced command
parent
60cd4bca73
commit
3859213936
|
@ -1511,8 +1511,14 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
|
||||||
if (cnt_r <= 0)
|
if (cnt_r <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cnt_w = (int)write(stdinPipe[1], channelBuffer,
|
if (forcedCmd) {
|
||||||
cnt_r);
|
cnt_w = (int)write(stdinPipe[1], channelBuffer,
|
||||||
|
cnt_r);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cnt_w = (int)write(childFd, channelBuffer,
|
||||||
|
cnt_r);
|
||||||
|
}
|
||||||
if (cnt_w <= 0)
|
if (cnt_w <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1545,7 +1551,7 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
|
||||||
current = wolfSSH_ChannelFind(ssh, lastChannel,
|
current = wolfSSH_ChannelFind(ssh, lastChannel,
|
||||||
WS_CHANNEL_ID_SELF);
|
WS_CHANNEL_ID_SELF);
|
||||||
eof = wolfSSH_ChannelGetEof(current);
|
eof = wolfSSH_ChannelGetEof(current);
|
||||||
if (eof) {
|
if (eof && forcedCmd) {
|
||||||
/* SSH is done, close stdin pipe to child process */
|
/* SSH is done, close stdin pipe to child process */
|
||||||
close(stdinPipe[1]);
|
close(stdinPipe[1]);
|
||||||
stdinPipe[1] = -1;
|
stdinPipe[1] = -1;
|
||||||
|
|
Loading…
Reference in New Issue