Compare commits

...

367 Commits

Author SHA1 Message Date
Daniel Stenberg
507d5f96cf Makefile.am: the Makefile.win32 files are gone 2011-09-06 22:56:06 +02:00
Daniel Stenberg
84d8728835 RELEASE-NOTES: updated for 1.3.0 2011-09-06 22:47:34 +02:00
Daniel Stenberg
296d57bb2c sftp_read: a short read is not end of file
A returned READ packet that is short will now only reduce the
offset.

This is a temporary fix as it is slightly better than the previous
approach but still not very good.
2011-09-06 22:43:26 +02:00
liuzl
9e79031ad7 _libssh2_packet_add: adjust window size when truncating
When receiving more data than what the window size allows on a
particular channel, make sure that the window size is adjusted in that
case too. Previously it would only adjust the window in the non-error
case.
2011-08-31 10:45:12 +02:00
Guenter Knauf
689fc5c596 Silent compiler warning with MinGW64. 2011-08-29 15:30:18 +02:00
Guenter Knauf
31a9e8860d Fixed link to native Win32 awk tool. 2011-08-29 14:05:15 +02:00
Guenter Knauf
b26c3e7cce Renamed MinGW makefiles. 2011-08-29 13:59:43 +02:00
Guenter Knauf
e4eeb85f01 Some MinGW makefile tweaks.
Enable build without GNU tools and with MinGW64 compiler.
2011-08-29 13:54:51 +02:00
Guenter Knauf
7de77e94bf Fixed aes_ctr_do_cipher() signature. 2011-08-29 13:27:46 +02:00
liuzl
8c0294db66 libssh2_sftp_seek64: flush packetlist and buffered data
When seeking to a new position, flush the packetlist and buffered data
to prevent already received or pending data to wrongly get used when
sftp-reading from the new offset within the file.
2011-08-26 13:47:35 +02:00
Daniel Stenberg
900c90ccbe sftp_read: advance offset correctly for buffered copies
In the case where a read packet has been received from the server, but
the entire contents couldn't be copied to the user-buffer, the data is
instead buffered and copied to the user's buffer in the next invocation
of sftp_read(). When that "extra" copy is made, the 'offset' pointer was
not advanced accordingly.

The biggest impact of this flaw was that the 'already' variable at the
top of the function that figures out how much data "ahead" that has
already been asked for would slowly go more and more out of sync, which
could lead to the file not being read all the way to the end.

This problem was most noticable in cases where the application would
only try to read the exact file size amount, like curl does. In the
examples libssh2 provides the sftp read function is most often called
with a fixed size large buffer and then the bug would not appear as
easily.

This bug was introduced in the SFTP rewrite in 1.2.8.

Bug: http://curl.haxx.se/mail/lib-2011-08/0305.html
     http://www.libssh2.org/mail/libssh2-devel-archive-2011-08/0085.shtml
2011-08-26 11:45:48 +02:00
Daniel Stenberg
d5eec4aad9 wrap some long lines < 80 columns 2011-08-25 22:41:17 +02:00
Daniel Stenberg
19864f0f64 LIBSSH2_RECV: fix typo, use the RECV_FD macro 2011-08-25 22:38:46 +02:00
Daniel Stenberg
420f0b7793 subsystem_netconf.c: fix compiler warnings 2011-08-21 15:24:55 +02:00
Henrik Nordstrom
7aa4bfc671 Custom callbacks for performing low level socket I/O 2011-08-21 15:19:44 +02:00
Daniel Stenberg
462996b064 version bump: start working towards 1.3.0 2011-08-16 23:03:52 +02:00
Daniel Stenberg
07d7a85bdb RELEASE-NOTES: synced with 95d69d3a81 2011-08-16 10:30:13 +02:00
Henrik Nordstrom
95d69d3a81 Document prototypes for macro defined functions 2011-08-16 10:29:07 +02:00
Henrik Nordstrom
2fe1770d9f Avoid reuse after free when closing X11 channels 2011-08-16 10:27:49 +02:00
Daniel Stenberg
3c71ad4fce _libssh2_channel_write: handle window_size == 0 better
When about to send data on the channel and the window size is 0, we must
not just return 0 if the transport_read() function returned EAGAIN as it
then causes a busy-loop.

Bug: http://libssh2.org/mail/libssh2-devel-archive-2011-08/0011.shtml
2011-08-11 14:36:05 +02:00
Daniel Stenberg
79f48e4881 gettimeofday: fix name space pollution
For systems without its own gettimeofday() implementation, we still must
not provide one outside our namespace.

Reported by: Bill Segall
2011-08-05 23:50:22 +02:00
Dan Fandrich
49453c9ae2 libssh2.pc.in: Fixed spelling in pkgconfig file 2011-08-05 14:33:26 -07:00
Peter Stuge
b232eeb598 example/subsystem_netconf.c: Add missing #include <string.h> 2011-07-17 08:04:52 +02:00
Peter Stuge
f922df9e1b example/subsystem_netconf.c: Discard ]]>]]> and return only XML response 2011-07-17 08:00:48 +02:00
Peter Stuge
7e47bd6640 example/subsystem_netconf.c: Fix uninitialized variable bug 2011-07-17 07:18:39 +02:00
Peter Stuge
4ae907cdef example: Add subsystem_netconf.c
This example demonstrates how to use libssh2 to send a request to
the NETCONF subsystem available e.g. in JunOS.

See also http://tools.ietf.org/html/draft-ietf-netconf-ssh-06
2011-07-17 07:08:48 +02:00
Daniel Stenberg
01d199180a man page cleanups: non-existing functions need no man pages 2011-07-16 00:22:00 +02:00
Daniel Stenberg
7e18862eae libssh2_new_host_entry.3: removed
This is just junk leftovers.
2011-07-16 00:17:12 +02:00
Daniel Stenberg
45ffdcfe3c userauth_keyboard_interactive: fix buffer overflow
Partly reverse 566894494b which was simplifying the code far too
much and ended up overflowing a buffer within the LIBSSH2_SESSION
struct. Back to allocating the buffer properly like it used to do.

Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-06/0032.shtml
Reported by: Alfred Gebert
2011-06-29 21:32:50 +02:00
Daniel Stenberg
dadc05fdfd keyboard-interactive man page: cleaned up 2011-06-29 20:49:35 +02:00
Alfred Gebert
733bf877f8 _libssh2_recv(): handle ENOENT error as EAGAIN
A sftp session failed with error "failure establishing ssh session" on
Solaris and HP-UX. Sometimes the first recv() function call sets errno
to ENOENT. In the man pages for recv of Solaris and HP-UX the error
ENOENT is not documented.

I tested Solaris SPARC and x86, HP-UX i64, AIX, Windows and Linux.
2011-06-28 22:43:50 +02:00
Daniel Stenberg
2db7d9c655 agent_list_identities: fix out of scope access
An auto variable out of scope was being referenced and used.

fixes #220
2011-06-20 00:08:51 +02:00
Daniel Stenberg
9a24b03402 _libssh2_wait_socket: fix timeouts for poll() uses 2011-06-20 00:08:51 +02:00
Daniel Stenberg
81d53de4dc windows: inclusion fix
include winsock2.h for all windows compilers
2011-06-04 22:24:41 +02:00
Daniel Stenberg
5b004a4b67 keyb-interactive: add the fixed buffer
Belongs to commit 5668944
2011-05-31 23:35:49 +02:00
Daniel Stenberg
da64618c9a code cleanup: don't use C99/c++ comments
We aim for C89 compliance
2011-05-31 23:35:06 +02:00
Daniel Stenberg
566894494b keyb-interactive: allow zero length fields
Allow zero length fields so they don't cause malloc(0) calls

Avoid free()ing NULL pointers

Avoid a malloc of a fixed 5 byte buffer.
2011-05-31 23:33:56 +02:00
Daniel Stenberg
0723dab4d7 libssh2_channel_process_startup.3: clean up
Remove the references to the macro-fied shortcuts as they have their own
individual man pages.

Made the prototype different and more readable.
2011-05-30 09:28:31 +02:00
Daniel Stenberg
67ba8713a6 man page: fix .BR lines
We don't use \fI etc on .BR lines
2011-05-30 09:26:34 +02:00
Daniel Stenberg
dade304c47 userauth_keyboard_interactive: skip code on zero length auth 2011-05-25 22:39:25 +02:00
Daniel Stenberg
6e8229a221 libssh2_channel_forward_accept.3: mention how to get error
Since this returns a pointer, libssh2_session_last_errno() must be used
to get the actual error code and it wasn't that clear before.
2011-05-17 19:32:56 +02:00
Daniel Stenberg
821fb6ca71 timeout docs: mention they're added in 1.2.9 2011-05-13 22:47:22 +02:00
Daniel Stenberg
59673a111e sftp_write_sliding.c: indent fix
Use the standard indenting and removed CVS leftover comment
2011-05-10 10:17:32 +02:00
zl liu
5b66a5f38d sftp_write_sliding: send the complete file
When reaching the end of file there can still be data left not sent.
2011-05-10 10:16:05 +02:00
Douglas Masterson
ce8f0b29a4 session_startup: init state properly
libssh2_session_startup() didn't set the state correctly so it could get
confused.

Fixes #218
2011-05-05 23:24:40 +02:00
Daniel Stenberg
26dad4590b timeout: added man pages 2011-05-04 23:26:26 +02:00
Daniel Stenberg
4ed1e9d96b BLOCK_ADJUST_ERRNO: move rc to right level
We can't declare the variable within the block and use it in the final
do-while() expression to be properly portable C89.
2011-05-04 23:06:13 +02:00
Matt Lilley
c5ec167881 adds a timeout to blocking calls
Fixes bug #160 as per Daniel's suggestion

Adds libssh2_session_set_timeout() and libssh2_session_get_timeout()
2011-05-04 22:58:21 +02:00
Daniel Stenberg
e652b4c7b8 SCP: fix incorrect error code
After an error occurs in libssh2_scp_recv() or libssh2_scp_send(), the
function libssh2_session_last_error() would return
LIBSSH2_ERROR_SOCKET_NONE on error.

Bug: http://trac.libssh2.org/ticket/216
Patch by: "littlesavage"

Fixes #216
2011-05-02 22:27:29 +02:00
Guenter Knauf
cc84d875eb Updated default (recommended) dependency versions. 2011-04-19 14:21:49 +02:00
Daniel Stenberg
c01737e679 libssh2_session_block_directions: fix mistake
The last LIBSSH2_SESSION_BLOCK_INBOUND should be
LIBSSH2_SESSION_BLOCK_OUTBOUND

And I shortened the short description

Reported by: "drswinghead"
2011-04-17 12:40:43 +02:00
Daniel Stenberg
4825171919 msvcproj: added libs and debug stuff
Added libraries needed to link whether using openssl dynamically or
statically

Added LIBSSH2DEBUG define to debug versions to enable tracing

URL: http://trac.libssh2.org/ticket/215
Patch by: Mark Smith
2011-04-15 14:29:30 +02:00
Daniel Stenberg
d881e7e8ef sftp_write: clean offsets on error
When an error has occurred on FXP_WRITE, we must make sure that the
offset, sent offset and acked counter are reset properly.
2011-04-13 13:59:50 +02:00
Daniel Stenberg
5dc5c80a39 example/.gitignore: ignore built binaries 2011-04-13 11:29:08 +02:00
Daniel Stenberg
9f477073bc sftp_write: flush the packetlist on error
When an error occurs during write, flush the entire list of pending
outgoing SFTP packets.
2011-04-13 10:30:30 +02:00
Daniel Stenberg
78498e0588 keepalive: add first basic man pages
Someone on IRC pointed out that we don't have these documented so I
wrote up a first set based on the information in the wiki:
http://trac.libssh2.org/wiki/KeepAlive
2011-04-13 00:11:41 +02:00
Daniel Stenberg
0b0aa209f6 scp_write_nonblock.c: remove pointless check
libssh2_channel_write() cannot return a value that is larger than the
input length value
2011-04-12 10:46:47 +02:00
Mikhail Gusarov
aa07cdee9a s/\.NF/.nf/ to fix wrong macro name caught by man --warnings 2011-04-09 16:25:19 +02:00
Daniel Stenberg
274fb2169c version: bump to 1.2.9_dev
Also update the copyright year range to include 2011
2011-04-06 12:06:22 +02:00
Daniel Stenberg
f0a37bdadc configure: fix $VERSION
Stop using the $VERSION variable as it seems to be magically used by
autoconfig itself and thus gets set to the value set in AC_INIT()
without us wanting that. $LIBSSH2VER is now the libssh2 version as
detected.

Reported by: Paul Howarth
Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-04/0008.shtml
2011-04-06 12:03:11 +02:00
Daniel Stenberg
1249dd2272 maketgz: use git2news.pl by the correct name 2011-04-05 19:19:49 +02:00
Daniel Stenberg
5633bb4a3b RELEASE-NOTES: synced with fabf1a45ee 2011-04-04 13:32:58 +02:00
Daniel Stenberg
fabf1a45ee NEWS: auto-generated from git
Starting now, the NEWS file is generated from git using the git2news.pl
script. This makes it always accurate and up-to-date, even for daily
snapshots etc.
2011-04-04 13:31:33 +02:00
Daniel Stenberg
2e352d3085 sftp_write: handle FXP_WRITE errors
When an sftp server returns an error back on write, make sure the
function bails out and returns the proper error.
2011-03-30 11:35:37 +02:00
Daniel Stenberg
8c9571b7ba configure: stop using the deprecated AM_INIT_AUTOMAKE syntax 2011-03-15 11:34:41 +01:00
Alexander Lamaison
527c1b2def Support unlimited number of host names in a single line of the known_hosts file.
Previously the code assumed either a single host name or a hostname,ip-address pair.  However, according to the spec [1], there can be any number of comma separated host names or IP addresses.

[1] http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8
2011-03-13 00:29:39 +00:00
Daniel Stenberg
ec934f6dab libssh2_knownhost_readfile.3: clarify return value
This function returns the number of parsed hosts on success, not just
zero as previously documented.
2011-02-26 10:57:56 +01:00
Peter Stuge
516fa7fdd9 Don't save allocated packet size until it has actually been allocated
The allocated packet size is internal state which needs to match reality
in order to avoid problems. This commit fixes #211.
2011-02-26 05:21:01 +01:00
Alfred Gebert
3ce2628140 session_startup: manage server data before server identification
Fix the bug that libssh2 could not connect if the sftp server
sends data before sending the version string.

http://tools.ietf.org/html/rfc4253#section-4.2

"The server MAY send other lines of data before sending the version
string.  Each line SHOULD be terminated by a Carriage Return and Line
Feed.  Such lines MUST NOT begin with "SSH-", and SHOULD be encoded
in ISO-10646 UTF-8 [RFC3629] (language is not specified).  Clients
MUST be able to process such lines."
2011-02-21 23:19:27 +01:00
Alfred Gebert
ad88325b3f fullpacket: decompression only after init
The buffer for the decompression (remote.comp_abstract) is initialised
in time when it is needed.  With this fix decompression is disabled when
the buffer (remote.comp_abstract) is not initialised.

Bug: http://trac.libssh2.org/ticket/200
2011-02-16 13:57:58 +01:00
Daniel Stenberg
2db4863e6e _libssh2_channel_read: store last error
When the transport layer returns EAGAIN this function didn't call
_libssh2_error() which made the last_error not get set.
2011-02-15 23:21:38 +01:00
Daniel Stenberg
691cabc048 sftp_write: clarified the comment header 2011-01-20 09:01:59 +01:00
Daniel Stenberg
90b4b4073f sftp_read: avoid wrapping counter to insanity
As pointed out in bug #206, if a second invoke of libssh2_sftp_read()
would shrink the buffer size, libssh2 would go nuts and send out read
requests like crazy. This was due to an unsigned variable turning
"negative" by some wrong math, and that value would be the amount of
data attempt to pre-buffer!

Bug: http://trac.libssh2.org/ticket/206
2011-01-17 22:39:47 +01:00
Daniel Stenberg
8ce9a66ccf sftp_packet_read: use 32bit variables for 32bit data 2011-01-09 00:34:09 +01:00
Daniel Stenberg
7015488150 libssh2_sftp_stat_ex.3: cleaned up, extended
Removed the macros from it as they have their own man pages.

Added the LIBSSH2_SFTP_ATTRIBUTES struct in here for easier reference.
2011-01-06 00:30:32 +01:00
Daniel Stenberg
164838c7dd sftp_readdir: return error if buffer is too small
If asked to read data into a buffer and the buffer is too small to hold
the data, this function now returns an error instead of as previously
just copy as much as fits.
2011-01-04 14:30:04 +01:00
Daniel Stenberg
f9b1b95059 sftp_symlink: return error if receive buffer too small
and clean up some variable type mismatches

Discussion: http://www.libssh2.org/mail/libssh2-devel-archive-2011-01/0001.shtml
2011-01-04 14:15:57 +01:00
Daniel Stenberg
59207291fc docs: clarify what happens with a too small buffer
This flaw is subject to change, but I figured it might be valuable to
users of existing code to know how it works.
2011-01-03 00:07:44 +01:00
Daniel Stenberg
0da37e0924 channel_request_pty_size: fix reqPTY_state
The state variable isn't properly set so every other call to the
function fails!

Bug: http://libssh2.org/mail/libssh2-devel-archive-2010-12/0096.shtml
Reported by: Steve Legg
2011-01-01 16:16:32 +01:00
Daniel Stenberg
4552c73cd5 data size: cleanup
Fix 64bit warnings by using (s)size_t and dedicated uint32_t types more.
2010-12-30 00:09:53 +01:00
Pierre Joye
306929ee80 ssize_t: proper typedef with MSVC compilers
As discussed on the mailing list, it was wrong for win64 and using the
VC-provided type is the safest approach instead of second- guessing
which one it should be.
2010-12-29 23:22:00 +01:00
Guenter Knauf
326f741a52 Updated OpenSSL version. 2010-12-22 14:39:59 +01:00
Guenter Knauf
aa4f861643 Expanded tabs to spaces. 2010-12-22 14:27:55 +01:00
Joey Degges
fd691deb17 _libssh2_ntohu64: fix conversion from network bytes to uint64
Cast individual bytes to uint64 to avoid overflow in arithmetic.
2010-12-21 13:15:42 +01:00
Daniel Stenberg
20da09932e libssh2_userauth_list: language fix
"faily" is not a good English word, and I also cleaned up some other minor
mistakes
2010-12-20 14:22:07 +01:00
Daniel Stenberg
3ab7af095a crypto: unify the generic functions
Added crypto.h that is the unified header to include when using crypto
functionality. It should be the only header that needs to adapt to the
underlying crypto library in use. It provides the set of prototypes that
are library agnostic.
2010-12-19 00:00:50 +01:00
Mark Smith
5b1a7ec2f1 userauth: derive publickey from private
Pass a NULL pointer for the publickey parameter of
libssh2_userauth_publickey_fromfile and
libssh2_userauth_hostbased_fromfile functions.  In this case, the
functions recompute the public key from the private key file data.

This is work done by Jean-Louis CHARTON
<Jean-Louis.CHARTON@oikialog.com>, then adapted by Mark Smith and
slightly edited further by me Daniel.

WARNING: this does leave the feature NOT WORKING when libssh2 is built
to use libgcrypt instead of OpenSSL simply due to lack of
implementation.
2010-12-18 23:38:08 +01:00
Daniel Stenberg
5ee38702a0 ssh2_echo: Value stored to 'exitcode' is never read 2010-12-15 21:58:43 +01:00
Daniel Stenberg
2165ceacd3 _libssh2_packet_add: fix SSH_MSG_DEBUG weirdness
I believe I may have caused this weird typo style error when I cleaned
up this function a while ago. Corrected now.
2010-12-15 21:57:06 +01:00
Daniel Stenberg
121237ce2f uint32: more longs converted to proper types
I also moved the MAC struct over to the mac.h header file and made sure
that the users of that struct include that file.
2010-12-15 09:52:18 +01:00
Daniel Stenberg
b3e832172b SFTP: more types to uint32_t
The 'num_names' field in the SSH_FXP_NAME response is an unsigned 32bit
value so we make sure to treat it like that.
2010-12-15 09:31:37 +01:00
Daniel Stenberg
3faa8bc940 SFTP: request_ids are uint32_t
I went over the code and made sure we use uint32_t all over for the
request_id data. It is an unsigned 32bit value on the wire.
2010-12-15 09:27:00 +01:00
Daniel Stenberg
2f0c0cef76 SFTP: store request_id separately in packets
By using a new separate struct for incoming SFTP packets and not sharing
the generic packet struct, we can get rid of an unused field and add a
new one dedicated for holding the request_id for the incoming
package. As sftp_packet_ask() is called fairly often, a "mere" integer
comparison is MUCH faster than the previous memcmp() of (typically) 5
bytes.
2010-12-14 23:49:51 +01:00
Daniel Stenberg
75909e05a9 libssh2_sftp_open_ex: man page extended and cleaned up
I added the missing documentation for the 'flags' argument.
2010-12-14 15:06:04 +01:00
Daniel Stenberg
47b4e62780 SFTP: unify the READ/WRITE chunk structs 2010-12-14 13:29:41 +01:00
Daniel Stenberg
1b1ff333e4 SFTP: fix memory leaks
Make sure that we cleanup remainders when the handle is closed and when
the subsystem is shutdown.

Existing flaw: if a single handle sends packets that haven't been
replied to yet at the time when the handle is closed, those packets will
arrive later and end up in the generic packet brigade queue and they
will remain in there until flushed. They will use unnecessary memory,
make things slower and they will ruin the SFTP handling if the
request_id counter ever wraps (highly unlikely to every happen).
2010-12-14 11:46:53 +01:00
Daniel Stenberg
c1683ae92c sftp_close_handle: packet list is generic
Fix comment, simplify the loop logic
2010-12-14 09:33:58 +01:00
Daniel Stenberg
1b65c6ae26 sftp_read: pipeline reads
The SFTP read function now does transfers the same way the SFTP write
function was made to recently: it creates a list of many outgoing
FXP_READ packets that each asks for a small data chunk. The code then
tries to keep sending read request while collecting the acks for the
previous requests and returns the received data.
2010-12-14 09:30:25 +01:00
Daniel Stenberg
92ea3bda60 sftp_write: removed unused variable 2010-12-13 19:02:19 +01:00
Daniel Stenberg
811cce09b5 _libssh2_channel_close: don't call transport read if disconnected
The loop that waits for remote.close to get set may end up looping
forever since session->socket_state gets set to
LIBSSH2_SOCKET_DISCONNECTED by the packet_add() function called from the
transport_read() function and after having been set to
LIBSSH2_SOCKET_DISCONNECTED, the transport_read() function will only
return 0.

Bug: http://trac.libssh2.org/ticket/198
2010-12-11 22:43:22 +01:00
Daniel Stenberg
6875285b71 libssh2_sftp_seek64: new man page
Split off libssh2_sftp_seek64 from the libssh2_sftp_seek man page, and
mentioned that we consider the latter deprecated. Also added a mention
about the dangers of doing seek during writing or reading.
2010-12-11 00:03:42 +01:00
Daniel Stenberg
0cc14be09d sftp_seek: fix
The new SFTP write code caused a regression as the seek function no
longer worked as it didn't set the write position properly.

