-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wolfSSHd Connection Closure #718
Conversation
6f2548a
to
8f0b1ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. a stray XSTRLEN()
and a couple XSNPRINTF()
s to fix.
apps/wolfsshd/wolfsshd.c
Outdated
WMEMSET(cmd, 0, sizeof(cmd)); | ||
if (XSTRLEN(pPasswd->pw_shell) == 0) { | ||
XSNPRINTF(cmd, sizeof(cmd), "%s", "/bin/sh"); | ||
if (pPasswd->pw_shell && XSTRLEN(pPasswd->pw_shell)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be WSTRLEN()
.
apps/wolfsshd/wolfsshd.c
Outdated
if (XSTRLEN(pPasswd->pw_shell) == 0) { | ||
XSNPRINTF(cmd, sizeof(cmd), "%s", "/bin/sh"); | ||
if (pPasswd->pw_shell && XSTRLEN(pPasswd->pw_shell)) { | ||
XSNPRINTF(cmd, sizeof(cmd), "%s", pPasswd->pw_shell); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be WSNPRINTF()
.
1. Initialize all the fds to -1. 2. Add flags for peerConnected and stdoutEmpty. 3. Remove the idle counter. 4. When the socket would block on write, set a flag to check the socket for writing later to call the worker which will send pending data. 5. When reading the pipes, a 0 returns means the pipe is closed. Deal with that. 6. If the ssh write fails, interrupt the subordinate process. 7. When waiting for the peer to close its channel and shutdown, sleep for 100ms, rather than 1us. It takes a little while to tear down. 8. Shutdown the peer socket. Spin on receiving the peer socket until it closes or has an error. 9. Fixed a few function wrappers; was using Xname instead of Wname.
1b796d7
to
6c69c12
Compare
wolfSSHd Connection Closure
wolfSSHd Connection Closure
wolfSSHd Connection Closure
wolfSSHd Connection Closure
DESCRIPTION
Improvements to wolfSSHd to shutdown the connection cleaner, without disconnection errors. The server will keep processing the channel data and close its side of the connection. On socket shutdown, it will
shutdown
its side of the socket and read data from the socket until 0 return, then it closes the socket. Will also interrupt the child process if there are any socket errors.(ZD 17722)