1
1

253 Коммитов

Автор SHA1 Сообщение Дата
Daniel Stenberg
210459db4b re-indented the source code with this script:
indent \
--braces-on-if-line \
--braces-after-struct-decl-line \
--space-after-cast \
--line-length 79 \
--comment-line-length 79 \
--cuddle-else \
--no-tabs \
--tab-size 8 \
--indent-level 4 \
--no-space-after-for \
--space-after-if \
--space-after-while \
--no-space-after-function-call-names \
*.[ch]
2007-08-06 20:48:04 +00:00
Daniel Stenberg
209d06d6c9 libssh2_poll() no longer relies on C99 features but instead uses alloca()
on systems that have it - and uses a fixed-size array on those that don't.
session.c was also cleaned from a large amount of trailing whitespace.
2007-07-23 21:18:43 +00:00
James Housley
46f59112d9 * After setting the error to the error string from in the packet, set
the pointer to NULL so it can't be double freed.
* On session cleanup be sure to free the last error if it needs to be
2007-07-19 15:02:37 +00:00
James Housley
05c1164a67 The test after the memory allocation was backwards, so keyboard-interactive
would always fail due to a memory problem.
2007-07-18 19:54:51 +00:00
Guenter Knauf
8f62c7322f added NMakefile to Makefile.am so that it gets included with releases and daily snapshots. 2007-07-17 13:22:55 +00:00
Guenter Knauf
bb76ed34a0 fixed NMakefile stuff to build at least the DLL again. 2007-07-15 20:06:19 +00:00
James Housley
a87fdff9e9 The variable "packet" needs to be in LIBSSH2_SFTP_HANDLE for re-entry when
blocking in libssh2_sftp_close_handle()
2007-07-09 15:11:37 +00:00
James Housley
50fd6590f0 While the previous commit seemed to correct a problem, it actually exposed
another problem.  Commit this until a proper fix is found
2007-07-08 17:14:19 +00:00
James Housley
2b1c979d7e Remove a blocking while loop that wasn't removed when the code to
return PACKET_EAGAIN was added, but should have been.
2007-07-08 15:37:44 +00:00
James Housley
6ac790a477 * Since the packet as already had data read from it, it can't retrun
PACKET_EAGAIN while reading the rest of it.
* Get the error message in libssh2_scp_recv() in the same manner as it
  was gotten in libssh2_scp_send_ex()
2007-07-05 15:31:19 +00:00
James Housley
530e57d4ac Gavrie Philipson sumitted a patch to get the actual text of the error
on scp upload.
2007-07-05 11:08:17 +00:00
Daniel Stenberg
cf9ed016e7 as mentioned in bug #1655429, the CRLF pair was stripped off in the wrong
order!
2007-06-28 20:53:32 +00:00
James Housley
74b12c3c7a * Eberhard Mattes submitted a patch "According to RFC 4251,
a boolean value of true is encoded as 1, not as 0xff".  Servers
should accept any non-zero value.

Bug:	1703472
2007-06-23 22:20:30 +00:00
James Housley
25adcc150e Guenter Knauf submitted code to detect on windows if the socket is
blocking or not
2007-06-22 16:46:36 +00:00
James Housley
7808cab1e4 libssh2_channel_read_ex() needed more changes to fully support
non-blocking IO
2007-06-18 22:39:30 +00:00
James Housley
9dfd71121e Small fixes:
* libssh2_sftp_packet_read() - use the right variable for the
        number of bytes returned by libssh2_channel_read_ex()
* libssh2_sftp_packet_requirev - only call libssh2_waitsocket() when
        in blocking IO mode