It should be noted that seeking is STRONGLY PROHIBITED during upload, as
the upload magic uses two different offset positions and the multiple
outstanding packets etc make them sensitive to change in the midst of
operations.

This functionality was just verified with the new example code
sftp_append. This bug was filed as bug #202:

Bug: http://trac.libssh2.org/ticket/202
2010-12-10 23:51:20 +01:00
Daniel Stenberg
499b989d46 sftp_append: new example doing SFTP append 2010-12-10 23:49:16 +01:00
Daniel Stenberg
fa07d9fefc MAX_SFTP_OUTGOING_SIZE: 30000
I ran SFTP upload tests against localhost. It showed that to make the
app reach really good speeds, I needed to do a little code tweak and
change MAX_SFTP_OUTGOING_SIZE from 4000 to 30000. The tests I did before
with the high latency tests didn't show any real difference whatever I
had that size set to.

This number is the size in bytes that libssh2 cuts off the large input
buffer and sends off as an individual sftp packet.
2010-12-06 21:10:10 +01:00
Daniel Stenberg
b0c32a85fc sftp_write_sliding.c: new example
This is an example that is very similar to sftp_write_nonblock.c, with
the exception that this uses

1 - a larger upload buffer

2 - a sliding buffer mechnism to allow the app to keep sending lots of
data to libssh2 without having to first drain the buffer.

These are two key issues to make libssh2 SFTP uploads really perform
well at this point in time.
2010-12-05 00:06:39 +01:00
Daniel Stenberg
7ed7dad3b4 cpp: s/#elsif/#elif
This looks like a typo as #elsif is not really C...
2010-12-02 12:40:59 +01:00
Daniel Stenberg
b215ec0af5 _libssh2_channel_write: revert channel_write() use
The attempts made to have _libssh2_channel_write() accept larger pieces
of data and split up the data by itself into 32700 byte chunks and pass
them on to channel_write() in a loop as a way to do faster operations on
larger data blocks was a failed attempt.

The reason why it is difficult:

The API only allows EAGAIN or a length to be returned. When looping over
multiple blocks to get sent, one block can get sent and the next might
not. And yet: when transport_send() has returned EAGAIN we must not call
it again with new data until it has returned OK on the existing data it
is still working on. This makes it a mess and we do get a much easier
job by simply returning the bytes or EAGAIN at once, as in the EAGAIN
case we can assume that we will be called with the same arguments again
and transport_send() will be happy.

Unfortunately, I think we take a small performance hit by not being able
to do this.
2010-11-13 23:13:21 +01:00
Daniel Stenberg
ac6d0fb706 ssh2_echo: new example
This is a new example snippet. The code is largely based on ssh2_exec,
and is written by Tommy Lindgren. I edited it into C90 compliance and to
conform to libssh2 indent style and some more.
2010-11-13 23:11:39 +01:00
Daniel Stenberg
e87293d480 send_existing: return after send_existing
When a piece of data is sent from the send_existing() function we must
make the parent function return afterwards. Otherwise we risk that the
parent function tries to send more data and ends up getting an EGAIN for
that more data and since it can only return one return code it doesn't
return info for the successfully sent data.

As this change is a regression I now added a larger comment explaining
why it has to work like this.
2010-11-13 12:25:06 +01:00
Daniel Stenberg
a3ce1073c4 _libssh2_channel_write: count resent data as written
In the logic that resends data that was kept for that purpose due to a
previous EAGAIN, the data was not counted as sent causing badness.
2010-11-13 12:23:23 +01:00
Peter Stuge
97a1881749 Use fprintf(stderr, ) instead of write(2, ) for debugging 2010-11-13 02:06:41 +01:00
Peter Stuge
80f7508d55 session/transport: Correctly handle when _libssh2_send() returns -EAGAIN 2010-11-13 01:53:39 +01:00
Peter Stuge
e8c44e789f src/agent.c: Simplify _libssh2_send() error checking ever so slightly 2010-11-13 01:50:24 +01:00
Daniel Stenberg
ca2e81eb1f send/recv: use _libssh2_recv and _libssh2_send now
Starting now, we unconditionally use the internal replacement functions
for send() and recv() - creatively named _libssh2_recv() and
_libssh2_send().

On errors, these functions return the negative 'errno' value instead of
the traditional -1. This design allows systems that have no "natural"
errno support to not have to invent it. It also means that no code
outside of these two transfer functions should use the errno variable.
2010-11-12 21:53:35 +01:00
Daniel Stenberg
aff9c825c8 channel_write: move some logic to _libssh2_channel_write
Some checks are better done in _libssh2_channel_write just once per
write instead of in channel_write() since the looping will call the
latter function multiple times per _libssh2_channel_write() invoke.
2010-11-12 15:15:46 +01:00
Daniel Stenberg
7899d28ecb sftp_write: handle "left over" acked data
The SFTP handle struct now buffers number of acked bytes that haven't
yet been returned. The way this is used is as following:

1. sftp_write() gets called with a buffer of let say size 32000. We
split 32000 into 8 smaller packets and send them off one by one. One of
them gets acked before the function returns so 4000 is returned.

2. sftp_write() gets called again a short while after the previous one,
now with a much smaller size passed in to the function. Lets say 8000.
In the mean-time, all of the remaining packets from the previous call
have been acked (7*4000 = 28000). This function then returns 8000 as all
data passed in are already sent and it can't return any more than what
it got passed in. But we have 28000 bytes acked. We now store the
remaining 20000 in the handle->u.file.acked struct field to add up in
the next call.

3. sftp_write() gets called again, and now there's a backlogged 20000
bytes to return as fine and that will get skipped from the beginning
of the buffer that is passed in.
2010-11-11 11:57:35 +01:00
Daniel Stenberg
2f5a2ff8e6 sftp_write: polished and simplified
Removed unnecessary struct fields and state changes within the function.

Made the loop that checks for ACKs only check chunks that were fully
sent.
2010-11-10 23:29:16 +01:00
Daniel Stenberg
160453cee4 SCP: on failure, show the numerical error reason
By calling libssh2_session_last_errno()
2010-11-10 17:26:38 +01:00
Daniel Stenberg
82fa5d2167 SFTP: provide the numerical error reason on failure 2010-11-10 17:26:02 +01:00
Daniel Stenberg
1c3e1c4d25 SCP: clean up failure treatment
When SCP send or recv fails, it gets a special message from the server
with a warning or error message included. We have no current API to
expose that message but the foundation is there. Removed unnecessary use
of session struct fields.
2010-11-10 17:17:32 +01:00
Daniel Stenberg
1d2a5b8456 sftp_write: enlarge buffer to perform better 2010-11-10 15:00:55 +01:00
Daniel Stenberg
1d11d02aa9 packets: code cleanup
I added size checks in several places. I fixed the code flow to be easier
to read in some places.

I removed unnecessary zeroing of structs. I removed unused struct fields.
2010-11-10 14:56:14 +01:00
Daniel Stenberg
f4ad3e0120 LIBSSH2_CALLBACK_MACERROR: clarify return code use 2010-11-10 14:41:56 +01:00
Daniel Stenberg
772564650d _libssh2_userauth_publickey: avoid shadowing 2010-11-10 13:28:33 +01:00
Daniel Stenberg
05ba8db8aa packet: avoid shadowing global symbols 2010-11-10 13:06:39 +01:00
Daniel Stenberg
1964ccb557 sftp_readdir: avoid shadowing 2010-11-10 13:05:08 +01:00
Daniel Stenberg
bef0ce5392 shadowing: don't shadow the global compress 2010-11-10 13:04:30 +01:00
Daniel Stenberg
fb6afd01a1 _libssh2_packet_add: turn ifs into a single switch 2010-11-10 12:21:48 +01:00
Daniel Stenberg
a302428335 _libssh2_packet_add: check SSH_MSG_GLOBAL_REQUEST packet 2010-11-09 19:59:18 +01:00
Daniel Stenberg
7ad152a6b2 _libssh2_packet_add: SSH_MSG_DEBUG length checks
Verify lengths before using them. Read always_display from the correct
index. Don't copy stuff around just to provide zero-termination of the
strings.
2010-11-09 15:07:32 +01:00
Daniel Stenberg
075ff19574 _libssh2_packet_add: SSH_MSG_IGNORE skip memmove
There's no promise of a zero termination of the data in the callback so
no longer perform ugly operation in order to provide it.
2010-11-09 14:57:36 +01:00
Daniel Stenberg
16f46c1cfc _libssh2_packet_add: SSH_MSG_DISCONNECT length checks
Verify lengths before trying to read data.
2010-11-09 14:53:44 +01:00
Daniel Stenberg
aa2fdb3e7e indent: break lines at 80 columns 2010-11-09 14:32:02 +01:00
Daniel Stenberg
8f10da89c5 SSH_MSG_CHANNEL_OPEN_FAILURE: used defined values
We don't like magic numbers in the code. Now the acceptable failure
codes sent in the SSH_MSG_CHANNEL_OPEN_FAILURE message are added as
defined values in the private header file.
2010-11-09 14:28:29 +01:00
Daniel Stenberg
2dfa5d38cb sftp_write: don't return EAGAIN if no EAGAIN was received
This function now only returns EAGAIN if a lower layer actually returned
EAGAIN to it. If nothing was acked and no EAGAIN was received, it will
now instead return 0.
2010-11-09 13:09:08 +01:00
Daniel Stenberg
095e9e7b3e _libssh2_wait_socket: detect nothing-to-wait-for
If _libssh2_wait_socket() gets called but there's no direction set to
wait for, this causes a "hang". This code now detects this situation,
set a 1 second timeout instead and outputs a debug output about it.
2010-11-09 13:07:15 +01:00
Daniel Stenberg
588c8946fc decomp: remove the free_dest argument
Since the decompress function ALWAYS returns allocated memory we get a
lot simpler code by removing the ability to return data unallocated.
2010-11-03 15:03:57 +01:00
Daniel Stenberg
a6fc9aeec9 decomp: cleaned off old compression stuff
I cleared off legacy code from when the compression and decompression
functions were a single unified function. Makes the code easier to read
too.
2010-11-03 14:52:42 +01:00
TJ Saunders
7603c0f854 decomp: increase decompression buffer sizes 2010-11-03 14:45:52 +01:00
TJ Saunders
8974dc05ae zlib: Add debug tracing of zlib errors 2010-11-03 14:42:44 +01:00
Daniel Stenberg
6395a738fd sftp_packet_read: handle partial reads of the length field
SFTP packets come as [32 bit length][payload] and the code didn't
previously handle that the initial 32 bit field was read only partially
when it was read.
2010-11-02 19:14:33 +01:00
Jasmeet Bagga
73be9fab04 kex_agree_hostkey: fix NULL pointer derefence
While setting up the session, ssh tries to determine the type of
encryption method it can use for the session. This requires looking at
the keys offered by the remote host and comparing these with the methods
supported by libssh2 (rsa & dss). To do this there is an iteration over
the array containing the methods supported by libssh2.

If there is no agreement on the type of encryption we come to the 3rd
entry of the hostkeyp array. Here hostkeyp is valid but *hostkep is
NULL. Thus when we dereference that in (*hostkeyp)->name there is a
crash
2010-11-02 00:02:25 +01:00
Daniel Stenberg
753e55ef23 _libssh2_transport_send: remove dead assignment
'data' isn't accessed beyond this point so there's no need to assign it.
2010-11-01 23:00:07 +01:00
Daniel Stenberg
4760e4d051 scp_recv: remove dead assignment
Instead of assigning a variable we won't read, we now use the more
explicit (void) prefix.
2010-11-01 22:59:15 +01:00
Daniel Stenberg
57af0da9f7 sftp_write: removed superfluous assignment 2010-11-01 22:58:47 +01:00
Daniel Stenberg
024b5d29f5 bugfix: avoid use of uninitialized value 2010-11-01 22:58:12 +01:00
Daniel Stenberg
a0dd0c5992 sftp_packet_require: propagate error codes better
There were some chances that they would cause -1 to get returned by
public functions and as we're hunting down all such occurances and since
the underlying functions do return valuable information the code now
passes back proper return codes better.
2010-11-01 09:33:36 +01:00
Alfred Gebert
92d308c157 fix memory leaks (two times cipher_data) for each sftp session 2010-10-27 23:17:16 +02:00
Daniel Stenberg
4ae71b4838 libssh2_userauth_authenticated: make it work as documented
The man page clearly says it returns 1 for "already authenticated" but
the code said non-zero. I changed the code to use 1 now, as that is also
non-zero but it gets the benefit that it now matches the documentation.

Using 1 instead of non-zero is better for two reasons:

1. We have the opportunity to introduce other return codes in the future for
   things like error and what not.
2. We don't expose the internal bitmask variable value.
2010-10-27 22:59:32 +02:00
Daniel Stenberg
ba190d34c6 userauth_keyboard_interactive: fix indent 2010-10-27 22:58:39 +02:00
Alfred Gebert
b84f69c960 fix memory leak in userauth_keyboard_interactive()
First I wanted to free the memory in session_free() but then
I had still memory leaks because in my test case the function
userauth_keyboard_interactive() is called twice. It is called
twice perhaps because the server has this authentication
methods available: publickey,gssapi-with-mic,keyboard-interactive
The keyboard-interactive method is successful.
2010-10-27 22:47:34 +02:00
Daniel Stenberg
a7aee34522 dist: include sftp.h in dist archives 2010-10-27 14:51:25 +02:00
Simon Josefsson
1dc366109d Update header to match new function prototype, see c48840ba88. 2010-10-27 11:45:07 +02:00
Daniel Stenberg
e1ea2eb7c2 bugfixes: the transport rearrange left some subtle flaws now gone 2010-10-26 00:14:31 +02:00
Daniel Stenberg
610a8ab919 libssh2_userauth_publickey_fromfile_ex.3: cleaned up looks 2010-10-25 23:44:39 +02:00
Daniel Stenberg
8ec21e0afe libssh2_userauth_publickey: add man page
I found an undocumented public function and we can't have it like
that. The description here is incomplete, but should serve as a template
to allow filling in...
2010-10-25 23:18:50 +02:00
Daniel Stenberg
8e0983347b libssh2_sftp_write.3: added blurb about the "write ahead"
Documented the new SFTP write concept
2010-10-25 16:38:37 +02:00
Daniel Stenberg
95db6cc62c sftp_close_handle: free any trailing write chunks 2010-10-25 16:30:09 +02:00
Daniel Stenberg
727043074a _libssh2_channel_write: fix warnings 2010-10-25 16:07:46 +02:00
Daniel Stenberg
5b4ed2717b SFTP: bufgix, move more sftp stuff to sftp.h
The sftp_write function shouldn't assume that the buffer pointer will be
the same in subsequent calls, even if it assumes that the data already
passed in before haven't changed.

The sftp structs are now moved to sftp.h (which I forgot to add before)
2010-10-25 16:05:53 +02:00
Daniel Stenberg
59f74de157 SFTP: use multiple outgoing packets when writing
sftp_write was rewritten to split up outgoing data into multiple packets
and deal with the acks in a more asynchronous manner. This is meant to
help overcome latency and round-trip problems with the SFTP protocol.
2010-10-25 01:43:54 +02:00
Daniel Stenberg
d87562976a TODO: implemented a lot of the ideas now 2010-10-24 23:38:26 +02:00
Daniel Stenberg
a94886f157 _libssh2_channel_write: removed 32500 size limit
Neither _libssh2_channel_write nor sftp_write now have the 32500 size
limit anymore and instead the channel writing function now has its own
logic to send data in multiple calls until everything is sent.
2010-10-23 01:16:12 +02:00
Daniel Stenberg
dec0ea9e70 send_existing: don't tell parent to return when drained
That will just cause unnecessary code execution.
2010-10-23 00:47:51 +02:00
Daniel Stenberg
030b2d9b60 _libssh2_channel_write: general code cleanup
simplified the function and removed some unused struct fields
2010-10-23 00:35:10 +02:00
Daniel Stenberg
c48840ba88 _libssh2_transport_send: replaces _libssh2_transport_write
The new function takes two data areas, combines them and sends them as a
single SSH packet. This allows several functions to allocate and copy
less data.

I also found and fixed a mixed up use of the compression function
arguments that I introduced in my rewrite in a recent commit.
2010-10-23 00:11:59 +02:00
Daniel Stenberg
d9cdd8c0a7 scp_write_nonblock: use select() instead of busyloop
Make this example nicer by not busylooping.
2010-10-22 13:37:14 +02:00
Daniel Stenberg
c49061e708 send_existing: clear olen when the data is sent off 2010-10-22 13:37:14 +02:00
Daniel Stenberg
d674b1a09a _libssh2_transport_write: allow 256 extra bytes around the packet 2010-10-22 13:37:13 +02:00
Daniel Stenberg
5ede32a826 _libssh2_transport_write: remade to send without malloc 2010-10-22 13:37:13 +02:00
Daniel Stenberg
3a391f6cf2 compress: compression disabled by default
We now allow libssh2_session_flag() to enable compression with a new
flag and I added documentation for the previous LIBSSH2_FLAG_SIGPIPE
flag which I wasn't really aware of!
2010-10-22 13:37:13 +02:00
Daniel Stenberg
64063d5f0b comp: split the compress function
It is now made into two separate compress and decompress functions. In
preparation for upcoming further modficications.
2010-10-22 13:37:13 +02:00
Dan Fandrich
784db8e987 Added header file to allow compiling in older environments 2010-10-20 22:19:38 -07:00
Daniel Stenberg
84efbf788f TODO: add a possible new API for SFTP transfers 2010-10-20 23:16:26 +02:00
Daniel Stenberg
f805c2db2a TODO: "New Transport API" added 2010-10-20 23:16:26 +02:00
Daniel Stenberg
08ce6425f6 TODO: add buffering plans 2010-10-20 23:16:26 +02:00
Simon Josefsson
fac9412a74 Mention libssh2_channel_get_exit_signal and give kudos. 2010-10-13 15:33:13 +02:00
Tommy Lindgren
4d15e0c9d1 Add libssh2_channel_get_exit_signal man page.
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2010-10-13 15:31:53 +02:00
Tommy Lindgren
6140ec2de3 Add libssh2_channel_get_exit_signal.
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2010-10-13 15:31:06 +02:00
Simon Josefsson
70d6bd6c6f Add libssh2_free man page and fix typo. 2010-10-13 15:24:18 +02:00
Simon Josefsson
98e38c4f3a Add libssh2_free. 2010-10-13 15:19:12 +02:00
Daniel Stenberg
cd6d41b806 scp_recv: improved treatment of channel_read() returning zero
As a zero return code from channel_read() is not an error we must make
sure that the SCP functions deal with that properly. channel_read()
always returns 0 if the channel is EOFed already so we check for EOF
after 0-reads to be able to return error properly.
2010-10-11 22:54:24 +02:00
Daniel Stenberg
c36f379b88 libssh2_session_methods.3: detail what can be asked for 2010-10-10 23:51:22 +02:00
Daniel Stenberg
77a9335515 compression: send zlib before none
As the list of algorithms in a preferred order we should send zlib
before none to increase the chances that the server will let us do
compression.
2010-10-08 17:06:55 +02:00
Daniel Stenberg
59636cc11e compress: faster check, better return codes
In the transport functions we avoid a strcmp() now and just check a
boolean instead.

The compress/decompress function's return code is now acknowledged and
used as actual return code in case of failures.
2010-10-08 16:26:50 +02:00
Daniel Stenberg
0d58af6aec libssh2_session_handshake: replaces libssh2_session_startup()
The function libssh2_session_startup() is now considered deprecated due
to the portability issue with the socket argument.
libssh2_session_handshake() is the name of the replacement.
2010-10-07 19:56:12 +02:00
Daniel Stenberg
c34e1d8735 libssh2_socket_t: now externally visible
In preparation for upcominig changes, the libssh2_socket_t type is now
typedef'ed in the public header.
2010-10-07 15:33:24 +02:00
Daniel Stenberg
861fc75fa3 _libssh2_transport_drain: removed
This function proved not to be used nor useful.
2010-10-07 13:30:05 +02:00
Daniel Stenberg
f4d302fdfe _libssh2_channel_write: don't iterate over transport writes
When a call to _libssh2_transport_write() succeeds, we must return from
_libssh2_channel_write() to allow the caller to provide the next chunk
of data.

We cannot move on to send the next piece of data that may already have
been provided in this same function call, as we risk getting EAGAIN for
that and we can't return information both about sent data as well as
EAGAIN. So, by returning short now, the caller will call this function
again with new data to send.
2010-10-07 13:28:49 +02:00
Daniel Stenberg
4faf67d3e9 _libssh2_transport_write: updated documentation blurb 2010-10-07 13:17:28 +02:00
Daniel Stenberg
76a30f2c6f _libssh2_transport_write: remove fprintf remainder
Mistake from previous debugging
2010-10-07 12:57:08 +02:00
Daniel Stenberg
bcd7eee1d2 session: improved errors
Replaced -1/SOCKET_NONE errors with appropriate error defines instead.

Made the verbose trace output during banner receiving less annoying for
non-blocking sessions.
2010-10-07 11:21:56 +02:00
Daniel Stenberg
046ad88d88 crypt_init: use correct error define 2010-10-07 11:21:20 +02:00
Daniel Stenberg
9887c01103 _libssh2_error: hide EAGAIN for non-blocking sessions
In an attempt to make the trace output less cluttered for non-blocking
sessions the error function now avoids calling the debug function if the
error is the EAGAIN and the session is non-blocking.
2010-10-07 11:19:51 +02:00
Daniel Stenberg
822f9e8689 agent: use better error defines 2010-10-07 11:19:35 +02:00
Daniel Stenberg
3ee2aabd7a comp_method_zlib_init: use correct error defines 2010-10-07 11:19:15 +02:00
Daniel Stenberg
7c49c8be58 transport: better error codes
LIBSSH2_SOCKET_NONE (-1) should no longer be used as error code as it is
(too) generic and we should instead use specific and dedicated error
codes to better describe the error.
2010-10-07 11:18:14 +02:00
Daniel Stenberg
665d9ee885 channel: return code and _libssh2_error cleanup
Made sure that all transport_write() call failures get _libssh2_error
called.
2010-10-07 11:16:49 +02:00
Daniel Stenberg
b3d6c6567d _libssh2_channel_write: limit to 32700 bytes
The well known and used ssh server Dropbear has a maximum SSH packet
length at 32768 by default. Since the libssh2 design current have a
fixed one-to-one mapping from channel_write() to the packet size created
by transport_write() the previous limit of 32768 in the channel layer
caused the transport layer to create larger packets than 32768 at times
which Dropbear rejected forcibly (by closing the connection).

The long term fix is of course to remove the hard relation between the
outgoing SSH packet size and what the input length argument is in the
transport_write() function call.
2010-10-07 11:11:59 +02:00
Daniel Stenberg
7dd574c353 libssh.h: add more dedicated error codes 2010-10-07 11:10:28 +02:00
Daniel Stenberg
018602cb34 SCP: allow file names with bytes > 126
When parsing the SCP protocol and verifying that the data looks like a
valid file name, byte values over 126 must not be consider illegal since
UTF-8 file names will use such codes.

