cURL / Mailing Lists / curl-library / Single Mail


ssh.c state machine code review

From: James Housley <>
Date: Wed, 27 Jun 2007 10:29:18 -0400

Attached is the 5 files I have changed to have SFTP fully non-
blocking in "multi" mode. Since there are 80+K of diffs I thought it
might be easier to send the full code and allow diffs to be done
locally if desired. Points of interest that needs comments:

1) lib/transfer.c has a couple of lines added to force it to look
like there is SFTP/SCP data ready to read during downloads. This is
needed since these protocols don't send data packets until a request
packet is sent.

2) Curl_sftp_do(), sftp_perform(), Curl_ssh_multi_statemach() don't
actually check the state of the sockets since we are in non-blocking
mode and it is not really possible to tell if we should be checking
for incoming data or space to send data. But, since libssh2 0.15 and
beyond (which is required for using these calls) will return
EWOULDBLOCK it works correctly.

3) Curl_sftp_done() calls and runs the state machine, is that okay?

4) url.c, have I set all the required functions for SFTP?

5) Tests 613 and 614 now fail. This is because libssh2 0.15 will
return the username and group, when it can instead of their numeric


/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
                 The Power to Serve
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?
  • application/zip attachment:
Received on 2007-06-27