2007-06-18 22:38:32 +00:00
James Housley
ba728148a9 Make libssh2_channel_receive_window_adjust() properly support non-blocking 2007-06-17 23:35:07 +00:00
James Housley
019cd1abc0 Clean up and standardization of code 2007-06-17 23:34:35 +00:00
James Housley
0742a972c1 Created libssh2_sftp_readdir_ex() and updated LIBSSH2_APINO to 200706151200 2007-06-15 17:22:49 +00:00
James Housley
363f5a690d Another bug pointed out by Troy Gutjahr. The free and nulling for two
pointers were crossed
2007-06-15 10:07:49 +00:00
James Housley
8223acec0a Don't use memory after it has been freed, pointed out by Troy Gutjahr 2007-06-15 01:41:58 +00:00
James Housley
136b2bfcdc Some older BSD systems, OS X 10.3.9 for example, need <stdio.h> before
<sys/select.h>.  And <uio.h> is needed for iovec
2007-06-14 22:50:32 +00:00
Guenter Knauf
ddb935af3d non-gcc compilers break with var declarations in the middle of the code. 2007-06-14 00:38:35 +00:00
James Housley
dde2b09496 libssh2_channel_free() actually can return PACKET_EAGAIN. Update all
calling functions to support that with the following API notes:

* libssh2_publickey_shutdown(), libssh2_session_free() changed
  to return an "int" to allow signaling of LIBSSH2_ERROR_EAGAIN.

* libssh2_scp_recv(), libssh2_scp_send_ex() and libssh2_sftp_init()
  will loop in on libssh2_channel_free() when there is an error.
  It is not possible to return LIBSSH2_ERROR_EAGAIN in this condition
  in these 3 functions and not lose the original error code.
2007-06-12 18:27:37 +00:00
James Housley
a5109ee5ba Sharing state vairables between the userauth functions was a nice idea,
but libssh2_userauth_list() can't share with the others.  So to be safe
don't have any share.
2007-06-10 13:59:05 +00:00
James Housley
8b4df6a9ab Fix misspelling in trace
Bug:	1703464
2007-06-10 11:09:39 +00:00
James Housley
8466a826f1 Since uint32_t is used, inttypes.h should be included. 2007-06-09 01:34:21 +00:00
James Housley
bdde6c3d60 In the code rewrite
libssh2_kex_method_diffie_hellman_group14_sha1_key_exchange() lost two
initializer routines, restore them.
2007-06-08 15:57:46 +00:00
James Housley
cf8f4d1818 To simplify the user's error interface always use LIBSSH2_ERROR_EAGAIN.
LIBSSH2CHANNEL_EAGAIN and LIBSSH2SFTP_EAGAIN are still valid, but are
defined as LIBSSH2_ERROR_EAGAIN.
2007-06-08 13:33:08 +00:00
James Housley
281283d252 libssh2_session_disconnect_ex() should be returning PACKET_EAGAIN instead
of LIBSSH2_ERROR_EAGAIN, so it matches the other functions return values.
2007-06-08 12:07:09 +00:00
James Housley
b2f3582a59 When shutting down sub-systems and closing the channel try our best
to free any memory still allocated in the state variables
2007-06-07 16:43:20 +00:00
James Housley
7d57222912 Finish making SFTP fully non-blocking capable.
Functions that return an "int", and friends, return LIBSSH2SFTP_EAGAIN.
Functions that return a structure return NULL and set the error to
LIBSSH2_ERROR_EAGAIN
2007-06-07 16:01:12 +00:00
James Housley
d141ba49f3 Make libssh2_sftp_write() be fully non-blocking. The state of the socket
is fully honored.  LIBSSH2SFTP_EAGAIN is returned when the call would
block.
2007-06-06 19:52:11 +00:00
James Housley
4b8db8c1ab Modify the code to truely support non-blocking. Propogate the EAGAIN error
all the way up to the user interface.  All code modules bug sftp.c have
been completed.

Functions that return an "int", or similar return LIBSSH2CHANNEL_EAGAIN to
indicate some part of the call would block, in non-blocking mode.

Functions that return a structure, like "LIBSSH2_CHANNEL *", return NULL
and set the libssh2 error.  The error can be obtained with either
libssh2_session_last_error() or libssh2_session_last_errno().  Either of
these will return the error code of LIBSSH2_ERROR_EAGAIN if the
call would block, in non-blocking mode.