Reported by: Uli Zappe
Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2010-08/0112.shtml
2010-08-31 19:56:00 +02:00
Dan Fandrich
eec7f2fb63 Document the three sftp stat constants 2010-08-25 17:10:06 -07:00
Guenter Knauf
c32b0d164e Fixed Win32 makefile which was now broken at resource build. 2010-08-18 17:22:33 +02:00
Guenter Knauf
835c03e076 It is sufficient to pipe stderr to NUL to get rid of the nasty messages. 2010-08-18 16:59:21 +02:00
Author: Guenter Knauf
6c6c43f92c Removed Win32 ifdef completely for sys/uio.h.
No idea why we had this ifdef at all but MSVC, MingW32, Watcom
and Borland all have no sys/uio.h header; so if there's another
Win32 compiler which needs it then it should be added explicitely
instead of this negative list.
2010-08-18 16:40:03 +02:00
Guenter Knauf
5af87e8c80 New files should also be added to Makefile.am.
Otherwise they will never be included with release and snapshot tarballs ...
2010-08-18 14:59:03 +02:00
Daniel Stenberg
10a65fda01 version: bump to 1.2.8_DEV 2010-08-18 00:20:10 +02:00
Daniel Stenberg
8d9d3e0d7a release: updated to hold 1.2.7 info 2010-08-17 23:10:54 +02:00
Guenter Knauf
c46abb2663 Use the new libssh2.rc file. 2010-08-17 01:58:39 +02:00
Guenter Knauf
0a34fa79f0 Added resource file for libssh2.dll (shamelessly stolen from libcurl). 2010-08-17 01:54:20 +02:00
Guenter Knauf
43001570d6 Updated Win32 MSVC dependencies versions. 2010-08-17 01:35:55 +02:00
Guenter Knauf
4b878e7cf8 Added include for sys/select.h to get fd.set on some platforms. 2010-08-17 01:34:32 +02:00
Guenter Knauf
ac709e0d4f Added Watcom makefile borrowed from libcurl.
This makefile compiles already all files fine for static lib, but needs
final touch when I have OpenSSL fully working with shared libs and Watcom.
2010-08-16 16:10:07 +02:00
Guenter Knauf
56d0877f07 Added copyright define to libssh2.h and use it for binary builds. 2010-08-15 04:09:01 +02:00
Guenter Knauf
51a8335486 Moved version defines up in order to include from .rc file.
Blocked rest of header with ifndef so its possible to let
the rc compiler only use the version defines.
2010-08-15 03:38:49 +02:00
Guenter Knauf
2bd9418ac7 Some minor makefile tweaks. 2010-08-14 21:56:37 +02:00
Daniel Stenberg
4b8013a8a7 example: treat the libssh2_channel_read() return code properly
A short read is not an error. Only negative values are errors!
2010-08-02 00:20:24 +02:00
Daniel Stenberg
697b4e8ed7 libssh2_wait_socket: reset error code to "leak" EAGAIN less
Since libssh2 often sets LIBSSH2_ERROR_EAGAIN internally before
_libssh2_wait_socket is called, we can decrease some amount of
confusion in user programs by resetting the error code in this function
to reduce the risk of EAGAIN being stored as error when a blocking
function returns.
2010-07-18 19:47:21 +02:00
Daniel Stenberg
2afa5b2dc2 _libssh2_wait_socket: poll needs milliseconds
As reported on the mailing list, the code path using poll() should
multiple seconds with 1000 to get milliseconds, not divide!

Reported by: Jan Van Boghout
2010-07-17 19:20:20 +02:00
Daniel Stenberg
992aff7aca typedef: make ssize_t get typedef without LIBSSH2_WIN32
The condition around the ssize_t typedef depended on both LIBSSH2_WIN32
*and* _MSC_VER being defined when it should be enough to depend on
_MSC_VER only. It also makes it nicer so libssh2-using code builds fine
without having custom defines.
2010-07-06 16:17:59 +02:00
John Little
ef4c8718c2 session_free: free more data to avoid memory leaks 2010-07-01 19:56:06 +02:00
Daniel Stenberg
c375e5e5ad channel_free: ignore problems with channel_close()
As was pointed out in bug #182, we must not return failure from
_libssh2_channel_free() when _libssh2_channel_close() returns an error
that isn't EAGAIN. It can effectively cause the function to never go
through, like it did now in the case where the socket was actually
closed but socket_state still said LIBSSH2_SOCKET_CONNECTED.

I consider this fix the right thing as it now also survives other
errors, even if making sure socket_state isn't lying is also a good
idea.
2010-06-30 22:47:22 +02:00
Daniel Stenberg
46be03f92b publickey_list_free: no return value from a void function
Fixed a compiler warning I introduced previously when checking input
arguments more. I also added a check for the other pointer to avoid NULL
pointer dereferences.
2010-06-30 15:43:31 +02:00
Lars Nordin
1d83b520b4 openssl: make use of the EVP interface
Make use of the EVP interface for the AES-funktion. Using this method
supports the use of different ENGINES in OpenSSL for the AES function
(and the direct call to the AES_encrypt should not be used according to
openssl.org)
2010-06-27 22:23:50 +02:00
Tor Arntsen
f9c0a4a95a Don't overflow MD5 server hostkey
Use SHA_DIGEST_LENGTH and MD5_DIGEST_LENGTH in memcpy instead of hardcoded
values. An incorrect value was used for MD5.
2010-06-23 11:31:04 +02:00
Peter Stuge
7861ae8e4e Fix message length bugs in libssh2_debug()
There was a buffer overflow waiting to happen when a debug message was
longer than 1536 bytes.

Thanks to Daniel who spotted that there was a problem with the message
length passed to a trace handler also after commit
0f0652a309.
2010-06-23 11:16:02 +02:00
Peter Stuge
0f0652a309 Make libssh2_debug() create a correctly terminated string
Also use FILE *stderr rather than fd 2, which can very well be something
completely different.
2010-06-23 10:48:29 +02:00
TJ Saunders
2cc4a629ac handshake: Compression enabled at the wrong time
In KEXINIT messages, the client and server agree on, among other
things, whether to use compression. This method agreement occurs
in src/kex.c's kex_agree_methods() function. However, if
compression is enabled (either client->server, server->client, or
both), then the compression layer is initialized in
kex_agree_methods() -- before NEWKEYS has been received.

Instead, the initialization of the compression layer should
happen after NEWKEYS has been received. This looks to occur
insrc/kex.c's diffie_hellman_sha1(), which even has the comment:

    /* The first key exchange has been performed,

        switch to active crypt/comp/mac mode */

There, after NEWKEYS is received, the cipher and mac algorithms
are initialized, and that is where the compression should be
initialized as well.

The current implementation fails if server->client compression is
enabled because most server implementations follow OpenSSH's
lead, where compression is initialized after NEWKEYS. Since the
server initializes compression after NEWKEYS, but libssh2
initializes compression after KEXINIT (i.e. before NEWKEYS), they
are out of sync.

Reported in bug report #180
2010-06-23 00:03:31 +02:00
TJ Saunders
04f90b2265 userauth_hostbased_fromfile: packet length too short
The packet length calculated in src/userauth.c's
userauth_hostbased_fromfile() function is too short by 4 bytes;
it forgets to add four bytes for the length of the hostname.
This causes hostbased authentication to fail, since the server
will read junk data.

verified against proftpd's mod_sftp module
2010-06-22 23:34:21 +02:00
Daniel Stenberg
7dc2bfac94 _libssh2_userauth_publickey: reject method names longer than the data
This functions get the method length by looking at the first 32
bit of data, and I now made it not accept method lengths that are
longer than the whole data set is, as given in the dedicated
function argument.

This was detected when the function was given bogus public key
data as an ascii string, which caused the first 32bits to create
a HUGE number.
2010-06-20 00:23:28 +02:00
Daniel Stenberg
35cf08e130 NULL resistance: make more public functions survive NULL pointer input
Sending in NULL as the primary pointer is now dealt with by more
public functions. I also narrowed the userauth.c code somewhat to
stay within 80 columns better.
2010-06-18 20:25:03 +02:00
Daniel Stenberg
32bd0df992 agent: make libssh2_agent_userauth() work blocking properly
previously it would always work in a non-blocking manner
2010-06-18 20:13:08 +02:00
Peter Stuge
38940f45d2 Fix underscore typo for 64-bit printf format specifiers on Windows
Commit 49ddf447ff was missing underscores.
2010-06-17 12:23:25 +02:00
Daniel Stenberg
537a00ee4b libssh2_session_callback_set: extended the man page 2010-06-16 00:12:24 +02:00
John
6ddcc493e8 LIBSSH2_DEBUG: macro uses incorrect function variable
The LIBSSH2_DEBUG macro, defined in libssh2_priv.h, incorrectly uses the
function variable ssh_msg_disconnect when it should use ssh_msg_debug.

This shows that the LIBSSH2_CALLBACK_DEBUG callback never has worked...
2010-06-16 00:04:25 +02:00
Daniel Stenberg
3496e1c2a2 warning: fix a compiler warning 'pointer differs in signedness'
As reported in bug #177
2010-06-15 19:51:26 +02:00
Daniel Stenberg
49ddf447ff portability: introduce LIBSSH2_INT64_T_FORMAT for 64bit printf()s
As pointed out in bug #177, some of the Windows compilers use
%I64 to output 64 bit variables with the printf family.
2010-06-15 19:47:31 +02:00
Daniel Stenberg
04d4bbb66b debug: avoid sending NULL to sprintf %s
Via the _libssh2_debug() macro/function. Pointed out by john in bug report
2010-06-15 17:00:02 +02:00
Daniel Stenberg
897f8463d8 sftp docs: show macro on macro page, only function on function page
The individual man pages for macros now show the full convenience
macro as defined, and then the man page for the actual function
only shows the function.
2010-06-14 20:04:29 +02:00
Daniel Stenberg
2fd044fdf5 code police: make the code use less than 80 columns 2010-06-14 17:23:00 +02:00
Daniel Stenberg
20e969d2e0 libssh2_channel_write_ex: remove macros, added wording on buffer size 2010-06-13 17:00:43 +02:00
Daniel Stenberg
33e2bc8785 libssh2_sftp_write: document buffer size and changed some ordering 2010-06-13 17:00:14 +02:00
Daniel Stenberg
d7e6f9cf27 libssh2_channel_write_stderr: show how the macro is defined 2010-06-13 16:59:40 +02:00
Daniel Stenberg
be7cee1b3e libssh2_channel_write: show how the macro is defined 2010-06-13 16:59:18 +02:00
Daniel Stenberg
518d25eba1 SFTP: limit write() to not produce overly large packets
sftp_write() now limits how much data it gets at a time even more
than before. Since this function creates a complete outgoing
packet based on what gets passed to it, it is crucial that it
doesn't create too large packets.

With this method, there's also no longer any problem to use very
large buffers in your application and feed that to libssh2. I've
done numerous tests now with uploading data over SFTP using 100K
buffers and I've had no problems with that.
2010-06-11 16:07:30 +02:00
Daniel Stenberg
1785d0d6f3 scp_write_nonblock: add transfer time info
Using the same timing logic and output format as
sftp_write_nonblock allows us to very easily run benchmarks on
SCP vs SFTP uploads using libssh2.
2010-06-11 16:05:22 +02:00
Daniel Stenberg
31d71a94f2 sftp_write_nonblock: select() on socket, use *BIG* buffer, time transfer
The select() is just to make it nicer so that it doesn't
crazy-loop on EAGAIN. The buffer size thing is mostly to verify
that this really work as supposed.

