-
Notifications
You must be signed in to change notification settings - Fork 121
ssh: add opt-in application-driven channels #1233
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
base: master
Are you sure you want to change the base?
Changes from all commits
e926934
867da99
3b08051
b2a5c96
162dfb8
127b742
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1383,8 +1383,12 @@ int wolfSSH_SFTP_accept(WOLFSSH* ssh) | |
| if (ssh->error == WS_WANT_READ || ssh->error == WS_WANT_WRITE) | ||
| ssh->error = WS_SUCCESS; | ||
|
|
||
| /* check accept is done, if not call wolfSSH accept */ | ||
| if (ssh->acceptState < ACCEPT_CLIENT_SESSION_ESTABLISHED) { | ||
| /* check accept is done, if not call wolfSSH accept. In | ||
| * application-driven mode accept() parks at ACCEPT_SERVER_USERAUTH_SENT | ||
| * and never advances, so that state counts as done here. */ | ||
| if (ssh->acceptState < ACCEPT_CLIENT_SESSION_ESTABLISHED | ||
| && !(ssh->appChannels | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wolfSSH_SFTP_accept() serves SFTP without a granted subsystem request in app-channels mode · Channel handling errors The new guard drops into the SFTP state machine as soon as Fix: Gate the app-channels bypass on the session request having been granted (e.g. |
||
| && ssh->acceptState >= ACCEPT_SERVER_USERAUTH_SENT)) { | ||
| byte name[] = "sftp"; | ||
|
|
||
| WLOG(WS_LOG_SFTP, "Trying to do SSH accept first"); | ||
|
|
||
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.
wolfSSH_AGENT_ChannelOpen() latches its benign "not requested yet" return into ssh-error · Incorrect error handling
Every return is written into
ssh->error, including theWS_BAD_ARGUMENTreported while the peer has not asked for agent forwarding — the pollingagent.hdocuments as safe.wolfSSH_accept()(src/ssh.c:598) clears only the want/auth-pending codes, so a poll poisons the session and later accepts returnWS_INVALID_STATE_E. The success path likewise clears a latchedWS_WANT_WRITE. SiblingwolfSSH_AGENT_Relay()setsssh->erroronly on genuine failure.Fix: Record
ssh->erroronly for genuine failures, leaving it untouched on WS_SUCCESS and on the WS_BAD_ARGUMENT no-agent-requested return.