The current state of a function and some variable are keep in the
structures so that on the next call the operation that would block can
be retried again with the same data.
2007-06-06 12:34:06 +00:00
James Housley
9896c291e4 libssh2_packet_read() was checking the "errno" even when recv() didn't
return an error.  "errno" should have been zero by the recv() call but
doesn't seem to be on all systems.  Only check when recv() says there
is an error.

Bug:		1703467
Patch:		1703468
2007-06-06 10:13:30 +00:00
James Housley
412b25d971 Initially the libssh2 code was indented with tabs of 4 spaces. Some of
the recent commits converted the tabs to 4 spaces, which matched the
initial indent size.  Other commits converted the tabs to 8 spaces, this
didn't match.

All the code has been converted to 4 space indents.  No changes to line
lengths or actual code was performed.  This is in preperation to my up
coming non-blocking work so my commits should only be code changes and
line lengths in the code I am working on.
2007-05-28 17:56:08 +00:00
Daniel Stenberg
355c9c634b Eberhard Mattes' fix for libssh2_packet_read() for when reading very small
chunks at a time.
2007-05-08 19:20:05 +00:00
James Housley
a66885c51c Make _libssh2_sftp_mkdir_ex() fully non-blocking safe. This makes
libssh2_sftp_mkdirnb_ex() non-blocking safe and libssh2_sftp_mkdir_ex()
blocking safe
2007-04-22 19:51:24 +00:00
James Housley
9ff217b6d2 libssh2_sftp_seek() and libssh2_sftp_tell() are NB-SAFE, since they
only set variables
2007-04-22 16:42:54 +00:00
James Housley
7eccfc7fbc Make _libssh2_sftp_write() fully non-blocking safe. This makes
libssh2_sftp_writenb() non-blocking safe and libssh2_sftp_write() blocking
safe
2007-04-22 15:56:06 +00:00
James Housley
42f0f69a35 Make _libssh2_sftp_read() fully non-blocking safe. This makes
libssh2_sftp_readnb() non-blocking safe and libssh2_sftp_read() blocking
safe
2007-04-22 13:13:51 +00:00
James Housley
2dc313d365 Non-blocking work
* The following low level packet routines now fully support non-blocking:
    libssh2_sftp_packet_read()
    libssh2_sftp_packet_ask()
    libssh2_sftp_packet_require()
    libssh2_sftp_packet_requirev()

* libssh2_sftp_readdirnb() functions completely in non-blocking mode

* The rest of the routines which call the libssh2_sftp_packet_* routine
  loop on a return code of PACKET_EAGAIN.  This maintains the current
  functionality until they fully support non-blocking

* The state of all function are labeled with either NB-SAFE or NB-UNSAFE,
  for those that are know.  NB-UNSAFE?? for those that haven't been
  examined.
2007-04-21 18:16:23 +00:00
Dan Fandrich
1a6e00cfef Fixed some compiler warnings and made some more tables 'const'. 2007-04-18 21:03:42 +00:00
Dan Fandrich
9b81a01376 Made some function parameters in the API const. This is an API change,
but correctly-written applications should see no source or binary
compatibility issues.  Also fixed a few compiler warnings.
2007-04-18 18:51:03 +00:00
Dan Fandrich
4c6bfdd5b2 Bail out on a short kex packet. 2007-04-17 18:30:05 +00:00
Dan Fandrich
5dd66e604f Made most internal tables 'static const'. 2007-04-17 18:12:41 +00:00
Dan Fandrich
197764afcc Properly propagate out of memory errors. 2007-04-13 18:28:10 +00:00
Guenter Knauf
f33375bc03 changed to configure defines to control inclusion of headers from libssh2_config.h. 2007-04-12 22:20:18 +00:00
Guenter Knauf
159c351d05 Win32 has no ENOTCONN - checked MSVC6, MingW32, Borland C++ 5.5, OpenWatcom 1.6; all have this define in winsock2.h but blocked with '#if 0';
changed to configure defines to control inclusion of headers from libssh2_config.h
2007-04-12 22:18:27 +00:00
Guenter Knauf
51e49f5a1e fixed wrong type and sync with usage. 2007-04-12 22:03:27 +00:00