Transfer timing is just a minor thing, but it can just as well be
there and help us time and work on performance easier using out
of the box examples.
2010-06-11 16:03:33 +02:00
Daniel Stenberg
22a2de7347 agent: use _libssh2_error() when returning errors
As pointed out in bug report #173, this module basically never
used _libssh2_error() which made it work inconstently with other
parts of the libssh2 code base. This is my first take at making
this code more in line with the rest.
2010-06-11 13:32:41 +02:00
Daniel Stenberg
4cf935abab inputchecks: make lots of API functions check for NULL pointers
If an application accidentally provides a NULL handle pointer to
the channel or sftp public functions, they now return an error
instead of segfaulting.
2010-06-11 13:05:55 +02:00
Daniel Stenberg
cce6ebbee7 libssh2_channel_eof: clarify that it returns negative on errors 2010-06-11 13:02:00 +02:00
Daniel Stenberg
18605cb81f SFTP: keep the sftp error code as 32 bit
'last_errno' holds to the error code from the SFTP protocol and
since that is 32 bits on the wire there's no point in using a
long for this internally which is larger on some platforms.
2010-06-11 13:00:31 +02:00
Daniel Stenberg
3490b3fe10 agent: make the code better deal with unexpected code flows
agent->ops gets initialized by the libssh2_agent_connect() call
but we need to make sure that we don't segfault even if a bad
sequence of function calls is used.
2010-06-11 11:13:46 +02:00
Alexander Lamaison
c87a48ae4c Better handling of invalid key files.
Passing an invalid public key to libssh2_userauth_publickey_fromfile_ex
triggered an assertion.  Replaced this with a runtime check that rejects
obviously invalid key data.
2010-06-10 12:25:26 +01:00
Daniel Stenberg
ab8ee8abf3 version: we start working on 1.2.7 now 2010-06-10 10:31:18 +02:00
Daniel Stenberg
6e40af7bea NEWS: add the 1.2.6 release details 2010-06-10 10:19:31 +02:00
Daniel Stenberg
5e46c864dc RELEASE-NOTES: 1.2.6 details added 2010-06-10 10:15:46 +02:00
Guenter Knauf
a4fdf0de01 fixed libssh2.dsw to use the generated libssh2.dsp; removed old *.dsp files. 2010-06-10 02:43:49 +02:00
Guenter Knauf
2c1c751ad1 moved MSVC strdup define to libssh2_config.h which we include already. 2010-06-10 02:31:48 +02:00
Guenter Knauf
f682684fdd added missing source files to src/NMakefile. 2010-06-10 02:28:47 +02:00
Daniel Stenberg
0ad1a52a09 libssh2_poll: refer to poll(3) and select(3) instead 2010-06-08 08:37:37 +02:00
Daniel Stenberg
4e10882e06 example: fix strdup() for MSVC compiles
MSVC has a _strdup() that we better use. This was reported in bug
2010-06-07 13:36:12 +02:00
Daniel Stenberg
eeeebd02e7 SFTP: fail init SFTP if session isn't authenticated
Alexander Lamaison filed bug #172
(http://trac.libssh2.org/ticket/172), and pointed out that SFTP
init would do bad if the session isn't yet authenticated at the
time of the call, so we now check for this situation and returns
an error if detected. Calling sftp_init() at this point is bad
usage to start with.
2010-06-07 13:10:51 +02:00
Daniel Stenberg
f285438022 direct_tcpip: bring back inclusion of libssh2_config.h
In order to increase portability of this example, I'm bringing
the inclusion of libssh2_config.h back, and I also added an
require that header for this example to compile.

I also made all code lines fit within 80 columns.
2010-06-03 13:55:54 +02:00
Guenter Knauf
81912f67e7 cast away a warning. 2010-06-03 05:21:02 +02:00
Guenter Knauf
2996e02482 moved CRT_SECURE_NO_DEPRECATE define up so its defined before the winsock headers are included. 2010-06-03 03:12:20 +02:00
Guenter Knauf
2683fddcca fixed platform detection for MingW32 test makefile. 2010-06-01 21:19:14 +02:00
Guenter Knauf
fa5d6c705d MingW32 has gettimeofday() implemented, so proper ifdef this function here. 2010-06-01 21:09:08 +02:00
Guenter Knauf
b6c6470e7e removed MSVC ifdef since seems we can use __int64 still with latest headers. 2010-06-01 20:24:05 +02:00
Guenter Knauf
dceb3d1452 changed copyright notice for MinW32 and NetWare binaries. 2010-06-01 20:17:05 +02:00
Guenter Knauf
86c935317c cleaned up MSVC ifdefs which where spreaded over 3 places. 2010-06-01 19:32:11 +02:00
Guenter Knauf
aad74b7fa6 added uint8_t typedef for NetWare CLIB platform. 2010-06-01 19:08:19 +02:00
Guenter Knauf
0b593c8a9d if the function declaration gets changed the header should be changed too. 2010-06-01 17:28:46 +02:00
Guenter Knauf
8ff3f62786 this is MSVC specific and doesnt apply for all Win32 compilers;
the uint8_t typedef clashes with MingW32 headers.
2010-06-01 17:15:46 +02:00
Guenter Knauf
4d7b2950d9 updated MingW32 makefiles for latest dependency lib versions. 2010-06-01 16:58:40 +02:00
Guenter Knauf
18569d76de updated NetWare makefiles for latest dependency lib versions. 2010-06-01 16:44:17 +02:00
Dan Fandrich
7a088a8ab7 Fixed compiling with libgcrypt
A change of parameter types from unsigned long to size_t was
missed in the prototype in libgcrypt.h
2010-05-30 22:53:53 -07:00
Daniel Stenberg
d15663477b statvfs: use libssh2_sftp_statvfs only, no "_ex"
As the long-term goal is to get rid of the extensive set of
macros from the API we can just as well start small by not adding
new macros when we add new functions. Therefore we let the
function be libssh2_sftp_statvfs() plainly without using an _ex
suffix.

I also made it use size_t instead of unsigned int for the string
length as that too is a long-term goal for the API.
2010-05-28 17:25:42 +02:00
Grubsky Grigory
8145f9e79c DSP: output lib name typo 2010-05-25 23:28:01 +02:00
Grubsky Grigory
dc747fb221 win32: provide a uint8_t typedef for better building on windows 2010-05-25 23:22:39 +02:00
Daniel Stenberg
76fd96e63e agent: win32: fix bad _libssh2_store_str call
As pointed out by Grubsky Grigory <g.grubsky@securitycode.ru>, I
made a mistake when I added the _libssh2_store_str() call before
and I made a slightly different patch than what he suggested.
Based purely on taste.
2010-05-25 23:19:46 +02:00
Joey Degges
ed526a0e24 Add libssh2_sftp_statvfs() and libssh2_sftp_fstatvfs()
These can be used to get file system statistics from servers that
support the statvfs@openssh.com and fstatvfs@openssh.com extensions.
2010-05-24 07:05:23 +02:00
Jose Baars
667f4acda6 VMS specific: make sure final release can be installed over daily build 2010-05-22 11:06:08 +01:00
Jose Baars
f3208b99ca VMS: small improvement to the man2help utilities 2010-05-22 11:05:29 +01:00
Joey Degges
b702441242 libssh2_exit and libssh2_sftp_readdir man page fixes 2010-05-22 08:30:42 +02:00
Daniel Stenberg
396dcedc56 spelling: s/sue/use 2010-05-21 23:37:43 +02:00
Alexander Lamaison
798a808a2b Change magic port number for generic knownhost check.
libssh2_knownhost_checkp took 0 as a magic port number that indicated
a 'generic' check should be performed.  However, 0 is a valid port
number in its own right so this commit changes the magic value to any
negative int.
2010-05-21 00:01:57 +01:00
Mikhail Gusarov
c8df661129 Add re-discovered copyright holders to COPYING 2010-05-05 15:45:17 +07:00
Mikhail Gusarov
b3ed8e064a Restoring copyright statements from pre-git era
Eli Fant has contributed fragmenting SFTP requests
2010-05-05 15:44:15 +07:00
Mikhail Gusarov
ffb55aa2a3 Restoring my copyright statements from pre-git era
keyboard_interactive, 'exit-status' information packet, non-atomic read/write
under FreeBSD, multi-channel operation bugfixes.
2010-05-05 15:41:19 +07:00
Daniel Stenberg
9251642ef3 pedantic: make the code C90 clean 2010-05-03 22:16:01 +02:00
Peter Stuge
79b97c67c7 Do proper keyboard-interactive user dialog in the sftp.c example 2010-05-03 15:36:16 +02:00
Daniel Stenberg
b23ae2bf22 added to tarball: libssh2_knownhost_checkp.3 2010-05-03 09:45:53 +02:00
Daniel Stenberg
a3f3347c12 knownhost: support [host]:port in knownhost file
OpenSSH has ways to add hosts to the knownhosts file that include
a specific port number which makes the key associated with only
that specific host+port pair. libssh2 previously did not support
this, and I was forced to add a new function to the API to
properly expose this ability to applications:
libssh2_knownhost_checkp()

To *add* such hosts to the knownhosts file, you make sure to pass
on the host name in that manner to the libssh2_knownhost_addc()
function.
2010-05-02 16:56:31 +02:00
Daniel Stenberg
5184aec461 init/exit: mention these were added in 1.2.5 2010-05-01 23:49:45 +02:00
Daniel Stenberg
358aa3e24b libssh2_knownhost_check docs: correct the prototype 2010-05-01 23:35:16 +02:00
Daniel Stenberg
7bbefe0660 examples: avoid use of uninitialized variable 'sock' 2010-04-30 12:30:24 +02:00
Daniel Stenberg
204100e636 KEX: stop pretending we negotiate language
There was some stub-like parts of an implementation for
implementing kex language negotiation that caused clang-analyzer
to warn and as it did nothing I've now removed the dead code.
2010-04-29 23:57:47 +02:00
Daniel Stenberg
6c85370428 Uninitialized argument 2010-04-29 22:01:32 +02:00
Daniel Stenberg
23f02aad11 sftpdir: removed dead assignment 2010-04-29 22:00:05 +02:00
Daniel Stenberg
eb7581e72e Makefile.am: include the VMS-specific config header as well 2010-04-29 20:28:56 +02:00
Jose Baars
a16d67e250 Add VMS specific libssh2_config.h 2010-04-29 20:28:02 +02:00
Daniel Stenberg
ab81b75a8e fix Value stored to 's' is never read warning
and moved variable declaration of s to be more local
2010-04-28 23:28:26 +02:00
Daniel Stenberg
0c918ef72a kexinit: simplify the code and avoid scan-build warning
Previously it would say "Value stored to 's' is never read" due
fourth increment of 's'.
2010-04-28 23:28:26 +02:00
Alexander Lamaison
6c3f2ec815 Removed unecessary brackets. 2010-04-28 17:41:17 +01:00
Alexander Lamaison
f1df0b7fbc Changed sftp_attrsize macro to a static function. 2010-04-28 17:38:00 +01:00
Daniel Stenberg
6f895e3298 release: include the VMS-specific files 2010-04-28 13:28:54 +02:00
Daniel Stenberg
45210d8376 sftp_attrsize: protect the macro argument with proper parentheses 2010-04-28 10:23:40 +02:00
Daniel Stenberg
6a44eff0b5 ssh2_agent: avoid using 'session' uninitialized on failures 2010-04-28 09:13:22 +02:00
Daniel Stenberg
0862a1a39a examples: remove assignments of variable rc that's never used 2010-04-28 09:05:19 +02:00
Daniel Stenberg
514f4d9305 publickey_init: remove useless variable increment 2010-04-28 08:59:17 +02:00
Daniel Stenberg
d5d80d296a hostkey_method_ssh_rsa_init: remove useless variable increment 2010-04-28 08:57:56 +02:00
Daniel Stenberg
568060d266 packet_x11_open: removed useless variable increment
and made the declaration of a variable more local
2010-04-28 08:48:50 +02:00
Daniel Stenberg
6e2a0e603a packet_queue_listener: removed useless variable increment
and made the declaration of a variable more local
2010-04-28 08:47:30 +02:00
Daniel Stenberg
d811478071 sftp_read: move a read_responses array to where its used
I find that this increases readability since the array is used
only in the function call just immediately below and nowhere
else.
2010-04-28 00:39:23 +02:00
Daniel Stenberg
b979af1eee sftp_readdir: turn a small array static const and move it 2010-04-28 00:38:22 +02:00
Daniel Stenberg
37624b61e3 sftp_attrsize: converted function to a macro
This way, the macro can evaluate a static number at compile time
for two out of four uses, and it probably runs faster for the
other two cases too.
2010-04-28 00:23:09 +02:00
Daniel Stenberg
4c26a46362 sftp_open: deal with short channel_write calls
This was an old TODO that just wasn't done before. If
channel_write returns short, that is not an error.
2010-04-28 00:12:47 +02:00
Daniel Stenberg
77efca961d sftp_open: clean up, better check of input data
The clang-analyzer report made it look into this function and
I've went through it to remove a potential use of an
uninitialized variable and I also added some validation of input
data received from the server.

In general, lots of more code in this file need to validate the
input before assuming it is correct: there are servers out there
that have bugs or just have another idea of how to do the SFTP
protocol.
2010-04-27 23:59:55 +02:00
Daniel Stenberg
c28fa65424 bugfix: avoid using the socket if it failed to create one 2010-04-27 15:18:40 +02:00
Daniel Stenberg
03815483be bugfix: potential use of NULL pointer 2010-04-27 15:10:48 +02:00
Daniel Stenberg
67de62d650 libssh2_userauth_password_ex: clarify errors somewhat
The errors mentioned in this man page are possible return codes
but not necessarily the only return codes that this can return.

Also reformatted the typ prototypes somewhat.
2010-04-26 22:28:36 +02:00
Daniel Stenberg
cb42be1a9c examples: fixed and made them more similar
The channel read/write functions can return 0 in legitimate cases
without it being an error, and we need to loop properly if they
return short.
2010-04-26 16:49:30 +02:00
Jose Baars
c511177d39 VMS port of libssh2; changes in the libssh2 common code 2010-04-25 19:57:45 +02:00
Daniel Stenberg
d4edb0b9c3 Makefile: added the two news headers userauth.h and session.h 2010-04-25 19:52:36 +02:00
Daniel Stenberg
71fb9cc93e cleanup: prefer the internal functions
To get the blocking vs non-blocking to work as smooth as possible
and behave better internally, we avoid using the external
interfaces when calling functions internally.

Renamed a few internal functions to use _libssh2 prefix when not
being private within a file, and removed the libssh2_ for one
that was private within the file.
2010-04-25 19:35:43 +02:00
Daniel Stenberg
5163e4ecb8 session_free: remove dead code 2010-04-25 19:35:43 +02:00
Daniel Stenberg
000b0f73d0 libssh2_publickey_init: fixed to work better non-blocking
This was triggered by a clang-analyzer complaint that turned out
to be valid, and it made me dig deeper and fix some generic non-
blocking problems I disovered in the code.

While cleaning this up, I moved session-specific stuff over to a
new session.h header from the libssh2_priv.h header.
2010-04-25 19:35:43 +02:00
Daniel Stenberg
c5602fac58 channel: reduce duplicated free and returns
Simplified the code by trying to free data and return on a single
spot.
2010-04-25 19:35:43 +02:00
Daniel Stenberg
046ff03c3f channel: make variables more local
By making 'data' and 'data_len' more local in several places in
this file it will be easier to spot how they are used and we'll
get less risks to accidentally do bad things with them.
2010-04-25 19:35:43 +02:00
Mikhail Gusarov
d06f983c9c Fix typos in manpages, catched by Lintian 2010-04-24 23:43:07 +07:00
Daniel Stenberg
8620cc03f8 channel_request_pty: simplify the code
clang-analyzer pointed out how 'data' could be accessed as a NULL
pointer if the wrong state was set, and while I don't see that
happen in real-life the code flow is easier to read and follow by
moving the LIBSSH2_FREE() call into the block that is supposed to
deal with the data pointer anyway.
2010-04-24 13:14:12 +02:00
Daniel Stenberg
21f55d0006 libssh2_channel_process_startup: simplify the code
clang-analyzer pointed out how 'data' could be accessed as a NULL
pointer if the wrong state was set, and while I don't see that
happen in real-life the code flow is easier to read and follow by
moving the LIBSSH2_FREE() call into the block that is supposed to
deal with the data pointer anyway.
2010-04-24 13:11:05 +02:00
Daniel Stenberg
88ac2dd43c sftp_close_handle: add precation to not access NULL pointer
clang-analyzer pointed this out as a "Pass-by-value argument in
function call is undefined" but while I can't see exactly how
this can ever happen in reality I think a little check for safety
isn't such a bad thing here.
2010-04-24 13:03:27 +02:00
Daniel Stenberg
26d1698320 scp_write_nonblock: Value stored to 'nread' is never read 2010-04-24 12:58:34 +02:00
Daniel Stenberg
7dfeadef97 scp_write: Value stored to 'ptr' is never read 2010-04-24 12:57:32 +02:00
Daniel Stenberg
5804444936 scp_write_nonblock: Value stored to 'ptr' is never read 2010-04-24 12:56:53 +02:00
Daniel Stenberg
ee5dd3561d sftp_mkdir: less silly output but show failures 2010-04-24 12:56:13 +02:00
Jose Baars
ad1ec1c9e4 VMS port of libssh2 including VMS specific build procedures 2010-04-24 10:11:27 +02:00
Daniel Stenberg
28ef62be20 two variable types changes, made lines less than 80 columns
The two variable type changes are only to match type variable
fields actually read from the binary protocol.
2010-04-20 22:49:32 +02:00
Daniel Stenberg
1acca6e3ee remove check for negative padding_length
It was silly, since it is read as an unsigned char...
2010-04-20 22:48:40 +02:00
Daniel Stenberg
d3a0f2932b hostkey_method_ssh_dss_init: Value stored to 's' is never read 2010-04-18 15:31:46 +02:00
Daniel Stenberg
7adc23a628 libssh2_banner_set: avoid unnecessary increment and explain code 2010-04-18 15:30:03 +02:00
Daniel Stenberg
fca949ea55 agent_transact_unix: remove unused variable 2010-04-18 15:27:47 +02:00
Daniel Stenberg
f8b42cab86 remove two unnecessary increments 2010-04-18 15:26:41 +02:00
Daniel Stenberg
fea133f8d6 more code converted to use _libssh2_store_*() 2010-04-18 15:24:13 +02:00
Daniel Stenberg
9ba30d888e libssh2_publickey_list_fetch: removed unused variables 2010-04-18 15:20:29 +02:00
Daniel Stenberg
5d37cd44aa libssh2_publickey_init: remove unused variables 2010-04-18 15:18:18 +02:00
Daniel Stenberg
be9ee7095e libssh2_scp_send64: added to API to provide large file transfers
The previously existing libssh2_scp_send_ex() function has no way
to send files that are larger than 'size_t' which on 32bit
systems mean 4GB. This new API uses a libssh2_int64_t type and
should thus on most modern systems be able to send enormous
files.
2010-04-17 19:47:50 +02:00
Daniel Stenberg
9209309bc3 sftp_init: remove unused variables and assignments 2010-04-17 19:05:53 +02:00
Daniel Stenberg
2a069503be libssh2_knownhost_check: Value stored to 'keylen' is never read 2010-04-17 19:02:44 +02:00
Daniel Stenberg
182108ac91 hostkey: fix compiler warning 2010-04-17 13:38:20 +02:00
Daniel Stenberg
21a01c96f8 remove unused variable 2010-04-17 13:38:07 +02:00
Daniel Stenberg
100059989f data types: convert more to use size_t and uint32_t 2010-04-17 13:34:44 +02:00
Daniel Stenberg
13caffa00e channel: variable type cleanups 2010-04-17 13:27:17 +02:00
Daniel Stenberg
c3bcdd88a4 cleanups: better binary packet gen, size_t fixes and PACKET_* removal
I'll introduce a new internal function set named

 _libssh2_store_u32
 _libssh2_store_u64
 _libssh2_store_str

That can be used all through the library to build binary outgoing
packets.  Using these instead of the current approach removes
hundreds of lines from the library while at the same time greatly
enhances readability. I've not yet fully converted everything to
use these functions.

I've converted LOTS of 'unsigned long' to 'size_t' where
data/string lengths are dealt with internally. This is The Right
Thing and it will help us make the transition to our
size_t-polished API later on as well.

I'm removing the PACKET_* error codes. They were originally
introduced as a set of separate error codes from the transport
layer, but having its own set of errors turned out to be very
awkward and they were then converted into a set of #defines that
simply maps them to the global libssh2 error codes instead. Now,
I'l take the next logical step and simply replace the PACKET_*
defines with the actual LIBSSH2_ERROR_* defines. It will increase
readability and decrease confusion.

I also separated packet stuff into its own packet.h header file.
2010-04-17 13:18:15 +02:00
Daniel Stenberg
81e63b3657 clarified the return code 2010-04-17 09:55:24 +02:00
Daniel Stenberg
1adcb5234f rename libssh2_error to the correct _libssh2_error
We reserve ^libssh2_ for public symbols and we use _libssh2 as
prefix for internal ones. I fixed the intendation of all these
edits with emacs afterwards, which then changed it slightly more
than just _libssh2_error() expressions but I didn't see any
obvious problems.
2010-04-16 00:18:51 +02:00
Daniel Stenberg
9cc824e27b data type cleanup: made lots of code use size_t etc
A lot of code used 'unsigned long' and the likes when it should
rather just use plain 'int' or use size_t for data lengths.
2010-04-15 20:37:46 +02:00
Daniel Stenberg
2f9c105ec2 wait_socket: make c89 compliant and use two fd_sets for select() 2010-04-15 11:02:41 +02:00
Daniel Stenberg
8ab009c0b0 sftp_readdir: always zero terminate, detail the return code
I also added a description for the 'longentry' field which was
previously undocumented!
2010-04-15 01:16:02 +02:00
Daniel Stenberg
e22cdcea77 sftp_readdir: simplified and bugfixed
This function no longer has any special purpose code for the
single entry case, as it was pointless.

The previous code would overflow the buffers with an off-by-one
in case the file name or longentry data fields received from the
server were exactly as long as the buffer provided to
libssh2_sftp_readdir_ex.

We now make sure that libssh2_sftp_readdir_ex() ALWAYS zero
terminate the buffers it fills in.

The function no longer calls the libssh2_* function again, but
properly uses the internal sftp_* instead.
2010-04-15 01:15:35 +02:00
Daniel Stenberg
7f740368f4 channel/transport: we now drain the outgoing send buffer when we ignore EAGAIN
When we ignore the EAGAIN from the transport layer within channel_write, we
now drain the outgoing transport layer buffer so that remainders in that
won't cause any problems in the next invoke of _libssh2_transport_write()
2010-04-15 01:12:22 +02:00
Daniel Stenberg
8b63dc9e59 channel_write: if data has been sent, don't return EAGAIN
When sending data in a loop, we must not return EAGAIN if we
managed to send data in an earlier round. This was reported in
bug #126 => http://libssh2.stuge.se/ticket/126
2010-04-14 23:35:40 +02:00
Simon Josefsson
77fa740674 Fix OpenSSL AES-128-CTR detection.
Patch from Paul Howarth <paul@city-fan.org>.
2010-04-14 14:04:45 +02:00
Daniel Stenberg
32cf14b512 version in header file now says 1.2.6-DEV 2010-04-13 23:39:39 +02:00
Daniel Stenberg
44cd934fa2 1.2.6: clean the RELEASE-NOTES for next release round 2010-04-13 23:38:21 +02:00
Daniel Stenberg
339ad5ccd3 NEWS: add the stuff from the version 1.2.5 RELEASE-NOTES 2010-04-13 23:37:47 +02:00
181 changed files with 10987 additions and 6237 deletions

View File

@@ -1,5 +1,7 @@
/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
* Copyright (c) 2005,2006 Mikhail Gusarov <dottedmag@dottedmag.net>
* Copyright (c) 2006-2007 The Written Word, Inc.
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
* Copyright (c) 2009 Daniel Stenberg
* Copyright (C) 2008, 2009 Simon Josefsson
* All rights reserved.

View File

@@ -21,13 +21,18 @@ VCPROJ = win32/libssh2.vcproj
DISTCLEANFILES = $(DSP)
WIN32FILES = win32/Makefile.win32 win32/libssh2.dsw \
win32/config.mk win32/Makefile win32/test/Makefile.win32 \
win32/libssh2_config.h win32/tests.dsp win32/rules.mk $(DSP) \
win32/msvcproj.head win32/msvcproj.foot
VMSFILES = vms/libssh2_make_example.dcl vms/libssh2_make_help.dcl \
vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \
vms/readme.vms vms/libssh2_config.h
WIN32FILES = win32/libssh2.dsw win32/config.mk win32/Makefile \
win32/libssh2_config.h win32/tests.dsp win32/rules.mk $(DSP) \
win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc \
win32/Makefile.Watcom
EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \
maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in
maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in $(VMSFILES)
ACLOCAL_AMFLAGS = -I m4

View File

@@ -4,4 +4,4 @@ CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \
global.c
HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h \
comp.h mac.h misc.h
comp.h mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h

710
NEWS
View File

@@ -1,709 +1,3 @@
o Use poll instead of select when available. By Paul Querna.
The old NEWS file.
o Add APIs to have libssh2 automatically send keep-alive requests.
The APIs are libssh2_keepalive_config, and libssh2_keepalive_send.
By Simon Josefsson.
o Add global init/exit points, to do crypto initialization in one place.
The APIs are libssh2_init and libssh2_exit. By Lars Nordin.
* (February 15 2010) Daniel Stenberg:
- Added 46 new man pages for public convenience macros. The man pages are
just short redirects to the actual underlying function. The were all
initially created by a script.
- Committed the patch by Yoichi Iwaki in bug #2929647, which fixed a memory
leak when an 'outbuf' was still allocated when a session was freed.
Version 1.2.4 (February 13, 2010)
o Resolve compile issues on Solaris x64 and UltraSPARC
o Allow compiling with OpenSSL when AES isn't available
o Fix Tru64 socklen_t compile issue with example/direct_tcpip.c
Version 1.2.3 (February 3, 2010)
o Added libssh2_trace_sethandler()
o Added the direct_tcpip.c example
o Fixed memory leak in userauth_publickey
o Added support for authentication via SSH-Agent. By Daiki Ueno.
o Respond to unknown SSH_MSG_GLOBAL_REQUEST/SSH_MSG_CHANNEL_REQUEST
with SSH_MSG_REQUEST_FAILURE/SSH_MSG_CHANNEL_FAILURE in order to
make (at least) OpenSSH server keepalive work. Before OpenSSH
servers (configured with a positive ClientAliveInterval) would
terminate connections against libssh2 clients because libssh2 did
not respond properly to the request. By Simon Josefsson.
Version 1.2.2 (November 16, 2009)
* This release includes the following changes:
o Fix crash when server sends an invalid SSH_MSG_IGNORE message.
Reported by Bob Alexander <balexander@expressor-software.com> in
<http://thread.gmane.org/gmane.network.ssh.libssh2.devel/2530>.
By Simon Josefsson.
o Support for the "aes128-ctr", "aes192-ctr", "aes256-ctr" ciphers
as per RFC 4344 for libgcrypt and OpenSSL. They are now the
preferred ciphers. By Simon Josefsson.
o Support for the "arcfour128" cipher as per RFC 4345 for libgcrypt
and OpenSSL. It is preferred over the normal "arcfour" cipher
which is somewhat broken. By Simon Josefsson.
o Add support for GCC visibility features. By Cristian Rodr<64>guez.
o Fix libssh2_channel_forward_accept. By Juzna.
o Generate Win32 files correctly. By Peter Stuge.
o Fix permission issue in ssh2 self test. By Dan Fandrich.
o Use memmove instead of memcpy in one place which copies
overlapping memory areas.
o Cleanup hard coding of cipher modes in libgcrypt backend. By Simon.
o Added man page for libssh2_knownhost_free. By Daniel.
Version 1.2.1 (September 28, 2009)
* This release includes the following changes:
o generate and install libssh2.pc
... and the following bugfixes:
o proper return codes returned from several functions
o return EAGAIN internal cleanup
o added knownhost.c to windows makefiles
o pass private-key to OpenSSL as a filename with BIO_new_file().
o make libssh2_scp_send/recv do blocking mode correctly
o libssh2_channel_wait_closed() could hang
o libssh2_channel_read_ex() must return 0 when closed
o added gettimeofday() function for win32 for the debug trace outputs
o transport layer bug causing invalid -39 (LIBSSH2_ERROR_BAD_USE) errors
o scp examples now loop correctly over libssh2_channel_write()
* (August 29 2009) Daniel Stenberg:
- I fixed all code to use the recently added dedicated linked list functions
instead of doing the same stuff spread out all over.
- I also fixed a few cases where local variables where used to keep memory
but was used to keep state for re-invokes due to non-blocking situations
which would lead to segfaults.
Version 1.2 (August 10, 2009)
-----------------------------
* (August 02 2009) Alexander Lamaison:
- changed _libssh2_rsa_new_private and _libssh2_rsa_new_private so that they
no longer use the OpenSSL functions that take a FILE* argument. Passing
CRT-created objects across a DLL boundary causes crashes on Windows of the
DLL and the client aren't linked to the exact same verison of the CRT. Now
we pass the keys as strings to avoid this issue.
* (May 29 2009) Daniel Stenberg:
- Updated the knownhost API and there are now 9 functions, and all of them
have man pages. The libssh2.h now defines HAVE_LIBSSH2_KNOWNHOST_API to
ease things for applications to check for the correct release before trying
to use it.
* (May 23 2009) Daniel Stenberg:
- Anonymous bug report #2795816 revealed that doing subsequent
libssh2_sftp_init() calls on the same session failed.
* (May 20 2009) Daniel Stenberg:
- made libssh2_sftp_write() properly deal with huge/any sized input buffers.
- fixed libssh2_channel_write_ex() to return the correct return code, and
deal with sending off huge buffers better
* (May 7 2009) Daniel Stenberg:
- linked list code. I got a bit tired of the fact that we don't have any
generic linked-list functions within libssh2 so I wrote up the first embryo
for one that I use for this new functionality. The plan would then be to
move all existing code that uses linked lists to use this new set.
- base64 encode. I had to add a base64 encoding function which was missing
in the code base so it helps to "bloat" my patch.
- The knownhost API is currently:
_init() - init a bundle of known hosts
_add() - add a known host
_del() - delete a known host
_free() - free an entire bundle of known hosts
_check() - check if a host+key is present in the bundle
The convenience function:
_parsefile() - reads a ~/.ssh/known_hosts file and add all entries to the
given bundle
- there's no docs other than some comments in the code/headers yet
- the patch includes changes to example/simple/ssh2_exec.c that makes use of
a few of these functions. Using that I've verified that the functions in
fact can verify my localhost's key agains my ~/.ssh/known_hosts file
* (Apr 30 2009) Daniel Stenberg:
Markus posted a bug report about a bad 0-return from libssh2_channel_read:
http://libssh2.haxx.se/mail/libssh2-devel-archive-2009-04/0076.shtml
And it was indeed a bad loop that terminated too early due to a receveived
close packet.
* (Apr 14 2009) Daniel Stenberg:
libssh2_poll() and libssh2_poll_channel_read() are now considered and
documented deprecated and they will be removed at next soname bump. It also
saves us from fixing some rather quirky bugs in libssh2_poll()...
Version 1.1 (April 2, 2009)
---------------------------
- (Mar 28 2009) Daniel Stenberg:
Jean-Louis Charton found a memory leak in
libssh2_userauth_hostbased_fromfile_ex()
- (Mar 25 2009) Daniel Stenberg:
* Renamed the functions in src/transport.c to be _libssh2_transport_ prefixed
and introduced a transport.h header.
* Fixed the blocking mode to only change behavior not the actual underlying
socket mode so we now always work with non-blocking sockets. This also
introduces a new rule of thumb in libssh2 code: we don't call the
external function calls internally. We use the internal (non-blocking)
ones!
* libssh2_channel_receive_window_adjust2 was added and
libssh2_channel_receive_window_adjust is now deprecated
* Introduced "local" header files with prototypes etc for different parts
instead of cramming everything into libssh2_priv.h. channel.h is the
first.
- (Mar 19 2009) Daniel Stenberg: based on a patch by "E L" we now use errno
properly after recv() and send() calls (that internally are now known as
_libssh2_recv() and _libssh2_send()) so that the API and more works fine on
windows too!
- (Mar 17 2009) Simon Josefsson:
Added a Libtool -export-symbols-regex flag to reduce the number of
exported symbols in shared libraries. Reported by Mikhail Gusarov.
- (Mar 16 2009) Daniel Stenberg:
I renamed a few man pages to match the exact name of the functions they
describe. I also added template versions for the 13 functions that
previously lacked man pages. While these don't contain any docs just yet, it
will now be easier to add the info as the foundation is there!
- (Mar 15 2009) Daniel Stenberg:
* libssh2_channel_read_ex() was simplified and enhanced. It now adjusts the
window less frequent and uses much larger window that now allows MUCH
faster transfers.
* SCP send/recv now allow file names with whitespaces etc, thanks to a patch
by Heiner Steven
- (Mar 13 2009) Daniel Stenberg: Cleanups, that do seem to have boosted SFTP
download performance up to 300% in some tests:
* cut off "_ex" from several internal function names
* corrected some log outputs
* simplified libssh2_channel_read_ex() and made it much faster in the process
* cut out {{{ and }}} comments that were incorrect anyway
* fixed sftp_packet_ask() to return the correct packet by using memcmp() and
not strncmp()
* fixed mkdir()'s wait for packet to use the correct request_id - it
semi-worked previously because strncmp() in sftp_packet_ask() made it
match far too easily.
* took away the polling functionality from sftp_packet_ask() since it wasn't
used
- (Mar 7 2009) Olivier Hervieu pointed out a flaw in the
libssh2_channel_x11_req_ex() function that made it produce a crappy random
chunk of data. Peter Stuge improved the fix to not do out-of-boundary
writes. I (Daniel Stenberg) replaced the snprintf() with a plain sprintf()
since the size argument wasn't adding anything anyway.
- (Feb 23 2009) Added libssh2_version()
- (Feb 20 2009) libssh2_channel_direct_tcpip_ex() bug #1902169 fixed, which
caused it to fail when called a second time.
- (Feb 12 2009) Romain Bondue extended Markus Moeller fix from Feb 8, based on
a previous (uncommitted) patch by Erik Brossler. It improves
libssh2_channel_write_ex in blocking situations when the socket is set non-
blocking.
- (Feb 8 2009) Markus Moeller fixed a flaw in libssh2_channel_write_ex() that
would occur on EAGAIN situations.
Version 1.0 (December 26 2008)
------------------------------
- (Dec 20 2008) Based on Alexander Lamaison's patch, there's now a new
function called libssh2_sftp_tell64() that returns the 64 bit file offset,
as the existing libssh2_sftp_tell() only returns a size_t.
- (Dec 18 2008) Markus Moeller fixed the issue also reported by Alexander
Lamaison which caused SFTP reads with large buffers to fail.
- Several flaws were fixed that prevented at least SFTP to work reliably
- Vlad Grachov brought the new function called
libssh2_session_block_directions() which returns a bitmask for what
directions the connection blocks. It is to be used applications that use
non-blocking sockets and when a libssh2 function returns
LIBSSH2_ERROR_EAGAIN this function can be used to figure out in which
direction the socket would block and thus it can wait for the socket to
again be ready for communication in that direction before it calls libssh2
again.
- Vincent Jaulin brought the new libssh2_channel_request_pty_size_ex()
function.
- Carlo Bramini fixed the build for msys+mingw. Bug #1943976.
- Neil Gierman provided improved Visual Studio 2008 code in bug #1946268
- Bug #1862727 fixed libssh2_poll() to work on windows (by defining
HAVE_SELECT).
- Based on bug #1815692, we introduce libssh2_sftp_seek64() that allows
seeking beyond the 2GB margin even on 32bit machines.
- Based on a patch in bug #1878059 by Steven Ayre libssh2 now parses >2GB file
sizes when downloading SCP files.
- Bug #2064371 pointed out that the SSH2 banner may not use dash
('-'). Reported by Bjorn Stenborg.
- Sean Peterson fixed a key re-exchange bug:
http://daniel.haxx.se/projects/libssh2/mail/libssh2-devel-archive-2008-06/0002.shtml
- Mike Protts filed the bug report #1908724 that identified and fixed a problem
with SFTP stat on files >4GB in size. Previously it used 32bit math only.
- Removed a stderr debug message that was accidentally left in (bug #1863153)
- OpenSSL and libz detection changed to make cross-compiling to Mingw
work. See README for parameters to use if the auto-detection does
not work for you. From Simon Josefsson.
- Simon Josefsson added a self-test that uses libssh2 to connect to a
local sshd (only enabled if if OpenSSH is installed).
Version 0.18 (November 11 2007)
-------------------------------
- Various changes that improve non-blocking operations and prevent stalls.
Especially noticable on Windows since libssh2 just didn't work properly
non-blocking on Windows before.
- Peter O'Gorman reported how a SCP transfer would hang for him, and it was
fairly easy reproducable. One bug was in the transport layer, ignoring to
read more data while there was data left even though it couldn't decrypt the
data that was left due to it being too little... The other bug was in the
channel layer, where the libssh2_channel_receive_window_adjust() function
missed to set the state variables at times and thus this function would
misbehave on repeated invokes.
- Changed the signature of libssh2_channel_setenv_ex to add const to the
"varname" parameter (Dan Fandrich)
- Satish Mittal and David J Sullivan fixed an infinit recv() loop in
libssh2_banner_receive()
Version 0.17 (August 6 2007)
----------------------------
Changes since previous version include:
o Re-indented the source code with this GNU indent setup:
--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
Version 0.16 (August 6 2007)
----------------------------
Changes since previous version include:
o CRLF stripping fix for PEM reading
o libssh2_scp_recv() error message fix
o added HACKING as an initial attempt to describe our source code format
o new public defines in include/libssh2.h to allow applictions to figure out
version number etc
o new script (maketgz) to build releases with
o updated files for building with MSVC and mingw
o keyboard-interactive would always fail due to claimed memory problem
o a few minor memory leaks fixed
o libssh2_poll() no longer relies on C99 features
o AIX 4 and 5 now supports non-blocking sockets
o large file magic checks in configure
o LIBSSH2_APINO was removed from the public header file
This release would not have been possible without these friendly contributors:
James Housley, Simon Josefsson, Dan Fandrich, Guenter Knauf and I too did
some poking. (Sorry if I forgot anyone I should've mentioned here.)
Of course we would have nothing without the great work by Sara Golemon that
we're extending and building upon.
Version 0.15 (June 15 2007)
---------------------------
Added libssh2_sftp_readdir_ex() and updated LIBSSH2_APINO to
200706151200 (James Housley)
Converted all of the libssh2 code to be able to work in non-blocking
mode. This included some public API changes, listed below (James Housley)
Changed function return values:
int libssh2_session_free()
int libssh2_publickey_shutdown()
ssize_t libssh2_channel_read_ex()
ssize_t libssh2_channel_write_ex()
Added functions:
libssh2_session_last_errno(), libssh2_channel_handle_extended_data2(),
libssh2_channel_wait_closed(), libssh2_channel_wait_eof(),
libssh2_session_set_blocking()
Removed functions:
libssh2_channel_readnb_ex(), libssh2_channel_writenb_ex(),
libssh2_sftp_readnb(), libssh2_sftp_writenb(),
libssh2_sftp_mkdirnb_ex()
Added the following functions for non-blocking operations: (Daniel Stenberg)
libssh2_channel_readnb_ex()
libssh2_channel_writenb_ex()
libssh2_sftp_readnb()
libssh2_sftp_writenb()
Size parameter changed from 'int' to 'unsigned int' in several
public APIs.
Added (a few) man pages in docs/. (Daniel Stenberg)
Maximum SSH packet size is now some 35000 bytes.
Private include files are now in src/ and only public headers are in
include/. (Daniel Stenberg)
Automake and libtool are being used (increased portability). (Daniel
Stenberg)
Fixed OpenSSL detection using pkg-config. (Daniel Stenberg)
Simple self test added to tests/. (Simon Josefsson)
Libgcrypt can now be used instead of OpenSSL if you specify
--with-libgcrypt. (Simon Josefsson)
Fixed a memory leak in the packet handling, and better handle out of
memory situations. (Dan Fandrich)
Made libssh2 build with OpenSSL 0.9.6. (Dan Fandrich)
Improved portability to Solaris related to -lsocket and
-lnsl. (Simon Josefsson)
Clean up of README, INSTALL, NEWS, added ChangeLog. (Simon
Josefsson)
Improve debugging code. Avoids many #ifdef's.
Improved session closing to avoid potentially truncated files on
OpenSSH servers (Dan Fandrich)
Made some function parameters in the API const (Dan Fandrich)
Version 0.14
------------
Plug leaks in EVP cipher init/shutdown. (Selcuk Gueney)
Allow socket_fd == 0 in libssh2_session_startup(). (puudeli)
Swap ordering of packet_add/packet-inspection to avoid inspect after
free. (Selcuk)
Swap KEX_INIT ordering, send our KEX_INIT first.
Add check for oportunistic KEX_INIT packets. Burn bad guess if necessary.
Fix OpenSSL detection using pkg-config. (Dan Casey)
Version 0.13
------------
Fixed channel not being marked closed when CHANNEL_CLOSE package cannot be
sent. (David Robins)
Fixed payload packet allocation bug when invalid packet length
received. (David Robins)
Fixed `make install' target for MacOSX.
Add terminating NULL character to readlink()/realpath() results.
BugFix#1436593: Apply build options for HPUX targets.
Version 0.12
------------
Added support for publickey subsytem (not the same as publickey auth).
Fix x11_req. Multiple packet_len issues and error handling logic.
(Thanks Simon Hart)
Fix generation of 'e' portion of Diffie-Hellman keyset.
Use appropriate order for BN_rand() rather than fixed group1-specific value.
Re-fixed libssh2_sftp_rename_ex()
Transport had right packet_len, but sftp layer still had extra 4 bytes.
Fixed build with newer OpenSSL headers.
Added extern "C" declarations to libssh2_sftp.h for C++ compatability.
Version 0.11
------------
Added libssh2_chnnale_get_exit_status() -- Mikhail
Added libssh2_channel_wait_closed() -- Mikhail
Added libssh2_userauth_keyboard_interactive_ex() -- Mikhail
Added libssh2_channel_receive_window_adjust() to be able to increase the
size of the receive window.
Added queueing for small window_adjust packets to avoid unnecessary packet
conversation.
Fixed libssh2_sftp_rename_ex() to only send flags parameter if version >= 5
negotiated (not currently possible, but will be and might as well keep the
API consistent).
Version 0.10
------------
Added developer debugging hooks. See --enable-debug-* options to ./configure
Ignore extended data in the SFTP layer. With no other mechanism to deal
with that data it'd just fill up and get stuck.
(Re)Fixed channel_write() to provide an opportunity for window space to
become available again.
(Re)Fixed SFTP INIT to send the correct SFTP packet length.
Fixed segfault when client and host can't agree on a hostkey/crypt/mac/comp
method. (Thanks puudeli)
Fixed major issue with sftp packet buffering mechanism. Using wrong
blocking semantics. (No puudeli, YOU the man)
Reduced busy-looping of libssh2_sftp_packet_requirev.
Version 0.9
-----------
Changed blocking_read to only block as much as necessary and not an
arbitrary length of time. (Thanks Felix)
Fixed SFTP INIT/VERSION to exclude request_id and send correct maximum
version number.
Fixed SFTP to be properly BC with version 1 and 2 servers.
Fixed libssh2_poll() to recognized closed sessions/channels.
Fixed libssh2_channel_write_ex() to fully block when set to blocking mode.
Return actual bytes written as well. (Thanks deadem)
Added tests for -lm and -lsocket and add them when necessary.
Added libssh2_channel_window_read_ex() and libssh2_channel_window_write_ex()
for examining the ssh transport windowing states.
Version 0.8
-----------
Fix potential segfault in compression/decompression.
Fix compatability with older versions of OpenSSL
Swapped order of none,zlib compression modes to prefer no compression by
default.
Added sys/uio.h for platforms (FBSD) which need it in order to define struct
iovec.
Added libssh2_poll() to check status of sockets/channels/listeners.
Removed unnecessary inclusion of stdio.h (holdover from debugging)
Version 0.7
-----------
Added libssh2_userauth_hostbased_fromfile_ex() for authenticating from hostkey.
Added configure recognition for MacOSX (Darwin) (Thanks Gabe)
Fixed extended data identification in libssh2_channel_read().
Fixed window adjust code. Hadn't acknowledged adjustments correctly.
Removed initial_window_size requirement for sending window adjust packet.
Version 0.6
-----------
Added LIBSSH2_FLAG_SIGPIPE to enable/disable SIGPIPE generated by
send()/recv() calls. Default off.
Added libssh2_session_flag() to set optional session flags.
Collapsed exchanging_keys/newkeys/authenticated flags into single state
attribute.
Fix zlib compression issue when internal buffer state misses partial sync.
Fix segfault when libssh2_session_methods() is called prior to
session_startup().
Fixed client to server channel windowing. Pervent send queue overruns.
Swapped banner send/receive order (send first, then wait for response).
Version 0.5
-----------
*** BC Break ***
Reimplemented libssh2_session_methods() to match
libssh2_session_method_pref() style
Fixed libssh2_attr2bin() (effects any setstat style call).
Fixed authenticating with encrypted private key.
Fixed authenticating via ssh-dss public key.
Fixed KEX_INIT cookie and packet padding to use actual random data
Added DESTDIR support to makefiles (Adam Go<47><6F>biowski -- I hope that
character set translates right)
Added libssh2_channel_forward_listen_ex(), libssh2_channel_forward_cancel(),
and libssh2_channel_forward_accept().
Added ./configure option '--disable-gex-new' to allow using the older
group-exchange format
Added MAC methods hmac-md5 and hmac-md5-96.
Version 0.4
-----------
Fixed crash when trying to free sftp_dirhandle data from a filehandle struct.
Fixed leak in sftp_open_ex(), handle->handle not freed in handle_close().
Fixed leak in sftp_symlink_ex(), result for READLINK and REALPATH not freed unless there was an error.
Added libssh2_banner_set(), specify an arbitrary banner to send on introduction.
Version 0.3
-----------
Fixed libssh2_channel_read_ex(). Packet loop initialized BEFORE transport polled for new packets (should have been after).
Fixed blocking issues in scp_send()/scp_recv().
Fixed degree of indirection in macerror callback.
Changed packet read mechanism to use a fixed buffer and avoid unnecessary alloc/free calls. (especially while non-block looping)
Added channel close callback.
Added SFTP support (Using its own header file: libssh2_sftp.h)
Version 0.2
-----------
Changed extended data ignorance mechanism:
libssh2_channel_ignore_extended_data() changed to libssh2_channel_handle_extended_data()
Macro introduced for backward compatability during beta phase.
*** THE LIBSSH2_CHANNEL_IGNORE_EXTENDED_DATA() MACRO WILL BE REMOVED PRIOR TO 1.0 RELEASE ***
libssh2_channel_handle_extended_data() may be passed one of three "ignore_mode" constants
LIBSSH2_CHANNEL_EXTENDED_DATA_NONE Default behavior, queue ED packets and return them with read_ex
LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE Equivalent to libssh2_channel_ignore_extended_data()
IGNORE will implicitly flush the extended data stream(s)
LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE Calls to channel_read() will check both the standard data stream
and the extended data stream(s) for the first available packet
Changed libssh2_session_disconnect_ex() to return an error code when alloc fails
Added libssh2_channel_flush_ex() and basic macros: ..._flush() ..._flush_stderr()
flush_ex accepts either the streamid (0 for standard data, 1 for stderr) or one of the two following constants:
LIBSSH2_CHANNEL_FLUSH_ALL Flush all streams
LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA Flush all streams EXCEPT the standard data stream
Added libssh2_session_callback_set() for setting ignore/debug/disconnect/macerror callbacks
Added libssh2_session_method_pref() to selectively set methods and method preferences.
Added libssh2_session_methods() to determine what methods were negotiated.
Added libssh2_session_abstract() for retreiving &session->abstract
Added libssh2_session_last_error() for retreiving error codes/messages
Version 0.1
-----------
Initial Release:
KEX methods: diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1, diffie-hellman-group1-sha1
Hostkey methods: ssh-rsa, ssh-dss
Cipher methods: aes256-cbc, rijndael-cbc@lysator.liu.se, aes192-cbc, aes128-cbc, blowfish-cbc, arcfour, cast128-cbc, 3des-cbc, none*
Compression methods: zlib, none
MAC methods: hmac-sha1, hmac-sha1-96, hmac-ripemd160, hmac-ripemd160@openssh.com none*
*Cipher/MAC "none" is disabled by default for security purposes,
Use --enable-crypt-none and/or --enable-mac-none with ./configure to enable
NEWS is now generated from git and put into the release tarballs.

View File

@@ -1,33 +1,19 @@
libssh2 1.2.5
libssh2 1.3.0
This release includes the following changes:
o Added Add keep-alive support: libssh2_keepalive_config() and
libssh2_keepalive_send()
o Added libssh2_knownhost_addc(), libssh2_init() and libssh2_exit()
o Added LIBSSH2_SFTP_S_IS***() macros
o Added custom callbacks for performing low level socket I/O
This release includes the following bugfixes:
o fix memory leak in libssh2_session_startup()
o added missing error codes - shown as hangs in blocking mode
o fix memory leak in userauth_keyboard_interactive()
o libssh2_knownhost_del: fix write to freed memory
o Send and receive channel EOF before sending SSH_MSG_CHANNEL_CLOSE
o Use AES-CTR from OpenSSL when available
o Fixed gettimeofday to compile with Visual C++ 6
o NULL dereference when window adjusting a non-existing channel
o avoid using poll on interix and mac os x systems
o fix scp memory leak
o Correctly clear blocking flag after sending multipart packet
o Reduce used window sizes by factor 10
o libssh2_userauth_publickey_fromfile_ex() handles a NULL password
o sftp_init() deal with _libssh2_channel_write() short returns
o sftp_read: advance offset correctly for buffered copies
o libssh2_sftp_seek64: flush packetlist and buffered data
o _libssh2_packet_add: adjust window size when truncating
o sftp_read: a short read is not end of file
This release would not have looked like this without help, code, reports and
advice from friends like these:
Peter Stuge, Simon Josefsson, Alexander Lamaison, Paul Querna, Suyog Jadhav,
Lars Nordin
Henrik Nordstrom, liuzl, Guenter Knauf
Thanks! (and sorry if I forgot to mention someone)

135
TODO
View File

@@ -1,6 +1,9 @@
Things TODO
===========
* Fix the numerous malloc+copy operations for sending data, see "Buffering
Improvements" below for details
* make sure the windowing code adapts better to slow situations so that it
doesn't then use as much memory as today. Possibly by an app-controllable
"Window mode"?
@@ -9,13 +12,13 @@ Things TODO
lib, like when libssh2_session_last_error() is asked to return the string
with 'want_buf' set to non-zero.
* Provide a libssh2_scp_send() API for files larger than 4GB (32bit size)
* Add more info to the man pages.
* Decrease the number of mallocs. Everywhere.
* Decrease the number of mallocs. Everywhere. Will get easier once the
buffering improvements have been done.
* Use SO_NOSIGPIPE for Mac OS/BSD systems where MSG_NOSIGNAL doesn't exist/work
* Use SO_NOSIGPIPE for Mac OS/BSD systems where MSG_NOSIGNAL doesn't
exist/work
* Extend the test suite to actually test lots of aspects of libssh2
@@ -23,6 +26,13 @@ Things TODO
* Expose error messages sent by the server
* Make SFTP transfers ask for and send several packages at once so that it
doesn't have to send-waitforack-send-waitforack as much. This will be
easier/smoother if we implement the "New SFTP API" described below.
* select() is troublesome with libssh2 when using multiple channels over
the same session. See "New Transport API" below for more details.
At next SONAME bump
===================
@@ -40,6 +50,7 @@ At next SONAME bump
libssh2_channel_receive_window_adjust()
libssh2_poll()
libssh2_poll_channel_read()
libssh2_session_startup() (libssh2_session_handshake() is the replacement)
* Rename a few function:
@@ -54,3 +65,119 @@ At next SONAME bump
* remove the existing libssh2_knownhost_add() function and rename
libssh2_knownhost_addc to become the new libssh2_knownhost_add instead
* remove the existing libssh2_scp_send_ex() function and rename
libssh2_scp_send64 to become the new libssh2_scp_send instead.
* remove the existing libssh2_knownhost_check() functin and rename
libssh2_knownhost_checkp() to become the new libssh2_knownhost_check instead
Buffering Improvements
======================
transport_write
- If this function gets called with a total packet size that is larger than
32K, it should create more than one SSH packet so that it keeps the largest
one below 32K
sftp_write
- should not copy/allocate anything for the data, only create a header chunk
and pass on the payload data to channel_write "pointed to"
New Transport API
=================
THE PROBLEM
The problem in a nutshell is that when an application opens up multiple
channels over a single session, those are all using the same socket. If the
application is then using select() to wait for traffic (like any sensible app
does) and wants to act on the data when select() tells there is something to
for example read, what does an application do?
With our current API, you have to loop over all the channels and read from
them to see if they have data. This effectively makes blocking reads
impossible. If the app has many channels in a setup like this, it even becomes
slow. (The original API had the libssh2_poll_channel_read() and libssh2_poll()
to somewhat overcome this hurdle, but they too have pretty much the same
problems plus a few others.)
Traffic in the other direction is similarly limited: the app has to try
sending to all channels, even though some of them may very well not accept any
data at that point.
A SOLUTION
I suggest we introduce two new helper functions:
libssh2_transport_read()
- Read "a bunch" of data from the given socket and returns information to the
app about what channels that are now readable (ie they will not block when
read from). The function can be called over and over and it will repeatedly
return info about what channels that are readable at that moment.
libssh2_transport_write()
- Returns information about what channels that are writable, in the sense
that they have windows set from the remote side that allows data to get
sent. Writing to one of those channels will not block. Of course, the
underlying socket may only accept a certain amount of data, so at the first
short return, nothing more should be attempted to get sent until select()
(or equivalent) has been used on the master socket again.
I haven't yet figured out a sensible API for how these functions should return
that info, but if we agree on the general principles I guess we can work that
out.
VOLUNTARY
I wanted to mention that these two helper functions would not be mandatory
in any way. They would just be there for those who want them, and existing
programs can remain using the old functions only if they prefer to.
New SFTP API
============
PURPOSE
Provide API functions that explicitly tells at once that a (full) SFTP file
transfer is wanted, to allow libssh2 to leverage on that knowledge to speed
up things internally. It can for example do read ahead, buffer writes (merge
small writes into larger chunks), better tune the SSH window and more. This
sort of API is already provided for SCP transfers.
API
New functions:
LIBSSH2_SFTP_HANDLE *libssh2_sftp_send(SFTP_SESSION *sftp,
uint64_t filesize,
char *remote_path,
size_t remote_path_len,
long mode);
Tell libssh2 that a local file with a given size is about to get sent to
the SFTP server.
LIBSSH2_SFTP_HANDLE *libssh2_sftp_recv();
Tell libssh2 that a remote file is requested to get downloaded from the SFTP
server.
Only the setup of the file transfer is different from an application's point
of view. Depending on direction of the transfer(s), the following already
existing functions should then be used until the transfer is complete:
libssh2_sftp_read()
libssh2_sftp_write()
HOW TO USE
1. Setup the transfer using one of the two new functions.
2. Loop through the reading or writing of data.
3. Cleanup the transfer

View File

@@ -15,12 +15,14 @@ if test "x$SED" = "xsed-was-not-found-by-configure"; then
fi
dnl figure out the libssh2 version
VERSION=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h`
AM_INIT_AUTOMAKE(libssh2,$VERSION)
LIBSSH2VER=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h`
AM_INIT_AUTOMAKE
AC_MSG_CHECKING([libssh2 version])
AC_MSG_RESULT($VERSION)
AC_MSG_RESULT($LIBSSH2VER)
AB_VERSION=$VERSION
AC_SUBST(LIBSSH2VER)
AB_VERSION=$LIBSSH2VER
AB_INIT
@@ -115,7 +117,7 @@ AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes")
if test "$ac_cv_libssl" = "yes"; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $LIBSSL"
AC_CHECK_FUNCS(EVP_aes128_ctr)
AC_CHECK_FUNCS(EVP_aes_128_ctr)
LDFLAGS="$save_LDFLAGS"
fi
@@ -289,13 +291,13 @@ AC_OUTPUT
AC_MSG_NOTICE([summary of build options:
version: ${VERSION}
version: ${LIBSSH2VER}
Host type: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
Compiler flags: ${CFLAGS}
Library types: Shared=${enable_shared}, Static=${enable_static}
Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no}
Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no}
Debug build: $enable_debug
Path to sshd: $ac_cv_path_SSHD (only for self-tests)
libz compression: $ac_cv_libz

View File

@@ -25,6 +25,7 @@ dist_man_MANS = \
libssh2_channel_forward_listen.3 \
libssh2_channel_forward_listen_ex.3 \
libssh2_channel_free.3 \
libssh2_channel_get_exit_signal.3 \
libssh2_channel_get_exit_status.3 \
libssh2_channel_handle_extended_data.3 \
libssh2_channel_handle_extended_data2.3 \
@@ -59,13 +60,15 @@ dist_man_MANS = \
libssh2_channel_x11_req.3 \
libssh2_channel_x11_req_ex.3 \
libssh2_exit.3 \
libssh2_free_host_entry.3 \
libssh2_host_entry_match.3 \
libssh2_free.3 \
libssh2_hostkey_hash.3 \
libssh2_init.3 \
libssh2_keepalive_config.3 \
libssh2_keepalive_send.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_addc.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_checkp.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_get.3 \
@@ -74,7 +77,6 @@ dist_man_MANS = \
libssh2_knownhost_readline.3 \
libssh2_knownhost_writefile.3 \
libssh2_knownhost_writeline.3 \
libssh2_new_host_entry.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_publickey_add.3 \
@@ -87,6 +89,7 @@ dist_man_MANS = \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \
libssh2_scp_send.3 \
libssh2_scp_send64.3 \
libssh2_scp_send_ex.3 \
libssh2_session_abstract.3 \
libssh2_session_block_directions.3 \
@@ -96,6 +99,7 @@ dist_man_MANS = \
libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_get_timeout.3 \
libssh2_session_hostkey.3 \
libssh2_session_init.3 \
libssh2_session_init_ex.3 \
@@ -104,6 +108,7 @@ dist_man_MANS = \
libssh2_session_method_pref.3 \
libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \
libssh2_session_set_timeout.3 \
libssh2_session_startup.3 \
libssh2_sftp_close.3 \
libssh2_sftp_close_handle.3 \
@@ -111,6 +116,7 @@ dist_man_MANS = \
libssh2_sftp_fsetstat.3 \
libssh2_sftp_fstat.3 \
libssh2_sftp_fstat_ex.3 \
libssh2_sftp_fstatvfs.3 \
libssh2_sftp_init.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_lstat.3 \
@@ -130,10 +136,12 @@ dist_man_MANS = \
libssh2_sftp_rmdir.3 \
libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \
libssh2_sftp_seek64.3 \
libssh2_sftp_setstat.3 \
libssh2_sftp_shutdown.3 \
libssh2_sftp_stat.3 \
libssh2_sftp_stat_ex.3 \
libssh2_sftp_statvfs.3 \
libssh2_sftp_symlink.3 \
libssh2_sftp_symlink_ex.3 \
libssh2_sftp_tell.3 \
@@ -151,6 +159,7 @@ dist_man_MANS = \
libssh2_userauth_list.3 \
libssh2_userauth_password.3 \
libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey.3 \
libssh2_userauth_publickey_fromfile.3 \
libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_version.3

View File

@@ -6,7 +6,8 @@ libssh2_channel_direct_tcpip - convenience macro for \fIlibssh2_channel_direct_t
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_direct_tcpip(arguments)
LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_channel_direct_tcpip_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_direct_tcpip_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_direct_tcpip_ex(3)\fP
.BR libssh2_channel_direct_tcpip_ex(3)

View File

@@ -13,6 +13,7 @@ libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
Check if the remote host has sent an EOF status for the selected stream.
.SH RETURN VALUE
Returns 1 if the remote host has sent EOF, otherwise 0.
Returns 1 if the remote host has sent EOF, otherwise 0. Negative on
failure.
.SH SEE ALSO
.BR libssh2_channel_close(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_exec - convenience macro for \fIlibssh2_channel_process_startup(
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_exec(arguments)
int libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *command);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_process_startup(3)\fP
.SH ERRORS
See \fIlibssh2_channel_process_startup(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_process_startup(3)\fP
.BR libssh2_channel_process_startup(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_flush - convenience macro for \fIlibssh2_channel_flush_ex(3)\fP
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_flush(arguments)
int libssh2_channel_flush(LIBSSH2_CHANNEL *channel);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_flush_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_flush_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_flush_ex(3)\fP
.BR libssh2_channel_flush_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_flush_stderr - convenience macro for \fIlibssh2_channel_flush_ex
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_flush_stderr(arguments)
int libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_flush_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_flush_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_flush_ex(3)\fP
.BR libssh2_channel_flush_ex(3)

View File

@@ -15,7 +15,8 @@ libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener);
.SH RETURN VALUE
A newly allocated channel instance or NULL on failure.
.SH ERRORS
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call
would block.
When this function returns NULL use \fIlibssh2_session_last_errno(3)\fP to
extract the error code. If that code is \fILIBSSH2_ERROR_EAGAIN\fP, the
session is set to do non-blocking I/O but the call would block.
.SH SEE ALSO
.BR libssh2_channel_forward_listen_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_forward_listen - convenience macro for \fIlibssh2_channel_forwar
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_forward_listen(arguments)
int libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_forward_listen_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_forward_listen_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_forward_listen_ex(3)\fP
.BR libssh2_channel_forward_listen_ex(3)

View File

@@ -0,0 +1,36 @@
.\" $Id$
.\"
.TH libssh2_channel_get_exit_signal 3 "4 Oct 2010" "libssh2 1.2.8" "libssh2 manual"
.SH NAME
libssh2_channel_get_exit_signal - get the remote exit signal
.SH SYNOPSIS
#include <libssh2.h>
int
libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel, char **exitsignal, size_t *exitsignal_len, char **errmsg, size_t *errmsg_len, char **langtag, size_t *langtag_len);
.SH DESCRIPTION
\fIchannel\fP - Closed channel stream to retrieve exit signal from.
\fIexitsignal\fP - If not NULL, is populated by reference with the exit signal
(without leading "SIG"). Note that the string is stored in a newly allocated
buffer. If the remote program exited cleanly, the referenced string pointer
will be set to NULL.
\fIexitsignal_len\fP - If not NULL, is populated by reference with the length
of exitsignal.
\fIerrmsg\fP - If not NULL, is populated by reference with the error message
(if provided by remote server, if not it will be set to NULL). Note that the
string is stored in a newly allocated buffer.
\fIerrmsg_len\fP - If not NULL, is populated by reference with the length of errmsg.
\fIlangtag\fP - If not NULL, is populated by reference with the language tag
(if provided by remote server, if not it will be set to NULL). Note that the
string is stored in a newly allocated buffer.
\fIlangtag_len\fP - If not NULL, is populated by reference with the length of langtag.
.SH RETURN VALUE
Numeric error code corresponding to the the Error Code constants.

View File

@@ -9,6 +9,9 @@ libssh2_channel_ignore_extended_data - convenience macro for \fIlibssh2_channel_
libssh2_channel_ignore_extended_data(arguments)
.SH DESCRIPTION
This function is deprecated. Use the
\fIlibssh2_channel_handle_extended_data2(3)\fP function instead!
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_handle_extended_data(3)\fP.
.SH RETURN VALUE
@@ -16,4 +19,4 @@ See \fIlibssh2_channel_handle_extended_data(3)\fP
.SH ERRORS
See \fIlibssh2_channel_handle_extended_data(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_handle_extended_data(3)\fP
.BR libssh2_channel_handle_extended_data(3)

View File

@@ -6,7 +6,8 @@ libssh2_channel_open_session - convenience macro for \fIlibssh2_channel_open_ex(
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_open_session(arguments)
LIBSSH2_CHANNEL *
libssh2_channel_open_session(LIBSSH2_SESSION *session);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_channel_open_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_open_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_open_ex(3)\fP
.BR libssh2_channel_open_ex(3)

View File

@@ -4,20 +4,14 @@
.SH NAME
libssh2_channel_process_startup - request a shell on a channel
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *request, unsigned int request_len, const char *message, unsigned int message_len);
int
libssh2_channel_shell(LIBSSH2_CHANNEL *channel);
int
libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *message);
int
libssh2_channel_subsystem(LIBSSH2_CHANNEL *channel, const char *message);
int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
const char *request,
unsigned int request_len,
const char *message,
unsigned int message_len);
.SH DESCRIPTION
\fIchannel\fP - Active session channel instance.

View File

@@ -6,7 +6,7 @@ libssh2_channel_read - convenience macro for \fIlibssh2_channel_read_ex(3)\fP ca
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_read(arguments)
ssize_t libssh2_channel_read(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_read_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_read_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_read_ex(3)\fP
.BR libssh2_channel_read_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_read_stderr - convenience macro for \fIlibssh2_channel_read_ex(3
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_read_stderr(arguments)
ssize_t libssh2_channel_read_stderr(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_read_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_read_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_read_ex(3)\fP
.BR libssh2_channel_read_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_request_pty - convenience macro for \fIlibssh2_channel_request_p
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_request_pty(arguments)
int libssh2_channel_request_pty(LIBSSH2_SESSION *session, const char *term);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_request_pty_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_request_pty_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_request_pty_ex(3)\fP
.BR libssh2_channel_request_pty_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_request_pty_size - convenience macro for \fIlibssh2_channel_requ
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_request_pty_size(arguments)
int libssh2_channel_request_pty_size(LIBSSH2_CHANNEL *channel, int width, int height);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_request_pty_size_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_request_pty_size_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_request_pty_size_ex(3)\fP
.BR libssh2_channel_request_pty_size_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_setenv - convenience macro for \fIlibssh2_channel_setenv_ex(3)\f
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_setenv(arguments)
int libssh2_channel_setenv(LIBSSH2_CHANNEL *channel, const char *varname, const char *value);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_setenv_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_setenv_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_setenv_ex(3)\fP
.BR libssh2_channel_setenv_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_shell - convenience macro for \fIlibssh2_channel_process_startup
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_shell(arguments)
int libssh2_channel_shell(LIBSSH2_CHANNEL *channel);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_process_startup(3)\fP
.SH ERRORS
See \fIlibssh2_channel_process_startup(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_process_startup(3)\fP
.BR libssh2_channel_process_startup(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_subsystem - convenience macro for \fIlibssh2_channel_process_sta
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_subsystem(arguments)
int libssh2_channel_subsystem(LIBSSH2_CHANNEL *channel, const char *subsystem);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_process_startup(3)\fP
.SH ERRORS
See \fIlibssh2_channel_process_startup(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_process_startup(3)\fP
.BR libssh2_channel_process_startup(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_window_read - convenience macro for \fIlibssh2_channel_window_re
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_window_read(arguments)
unsigned long libssh2_channel_window_read(LIBSSH2_CHANNEL *channel);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_window_read_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_window_read_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_window_read_ex(3)\fP
.BR libssh2_channel_window_read_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_window_write - convenience macro for \fIlibssh2_channel_window_w
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_window_write(arguments)
unsigend long libssh2_channel_window_write(LIBSSH2_CHANNEL *channel);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_window_write_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_window_write_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_window_write_ex(3)\fP
.BR libssh2_channel_window_write_ex(3)

View File

@@ -2,11 +2,12 @@
.\"
.TH libssh2_channel_write 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_write - convenience macro for \fIlibssh2_channel_write_ex(3)\fP calls
libssh2_channel_write - convenience macro for \fIlibssh2_channel_write_ex(3)\fP
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_channel_write(arguments)
ssize_t libssh2_channel_write(LIBSSH2_CHANNEL *channel, const char *buf, size_t buflen);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_channel_write_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_write_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_write_ex(3)\fP
.BR libssh2_channel_write_ex(3)

View File

@@ -4,16 +4,12 @@
.SH NAME
libssh2_channel_write_ex - write data to a channel stream blocking
.SH SYNOPSIS
.nf
#include <libssh2.h>
ssize_t
libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id, char *buf, size_t buflen);
ssize_t
libssh2_channel_write(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
ssize_t
libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
ssize_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel,
int stream_id, char *buf,
size_t buflen);
.SH DESCRIPTION
Write data to a channel stream. All channel streams have one standard I/O
substream (stream_id == 0), and may have up to 2^32 extended data streams as
@@ -29,7 +25,12 @@ defines a stream ID of 1 to be the stderr substream.
\fIbuflen\fP - size of the data to write
\fIlibssh2_channel_write(3)\fP and \fIlibssh2_channel_write_stderr(3)\fP are
macros.
convenience macros for this function.
\fIlibssh2_channel_write_ex(3)\fP will use as much as possible of the buffer
and put it into a single SSH protocol packet. This means that to get maximum
performance when sending larger files, you should try to always pass in at
least 32K of data to this function.
.SH RETURN VALUE
Actual number of bytes written or negative on failure.
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While

View File

@@ -2,11 +2,12 @@
.\"
.TH libssh2_channel_write_stderr 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_write_stderr - convenience macro for \fIlibssh2_channel_write_ex(3)\fP calls
libssh2_channel_write_stderr - convenience macro for \fIlibssh2_channel_write_ex(3)\fP
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_channel_write_stderr(arguments)
ssize_t libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel, const char *buf, size_t buflen);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_channel_write_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_write_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_write_ex(3)\fP
.BR libssh2_channel_write_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_channel_x11_req - convenience macro for \fIlibssh2_channel_x11_req_ex(3)
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_x11_req(arguments)
int libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel, int screen_number);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_x11_req_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_x11_req_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_x11_req_ex(3)\fP
.BR libssh2_channel_x11_req_ex(3)

View File

@@ -4,11 +4,11 @@ libssh2_exit - global library deinitialization
.SH SYNOPSIS
#include <libssh2.h>
int
void
libssh2_exit(void);
.SH DESCRIPTION
Exit the libssh2 functions and free's all memory used internal.
.SH AVAILABILITY
Added in libssh2 1.2.5
.SH SEE ALSO
.BR libssh2_init(3)

19
docs/libssh2_free.3 Normal file
View File

@@ -0,0 +1,19 @@
.TH libssh2_exit 3 "13 Oct 2010" "libssh2 1.2.8" "libssh2 manual"
.SH NAME
libssh2_free - deallocate libssh2 memory
.SH SYNOPSIS
#include <libssh2.h>
void
libssh2_free(LIBSSH2_SESSION *session, void *ptr);
.SH DESCRIPTION
Deallocate memory allocated by earlier call to libssh2 functions. It
uses the memory allocation callbacks provided by the application, if
any. Otherwise, this will just call free().
This function is mostly useful under Windows when libssh2 is linked to
one run-time library and the application to another.
.SH AVAILABILITY
Added in libssh2 1.2.8
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@@ -1,14 +0,0 @@
.\" $Id: libssh2_free_host_entry.3,v 1.1 2009/03/16 15:00:45 bagder Exp $
.\"
.TH libssh2_free_host_entry 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_free_host_entry - TODO
.SH SYNOPSIS
.SH DESCRIPTION
.SH RETURN VALUE
.SH ERRORS
.SH SEE ALSO

View File

@@ -1,14 +0,0 @@
.\" $Id: libssh2_host_entry_match.3,v 1.1 2009/03/16 15:00:45 bagder Exp $
.\"
.TH libssh2_host_entry_match 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_host_entry_match - TODO
.SH SYNOPSIS
.SH DESCRIPTION
.SH RETURN VALUE
.SH ERRORS
.SH SEE ALSO

View File

@@ -8,14 +8,13 @@ libssh2_init - global library initialization
int
libssh2_init(int flags);
.SH DESCRIPTION
Initialize the libssh2 functions. This typically initialize the
crypto library. It uses a global state, and is not thread safe -- you
must make sure this function is not called concurrently.
.SH RETURN VALUE
Returns 0 if succeeded, or a negative value for error.
.SH AVAILABILITY
Added in libssh2 1.2.5
.SH SEE ALSO
.BR libssh2_exit(3)

View File

@@ -0,0 +1,27 @@
.TH libssh2_keepalive_config 3 "12 Apr 2011" "libssh2 1.2.5" "libssh2 manual"
.SH NAME
libssh2_keepalive_config - short function description
.SH SYNOPSIS
#include <libssh2.h>
.nf
void libssh2_keepalive_config(LIBSSH2_SESSION *session,
int want_reply,
unsigned interval);
.fi
.SH DESCRIPTION
Set how often keepalive messages should be sent. \fBwant_reply\fP indicates
whether the keepalive messages should request a response from the server.
\fBinterval\fP is number of seconds that can pass without any I/O, use 0 (the
default) to disable keepalives. To avoid some busy-loop corner-cases, if you
specify an interval of 1 it will be treated as 2.
Note that non-blocking applications are responsible for sending the keepalive
messages using \fBlibssh2_keepalive_send(3)\fP.
.SH RETURN VALUE
Nothing
.SH AVAILABILITY
Added in libssh2 1.2.5
.SH SEE ALSO
.BR libssh2_keepalive_send(3)

View File

@@ -0,0 +1,20 @@
.\" $Id: keepalive_send.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_keepalive_send 3 "13 Apr 2011" "libssh2 1.2.5" "libssh2 manual"
.SH NAME
libssh2_keepalive_send - short function description
.SH SYNOPSIS
#include <libssh2.h>
.nf
int libssh2_keepalive_send(LIBSSH2_SESSION *session,
int *seconds_to_next);
.SH DESCRIPTION
Send a keepalive message if needed. \fBseconds_to_next\fP indicates how many
seconds you can sleep after this call before you need to call it again.
.SH RETURN VALUE
Returns 0 on success, or LIBSSH2_ERROR_SOCKET_SEND on I/O errors.
.SH AVAILABILITY
Added in libssh2 1.2.5
.SH SEE ALSO
.BR libssh2_keepalive_config(3)

View File

@@ -1,10 +1,11 @@
.\" Copyright (c) 2009 by Daniel Stenberg
.\" Copyright (c) 2009, 2010 by Daniel Stenberg
.\"
.TH libssh2_knownhost_add 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_add - add a known host
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
@@ -14,7 +15,7 @@ int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost **store);
.SH DESCRIPTION
We discourage use of this function as of libssh2 1.2.5. Instead we strongly
urge users to sue \fIlibssh2_knownhost_addc(3)\fP instead, which as a more
urge users to use \fIlibssh2_knownhost_addc(3)\fP instead, which as a more
complete API. \fIlibssh2_knownhost_add(3)\fP is subject for removal in a
future release.

View File

@@ -7,12 +7,12 @@ libssh2_knownhost_add - add a known host
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
char *host, char *salt,
char *key, size_t keylen,
const char *comment, size_t commentlen,
int typemask,
struct libssh2_knownhost **store);
int libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
char *host, char *salt,
char *key, size_t keylen,
const char *comment, size_t commentlen,
int typemask,
struct libssh2_knownhost **store);
.SH DESCRIPTION
Adds a known host to the collection of known hosts identified by the 'hosts'
handle.
@@ -21,7 +21,12 @@ handle.
must be provided base64 encoded. The host name can be the IP numerical address
of the host or the full name.
\fIsalt\P is a pointer to the salt used for the host hashing, if the host is
If you want to add a key for a specific port number for the given host, you
must provide the host name like '[host]:port' with the actual characters '['
and ']' enclosing the host name and a colon separating the host part from the
port number. For example: \&"[host.example.com]:222".
\fIsalt\fP is a pointer to the salt used for the host hashing, if the host is
provided hashed. If the host is provided in plain text, salt has no meaning.
The salt has to be provided base64 encoded with a trailing zero byte.

View File

@@ -8,7 +8,8 @@ libssh2_knownhost_check - check a host+key against the list of known hosts
#include <libssh2.h>
int libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
char *host, char *key, size_t keylen,
const char *host,
const char *key, size_t keylen,
int typemask,
struct libssh2_knownhost **knownhost);
.SH DESCRIPTION

View File

@@ -0,0 +1,63 @@
.\"
.\" Copyright (c) 2009-2010 by Daniel Stenberg
.\"
.TH libssh2_knownhost_check 3 "1 May 2010" "libssh2 1.2.6" "libssh2 manual"
.SH NAME
libssh2_knownhost_checkp - check a host+key against the list of known hosts
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
const char *host, int port,
const char *key, size_t keylen,
int typemask,
struct libssh2_knownhost **knownhost);
.SH DESCRIPTION
Checks a host and its associated key against the collection of known hosts,
and returns info back about the (partially) matched entry.
\fIhost\fP is a pointer the host name in plain text. The host name can be the
IP numerical address of the host or the full name.
\fIport\fP is the port number used by the host (or a negative number
to check the generic host). If the port number is given, libssh2 will
check the key for the specific host + port number combination in
addition to the plain host name only check.
\fIkey\fP is a pointer to the key for the given host.
\fIkeylen\fP is the total size in bytes of the key pointed to by the \fIkey\fP
argument
\fItypemask\fP is a bitmask that specifies format and info about the data
passed to this function. Specificly, it details what format the host name is,
what format the key is and what key type it is.
The host name is given as one of the following types:
LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
The key is encoded using one of the following encodings:
LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
\fIknownhost\fP if set to non-NULL, it must be a pointer to a 'struct
libssh2_knownhost' pointer that gets filled in to point to info about a known
host that matches or partially matches.
.SH RETURN VALUE
\fIlibssh2_knownhost_check(3)\fP returns info about how well the provided
host + key pair matched one of the entries in the list of known hosts.
LIBSSH2_KNOWNHOST_CHECK_FAILURE - something prevented the check to be made
LIBSSH2_KNOWNHOST_CHECK_NOTFOUND - no host match was found
LIBSSH2_KNOWNHOST_CHECK_MATCH - hosts and keys match.
LIBSSH2_KNOWNHOST_CHECK_MISMATCH - host was found, but the keys didn't match!
.SH AVAILABILITY
Added in libssh2 1.2.6
.SH EXAMPLE
See the ssh2_exec.c example as provided in the tarball.
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_add(3)

View File

@@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\" Copyright (c) 2009-2011 by Daniel Stenberg
.\"
.TH libssh2_knownhost_readfile 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
@@ -19,8 +19,8 @@ collection of known hosts.
\fILIBSSH2_KNOWNHOST_FILE_OPENSSH\fP is the only currently supported
format. This file is normally found named ~/.ssh/known_hosts
.SH RETURN VALUE
Returns a regular libssh2 error code, where negative values are error codes
and 0 indicates success.
Returns a negative value, a regular libssh2 error code for errors, or a
positive number as number of parsed known hosts in the file.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO

View File

@@ -35,7 +35,7 @@ and 0 indicates success.
If the provided buffer is deemed too small to fit the data libssh2 wants to
store in it, LIBSSH2_ERROR_BUFFER_TOO_SMALL will be returned. The application
is then adviced to call the function again with a larger buffer. The
is then advised to call the function again with a larger buffer. The
\fIoutlen\fP size will then hold the requested size.
.SH AVAILABILITY
Added in libssh2 1.2

View File

@@ -1,14 +0,0 @@
.\" $Id: libssh2_new_host_entry.3,v 1.1 2009/03/16 15:00:45 bagder Exp $
.\"
.TH libssh2_new_host_entry 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_new_host_entry - TODO
.SH SYNOPSIS
.SH DESCRIPTION
.SH RETURN VALUE
.SH ERRORS
.SH SEE ALSO

View File

@@ -8,7 +8,9 @@ libssh2_poll - poll for activity on a socket, channel or listener
int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout);
.SH DESCRIPTION
This function is deprecated. Do note use.
This function is deprecated. Do note use. We encourage users to instead use
the \fIpoll(3)\fP or \fIselect(3)\fP functions to check for socket activity or
when specific sockets are ready to get recevied from or send to.
Poll for activity on a socket, channel, listener, or any combination of these
three types. The calling semantics for this function generally match

View File

@@ -6,7 +6,10 @@ libssh2_publickey_add - convenience macro for \fIlibssh2_publickey_add_ex(3)\fP
.SH SYNOPSIS
#include <libssh2.h>
libssh2_publickey_add(arguments)
int libssh2_publickey_add(LIBSSH2_PUBLICKEY *pkey,
const unsigned char *name,
const unsigned char *blob, unsigned long blob_len, char overwrite,
unsigned long num_attrs, const libssh2_publickey_attribute attrs[]);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +19,4 @@ See \fIlibssh2_publickey_add_ex(3)\fP
.SH ERRORS
See \fIlibssh2_publickey_add_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_publickey_add_ex(3)\fP
.BR libssh2_publickey_add_ex(3)

View File

@@ -2,13 +2,26 @@
.\"
.TH libssh2_publickey_add_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_publickey_add_ex - TODO
libssh2_publickey_add_ex - Add a public key entry
.SH SYNOPSIS
#include <libssh2.h>
int
libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name,
unsigned long name_len, const unsigned char *blob,
unsigned long blob_len, char overwrite,
unsigned long num_attrs,
const libssh2_publickey_attribute attrs[])
.SH DESCRIPTION
TBD
.SH RETURN VALUE
Returns 0 on success, negative on failure.
.SH ERRORS
LIBSSH2_ERROR_BAD_USE
LIBSSH2_ERROR_ALLOC,
LIBSSH2_ERROR_EAGAIN
LIBSSH2_ERROR_SOCKET_SEND,
LIBSSH2_ERROR_SOCKET_TIMEOUT,
LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
.SH SEE ALSO

View File

@@ -6,7 +6,9 @@ libssh2_publickey_remove - convenience macro for \fIlibssh2_publickey_remove_ex(
.SH SYNOPSIS
#include <libssh2.h>
libssh2_publickey_remove(arguments)
int libssh2_publickey_remove(LIBSSH2_PUBLICKEY *pkey,
const unsigned char *name, unsigned long name_len,
const unsigned char *blob, unsigned long blob_len);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +18,4 @@ See \fIlibssh2_publickey_remove_ex(3)\fP
.SH ERRORS
See \fIlibssh2_publickey_remove_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_publickey_remove_ex(3)\fP
.BR libssh2_publickey_remove_ex(3)

View File

@@ -6,7 +6,8 @@ libssh2_scp_send - convenience macro for \fIlibssh2_scp_send_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_scp_send(arguments)
LIBSSH2_CHANNEL *
libssh2_scp_send(LIBSSH2_SESSION *session, const char *path, int mode, size_t size);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_scp_send_ex(3)\fP
.SH ERRORS
See \fIlibssh2_scp_send_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_scp_send_ex(3)\fP
.BR libssh2_scp_send_ex(3)

49
docs/libssh2_scp_send64.3 Normal file
View File

@@ -0,0 +1,49 @@
.\" $Id: libssh2_scp_send_ex.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\"
.TH libssh2_scp_send64 3 "17 Apr 2010" "libssh2 1.2.6" "libssh2 manual"
.SH NAME
libssh2_scp_send64 - Send a file via SCP
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
libssh2_uint64_t size, time_t mtime, time_t atime);
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIpath\fP - Full path and filename of file to transfer to. That is the remote
file name.
\fImode\fP - File access mode to create file with
\fIsize\fP - Size of file being transmitted (Must be known ahead of
time). Note that this needs to be passed on as variable type
libssh2_uint64_t. This type is 64 bit on modern operating systems and
compilers.
\fImtime\fP - mtime to assign to file being created
\fIatime\fP - atime to assign to file being created (Set this and
mtime to zero to instruct remote host to use current time).
Send a file to the remote host via SCP.
.SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_SCP_PROTOCOL\fP -
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
block.
.SH AVAILABILITY
This function was added in libssh2 1.2.6 and is meant to replace the former
\fIlibssh2_scp_send_ex(3)\fP function.
.SH SEE ALSO
.BR libssh2_channel_open_ex(3)

View File

@@ -4,11 +4,16 @@
.SH NAME
libssh2_scp_send_ex - Send a file via SCP
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t size, long mtime, long atime);
libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode,
size_t size, long mtime, long atime);
.SH DESCRIPTION
This function has been deemed deprecated since libssh2 1.2.6. See
\fIlibssh2_scp_send64(3)\fP.
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
@@ -38,6 +43,8 @@ Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
block.
.SH AVAILABILITY
This function was marked deprecated in libssh2 1.2.6 as
\fIlibssh2_scp_send64(3)\fP has been introduced to replace this function.
.SH SEE ALSO
.BR libssh2_channel_open_ex(3)

View File

@@ -2,7 +2,7 @@
.\"
.TH libssh2_session_block_directions 3 "1 Oct 2008" "libssh2 1.0" "libssh2 manual"
.SH NAME
libssh2_session_block_directions - get directions that socket should wait for before calling libssh2 function again
libssh2_session_block_directions - get directions to wait for
.SH SYNOPSIS
#include <libssh2.h>
@@ -26,6 +26,6 @@ LIBSSH2_SESSION_BLOCK_OUTBOUND: Outbound direction blocked.
Application should wait for data to be available for socket prior to calling a
libssh2 function again. If \fBLIBSSH2_SESSION_BLOCK_INBOUND\fP is set select
should contain the session socket in readfds set. Correspondingly in case of
\fBLIBSSH2_SESSION_BLOCK_INBOUND\fP writefds set should contain the socket.
\fBLIBSSH2_SESSION_BLOCK_OUTBOUND\fP writefds set should contain the socket.
.SH AVAILABILITY
Added in 1.0

View File

@@ -4,12 +4,16 @@
.SH NAME
libssh2_session_callback_set - set a callback function
.SH SYNOPSIS
.nf
#include <libssh2.h>
void *
libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callback);
void *libssh2_session_callback_set(LIBSSH2_SESSION *session,
int cbtype, void *callback);
.SH DESCRIPTION
Sets a custom callback handler for a previously initialized session
object. Callbacks are triggered by the receipt of special packets at the
Transport layer. To disable a callback, set it to NULL.
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
@@ -17,14 +21,26 @@ libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callbac
\fIcallback\fP - Pointer to custom callback function. The prototype for
this function must match the associated callback declaration macro.
Sets a custom callback handler for a previously initialized session
object. Callbacks are triggered by the receipt of special packets at
the Transport layer. To disable a callback, set it to NULL.
.SH CALLBACK TYPES
.IP LIBSSH2_CALLBACK_IGNORE
Called when a SSH_MSG_IGNORE message is received
.IP LIBSSH2_CALLBACK_DEBUG
Called when a SSH_MSG_DEBUG message is received
.IP LIBSSH2_CALLBACK_DISCONNECT
Called when a SSH_MSG_DISCONNECT message is received
.IP LIBSSH2_CALLBACK_MACERROR
Called when a mismatched MAC has been detected in the transport layer. If the
function returns 0, the packet will be accepted nonetheless.
.IP LIBSSH2_CALLBACK_X11
Called when an X11 connection has been accepted
.IP LIBSSH2_CALLBACK_SEND
Called when libssh2 wants to send some data on the connection.
Can be set to a custom function to handle I/O your own way.
.IP LIBSSH2_CALLBACK_RECV
Called when libssh2 wants to receive some data from the connection.
Can be set to a custom function to handle I/O your own way.
.SH RETURN VALUE
Pointer to previous callback handler. Returns NULL if no
prior callback handler was set.
Pointer to previous callback handler. Returns NULL if no prior callback
handler was set or the callback type was unknown.
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_session_disconnect - convenience macro for \fIlibssh2_session_disconnect
.SH SYNOPSIS
#include <libssh2.h>
libssh2_session_disconnect(arguments)
int libssh2_session_disconnect(LIBSSH2_SESSION *session, const char *description);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_session_disconnect_ex(3)\fP
.SH ERRORS
See \fIlibssh2_session_disconnect_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_session_disconnect_ex(3)\fP
.BR libssh2_session_disconnect_ex(3)

View File

@@ -5,11 +5,21 @@
libssh2_session_flag - TODO
.SH SYNOPSIS
int
libssh2_session_flag(LIBSSH2_SESSION * session, int flag, int value);
libssh2_session_flag(LIBSSH2_SESSION *session, int flag, int value);
.SH DESCRIPTION
This function has no purpose and no documented flags can be set nor read.
Set options for the created session. \fIflag\fP is the option to set, while
\fIvalue\fP is typically set to 1 or 0 to enable or disable the option.
.SH FLAGS
.IP LIBSSH2_FLAG_SIGPIPE
If set, libssh2 will not attempt to block SIGPIPEs but will let them trigger
from the underlying socket layer.
.IP LIBSSH2_FLAG_COMPRESS
If set - before the connection negotiation is performed - libssh2 will try to
negotiate compression enabling for this connection. By default libssh2 will
not attempt to use compression.
.SH RETURN VALUE
0
.SH ERRORS
Its mere existence is an error
Returns regular libssh2 error code.
.SH AVAILABILITY
This function has existed since the age of dawn. LIBSSH2_FLAG_COMPRESS was
added in version 1.2.8.
.SH SEE ALSO

View File

@@ -0,0 +1,19 @@
.TH libssh2_session_get_timeout 3 "4 May 2011" "libssh2 1.2.9" "libssh2 manual"
.SH NAME
libssh2_session_get_timeout - get the timeout for blocking functions
.SH SYNOPSIS
#include <libssh2.h>
.nf
long libssh2_session_get_timeout(LIBSSH2_SESSION *session);
.SH DESCRIPTION
Returns the \fBtimeout\fP (in milliseconds) for how long a blocking the
libssh2 function calls may wait until they consider the situation an error and
return LIBSSH2_ERROR_TIMEOUT.
By default libssh2 has no timeout (zero) for blocking functions.
.SH RETURN VALUE
The value of the timeout setting.
.SH AVAILABILITY
Added in 1.2.9
.SH SEE ALSO
.BR libssh2_session_set_timeout(3)

View File

@@ -0,0 +1,42 @@
.\" $Id: libssh2_session_handshake.3,v 1.7 2009/03/16 23:25:14 bagder Exp $
.\"
.TH libssh2_session_handshake 3 "7 Oct 2010" "libssh2 1.2.8" "libssh2 manual"
.SH NAME
libssh2_session_handshake - perform the SSH handshake
.SH SYNOPSIS
#include <libssh2.h>
int
libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t socket);
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIsocket\fP - Connected socket descriptor. Typically a TCP connection
though the protocol allows for any reliable transport and the library will
attempt to use any berkeley socket.
Begin transport layer protocol negotiation with the connected host.
.SH RETURN VALUE
Returns 0 on success, negative on failure.
.SH ERRORS
\fILIBSSH2_ERROR_SOCKET_NONE\fP - The socket is invalid.
\fILIBSSH2_ERROR_BANNER_SEND\fP - Unable to send banner to remote host.
\fILIBSSH2_ERROR_KEX_FAILURE\fP - >Encryption key exchange with the remote
host failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_SOCKET_DISCONNECT\fP - The socket was disconnected.
\fILIBSSH2_ERROR_PROTO\fP - An invalid SSH protocol response was received on
the socket.
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block.
.SH AVAILABILITY
Added in 1.2.8
.SH SEE ALSO
.BR libssh2_session_free(3)
.BR libssh2_session_init_ex(3)

View File

@@ -6,7 +6,8 @@ libssh2_session_init - convenience macro for \fIlibssh2_session_init_ex(3)\fP ca
.SH SYNOPSIS
#include <libssh2.h>
libssh2_session_init(arguments)
LIBSSH2_SESSION *
libssh2_session_init(void);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_session_init_ex(3)\fP
.SH ERRORS
See \fIlibssh2_session_init_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_session_init_ex(3)\fP
.BR libssh2_session_init_ex(3)

View File

@@ -13,17 +13,17 @@ libssh2_session_methods(LIBSSH2_SESSION *session, int method_type);
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fImethod_type\fP - One of the Method Type constants.
Return the actual method negotiated for a particular transport parameter.
\fImethod_type\fP - one of the method type constants: LIBSSH2_METHOD_KEX,
LIBSSH2_METHOD_HOSTKEY, LIBSSH2_METHOD_CRYPT_CS, LIBSSH2_METHOD_CRYPT_SC,
LIBSSH2_METHOD_MAC_CS, LIBSSH2_METHOD_MAC_SC, LIBSSH2_METHOD_COMP_CS,
LIBSSH2_METHOD_COMP_SC, LIBSSH2_METHOD_LANG_CS, LIBSSH2_METHOD_LANG_SC.
Returns the actual method negotiated for a particular transport parameter.
.SH RETURN VALUE
Negotiated method or NULL if the session has not yet been started.
.SH ERRORS
\fILIBSSH2_ERROR_INVAL\fP - The requested method type was invalid.
\fILIBSSH2_ERROR_METHOD_NONE\fP -
\fILIBSSH2_ERROR_METHOD_NONE\fP - no method has been set
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@@ -0,0 +1,20 @@
.TH libssh2_session_set_timeout 3 "4 May 2011" "libssh2 1.2.9" "libssh2 manual"
.SH NAME
libssh2_session_set_timeout - set timeout for blocking functions
.SH SYNOPSIS
#include <libssh2.h>
.nf
void libssh2_session_set_timeout(LIBSSH2_SESSION *session, long timeout);
.SH DESCRIPTION
Set the \fBtimeout\fP in milliseconds for how long a blocking the libssh2
function calls may wait until they consider the situation an error and return
LIBSSH2_ERROR_TIMEOUT.
By default or if you set the timeout to zero, libssh2 has no timeout for
blocking functions.
.SH RETURN VALUE
Nothing
.SH AVAILABILITY
Added in 1.2.9
.SH SEE ALSO
.BR libssh2_session_get_timeout(3)

View File

@@ -8,8 +8,10 @@ libssh2_session_startup - begin transport layer
int
libssh2_session_startup(LIBSSH2_SESSION *session, int socket);
.SH DESCRIPTION
Starting in libssh2 version 1.2.8 this function is considered deprecated. Use
\fIlibssh2_session_handshake(3)\fP instead.
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_close - convenience macro for \fIlibssh2_sftp_close_handle(3)\fP ca
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_close(arguments)
int libssh2_sftp_close(LIBSSH2_SFTP_HANDLE *handle);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_close_handle(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_close_handle(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_close_handle(3)\fP
.BR libssh2_sftp_close_handle(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_closedir - convenience macro for \fIlibssh2_sftp_close_handle(3)\fP
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_closedir(arguments)
int libssh2_sftp_closedir(LIBSSH2_SFTP_HANDLE *handle)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_close_handle(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_close_handle(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_close_handle(3)\fP
.BR libssh2_sftp_close_handle(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_fsetstat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP cal
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_fsetstat(arguments)
int libssh2_sftp_fsetstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_fstat_ex(3)\fP
.BR libssh2_sftp_fstat_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_fstat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_fstat(arguments)
int libssh2_sftp_fstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_fstat_ex(3)\fP
.BR libssh2_sftp_fstat_ex(3)

View File

@@ -60,7 +60,7 @@ You will find a full set of defines and macros to identify flags and
permissions on the \fBlibssh2_sftp.h\fP header file, but some of the
most common ones are:
To check for specific user permissons, the set of defines are in the
To check for specific user permissions, the set of defines are in the
pattern LIBSSH2_SFTP_S_I<action><who> where <action> is R, W or X for
read, write and excutable and <who> is USR, GRP and OTH for user,
group and other. So, you check for a user readable file, use the bit

View File

@@ -0,0 +1 @@
.so man3/libssh2_sftp_statvfs.3

View File

@@ -17,7 +17,7 @@ libssh2_sftp_last_error(LIBSSH2_SFTP *sftp);
Returns the last error code produced by the SFTP layer. Note that this only
returns a sensible error code if libssh2 returned LIBSSH2_ERROR_SFTP_PROTOCOL
in a previous call. Using \fBlibssh2_sftp_last_error(3)\fP without a
preceeding SFTP protocol error, it will return an unspecified value.
preceding SFTP protocol error, it will return an unspecified value.
.SH RETURN VALUE
Current error code state of the SFTP instance.

View File

@@ -6,7 +6,7 @@ libssh2_sftp_lstat - convenience macro for \fIlibssh2_sftp_stat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_lstat(arguments)
int libssh2_sftp_lstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_stat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_stat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_stat_ex(3)\fP
.BR libssh2_sftp_stat_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_mkdir - convenience macro for \fIlibssh2_sftp_mkdir_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_mkdir(arguments)
int libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path, long mode);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_mkdir_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_mkdir_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_mkdir_ex(3)\fP
.BR libssh2_sftp_mkdir_ex(3)

View File

@@ -6,7 +6,8 @@ libssh2_sftp_open - convenience macro for \fIlibssh2_sftp_open_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_open(arguments)
LIBSSH2_SFTP_HANDLE *
libssh2_sftp_open(LIBSSH2_SFTP *sftp, const char *path, unsigned long flags, long mode);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_sftp_open_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_open_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_open_ex(3)\fP
.BR libssh2_sftp_open_ex(3)

View File

@@ -4,31 +4,45 @@
.SH NAME
libssh2_sftp_open - open filehandle for file on SFTP.
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
LIBSSH2_SFTP_HANDLE *
libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp, const char *filename, unsigned int filename_len, unsigned long flags, long mode, int open_type);
LIBSSH2_SFTP_HANDLE *
libssh2_sftp_open(LIBSSH2_SFTP *sftp, const char *filename, unsigned long flags, long mode);
LIBSSH2_SFTP_HANDLE *
libssh2_sftp_opendir(LIBSSH2_SFTP *sftp, const char *path);
libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp, const char *filename,
unsigned int filename_len, unsigned long flags,
long mode, int open_type);
.SH DESCRIPTION
\fIsftp\fP - SFTP instance as returned by
.BR libssh2_sftp_init(3)
\fIsftp\fP - SFTP instance as returned by \fIlibssh2_sftp_init(3)\fP
\fIfilename\fP - Remote file/directory resource to open
\fIfilename_len\fP - Length of filename
\fIflags\fP - Any (reasonable) combination of the LIBSSH2_FXF_* constants
corresponding fopen modes.
\fIflags\fP - Any reasonable combination of the LIBSSH2_FXF_* constants:
.RS
.IP LIBSSH2_FXF_READ
Open the file for reading.
.IP LIBSSH2_FXF_WRITE
Open the file for writing. If both this and LIBSSH2_FXF_READ are specified,
the file is opened for both reading and writing.
.IP LIBSSH2_FXF_APPEND
Force all writes to append data at the end of the file.
.IP LIBSSH2_FXF_CREAT,
If this flag is specified, then a new file will be created if one does not
already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be
truncated to zero length if it previously exists)
.IP LIBSSH2_FXF_TRUNC
Forces an existing file with the same name to be truncated to zero length when
creating a file by specifying LIBSSH2_FXF_CREAT. LIBSSH2_FXF_CREAT MUST also
be specified if this flag is used.
.IP LIBSSH2_FXF_EXCL
Causes the request to fail if the named file already exists.
LIBSSH2_FXF_CREAT MUST also be specified if this flag is used.
.RE
\fImode\fP - POSIX file permissions to assign if the file is being newly
created.
created. See the LIBSSH2_SFTP_S_* convenience defines in <libssh2_sftp.h>
\fIopen_type\fP - Either of LIBSSH2_SFTP_OPENFILE (to open a file) or
LIBSSH2_SFTP_OPENDIR (to open a directory).

View File

@@ -6,7 +6,8 @@ libssh2_sftp_opendir - convenience macro for \fIlibssh2_sftp_open_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_opendir(arguments)
LIBSSH2_SFTP_HANDLE *
libssh2_sftp_opendir(LIBSSH2_SFTP *sftp, const char *path);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +17,4 @@ See \fIlibssh2_sftp_open_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_open_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_open_ex(3)\fP
.BR libssh2_sftp_open_ex(3)

View File

@@ -2,18 +2,18 @@
.\"
.TH libssh2_sftp_readdir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_readdir - convenience macro for \fIlibssh2_sftp_readdir_exa(3)\fP calls
libssh2_sftp_readdir - convenience macro for \fIlibssh2_sftp_readdir_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_readdir(arguments)
int libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_readdir_exa(3)\fP.
underlying function \fIlibssh2_sftp_readdir_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_readdir_exa(3)\fP
See \fIlibssh2_sftp_readdir_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_readdir_exa(3)\fP
See \fIlibssh2_sftp_readdir_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_readdir_exa(3)\fP
.BR libssh2_sftp_readdir_ex(3)

View File

@@ -4,16 +4,19 @@
.SH NAME
libssh2_sftp_readdir_ex - read directory data from an SFTP handle
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, char *longentry, size_t longentry_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
int
libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle,
char *buffer, size_t buffer_maxlen,
char *longentry, size_t longentry_maxlen,
LIBSSH2_SFTP_ATTRIBUTES *attrs);
.SH DESCRIPTION
Reads a block of data from a LIBSSH2_SFTP_HANDLE and returns file entry
information for the next entry, if any.
\fIhandle\fP - is the SFTP File Handle as returned by
.BR libssh2_sftp_open_ex(3)
@@ -25,25 +28,26 @@ filename is longer than the space provided by buffer_maxlen it will be
truncated to fit.
\fIlongentry\fP - is a pointer to a pre-allocated buffer of at least
\fIlongentry_maxlen\fP bytes to read data into.
\fIlongentry_maxlen\fP bytes to read data into. The format of the `longname'
field is unspecified by SFTP protocol. It MUST be suitable for use in the
output of a directory listing command (in fact, the recommended operation for
a directory listing command is to simply display this data).
\fIlongentry_maxlen\fP - is the length of longentry in bytes. If the length
of the full directory entry is longer than the space provided by
longentry_maxlen it will be truncated to fit.
\fIlongentry_maxlen\fP - is the length of longentry in bytes. If the length of
the full directory entry is longer than the space provided by
\fIlongentry_maxlen\fP it will be truncated to fit.
\fIattrs\fP - is a pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate
statbuf style data into.
Read a block of data from a LIBSSH2_SFTP_HANDLE. This method is modeled
after the POSIX
.BR readdir(2)
however, it uses a variable sized directory entry (filename) buffer and
returns statbuf type data in the same call.
.SH RETURN VALUE
Number of bytes actually populated into buffer, or negative on failure. It
returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
Number of bytes actually populated into buffer (not counting the terminating
zero), or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would
otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't
really a failure per se.
.SH BUG
Passing in a too small buffer for 'buffer' or 'longentry' when receiving data
only results in libssh2 1.2.7 or earlier to not copy the entire data amount,
and it is not possible for the application to tell when it happens!
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@@ -54,6 +58,10 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to be
returned by the server.
From 1.2.8, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if any of the
given 'buffer' or 'longentry' buffers are too small to fit the requested
object name.
.SH SEE ALSO
.BR libssh2_sftp_open_ex(3),
.BR libssh2_sftp_close_handle(3)

View File

@@ -2,12 +2,14 @@
.\"
.TH libssh2_sftp_readlink 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_readlink - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP calls
libssh2_sftp_readlink - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_sftp_readlink(arguments)
#define libssh2_sftp_readlink(sftp, path, target, maxlen) \\
libssh2_sftp_symlink_ex((sftp), (path), strlen(path), (target), (maxlen), \\
LIBSSH2_SFTP_READLINK)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_symlink_ex(3)\fP.
@@ -16,4 +18,4 @@ See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_symlink_ex(3)\fP
.BR libssh2_sftp_symlink_ex(3)

View File

@@ -2,12 +2,14 @@
.\"
.TH libssh2_sftp_realpath 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_realpath - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP calls
libssh2_sftp_realpath - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_sftp_realpath(arguments)
#define libssh2_sftp_realpath(sftp, path, target, maxlen) \\
libssh2_sftp_symlink_ex((sftp), (path), strlen(path), (target), (maxlen), \\
LIBSSH2_SFTP_REALPATH)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_symlink_ex(3)\fP.
@@ -16,4 +18,4 @@ See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_symlink_ex(3)\fP
.BR libssh2_sftp_symlink_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_rename - convenience macro for \fIlibssh2_sftp_rename_ex(3)\fP call
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_rename(arguments)
int libssh2_sftp_rename(LIBSSH2_SFTP *sftp, const char *source_filename, const char *destination_filename);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_rename_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_rename_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_rename_ex(3)\fP
.BR libssh2_sftp_rename_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_rewind - convenience macro for \fIlibssh2_sftp_seek64(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_rewind(arguments)
int libssh2_sftp_rewind(LINBSSH2_SFTP_HANDLE *handle);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_seek64(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_seek64(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_seek64(3)\fP
.BR libssh2_sftp_seek64(3)

View File

@@ -2,12 +2,13 @@
.\"
.TH libssh2_sftp_rmdir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_rmdir - convenience macro for \fIlibssh2_sftp_rmdir_ex(3)\fP calls
libssh2_sftp_rmdir - convenience macro for \fIlibssh2_sftp_rmdir_ex(3)\fP
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_sftp_rmdir(arguments)
#define libssh2_sftp_rmdir(sftp, path) \\
libssh2_sftp_rmdir_ex((sftp), (path), strlen(path))
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_rmdir_ex(3)\fP.
@@ -16,4 +17,4 @@ See \fIlibssh2_sftp_rmdir_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_rmdir_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_rmdir_ex(3)\fP
.BR libssh2_sftp_rmdir_ex(3)

View File

@@ -4,30 +4,26 @@
.SH NAME
libssh2_sftp_rmdir_ex - remove an SFTP directory
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len);
int
libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp, const char *path);
int libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp, const char *path,
unsigned int path_len);
.SH DESCRIPTION
Remove a directory from the remote file system.
\fIsftp\fP - SFTP instance as returned by
.BR libssh2_sftp_init(3)
\fIsourcefile\fP - Full path of the existing directory to remove.
\fIsourcefile_len\fP - Length of the full path of the existing directory to remove.
Remove a directory from the remote file system.
\fIsourcefile_len\fP - Length of the full path of the existing directory to
remove.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@@ -38,6 +34,5 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to
be returned by the server.
.SH SEE ALSO
.BR libssh2_sftp_init(3)

View File

@@ -4,16 +4,14 @@
.SH NAME
libssh2_sftp_seek - set the read/write position indicator within a file
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
void
libssh2_sftp_seek(LIBSSH2_SFTP_HANDLE *handle, size_t offset);
void
libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset);
void libssh2_sftp_seek(LIBSSH2_SFTP_HANDLE *handle, size_t offset);
.SH DESCRIPTION
Deprecated function. Use \fIlibssh2_sftp_seek64(3)\fP instead!
\fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open_ex(3)
@@ -24,7 +22,6 @@ Note that libssh2 implements file pointers as a localized concept to make
file access appear more POSIX like. No packets are exchanged with the server
during a seek operation. The localized file pointer is simply used as a
convenience offset during read/write operations.
.SH AVAILABILITY
libssh2_sftp_seek64(3) was added in 1.0
.SH SEE ALSO
.BR libssh2_sftp_open_ex(3)
.BR libssh2_sftp_open_ex(3),
.BR libssh2_sftp_seek64(3)

View File

@@ -0,0 +1,31 @@
.\" $Id: libssh2_sftp_seek.3,v 1.5 2009/03/17 10:34:27 bagder Exp $
.\"
.TH libssh2_sftp_seek64 3 "22 Dec 2008" "libssh2 1.0" "libssh2 manual"
.SH NAME
libssh2_sftp_seek64 - set the read/write position within a file
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
void libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle,
libssh2_uint64_t offset);
.SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open_ex(3)
\fIoffset\fP - Number of bytes from the beginning of file to seek to.
Move the file handle's internal pointer to an arbitrary location. libssh2
implements file pointers as a localized concept to make file access appear
more POSIX like. No packets are exchanged with the server during a seek
operation. The localized file pointer is simply used as a convenience offset
during read/write operations.
You MUST NOT seek during writing or reading a file with SFTP, as the internals
use outstanding packets and changing the "file position" during transit will
results in badness.
.SH AVAILABILITY
Added in 1.0
.SH SEE ALSO
.BR libssh2_sftp_open_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_setstat - convenience macro for \fIlibssh2_sftp_stat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_setstat(arguments)
int libssh2_sftp_setstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attr);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_stat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_stat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_stat_ex(3)\fP
.BR libssh2_sftp_stat_ex(3)

View File

@@ -6,7 +6,7 @@ libssh2_sftp_stat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_stat(arguments)
int libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_STFP_ATTRIBUTES *attrs);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_fstat_ex(3)\fP
.BR libssh2_sftp_fstat_ex(3)

View File

@@ -4,49 +4,64 @@
.SH NAME
libssh2_sftp_stat_ex - get status about an SFTP file
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len, int stat_type, LIBSSH2_SFTP_ATTRIBUTES *attrs);
int
libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs);
int
libssh2_sftp_lstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs);
int
libssh2_sftp_setstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs);
int libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp, const char *path,
unsigned int path_len, int stat_type,
LIBSSH2_SFTP_ATTRIBUTES *attrs);
.SH DESCRIPTION
\fIsftp\fP - SFTP instance as returned by
.BR libssh2_sftp_init(3)
\fIpath\fP - Remote filesystem object to stat/lstat/setstat.
\fIpath_len\fP - Lenght of the name of the remote filesystem object
\fIpath_len\fP - Length of the name of the remote filesystem object
to stat/lstat/setstat.
\fIstat_type\fP - One of the three constants specifying the type of
stat operation to perform.
stat operation to perform:
\fIattrs\fP - Pointer to attribute structure to set file metadata
from or into depending on the value of stat_type.
.br
\fBLIBSSH2_SFTP_STAT\fP: performs stat(2) operation
.br
\fBLIBSSH2_SFTP_LSTAT\fP: performs lstat(2) operation
.br
\fBLIBSSH2_SFTP_SETSTAT\fP: performs operation to set stat info on file
Get or Set statbuf type data on a remote filesystem object. When
getting statbuf data,
\fIattrs\fP - Pointer to a \fBLIBSSH2_SFTP_ATTRIBUTES\fP structure to set file
metadata from or into depending on the value of stat_type.
Get or Set statbuf type data on a remote filesystem object. When getting
statbuf data,
.BR libssh2_sftp_stat(3)
will follow all symlinks, while
.BR libssh2_sftp_lstat(3)
will return data about the object encountered, even if that object
happens to be a symlink.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
The LIBSSH2_SFTP_ATTRIBUTES struct looks like this:
.nf
struct LIBSSH2_SFTP_ATTRIBUTES {
/* If flags & ATTR_* bit is set, then the value in this struct will be
* meaningful Otherwise it should be ignored
*/
unsigned long flags;
libssh2_uint64_t filesize;
unsigned long uid;
unsigned long gid;
unsigned long permissions;
unsigned long atime;
unsigned long mtime;
};
.fi
.SH RETURN VALUE
Returns 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN
when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative
number, it isn't really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@@ -57,6 +72,5 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to
be returned by the server.
.SH SEE ALSO
.BR libssh2_sftp_init(3)

View File

@@ -0,0 +1,79 @@
.TH libssh2_sftp_statvfs 3 "22 May 2010" "libssh2 1.2.6" "libssh2 manual"
.SH NAME
libssh2_sftp_statvfs, libssh2_sftp_fstatvfs - get file system statistics
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path,
size_t path_len, LIBSSH2_SFTP_STATVFS *st);
int
libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle,
LIBSSH2_SFTP_STATVFS *st)
.fi
.SH DESCRIPTION
These functions provide statvfs(2)-like operations and require
statvfs@openssh.com and fstatvfs@openssh.com extension support on the server.
\fIsftp\fP - SFTP instance as returned by
.BR libssh2_sftp_init(3)
\fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open_ex(3)
\fIpath\fP - full path of any file within the mounted file system.
\fIpath_len\fP - length of the full path.
\fIst\fP - Pointer to a LIBSSH2_SFTP_STATVFS structure to place file system
statistics into.
.SH DATA TYPES
LIBSSH2_SFTP_STATVFS is a typedefed struct that is defined as below
.nf
struct _LIBSSH2_SFTP_STATVFS {
libssh2_uint64_t f_bsize; /* file system block size */
libssh2_uint64_t f_frsize; /* fragment size */
libssh2_uint64_t f_blocks; /* size of fs in f_frsize units */
libssh2_uint64_t f_bfree; /* # free blocks */
libssh2_uint64_t f_bavail; /* # free blocks for non-root */
libssh2_uint64_t f_files; /* # inodes */
libssh2_uint64_t f_ffree; /* # free inodes */
libssh2_uint64_t f_favail; /* # free inodes for non-root */
libssh2_uint64_t f_fsid; /* file system ID */
libssh2_uint64_t f_flag; /* mount flags */
libssh2_uint64_t f_namemax; /* maximum filename length */
};
.fi
It is unspecified whether all members of the returned struct have meaningful
values on all file systems.
The field \fIf_flag\fP is a bit mask. Bits are defined as follows:
.IP LIBSSH2_SFTP_ST_RDONLY
Read-only file system.
.IP LIBSSH2_SFTP_ST_NOSUID
Set-user-ID/set-group-ID bits are ignored by \fBexec\fP(3).
.SH RETURN VALUE
Returns 0 on success or negative on failure. If used in non-blocking mode, it
returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP -
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to be returned
by the server.
.SH AVAILABILITY
Added in libssh2 1.2.6
.SH SEE ALSO
.BR libssh2_sftp_open_ex(3)

View File

@@ -2,12 +2,14 @@
.\"
.TH libssh2_sftp_symlink 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_symlink - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP calls
libssh2_sftp_symlink - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_sftp_symlink(arguments)
#define libssh2_sftp_symlink(sftp, orig, linkpath) \\
libssh2_sftp_symlink_ex((sftp), (orig), strlen(orig), (linkpath), \\
strlen(linkpath), LIBSSH2_SFTP_SYMLINK)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_symlink_ex(3)\fP.
@@ -16,4 +18,4 @@ See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_symlink_ex(3)\fP
.BR libssh2_sftp_symlink_ex(3)

View File

@@ -4,22 +4,17 @@
.SH NAME
libssh2_sftp_symlink_ex - read or set a symbolic link
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len, char *target, unsigned int target_len, int link_type);
int
libssh2_sftp_symlink(LIBSSH2_SFTP *sftp, const char *path, char *target);
int
libssh2_sftp_readlink(LIBSSH2_SFTP *sftp, const char *path, char *target, unsigned int target_len);
int
libssh2_sftp_realpath(LIBSSH2_SFTP *sftp, const char *path, char *target, unsigned int target_len);
libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path,
unsigned int path_len, char *target,
unsigned int target_len, int link_type);
.SH DESCRIPTION
Create a symlink or read out symlink information from the remote side.
\fIsftp\fP - SFTP instance as returned by
.BR libssh2_sftp_init(3)
@@ -28,19 +23,24 @@ libssh2_sftp_realpath(LIBSSH2_SFTP *sftp, const char *path, char *target, unsign
\fIpath_len\fP - Length of the name of the remote filesystem object to
create a symlink from or resolve.
\fItarget\fP -
\fItarget\fP - a pointer to a buffer. The buffer has different uses depending
what the \fIlink_type\fP argument is set to.
.br
\fBLIBSSH2_SFTP_SYMLINK\fP: Remote filesystem object to link to.
.br
\fBLIBSSH2_SFTP_READLINK\fP: Pre-allocated buffer to resolve symlink target into.
\fBLIBSSH2_SFTP_READLINK\fP: Pre-allocated buffer to resolve symlink target
into.
.br
\fBLIBSSH2_SFTP_REALPATH\fP: Pre-allocated buffer to resolve realpath target into.
\fBLIBSSH2_SFTP_REALPATH\fP: Pre-allocated buffer to resolve realpath target
into.
\fItarget_len\fP - Length of the name of the remote filesystem target object.
\fIlink_type\fP - One of the three previously mentioned constants which
determines the resulting behavior of this function.
These are convenience macros:
.BR libssh2_sftp_symlink(3)
: Create a symbolic link between two filesystem objects.
.br
@@ -49,12 +49,23 @@ determines the resulting behavior of this function.
.br
.BR libssh2_sftp_realpath(3)
: Resolve a complex, relative, or symlinked filepath to its effective target.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
When using LIBSSH2_SFTP_SYMLINK, this funtion returns 0 on success or negative
on failure.
When using LIBSSH2_SFTP_READLINK or LIBSSH2_SFTP_REALPATH, it returns the
number of bytes it copied to the target buffer (not including the terminating
zero) or negative on failure.
It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
From 1.2.8, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if the given 'target'
buffer is too small to fit the requested object name.
.SH BUG
Passing in a too small buffer when receiving data only results in libssh2
1.2.7 or earlier to not copy the entire data amount, and it is not possible
for the application to tell when it happens!
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.

View File

@@ -6,7 +6,7 @@ libssh2_sftp_unlink - convenience macro for \fIlibssh2_sftp_unlink_ex(3)\fP call
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_unlink(arguments)
int libssh2_sftp_unlink(LIBSSH2_SFTP *sftp, const char *filename);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_unlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_unlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_unlink_ex(3)\fP
.BR libssh2_sftp_unlink_ex(3)

View File

@@ -4,23 +4,51 @@
.SH NAME
libssh2_sftp_write - write SFTP data
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
ssize_t
libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, size_t count);
ssize_t libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle,
const char *buffer,
size_t count);
.SH DESCRIPTION
\fBlibssh2_sftp_write(3)\fP writes a block of data to the SFTP server. This
method is modeled after the POSIX write() function and uses the same calling
semantics.
\fIhandle\fP - SFTP file handle as returned by \fIlibssh2_sftp_open_ex(3)\fP.
\fIbuffer\fP - points to the data to send off
\fIbuffer\fP - points to the data to send off.
\fIcount\fP - Number of bytes from 'buffer' to write. Note that it may not be
possible to write all bytes as requested.
\fBlibssh2_sftp_write(3)\fP writes a block of data to the SFTP server. This
method is modeled after the POSIX write() function and uses the same calling
semantics.
\fIlibssh2_sftp_handle(3)\fP will use as much as possible of the buffer and
put it into a single SFTP protocol packet. This means that to get maximum
performance when sending larger files, you should try to always pass in at
least 32K of data to this function.
.SH WRITE AHEAD
Starting in libssh2 version 1.2.8, the default behavior of libssh2 is to
create several smaller outgoing packets for all data you pass to this function
and it will return a positive number as soon as the first packet is
acknowledged from the server.
This has the effect that sometimes more data has been sent off but isn't acked
yet when this function returns, and when this function is subsequently called
again to write more data, libssh2 will immediately figure out that the data is
already received remotely.
In most normal situation this should not cause any problems, but it should be
noted that if you've once called libssh2_sftp_write() with data and it returns
short, you MUST still assume that the rest of the data might've been cached so
you need to make sure you don't alter that data and think that the version you
have in your next function invoke will be detected or used.
The reason for this funny behavior is that SFTP can only send 32K data in each
packet and it gets all packets acked individually. This means we cannot use a
simple serial approach if we want to reach high performance even on high
latency connections. And we want that.
.SH RETURN VALUE
Actual number of bytes written or negative on failure.

View File

@@ -6,7 +6,7 @@ libssh2_userauth_hostbased_fromfile - convenience macro for \fIlibssh2_userauth_
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_hostbased_fromfile(arguments)
int libssh2_userauth_hostbased_fromfile(LIBSSH2_SESSION *session, const char *username, const char *publickey, const char *privatekey, const char *passphrase, const char *hostname);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +16,4 @@ See \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
.BR libssh2_userauth_hostbased_fromfile_ex(3)

View File

@@ -6,7 +6,11 @@ libssh2_userauth_keyboard_interactive - convenience macro for \fIlibssh2_useraut
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_keyboard_interactive(arguments)
int
libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION* session,
const char *username,
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*response_callback)));
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +20,4 @@ See \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
.BR libssh2_userauth_keyboard_interactive_ex(3)

View File

@@ -2,44 +2,59 @@
.\"
.TH libssh2_userauth_keyboard_interactive_ex 3 "8 Mar 2008" "libssh2 0.19" "libssh2 manual"
.SH NAME
libssh2_userauth_keyboard_interactive_ex - authenticate a session using a challenge-response authentication
libssh2_userauth_keyboard_interactive_ex - authenticate a session using
keyboard-interactive authentication
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(*response_callback));
int
libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION *session, const char *username, LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(*response_callback));
libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session,
const char *username,
unsigned int username_len,
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(*response_callback));
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIsession\fP - Session instance as returned by
\fIlibssh2_session_init_ex(3)\fP.
\fIusername\fP - Name of user to attempt plain password authentication for.
\fIusername\fP - Name of user to attempt keyboard-interactive authentication
for.
\fIusername_len\fP - Length of username parameter.
\fIresponse_callback\fP - As authentication proceeds, host issues several (1 or more) challenges and requires responses. This callback will be called at this moment. Callback is responsible to obtain responses for the challenges, fill the provided data structure and then return control. Responses will be sent to the host. String values will be free(3)ed by the library.
\fIresponse_callback\fP - As authentication proceeds, the host issues several
(1 or more) challenges and requires responses. This callback will be called at
this moment. The callback is responsible to obtain responses for the
challenges, fill the provided data structure and then return
control. Responses will be sent to the host. String values will be free(3)ed
by the library. The callback prototype must match this:
.nf
void response(const char *name,
int name_len, const char *instruction,
int instruction_len,
int num_prompts,
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
void **abstract);
.fi
Attempts keyboard-interactive (challenge/response) authentication.
Note that many SSH servers will always issue single "password" challenge,
requesting actual password as response, but it is not required by the protocol,
and various authentication schemes, such as smartcard authentication may use
keyboard-interactive authentication type too.
Note that many SSH servers will always issue a single "password" challenge,
requesting actual password as response, but it is not required by the
protocol, and various authentication schemes, such as smartcard authentication
may use keyboard-interactive authentication type too.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
Return 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN
when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative
number, it isn't really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fLIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - failed, invalid username/password or public/private key.
\fLIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - failed, invalid username/password
or public/private key.
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@@ -2,42 +2,40 @@
.\"
.TH libssh2_userauth_list 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_userauth_list - list the authentication methods supported by a server
libssh2_userauth_list - list supported authentication methods
.SH SYNOPSIS
.nf
#include <libssh2.h>
char *
libssh2_userauth_list(LIBSSH2_SESSION *session, const char *username, unsigned int username_len);
libssh2_userauth_list(LIBSSH2_SESSION *session, const char *username,
unsigned int username_len);
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIusername\fP - Username which will be used while authenticating. Note
that most server implementations do not permit attempting authentication
with different usernames between requests. Therefore this must be the
same username you will use on later userauth calls.
\fIusername\fP - Username which will be used while authenticating. Note that
most server implementations do not permit attempting authentication with
different usernames between requests. Therefore this must be the same username
you will use on later userauth calls.
\fIusername_len\fP - Length of username parameter.
Send a \fBSSH_USERAUTH_NONE\fP request to the remote host. Unless the
remote host is configured to accept none as a viable authentication
scheme (unlikely), it will return \fBSSH_USERAUTH_FAILURE\fB along with a
listing of what authentication schemes it does support. In the unlikely
event that none authentication succeeds, this method with return NULL. This
case may be distinguished from faily by examining
.BR libssh2_userauth_authenticated(3)
Send a \fBSSH_USERAUTH_NONE\fP request to the remote host. Unless the remote
host is configured to accept none as a viable authentication scheme
(unlikely), it will return \fBSSH_USERAUTH_FAILURE\fP along with a listing of
what authentication schemes it does support. In the unlikely event that none
authentication succeeds, this method with return NULL. This case may be
distinguished from a failing case by examining
\fIlibssh2_userauth_authenticated(3)\fP.
.SH RETURN VALUE
On success a comma delimited list of supported authentication schemes. This list is
internally managed by libssh2. On failure ruturns NULL.
On success a comma delimited list of supported authentication schemes. This
list is internally managed by libssh2. On failure ruturns NULL.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@@ -6,7 +6,9 @@ libssh2_userauth_password - convenience macro for \fIlibssh2_userauth_password_e
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_password(arguments)
int libssh2_userauth_password(LIBSSH2_SESSION *session,
const char *username,
const char *password);
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
@@ -16,4 +18,4 @@ See \fIlibssh2_userauth_password_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_password_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_password_ex(3)\fP
.BR libssh2_userauth_password_ex(3)

View File

@@ -5,13 +5,18 @@
libssh2_userauth_password_ex - authenticate a session with username and password
.SH SYNOPSIS
#include <libssh2.h>
.nf
int libssh2_userauth_password_ex(LIBSSH2_SESSION *session,
const char *username,
unsigned int username_len,
const char *password,
unsigned int password_len,
LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)));
int
libssh2_userauth_password_ex(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, const char *password, unsigned int password_len, LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)));
int
libssh2_userauth_password(LIBSSH2_SESSION *session, const char *username, const char *password);
#define libssh2_userauth_password(session, username, password) \\
libssh2_userauth_password_ex((session), (username), \\
strlen(username), \\
(password), strlen(password), NULL)
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
@@ -40,13 +45,15 @@ LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS
Some of the errors this function may return include:
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_PASSWORD_EXPIRED\fP -
\fLIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - failed, invalid username/password or public/private key.
\fLIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - failed, invalid username/password
or public/private key.
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@@ -0,0 +1,29 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_userauth_publickey 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_userauth_publickey - authenticate using a callback function
.SH SYNOPSIS
#include <libssh2.h>
.nf
int libssh2_userauth_publickey(LIBSSH2_SESSION *session,
const char *user,
const unsigned char *pubkeydata,
size_t pubkeydata_len,
sign_callback,
void **abstract);
.SH DESCRIPTION
Authenticate with the \fIsign_callback\fP callback that matches the prototype
below
.SH CALLBACK
.nf
int name(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
const unsigned char *data, size_t data_len, void **abstract);
.fi
This function gets called...
.SH RETURN VALUE
Return 0 on success or negative on failure.
.SH SEE ALSO
.BR libssh2_userauth_publickey_fromfile_ex(3)

Some files were not shown because too many files have changed in this diff Show More