Compare commits

..

257 Commits

Author SHA1 Message Date
Daniel Stenberg
355fbf4d5b prepared for 1.2.2 2009-11-16 22:43:55 +01:00
Simon Josefsson
ebbd7c879b Support AES-Counter ciphers. 2009-11-16 16:04:00 +01:00
Simon Josefsson
b78f854d8b Silence compiler warning.
Reported by Steven Van Ingelgem <steven@vaningelgem.be>
in <http://thread.gmane.org/gmane.network.ssh.libssh2.devel/2566>.
2009-11-04 14:47:00 +01:00
Simon Josefsson
1f0d47fa92 Mention libssh2-style.el. 2009-10-29 10:39:15 +01:00
Simon Josefsson
463e09e55f Use memmove instead of memcpy on overlapping memory areas.
Reported by Bob Alexander <balexander@expressor-software.com> in
<http://thread.gmane.org/gmane.network.ssh.libssh2.devel/2530>.
2009-10-28 15:31:00 +01:00
Simon Josefsson
82bf39dbfa Add. 2009-10-28 15:29:36 +01:00
Simon Josefsson
e5f170bae2 Protect against crash on too small SSH_MSG_IGNORE packets.
Reported by Bob Alexander <balexander@expressor-software.com>
in <http://thread.gmane.org/gmane.network.ssh.libssh2.devel/2530>.
2009-10-28 15:27:11 +01:00
Simon Josefsson
fc60563840 add copyright line 2009-10-27 20:32:24 +01:00
Simon Josefsson
b38b4fb859 support arcfour128 cipher per RFC 4345 2009-10-27 20:03:30 +01:00
Cristian Rodríguez
3182045c2d add support for GCC visibility features 2009-10-21 17:02:12 +02:00
Simon Josefsson
60d73d5663 less hard coding of cipher mode in libgcrypt backend 2009-10-19 17:36:50 +02:00
Juzna
1e80194b97 libssh2_channel_forward_accept() and listening fixes
The forward accepting was not done right before, and the
packet_queue_listener function didn't assign a necessary
variable. All fixed by Juzna. I (Daniel) modified the
forward_accept() change somewhat.
2009-10-18 03:41:25 +02:00
Daniel Stenberg
0c13f7beda added man page for libssh2_knownhost_free 2009-10-18 03:03:55 +02:00
Daniel Stenberg
b859f4d9d2 more CVS => DEV conversions 2009-10-17 21:36:57 +02:00
Daniel Stenberg
13092c5a5e remove references to "CVS" 2009-10-17 21:36:05 +02:00
Daniel Stenberg
22b73235d3 we are on the 1.2.2 track nowadays 2009-10-17 21:34:49 +02:00
Peter Stuge
55034294e8 Ensure that win32/libssh2.dsp will be generated with CRLF line endings
First, win32/msvcproj.{head,foot} are now committed with CRLF line endings,
and .gitattributes specifies that these should not be changed on checkout or
commit. These are win32 files so it makes sense to store them with native
line endings.

Second, the rules for generating libssh2.dsp and libssh2.vcproj are changed
so that the full file contents passes through awk, which strips all CR and
then prints each line with one CRLF line ending. Stripping CR is important
to avoid CRCRLF in case the input already comes with CRLF.
2009-10-17 02:58:53 +02:00
Dan Fandrich
5e80055d22 Make sure permissions on the private host key file is tight enough that
sshd doesn't complain. Quote $srcdir to try to cope with embedded spaces.
2009-09-29 15:27:17 -07:00
Peter Stuge
11ca8d5583 Clarify the scp_write examples slightly and use an octal mask for the mode 2009-09-30 00:12:23 +02:00
Daniel Stenberg
9162fd7e61 1.2.1 preparations 2009-09-29 13:20:32 +02:00
Daniel Stenberg
7208e8d0d9 remove ChangeLog and win32/libssh2.dsp only at make distclean 2009-09-28 14:21:56 +02:00
Simon Josefsson
e1bb074287 Fix shell usage. 2009-09-23 09:39:47 +02:00
Daniel Stenberg
e887ffca4c clarify that the paths are the remote ones 2009-09-22 23:54:10 +02:00
Daniel Stenberg
65d1cb8107 let hpux systems build with _REENTRANT defined as well 2009-09-22 23:46:45 +02:00
Daniel Stenberg
4ed82f0e78 updated to match reality
I went over the commit log and added what I believe is all notable
changes and bugfixes since the 1.2 release
2009-09-20 20:14:23 +02:00
Peter Stuge
3cc2f143c1 Fix scp examples to loop correctly over libssh2_channel_write() 2009-09-20 01:35:19 +02:00
Peter Stuge
683aa0f6b5 Fix transport layer bug causing invalid -39 (LIBSSH2_ERROR_BAD_USE) errors
The channel layer sends packets using the transport layer, possibly
calling _libssh2_transport_write() many times for each packet.

The transport layer uses the send_existing() helper to send out any
remaining parts of previous packets before a new packet is started.

The bug made send_existing() consider the entire packet sent as soon as it
successfully sent the second part of a packet, even if the packet was not
completely done yet.
2009-09-20 00:30:42 +02:00
Neil Gierman
7a9d36903a Added gettimeofday() function for win32
Neil Gierman's patch adds a gettimeofday() function for win32
for the libssh2_trace() functionality. The code originates from
cygwin and was put in the public domain by the author
Danny Smith <dannysmith@users.sourceforge.net>
2009-09-19 22:39:50 +02:00
Daniel Stenberg
c2375dbfa4 libssh2_channel_read_ex() must return 0 when closed
If the channel is already at EOF or even closed at the end of the
libssh2_channel_read_ex() function and there's no data to return,
we need to signal that back. We may have gotten that info while
draining the incoming transport layer until EAGAIN so we must not
be fooled by that return code.
2009-09-16 23:46:30 +02:00
Dan Fandrich
906a7d8866 Ignore tags file 2009-09-16 07:49:32 -07:00
Dan Fandrich
1418993a0f Some platforms need sys/socket.h included before netinet/in.h.
Fixed an unused variable compiler warning.
2009-09-16 07:49:32 -07:00
Daniel Stenberg
c4b7f0394b libssh2_channel_wait_closed() could hang
libssh2_channel_wait_closed() had a bad loop waiting for the
channel to close, as it could easily miss the info and then if
the socket would be silent from that moment the funtion would
hang if in blocking-mode or just return EAGAIN wrongly to the
app. The drain-transport loop now correctly checks if the close
has arrived.
2009-09-16 13:49:04 +02:00
Daniel Stenberg
9e84b999a5 make libssh2_scp_send/recv do blocking mode correctly
Somehow I had completely missed to make the libssh2_scp_send/recv
functions support the blocking mode the correct way so when I
cleaned up things the other day blocking mode broke for them...
Fixed now.
2009-09-15 23:29:46 +02:00
Guenter Knauf
3fda91d725 changed NetWare test makefile static link order 2009-09-08 01:32:45 +02:00
Guenter Knauf
7c32c84d0e removed conditional sources from Makefile.inc
added ifdef blocks to libgcrypt.c, pem.c, openssl.c
2009-09-07 18:10:49 +02:00
Simon Josefsson
766127ad57 Fix compilation errors. 2009-09-07 14:14:10 +02:00
Guenter Knauf
a9e7f87e31 some more NetWare build fixes. 2009-09-06 06:57:55 +02:00
Guenter Knauf
a04a0b6c69 some more NetWare makefile fixes. 2009-09-06 06:31:59 +02:00
Guenter Knauf
1f8d58a4ce added sys/select.h include to samples for fd_set on NetWare. 2009-09-06 06:15:29 +02:00
Guenter Knauf
4b482eddbe accept CFLAGS from environment. 2009-09-06 04:36:51 +02:00
Guenter Knauf
05eb612f8e some more .cvsignore / .gitignore fixes. 2009-09-04 02:23:28 +02:00
Guenter Knauf
d48ee98ecf renamed .cvsignore to .gitignore. 2009-09-04 02:12:50 +02:00
Guenter Knauf
536443246e changed conditional into make language. 2009-09-04 01:24:38 +02:00
Guenter Knauf
b728b1018f changed NetWare and MingW32 makefile to use Makefile.inc. 2009-09-03 22:06:59 +02:00
Daniel Stenberg
3f5a6662d0 CVS leftovers removed 2009-09-02 22:41:47 +02:00
Daniel Stenberg
33f4e0f250 libssh2_version() exists since 1.1 2009-09-02 22:39:48 +02:00
Hacki
8dabb1c5eb added knownhost.c to makefiles. 2009-09-02 20:03:27 +02:00
Alexander Lamaison
0d6aaa1f56 Pass private-key to OpenSSL as a filename with BIO_new_file().
This keeps all FILE* handling on the OpenSSL side of the DLL boundary avoiding crashes on Windows while removing the need for libssh2 to read the private key file into memory.  This is now done by OpenSSL which is likely to do a better job of it.
2009-09-02 14:59:40 +01:00
Daniel Stenberg
00fac145ba generate and install libssh2.pc
oh these are necessary libssh2.pc changes too
2009-09-01 10:04:13 +02:00
Daniel Stenberg
f65f71a156 first take at producing and installing a pkg-config file 2009-09-01 09:55:25 +02:00
Daniel Stenberg
3142e8df7e renamed to .ac 2009-09-01 09:51:14 +02:00
Daniel Stenberg
bffefb12ea renamed to the modern name "configure.ac" 2009-09-01 09:48:14 +02:00
Daniel Stenberg
feadd5f321 always braces and else and brace on the same line removed
I don't follow those particular guidelines myself so I think I'd
rather remove them here and keep my style than the opposite. As
I am the most frequent writer of code for the moment.
2009-09-01 09:42:33 +02:00
Daniel Stenberg
7c139633a1 _libssh2_channel_write() only sends the 32K first bytes
In theory we could split larger buffers into several smaller
packets to pass to transport_write(), but for now we instead only
deal with the first 32K in this call and assume the app will call
this function again with the rest!  The 32K size is a
conservative limit based on the text in RFC4253 section 6.1.
2009-08-30 23:52:11 +02:00
Daniel Stenberg
692401633a document _libssh2_channel_write's return code 2009-08-30 19:46:42 +02:00
Daniel Stenberg
5bb1fb5cbc s/libssh2_channel_write_ex/_libssh2_channel_write internally 2009-08-30 19:31:07 +02:00
Daniel Stenberg
5e5ead00b4 call libssh2_error() when transport_write() returns EAGAIN
_libssh2_channel_write() should never return error without
libssh2_error() getting called
2009-08-30 19:28:43 +02:00
Daniel Stenberg
06278728e2 clarify that zero can be returned without meaning error 2009-08-30 17:07:50 +02:00
Daniel Stenberg
0357befa42 remove debug leftovers 2009-08-30 17:06:57 +02:00
Daniel Stenberg
85198c1cdb channel_read() was changed to _libssh2_channel_read() as lots of
internal code was changed to use that instead of wrongly using
libssh2_channel_read_ex(). Some files now need to include
channel.h to get this proto.

channel_read() calls libssh2_error() properly on transport_read()
failures

channel_read() was adjusted to not "invent" EAGAIN return code in
case the transport_read() didn't return it

channel_close() now returns 0 or error code, as
documented. Previously it would return number of bytes read in
the last read, which was confusing (and useless).
2009-08-30 17:00:49 +02:00
Daniel Stenberg
face4750ca changed all return EAGAIN to return the variable instead
I made this change just to easier grep for "return .*EAGAIN" cases
as they should be very rare or done wrongly. Already worked to find
a flaw, marked with "TODO FIXME THIS IS WRONG" in channel.c. I also
fixed a few cases to become more general returns now when we have
more unified return codes internally.
2009-08-25 00:54:47 +02:00
Daniel Stenberg
a1365916c7 _libssh2_channel_write() must not invent EAGAIN situations
it is important that only the transport layer can generate EAGAIN
error codes so that we limit where we need to set direction bits
and more. When the local window is too small to send data we simply
stop trying to send and (risk) returning zero in
_libssh2_channel_write()
2009-08-25 00:25:08 +02:00
Daniel Stenberg
f64a84a909 error code cleanup 2009-08-25 00:23:34 +02:00
Daniel Stenberg
fba3877ed8 remove all libssh2pack_t leftovers 2009-08-24 23:57:15 +02:00
Daniel Stenberg
f1e010f5d4 removed the libssh2pack_t type
and a minor _libssh2_transport_read() simplification
2009-08-24 23:50:53 +02:00
Daniel Stenberg
9e96acf86e fix return codes, shortened a very long function name 2009-08-24 23:49:58 +02:00
Daniel Stenberg
1a157d27cc remove use of libssh2_channel_receive_window_adjust
_libssh2_channel_receive_window_adjust is the new replacement that
is both the correct internal version instead of the external API one,
and it has the return code flaw fixed. I also fixed more return
codes to pass long the correct error found.
2009-08-24 23:24:35 +02:00
Daniel Stenberg
b3418bb1eb more proper return codes, added a missing libssh2_error() call 2009-08-24 23:23:46 +02:00
Daniel Stenberg
08be841b4d clear socket_block_directions bits before send/recv
These two places are the only places where send and recv are called
outside of transport.c so make sure they clear/set the bits correctly.
2009-08-24 23:22:39 +02:00
Daniel Stenberg
e39128df52 simplified fullpacket, clarified _libssh2_transport_write() comment 2009-08-24 23:13:14 +02:00
Daniel Stenberg
5c6b8166c7 cleaned up _libssh2_packet_add()
removed some code duplication, changed a few return -1 to return
error codes instead and added a missing libssh2_error() invoke
2009-08-24 23:03:08 +02:00
Daniel Stenberg
dcb9625473 convert return -1 instances to return [proper error code] 2009-08-24 22:50:46 +02:00
Daniel Stenberg
c1b687c9e4 simplify code by removing code duplication 2009-08-24 22:44:22 +02:00
Daniel Stenberg
13e920d4ef fix several return -1 to return a proper error code
On many places in the code there have been laziness return -1
statements lying around that should be fixed to return sensible
error codes. Here's a take at fixing a few offenders.
2009-08-24 22:28:27 +02:00
Daniel Stenberg
314e61e545 change transport to use unified error codes
I added three new public error codes, and then modified the return
codes we use in the transport layer to use the generic error codes
so that there won't be any risk of internal confusions due to
different error code sets.
2009-08-24 22:27:11 +02:00
Daniel Stenberg
13c16db3bc changes from int to libssh2_socket_t for sokcets
modified two functions to use libssh2_socket_t instead of int
when referring to a socket descriptor
2009-08-24 14:13:00 +02:00
Daniel Stenberg
82c3f0ba72 introducing libssh2_socket_t type and fixed iovec for windows
Steven Van Ingelgem introduces libssh2_socket_t as a generic socket
type to use internally to avoid compiler warnings and mistakes. Also,
the private struct iovec declaration for windows is now made to look
like the POSIX struct does.
2009-08-24 14:07:05 +02:00
Daniel Stenberg
9e099fb88a linked list changes and minor bug fixes 2009-08-20 01:03:40 +02:00
Daniel Stenberg
415efe10ac linked list code is now converted to new functions 2009-08-20 01:00:54 +02:00
Daniel Stenberg
4b1cb4e95e remove superfluous braces and re-indent somewhat 2009-08-20 00:59:23 +02:00
Daniel Stenberg
d8b6f3c7b8 move over lots of code to the _libssh2_list_* functions
and I fixed a few minor bugs at the same time
2009-08-20 00:56:54 +02:00
Daniel Stenberg
a871f0b214 converted listeners to the linked list functions 2009-08-20 00:56:54 +02:00
Daniel Stenberg
08cad8e14c moved the handling of SFTP handles to new linked list code
Each SFTP file handle is now handled by the "mother-struct"
using the generic linked list functions. The goal is to move
all custom linked list code to use this set of functions.

I also moved the list declarations to the misc.h where they
belong and made misc.h no longer include libssh2_priv.h itself
since now libssh2_priv.h needs misc.h...

In misc.c I added a #if 0'ed _libssh2_list_insert() function
because I ended up writing one, and I believe we may need it here
too once we move over more stuff to use the _libssh2_list* family.
2009-08-20 00:56:54 +02:00
Daniel Stenberg
46178378f2 correct the comment for _libssh2_list_add()
it adds the new node to the _end_ of the list
2009-08-20 00:56:54 +02:00
Steven Van Ingelgem
28b179ecf2 Suppress signed/unsigned comparison warning. 2009-08-16 23:14:20 +01:00
Daniel Stenberg
7b4d6b2868 added contributors from the 1.2 release notes 2009-08-11 10:11:11 +02:00
Simon Josefsson
fbe4737719 Need to use $(EXEEXT) on programs in TESTS to fix mingw cross-compiles. 2009-08-11 02:46:45 +02:00
Daniel Stenberg
ce4ad0d086 start working on 1.2.1 2009-08-10 22:58:15 +02:00
Daniel Stenberg
291ac7d433 Version 1.2 (August 10, 2009) 2009-08-10 20:07:17 +02:00
Daniel Stenberg
cccaa868f5 revert parts of the b95fe985af commit
Alexander Lamaison tracked down that my previous commit broke SFTP
reads in some aspects. The reversion now gets back to always recv()
until EAGAIN is returned so that the code no longer treats a short
read as an indication that it is "enough for now".

The bad commit in particular had another independent change included,
which is to clear the direction-bits first in the transport read
and write functions, but this reversion does not revert that change.
Clearing those bits first is a good thing.
2009-08-07 11:33:59 +02:00
Daniel Stenberg
08b0183d8e Fix some nroff formatting
Patch by Sofian Brabez
2009-08-06 15:56:27 +02:00
Alexander Lamaison
231a97a95f Replaced calls to OpenSSL FILE-pointer functions.
Passing a FILE* argument across a DLL boundary causes problems on Windows.  Instead the keys are read into memory by libssh2 and passed to the OpenSSL functions as BIO* arguments.
2009-08-02 23:20:20 +01:00
Daniel Stenberg
6c46bb4719 Add missing names
I went over the NEWS and git log outputs and added all mentioned
contributors through the project's history. I want us to make an
effort to give credit to everyone who contributes, big or small.
2009-07-31 16:07:33 +02:00
Daniel Stenberg
8a0ba6f5f6 fix the C99 variadic macro use for _libssh2_debug()
George Neill pointed out that the C99 vararg marcro use was
wrong, and I edited his suggested patch slightly and unified
both prec99-GCC and C99 into the same macro.
2009-07-29 22:03:40 +02:00
Daniel Stenberg
143720e922 Include RELEASE-NOTES in the release package 2009-07-29 14:38:06 +02:00
Daniel Stenberg
0cad4c08e9 Release notes for the pending release
I hope to maintain this file during development so that we also add
changes and bugfixes to it when we change things. Makes the daily
snapshots better and makes less of a hurdle when the release day
comes.
2009-07-29 14:35:42 +02:00
Daniel Stenberg
dd38d0a929 bad debugdump() causes SIGSEGV, partial sends not done right
The anonymous bug report #2822910 pointed out that debugdump() was
stupidly called within the send_existing() function. At closer
inspection was the report not only right, but it also revealed
another problem to me: when the _libssh2_send() function returns
after sending only a part of the buffer, it would then misbehave.
This probably is very rare though, which must be the reason we
haven't seen a bigger problem with this.
2009-07-28 19:57:02 +02:00
Simon Josefsson
ba57d5ae3c Silcen compiler warnings. 2009-07-28 13:27:43 +02:00
Daniel Stenberg
5ac67d1268 added two new issues to fix: socket type and better windowing
* make sure the windowing code adapts better to slow situations so that it
  doesn't then use as much memory as today

* Introduce a 'libssh2_socket_t' type for sockets in internal code
2009-07-27 23:58:06 +02:00
Daniel Stenberg
6f4463e81f remove superfluous check for large packets
as we're already doing the correct check further down anyway there's no point
in doing the (wrong) check further up as well. Paul Veldkamp pointed this out.
2009-07-27 22:54:18 +02:00
Simon Josefsson
690c3d42db Fix make distcheck problems. 2009-07-22 23:34:31 +02:00
Daniel Stenberg
2b780fa02d parts of the previous VS project files commit 2009-07-18 00:35:38 +02:00
Daniel Stenberg
b363c84366 From: Neil Gierman <ngierman@roadrunn.com>
Makefile changes to generate MSVS project files

- I integrated the libssh2_lib.dsp and libssh2_dll.dsp into a single
libssh2.dsp with different targets for lib vs dll
- Since I run Visual Studio 2008 with VC++9 I did not do vcproj files since
I would have newer vc8proj.head|foot than what others will be running
- My patch only has changes to Makefile.am's. I noticed that Makefile.in's
are included in the daily snapshots but they should be generated from the
.am's
- The 3 new files are msvcproj.head and msvcproj.foot for the beginning and
ending of the dsp file, and a new Makefile.inc that will have the source and
header file names. NOTE: All new source files will need to be added to
Makefile.inc and NOT Makefile.am now.
- I moved the win32 dir before the include dir
- I modified the dsw file so it points to the new libssh2.dsp project file
2009-07-18 00:23:25 +02:00
Daniel Stenberg
35a9d4bc62 From: Alexander Lamaison <swish@lammy.co.uk>
Make the public headers includable on their own
2009-07-17 23:40:32 +02:00
Daniel Stenberg
686db51284 From: Steven Van Ingelgem <steven@vaningelgem.be>
check first for libtoolize, and then for glibtoolize

Mac OS X (and others?) needs this
2009-07-17 23:38:41 +02:00
Daniel Stenberg
2361f50e9a Fix knownhost checking of non-hashed hosts
From: Ben Kibbey <bjk@luxsci.net>
2009-07-12 07:05:00 +02:00
Daniel Stenberg
e5d76b5468 Fix the functionality again with hashed host names again.
The breakage came with commit 8b46528c04.
2009-07-12 00:03:37 +02:00
Peter Stuge
7eead1461b Update mailing list URL to new address 2009-07-10 20:11:29 +02:00
Daniel Stenberg
c0d032a45c const'ify two arguments to libssh2_knownhost_check() 2009-07-10 00:54:59 +02:00
Daniel Stenberg
0751067c2f Fix compiler warnings appearing with VS2008. Based on Steven Van Ingelgem's
patch in #2787839 with a bunch of additional edits by yours truly.
2009-07-07 13:44:17 +02:00
Daniel Stenberg
acbdbb8914 Applied Francois Dupoux's extra checks for weird packet or padding length in
incoming packets. We really need to bail out this way on weird input.
bug report #2814613
2009-07-07 13:26:42 +02:00
Daniel Stenberg
bea1beb4fd Mark McPherson posted bug report #2815836 pointing out that the custom memory
functions were not given the correct data as argument. This is now fixed even
if I personally don't quite grasp why abstract is passed as a pointer to
pointer all over libssh2...
2009-07-07 13:09:11 +02:00
Daniel Stenberg
5b599fbf40 Ben Kibbey added a type parameter to the libssh2_session_hostkey() function,
which hasn't yet been in a public release so changing the API is fine!
2009-07-07 00:25:17 +02:00
Daniel Stenberg
75bec57c94 Guenter Knauf fixed this example to build on win32 2009-07-02 11:46:51 +02:00
Daniel Stenberg
b9b5e5fea5 corrected (again) 2009-07-02 11:44:54 +02:00
Daniel Stenberg
91bca481b5 clarify 2009-07-02 00:11:33 +02:00
Daniel Stenberg
9a6ce012cc Neil Gierman pointed out in bug report #2809163 that these two files cannot
include the public libssh2.h header as it breaks the compile on window. I'll
adapt to this now, but in the long run I think we should rather fix the
includes so that we _can_ include the public headers properly.
2009-06-26 20:43:56 +02:00
Daniel Stenberg
a4c3f0d0a3 fixed the length check in knownhost_writeline() since <= is actually good
enough when the size includes the trailing zero
2009-06-14 14:29:15 +02:00
Daniel Stenberg
320450201a After a mention from Ben Kibbey we now let knownhost_writeline() return the
length of the actual data it returns, excluding the trailing zero. I also
updated the man page for libssh2_knownhost_writeline() accordingly.
2009-06-14 14:27:15 +02:00
Daniel Stenberg
9f5c1caa81 empty line removed 2009-06-14 14:26:27 +02:00
Daniel Stenberg
8b46528c04 Ben Kibbey fixed the hostline() when parsing lines using only one hostname 2009-06-10 20:46:11 +02:00
Daniel Stenberg
aeaf07576e Merge branch 'master' of ssh://bagder@git.stuge.se/var/lib/git/libssh2 2009-06-09 00:00:26 +02:00
Daniel Stenberg
c01e147a40 Provide a libssh2_scp_send() API for files larger than 4GB (32bit size) 2009-06-08 16:10:37 +02:00
Daniel Stenberg
32080def94 Olivier Hervieu provided this x11 forwarding example. This is the version
after my initial cleanup that I posted to the list on May 26th 2009. It still
has a few ugly spots that should be cleaned up, but until then it's will at
least be found in the repo. For this reason I don't add this to the makefile.
2009-06-05 09:04:24 +02:00
Daniel Stenberg
da1230b35b New man page for libssh2_session_hostkey(3). We probably need to improve this
to also return the type of the key.
2009-06-05 09:02:56 +02:00
Daniel Stenberg
d440995a80 Add check for and use of the _REENTRANT define for Solaris so that libssh2
is then properly thread-safe on that OS. These autuconf macros are straight
from the cURL project and were mostly written by Yang Tse. They were only
very slightly edited by me when imported to here.
2009-06-04 20:23:23 +02:00
Tor Arntsen
2a142a6524 Ignore generated files 2009-06-04 18:20:29 +02:00
Daniel Stenberg
afcf63b433 use the correct #if condition for strtoll(), pointed out in bug report 2009-06-04 00:36:34 +02:00
Daniel Stenberg
bc4c258842 define the HAVE_LIBSSH2_KNOWNHOST_API to the version number 1.1.1 to make apps
know that when this define exists, the API exists. And the version number can
be used for run-time checks. 1.1.1 is not likely to be the release version as
I think we'll go with 1.2 instead but 1.1.1 OR LATER should still work.
2009-05-29 23:04:52 +02:00
Daniel Stenberg
e52a1057fd libssh2_knownhost_add() got an additional argument: 'store' so that an
application can get a pointer back to the internal representation of the host
it just added. Useful for example when the app wants to add a host, and then
convert that exact same host to a line for storing in a known host file.
'store' can also be set to NULL to simple not care.
2009-05-29 18:40:29 +02:00
Daniel Stenberg
517909d37a Added a call to libssh2_knownhost_writefile()
Updated to the slightly modified libssh2_knownhost_check() proto
2009-05-29 14:10:54 +02:00
Daniel Stenberg
8cd76af353 "struct libssh2_knownhost" is now part of the internal struct for each known
host so we now only return pointers to structs instead of having the app
allocate a full struct

I moved the private struct definition into knownhosts.c instead of exposing it
wider in libssh2_priv.h

I thus modified the proto for two functions that previously used 'struct
libssh2_knownhost *' to receive data.
2009-05-29 14:08:24 +02:00
Daniel Stenberg
1d31dadc1e when a host is added, we must make sure the app also provides a key *type* even
though we don't use the type in this function
2009-05-29 13:58:04 +02:00
Daniel Stenberg
2e990194ab Added man pages for the two newest members of the knownhosts API family:
libssh2_knownhost_readline() and libssh2_knownhost_writeline()
2009-05-29 10:12:22 +02:00
Daniel Stenberg
1afbbf4507 introducing libssh2_knownhost_writeline() and some cleanups to use more
defined error codes instead of the simplified -1 previously used a little too
much here
2009-05-29 10:00:45 +02:00
Daniel Stenberg
82bdd12a8b I think *readline() makes a better name 2009-05-29 00:19:02 +02:00
Daniel Stenberg
4df48aef41 clarify that the key "string" needs to be zero terminated too 2009-05-29 00:14:41 +02:00
Daniel Stenberg
bc28d0146d introducing libssh2_knownhost_read() that makes libssh2 read a single given
line
const'ified a few args to libssh2_knownhost_add() as well
2009-05-29 00:08:00 +02:00
Daniel Stenberg
8b1ec197b2 fix a warning for a comparison mixing signed and unsigned types 2009-05-28 22:54:37 +02:00
Daniel Stenberg
2436a4de60 After review/feedback/discussions on the mailing list. Rename two functions:
s/libssh2_knownhost_parsefile/libssh2_knownhost_readfile
s/libssh2_knownhost_dumpfile/libssh2_knownhost_writefile
2009-05-28 19:57:54 +02:00
Daniel Stenberg
22014f074b define removed 2009-05-28 16:12:24 +02:00
Daniel Stenberg
f35dbff3c4 LIBSSH2_KNOWNHOST_TYPE_DEFAULT is not a good idea, scrap it 2009-05-28 14:36:16 +02:00
Daniel Stenberg
703fbd9d11 Added the initial man pages for the 7 new functions for known host handling 2009-05-28 14:35:13 +02:00
Daniel Stenberg
5207690edf first shot at implementing libssh2_knownhost_dumpfile() and some minor
cleanups
2009-05-28 13:14:32 +02:00
Daniel Stenberg
eaa95e0331 introducing libssh2_knownhost_get() to the public API 2009-05-27 16:00:52 +02:00
Daniel Stenberg
d965dda027 clarified a comment 2009-05-26 11:18:29 +02:00
Daniel Stenberg
bf884488ae slighty better behavior and comments 2009-05-26 11:18:00 +02:00
Daniel Stenberg
28b08e0b4d remove include since we don't use struct iovec in this file 2009-05-26 11:14:07 +02:00
Daniel Stenberg
1ffa2cb519 These examples no longer need to explictly set the socket to non-blocking state
as libssh2 itself will always do that by itself.
2009-05-26 09:41:13 +02:00
Daniel Stenberg
279d6dd82a add myself as copyright owner 2009-05-25 11:35:06 +02:00
Daniel Stenberg
49192598d2 mention conversion of code to the new linked list code 2009-05-25 11:29:39 +02:00
Daniel Stenberg
6b7c19ec26 remove #if 0'ed code 2009-05-25 11:23:06 +02:00
Daniel Stenberg
160e5aa763 clarify the fix, as it wasn't a leak 2009-05-25 11:03:24 +02:00
Daniel Stenberg
42e9f02025 spell fix a comment 2009-05-25 10:58:13 +02:00
Daniel Stenberg
5a162ad9f8 Added some clarifying comments on how the 'sftpInit_sftp' and
'sftpInit_channel' struct fields within the session struct are used. And made
sure to clear them both correctly when sftp_init() returns instead of at
shutdown time, as it must not touch them at shutdown time. This should make it
possible to properly make more than one SFTP handle.
2009-05-25 10:50:49 +02:00
Daniel Stenberg
6ff83eab1b no need for LIBSSH2_ERROR_MEMORY when LIBSSH2_ERROR_ALLOC already exist!
added my own copyright line too now
2009-05-25 10:41:07 +02:00
Daniel Stenberg
8df3222d91 use LIBSSH2_ERROR_ALLOC instead of introducing a new error code 2009-05-25 10:40:36 +02:00
Daniel Stenberg
0357ce6c48 clear session->sftpInit_sftp unconditionally 2009-05-24 23:51:59 +02:00
Daniel Stenberg
c5f335ad4f Fix my recent session->sftpInit_sftp fix which wasn't correct. The memory area
does not need to be freed (it already gets freed) but clearing the pointer is
a good idea. And it should be done _after_ the channel_free() call.
2009-05-24 23:44:52 +02:00
Daniel Stenberg
fdc043e7b1 add an assert to help debugging 2009-05-24 23:44:23 +02:00
Daniel Stenberg
fdaa5ad5b4 Without CVS we must not use cvs tools to generate the changelog. I'm not
confident enough with git to attempt to make one so I'll just make a dummy for
now.
2009-05-23 23:03:31 +02:00
Daniel Stenberg
f1f49c3cce - Anonymous bug report #2795816 revealed that libssh2_sftp_shutdown() did not
properly free/cleanup the SFTP handle so libssh2 leaked memory and caused
   an assert() on subsequent libssh2_sftp_init() calls on the same session.
2009-05-23 22:30:43 +02:00
Daniel Stenberg
ad13de92d4 Fix _libssh2_channel_write(): fixed the write loop to also read from the
transport layer better, to avoid draining the window size when sending large
packets. I also fixed the return code for it to return the number of bytes
handled in this single invoke (and not the cumulative amount).
2009-05-20 14:34:30 +02:00
Daniel Stenberg
b755f3eb10 First, only try to send max packet size *4 to channel write, as trying to send
much larger packages only cause internal problems and much larger allocations.

Also fix sftp_write() when _libssh2_channel_write() returns that a packet was
only partially sent as that is not an error.

Fixed a few error messages to more accurately point out the problem
2009-05-20 14:31:46 +02:00
Daniel Stenberg
b95fe985af If recv() returns something less than the full buffer we know we're done for
now, so skip looping and doing another read that then simply will cause an
EAGAIN as it may trick the user into believing things that aren't true.
2009-05-20 14:30:05 +02:00
daniel
035cb24fa0 remove the old style as it makes little sense to mention here anymore 2009-05-14 17:01:54 +02:00
Daniel Stenberg
18e03739be typo 2009-05-12 10:10:55 +00:00
Daniel Stenberg
e367e1ad4e comment typo and some indent fixes 2009-05-12 10:07:30 +00:00
Daniel Stenberg
f7149d1830 Partial fix based on the patch and discussions in #2788319 2009-05-12 09:33:22 +00:00
Daniel Stenberg
042b545247 clear the passed in struct when the entry has been removed to help prevent
mistakes due to re-use
2009-05-12 09:32:51 +00:00
Daniel Stenberg
4490c6b434 use a better example file name for the known_hosts file 2009-05-07 20:30:22 +00:00
Daniel Stenberg
d3542e6f7d split out the knownhost code from hostkey.c into its own separate source file
now: knownhost.c
2009-05-07 17:21:56 +00:00
Daniel Stenberg
0cee15dc0c this was never supposed to be added for real 2009-05-07 17:21:14 +00:00
Daniel Stenberg
4b991b232d My knownhost work as of right now. It works at least partly. More tests and
tweaks will come.
2009-05-07 13:09:48 +00:00
Daniel Stenberg
4bc1b8a1d7 get host, user, password and command from the command line 2009-05-05 12:30:19 +00:00
Daniel Stenberg
755e213ae6 Added ssh2_exec as a new example, showing how to run a command remotely with
libssh2
2009-05-05 12:27:02 +00:00
Daniel Stenberg
9412588373 bug #2785173 pointed out that we really must call _libssh2_transport_read()
in loops until it returns < 0 when we call it, as if we just call it once we
may drain the socket for data and then leave unused in-memory data that we
won't detect because the socket is back to idle...
2009-05-01 19:07:20 +00:00
Daniel Stenberg
9f104cd883 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.
2009-04-30 10:30:26 +00:00
Daniel Stenberg
6409bb53ba remove pointless sleeps 2009-04-28 10:35:30 +00:00
Daniel Stenberg
c306119dd6 edited 2009-04-14 21:43:39 +00:00
Daniel Stenberg
2b8038e175 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()...
2009-04-14 21:38:36 +00:00
Guenter Knauf
2a39b32b1a some minor Makefile tweaks; mainly for crosscompiling. 2009-04-09 03:13:51 +00:00
Daniel Stenberg
e63cbd907f Jussi Mononen pointed out we used an unsigned variable to store negative
values in, when a plain int is much better anyway since it matches the return
type.
2009-04-06 14:50:29 +00:00
Daniel Stenberg
cb66b7b94f and we're now on the 1.1.1 track 2009-04-02 09:35:02 +00:00
Daniel Stenberg
98b0afdab8 release 1.1 2009-04-02 08:49:29 +00:00
Daniel Stenberg
5a3da233ec Sofian Brabez removed duplicate calls to libssh2_session_set_blocking() 2009-03-31 12:20:36 +00:00
Daniel Stenberg
74f4b7817b Uh, it is important that we don't set the local state 'local.close' to TRUE
until _after_ we're done as otherwise we might not get called again properly
to clean the entire thing since the close state is checked in
libssh2_channel_free
2009-03-31 08:52:25 +00:00
Daniel Stenberg
9ba11a374c Removed the trace output that said "May block until packet of type..." since
it simply wasn't true for non-blocking operations.
2009-03-30 09:19:49 +00:00
Daniel Stenberg
117b95e6e3 made sure the SFTP code makes more use of internal non-blocking functions
instead of the external API entries
2009-03-29 22:09:29 +00:00
Daniel Stenberg
60ee30b6c9 Fixed the memory leak in in libssh2_userauth_hostbased_fromfile_ex() that
Jean-Louis Charton found. Additional minor indent and comment edits.
2009-03-28 21:31:53 +00:00
Daniel Stenberg
55744f8f34 indent changes and removed libssh2_ prefix from static function 2009-03-28 21:22:16 +00:00
Yang Tse
8f78a935ca include libssh2_priv.h instead of libssh2.h in order to get
LIBSSH2_API properly defined on LIBSSH2_WIN32 build targets
2009-03-28 12:50:34 +00:00
Daniel Stenberg
75d5830490 Additional non-blocking fixes. 2009-03-27 22:24:09 +00:00
Daniel Stenberg
103a6e9e0b Me and my long fingers couldn't resist "merging" these statements in a previous
commit but of course that broke functionality and this is a revert of that
change.
2009-03-27 21:52:49 +00:00
Daniel Stenberg
76dab196b1 Dump to stderr simply because the other tracing functions in misc.c already
use stderr and mixing output "channels" causes too much confusion for me!
2009-03-27 21:51:43 +00:00
Daniel Stenberg
4353711127 fixed sftp_shutdown() for the blockiness and fixed libssh2_channel_close()
to work properly non-blocking
2009-03-27 20:20:48 +00:00
Daniel Stenberg
ad8b49b208 Fixed the order of the check in the BLOCK_ADJUST() macro so that it also works
for libssh2_session_free()
2009-03-27 12:48:03 +00:00
Daniel Stenberg
1d2bd301d3 kill warnings 2009-03-27 09:52:19 +00:00
Daniel Stenberg
5936d9ce4e Fix the BLOCK_ADJUST_ERRNO() macro to behave properly in blocking mode. 2009-03-27 09:37:48 +00:00
Simon Josefsson
de0c4159bf Add AC_CONFIG_MACRO_DIR to avoid warnings with libtool v2.2.x. 2009-03-27 08:54:15 +00:00
Daniel Stenberg
f390c8e02d fix comments, moved to htonu64 function to sftp.c and made it static 2009-03-27 07:03:00 +00:00
Daniel Stenberg
9df891e412 More cleaning up converting libssh2_ to _libssh2_ for internal functions and
removing libssh2_ from static functions. Added mac.h.
2009-03-26 22:25:23 +00:00
Daniel Stenberg
fc28f33384 comp.c only as a single _libssh2_ function, no external one 2009-03-26 22:09:35 +00:00
Daniel Stenberg
eabe072496 * 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.
2009-03-26 15:41:14 +00:00
Daniel Stenberg
239bdffb59 avoid some busy-looping 2009-03-25 22:52:32 +00:00
Daniel Stenberg
bab3a30220 one function to remove, one proto to correct 2009-03-23 13:54:16 +00:00
Daniel Stenberg
2e548c1ca0 Updated comments and removed "libssh2_" prefixes from static functions 2009-03-23 13:35:20 +00:00
Daniel Stenberg
1e1ba6219e added basic docs 2009-03-23 13:20:48 +00:00
Daniel Stenberg
27d74a7bd5 quite possibly one of the most pointless functions in the libssh2 API...a 2009-03-23 13:17:49 +00:00
Daniel Stenberg
3d97a87669 ENOTCONN obviously doesn't exist in win32 so don't try to map that 2009-03-23 13:08:17 +00:00
Daniel Stenberg
022cac8510 [no comment] 2009-03-23 12:53:50 +00:00
Daniel Stenberg
d187a0fdb6 EEK revert the part of the previous commit that was just my non-functional
attempts to make things work with blocking sockets.
2009-03-23 12:51:53 +00:00
Daniel Stenberg
1936d167d1 I cut out the poll_socket argument from the protos for_libssh2_packet_askv()
and _libssh2_packet_ask() since they are internal and nothing in the code base
uses that functionality == simplicity with no drawbacks!
2009-03-23 12:43:59 +00:00
Daniel Stenberg
26b65e06b1 pass in unsigned ints for u32 values and not longs 2009-03-19 12:54:58 +00:00
Daniel Stenberg
468272d648 - (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!
2009-03-19 12:45:59 +00:00
Daniel Stenberg
563f627647 I'm upgrading myself! 2009-03-18 13:11:28 +00:00
Simon Josefsson
872a6e28dc Add StrictModes=no to work around cygwin problem.
Reported by Yang Tse <yangsita@gmail.com>.
2009-03-17 19:07:35 +00:00
Simon Josefsson
fa5509d9f2 Add UsePrivilegeSeparation=no for cygwin.
Reported by Yang Tse <yangsita@gmail.com>
2009-03-17 17:25:42 +00:00
Daniel Stenberg
53ad07633e re-indented for clarity 2009-03-17 14:58:24 +00:00
Daniel Stenberg
0b7f20566c re-indented _libssh2_channel_packet_data_len() somewhat to make the huge
condition somewhat easier on the eye
2009-03-17 14:44:38 +00:00
Daniel Stenberg
cc5e952fa0 A cleanup effort: libssh2_ prefixes only on external APIs. Use _libssh2_ prefix
for library-wide internal functions. Don't use any of those on static functions.
I also did some comments and whitespace changes.
2009-03-17 13:48:35 +00:00
Daniel Stenberg
f2fa02c575 bump packet default size to 32768 2009-03-17 12:09:53 +00:00
Daniel Stenberg
0dbc6ed8b6 Refer to the exact symbol name, which also is the exact file name of the man
page file.
2009-03-17 10:34:27 +00:00
Simon Josefsson
c7a1d30590 Use libtool -export-symbols-regex to reduce numer of exported symbols. 2009-03-17 10:19:54 +00:00
Daniel Stenberg
8096b459d4 cleanup round 2009-03-16 23:25:14 +00:00
Daniel Stenberg
7ef3406b57 Added (templates for) the 13 missing man pages 2009-03-16 15:00:45 +00:00
Daniel Stenberg
d870042496 two more renaming of man pages to the actual function name 2009-03-16 14:40:37 +00:00
Daniel Stenberg
27355c740f rename the man page to use the same name as the actual function 2009-03-16 14:28:37 +00:00
Daniel Stenberg
f8ad00e6ae mention the basic changes in my previous few commits 2009-03-16 08:23:54 +00:00
Daniel Stenberg
94090cf55c Patch from bug report #1960894 by "Heiner" applied, and edited by me. It makes
SCP recv and send deal with file names containing spaces (and other
shell-special letters) by quoting them before they are passed to the remote
server.
2009-03-15 23:28:25 +00:00
Daniel Stenberg
ce9d44a3ff fixed some wrong comments and did a minor code edit and some further
whitespace changes
2009-03-15 23:07:09 +00:00
Daniel Stenberg
a678dbac06 added three more public functions I found lacking man pages 2009-03-15 22:59:46 +00:00
Daniel Stenberg
0812744424 fix a compiler warning 2009-03-15 22:40:11 +00:00
Daniel Stenberg
f56b8ef605 simplified how the "scp" command line is created in the libssh2_scp_recv()
function
2009-03-15 22:38:47 +00:00
Daniel Stenberg
1a630c5c09 Simplified libssh2_channel_read_ex() and made it send window adjustments less
frequent, use a few less struct fields in the channel struct and improved
reading from the network with libssh2_packet_read(). I also modified the
windowing algorithm and now use a much larger window. This greatly enhances
SSH/SCP performance. I also increased the size of the buffer the transport
layer uses from 4k to 16K.
2009-03-15 22:29:23 +00:00
Daniel Stenberg
3793b6768d oops, use %06d for the microseconds! 2009-03-14 23:04:25 +00:00
Daniel Stenberg
269bd5e9a4 re-indented and other whitespace edits 2009-03-14 22:29:48 +00:00
Daniel Stenberg
d7566e5065 improved trace logs with time stamps 2009-03-14 22:29:28 +00:00
Daniel Stenberg
bdd005a5e5 fixed to work quite similar to the sftp_nonblock example so that it waits
for the socket correctly and measures the transfer speed fine
2009-03-14 09:40:57 +00:00
Daniel Stenberg
a52f5d3b7e 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
2009-03-13 22:15:27 +00:00
Daniel Stenberg
d89782d99f improved non-blocking behavior for some of the initing stuff before the actual
data transfer begins
2009-03-13 22:14:47 +00:00
Daniel Stenberg
2ba8db9168 wait for socket action accordingly, and do some measurements on the transfer
to make this better to use for speed tests
2009-03-13 12:35:13 +00:00
Daniel Stenberg
5f32304805 - (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.
2009-03-07 22:08:05 +00:00
Guenter Knauf
16941e1fcf some minor Makefile tweaks. 2009-03-06 07:25:37 +00:00
Daniel Stenberg
663da93b42 - Added libssh2_version() 2009-02-23 16:22:46 +00:00
Daniel Stenberg
1addcbbf53 - (Feb 20 2009) libssh2_channel_direct_tcpip_ex() bug #1902169 fixed, which
caused it to fail when called a second time.
2009-02-20 16:14:45 +00:00
Mikhail Gusarov
d722e09196 Fixed dash-as-minus warning in libssh2_base64_decode.3 manpage 2009-02-17 16:22:51 +00:00
Mikhail Gusarov
317740415a Fixed syntax error in libssh2_banner_set.3 manpage 2009-02-17 16:22:17 +00:00
Simon Josefsson
558de5e103 Bump ABI revision from 1.0.0 to 1.0.1 due to code changes. 2009-02-16 21:49:31 +00:00
Simon Josefsson
74aad1869d Fix typo. 2009-02-16 21:48:22 +00:00
Simon Josefsson
b9de72732b Add date for v1.0 release. 2009-02-16 21:46:40 +00:00
Daniel Stenberg
c672b837f8 - (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.
2009-02-12 11:46:28 +00:00
Daniel Stenberg
c547e07caa Markus Moeller fixed a flaw in libssh2_channel_write_ex() that would occur
on EAGAIN situations.
2009-02-08 12:09:20 +00:00
Daniel Stenberg
6a78a6b358 I want to remove all those macros from the official API at next soname bump 2009-01-01 22:52:46 +00:00
Daniel Stenberg
369fcddb24 fixed compiler warnings, and stripped off "libssh2_" from static functions
as that makes shorter function names and then making the code look fine within
80 columns is easier!
2009-01-01 22:47:06 +00:00
Daniel Stenberg
97fbb77da5 made the three public headers use (mostly) lines shorter than 80 columns as
HACKING says - it makes them much more readable to my old tired eyes...
2009-01-01 22:27:08 +00:00
Daniel Stenberg
acc2c5dfb9 we're actually working on the 1.0.1 version now (or should it be 1.1?) 2008-12-28 21:01:36 +00:00
160 changed files with 9424 additions and 4694 deletions

View File

@@ -1,11 +0,0 @@
jas4711:Simon Josefsson <simon@josefsson.org>
bagder:Daniel Stenberg
sarag:Sara Golemon <pollita@libssh2.org>
gusarov:Mikhail Gusarov <dottedmag@dottedmag.net>
wez:Wez Furlong
edink:Edink Kadribasic
jehousley: James Housley
gknauf: Guenter Knauf
dfandrich: Dan Fandrich
yangtse: Yang Tse
thomaspu: Paul Thomas

2
.gitattribute Normal file
View File

@@ -0,0 +1,2 @@
win32/msvcproj.head -crlf
win32/msvcproj.foot -crlf

View File

@@ -26,3 +26,8 @@ ssh2_sample
libssh2-*.tar.gz libssh2-*.tar.gz
INSTALL INSTALL
install-sh install-sh
*.o
*.lo
*.la
mkinstalldirs
tags

59
AUTHORS
View File

@@ -1,16 +1,47 @@
* Sara Golemon: Author / Project Manager libssh2 is the result of many friendly people. This list is an attempt to
mention all contributors. If we've missed anyone, tell us!
* James Housleys: Nonblocking conversion This list of names is a-z sorted.
* Simon Josefsson: libgcrypt support Adam Gobiowski
Alexander Holyapin
* Daniel Stenberg: Nonblocking fixes, Build Improvements, and Daily snapshot Alexander Lamaison
artist Ben Kibbey
Bjorn Stenborg
* Mikhail Gusarov: Keyboard Interactive Authentication Carlo Bramini
Dan Casey
* Wez Furlong & Edink Kadribasic: Windows Port Dan Fandrich
Daniel Stenberg
* Dan Fandrich: bug fixes, cleanups David J Sullivan
David Robins
* Guenter Knauf: win32 work and more Edink Kadribasic
Erik Brossler
Francois Dupoux
Guenter Knauf
Heiner Steven
James Housleys
Jean-Louis Charton
Jussi Mononen
Mark McPherson
Markus Moeller
Mike Protts
Mikhail Gusarov
Neil Gierman
Olivier Hervieu
Paul Veldkamp
Peter O'Gorman
Peter Stuge
Romain Bondue
Sara Golemon
Satish Mittal
Sean Peterson
Selcuk Gueney
Simon Hart
Simon Josefsson
Steven Ayre
Steven Van Ingelgem
Tor Arntsen
Vincent Jaulin
Vlad Grachov
Wez Furlong
Yang Tse

View File

@@ -1,5 +1,7 @@
/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org> /* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
* Copyright (C) 2006-2007 The Written Word, Inc. * Copyright (c) 2006-2007 The Written Word, Inc.
* Copyright (c) 2009 Daniel Stenberg
* Copyright (C) 2008, 2009 Simon Josefsson
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, * Redistribution and use in source and binary forms,

21
HACKING
View File

@@ -9,24 +9,5 @@ libssh2 source code style guide:
go_nuts(); go_nuts();
} }
- write both braces on the else line:
if (banana) {
go_nuts();
} else {
stay_calm();
}
- use braces even for single-statement blocks
- keep source lines shorter than 80 columns - keep source lines shorter than 80 columns
- See libssh2-style.el for how to achieve this within Emacs
------------
Older libssh2 code that still hasn't quite transitioned to the above
mentioned style, used a different style:
- indented with tabs (only)
- no line length limits

View File

@@ -1,5 +1,10 @@
AUTOMAKE_OPTIONS = foreign nostdinc
SUBDIRS = src example tests docs SUBDIRS = src example tests docs
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libssh2.pc
include_HEADERS = \ include_HEADERS = \
include/libssh2.h \ include/libssh2.h \
include/libssh2_publickey.h \ include/libssh2_publickey.h \
@@ -11,20 +16,25 @@ NETWAREFILES = nw/keepscreen.c \
nw/nwlib.c \ nw/nwlib.c \
nw/test/Makefile.netware nw/test/Makefile.netware
WIN32FILES = win32/libssh2_dll.dsp win32/libssh2.dsw win32/Makefile.win32 \ DSP = win32/libssh2.dsp
win32/config.mk win32/Makefile win32/test/Makefile.win32 win32/libssh2_lib.dsp \ VCPROJ = win32/libssh2.vcproj
win32/libssh2_config.h win32/tests.dsp win32/rules.mk
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
EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \ EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \
maketgz NMakefile TODO maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
.PHONY: ChangeLog .PHONY: ChangeLog
ChangeLog: ChangeLog:
if test -f .cvsusers; then \ echo "see NEWS" > ./ChangeLog
cvs2cl --utc --fsf --FSF --usermap .cvsusers -I ChangeLog -I .cvs; \ DISTCLEANFILES += ChangeLog
fi
dist-hook: dist-hook:
rm -rf $(top_builddir)/tests/log rm -rf $(top_builddir)/tests/log
@@ -57,3 +67,62 @@ gen-coverage:
--title "$(PACKAGE_NAME)" --title "$(PACKAGE_NAME)"
coverage: init-coverage build-coverage gen-coverage coverage: init-coverage build-coverage gen-coverage
# DSP/VCPROJ generation adapted from libcurl
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
WIN32SOURCES = $(CSOURCES)
WIN32HEADERS = $(HHEADERS) libssh2_config.h
$(DSP): win32/msvcproj.head win32/msvcproj.foot Makefile.am
echo "creating $(DSP)"
@( (cat $(srcdir)/win32/msvcproj.head; \
echo "# Begin Group \"Source Files\""; \
echo ""; \
echo "# PROP Default_Filter \"cpp;c;cxx\""; \
win32_srcs='$(WIN32SOURCES)'; \
sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
for file in $$sorted_srcs; do \
echo "# Begin Source File"; \
echo ""; \
echo "SOURCE=..\\src\\"$$file; \
echo "# End Source File"; \
done; \
echo "# End Group"; \
echo "# Begin Group \"Header Files\""; \
echo ""; \
echo "# PROP Default_Filter \"h;hpp;hxx\""; \
win32_hdrs='$(WIN32HEADERS)'; \
sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
for file in $$sorted_hdrs; do \
echo "# Begin Source File"; \
echo ""; \
if [ "$$file" == "libssh2_config.h" ]; \
then \
echo "SOURCE=.\\"$$file; \
else \
echo "SOURCE=..\\src\\"$$file; \
fi; \
echo "# End Source File"; \
done; \
echo "# End Group"; \
cat $(srcdir)/win32/msvcproj.foot) | \
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )
$(VCPROJ): win32/vc8proj.head win32/vc8proj.foot Makefile.am
echo "creating $(VCPROJ)"
@( (cat $(srcdir)/vc8proj.head; \
win32_srcs='$(WIN32SOURCES)'; \
sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
for file in $$sorted_srcs; do \
echo "<File RelativePath=\""..\src\$$file"\"></File>"; \
done; \
echo "</Filter><Filter Name=\"Header Files\">"; \
win32_hdrs='$(WIN32HEADERS)'; \
sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
for file in $$sorted_hdrs; do \
echo "<File RelativePath=\""..\src\$$file"\"></File>"; \
done; \
cat $(srcdir)/vc8proj.foot) | \
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )

5
Makefile.inc Normal file
View File

@@ -0,0 +1,5 @@
CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \
packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \
version.c knownhost.c openssl.c libgcrypt.c pem.c
HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h comp.h mac.h misc.h

215
NEWS
View File

@@ -1,5 +1,216 @@
Version 1.0 ( ) Version 1.2.2 (unreleased)
-------------------------------
* 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.
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 - (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, function called libssh2_sftp_tell64() that returns the 64 bit file offset,

2
README
View File

@@ -6,7 +6,7 @@ the revised BSD license.
Web site: http://www.libssh2.org/ Web site: http://www.libssh2.org/
Mailing list: https://lists.sourceforge.net/lists/listinfo/libssh2-devel Mailing list: http://cool.haxx.se/mailman/listinfo/libssh2-devel
Generic installation instructions are in INSTALL. Some ./configure Generic installation instructions are in INSTALL. Some ./configure
options deserve additional comments: options deserve additional comments:

18
RELEASE-NOTES Normal file
View File

@@ -0,0 +1,18 @@
libssh2 1.2.2
This release includes the following changes:
o Support for the "aes128-ctr", "aes192-ctr", "aes256-ctr" ciphers
o Support for the "arcfour128" cipher
This release includes the following bugfixes:
o Fix crash when server sends an invalid SSH_MSG_IGNORE message
This release would not have looked like this without help, code, reports and
advice from friends like these:
Simon Josefsson, Bob Alexander
Thanks! (and sorry if I forgot to mention someone)

42
TODO
View File

@@ -1,21 +1,14 @@
Things TODO Things TODO
=========== ===========
* Add one of the missing man pages: * make sure the windowing code adapts better to slow situations so that it
doesn't then use as much memory as today
libssh2_channel_receive_window_adjust * Introduce a 'libssh2_socket_t' type for sockets in internal code
libssh2_channel_request_pty_size_ex
libssh2_channel_window_read_ex * Provide a libssh2_scp_send() API for files larger than 4GB (32bit size)
libssh2_channel_window_write_ex
libssh2_publickey_add_ex * Add more info to the man pages.
libssh2_publickey_init
libssh2_publickey_list_fetch
libssh2_publickey_list_free
libssh2_publickey_remove_ex
libssh2_publickey_shutdown
libssh2_session_flag
libssh2_session_get_blocking
libssh2_userauth_hostbased_fromfile_ex
* Decrease the number of mallocs. Everywhere. * Decrease the number of mallocs. Everywhere.
@@ -23,8 +16,27 @@ Things TODO
* Extend the test suite to actually test lots of aspects of libssh2 * Extend the test suite to actually test lots of aspects of libssh2
* Fix all compiler warnings (some can't be done without API changes)
At next SONAME bump At next SONAME bump
=================== ===================
* remove libssh2_base64_decode() from the API/ABI * stop using #defined macros as part of the official API. The macros should
either be turned into real functions or discarded from the API.
* fix the parts of the API where object pointers and function pointers are
mixed like libssh2_session_callback_set()
* remove the following functions from the API/ABI
libssh2_base64_decode()
libssh2_session_flag()
libssh2_channel_handle_extended_data()
libssh2_channel_receive_window_adjust()
libssh2_poll()
libssh2_poll_channel_read()
* Rename a few function:
libssh2_hostkey_hash => libssh2_session_hostkey_hash
libssh2_banner_set => libssh2_session_banner_set

View File

@@ -288,3 +288,97 @@ dnl end of non-blocking try-compile test
AC_MSG_WARN([non-block sockets disabled]) AC_MSG_WARN([non-block sockets disabled])
fi fi
]) ])
dnl CURL_CHECK_NEED_REENTRANT_SYSTEM
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
dnl must be unconditionally done for this platform.
dnl Internal macro for CURL_CONFIGURE_REENTRANT.
AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [
case $host in
*-*-solaris* | *-*-hpux*)
tmp_need_reentrant="yes"
;;
*)
tmp_need_reentrant="no"
;;
esac
])
dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
dnl -------------------------------------------------
dnl This macro ensures that configuration tests done
dnl after this will execute with preprocessor symbol
dnl _REENTRANT defined. This macro also ensures that
dnl the generated config file defines NEED_REENTRANT
dnl and that in turn setup.h will define _REENTRANT.
dnl Internal macro for CURL_CONFIGURE_REENTRANT.
AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
AC_DEFINE(NEED_REENTRANT, 1,
[Define to 1 if _REENTRANT preprocessor symbol must be defined.])
cat >>confdefs.h <<_EOF
#ifndef _REENTRANT
# define _REENTRANT
#endif
_EOF
])
dnl CURL_CONFIGURE_REENTRANT
dnl -------------------------------------------------
dnl This first checks if the preprocessor _REENTRANT
dnl symbol is already defined. If it isn't currently
dnl defined a set of checks are performed to verify
dnl if its definition is required to make visible to
dnl the compiler a set of *_r functions. Finally, if
dnl _REENTRANT is already defined or needed it takes
dnl care of making adjustments necessary to ensure
dnl that it is defined equally for further configure
dnl tests and generated config file.
AC_DEFUN([CURL_CONFIGURE_REENTRANT], [
AC_PREREQ([2.50])dnl
#
AC_MSG_CHECKING([if _REENTRANT is already defined])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
]],[[
#ifdef _REENTRANT
int dummy=1;
#else
force compilation error
#endif
]])
],[
AC_MSG_RESULT([yes])
tmp_reentrant_initially_defined="yes"
],[
AC_MSG_RESULT([no])
tmp_reentrant_initially_defined="no"
])
#
if test "$tmp_reentrant_initially_defined" = "no"; then
AC_MSG_CHECKING([if _REENTRANT is actually needed])
CURL_CHECK_NEED_REENTRANT_SYSTEM
if test "$tmp_need_reentrant" = "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
#
AC_MSG_CHECKING([if _REENTRANT is onwards defined])
if test "$tmp_reentrant_initially_defined" = "yes" ||
test "$tmp_need_reentrant" = "yes"; then
CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#
])

View File

@@ -1,6 +1,22 @@
#!/bin/sh #!/bin/sh
${LIBTOOLIZE:-libtoolize} --copy --automake --force LIBTOOLIZE="libtoolize"
if [ "x`which $LIBTOOLIZE`" == "x" ];
then
LIBTOOLIZE="glibtoolize";
fi
if [ "x`which $LIBTOOLIZE`" == "x" ];
then
echo "Neither libtoolize nor glibtoolize could be found!";
exit 1
fi
${LIBTOOLIZE} --copy --automake --force
${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS
${AUTOHEADER:-autoheader} ${AUTOHEADER:-autoheader}
# copy the private libssh2_config.h.in to the examples dir so that # copy the private libssh2_config.h.in to the examples dir so that

View File

@@ -1,5 +1,6 @@
# AC_PREREQ(2.57) # AC_PREREQ(2.57)
AC_INIT(libssh2, [-], libssh2-devel@lists.sourceforge.net) AC_INIT(libssh2, [-], libssh2-devel@lists.sourceforge.net)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src]) AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADER([src/libssh2_config.h]) AC_CONFIG_HEADER([src/libssh2_config.h])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
@@ -49,6 +50,10 @@ AC_CHECK_TYPE(long long,
[Define to 1 if the compiler supports the 'long long' data type.])] [Define to 1 if the compiler supports the 'long long' data type.])]
longlong="yes" longlong="yes"
) )
dnl Our configure and build reentrant settings
CURL_CONFIGURE_REENTRANT
# Some systems (Solaris?) have socket() in -lsocket. # Some systems (Solaris?) have socket() in -lsocket.
AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(socket, socket)
@@ -157,6 +162,45 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
dnl ************************************************************
dnl Enable hiding of internal symbols in library to reduce its size and
dnl speed dynamic linking of applications. This currently is only supported
dnl on gcc >= 4.0 and SunPro C.
dnl
AC_MSG_CHECKING([whether to enable hidden symbols in the library])
AC_ARG_ENABLE(hidden-symbols,
AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_CHECKING([whether $CC supports it])
if test "$GCC" = yes ; then
if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
AC_MSG_RESULT(yes)
AC_DEFINE(LIBSSH2_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
CFLAGS="$CFLAGS -fvisibility=hidden"
else
AC_MSG_RESULT(no)
fi
else
dnl Test for SunPro cc
if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
AC_MSG_RESULT(yes)
AC_DEFINE(LIBSSH2_API, [__global], [to make a symbol visible])
CFLAGS="$CFLAGS -xldscope=hidden"
else
AC_MSG_RESULT(no)
fi
fi
;;
esac ],
AC_MSG_RESULT(no)
)
# Checks for header files. # Checks for header files.
# AC_HEADER_STDC # AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
@@ -209,5 +253,6 @@ AC_CONFIG_FILES([Makefile
tests/Makefile tests/Makefile
example/Makefile example/Makefile
example/simple/Makefile example/simple/Makefile
docs/Makefile]) docs/Makefile
libssh2.pc])
AC_OUTPUT AC_OUTPUT

View File

View File

@@ -1,9 +1,10 @@
# $Id: Makefile.am,v 1.31 2008/12/26 07:46:45 bagder Exp $ # $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
EXTRA_DIST = template.3 EXTRA_DIST = template.3
dist_man_MANS = \ dist_man_MANS = \
libssh2_banner_set.3 \ libssh2_banner_set.3 \
libssh2_base64_decode.3 \
libssh2_channel_close.3 \ libssh2_channel_close.3 \
libssh2_channel_direct_tcpip_ex.3 \ libssh2_channel_direct_tcpip_ex.3 \
libssh2_channel_eof.3 \ libssh2_channel_eof.3 \
@@ -18,39 +19,66 @@ dist_man_MANS = \
libssh2_channel_open_ex.3 \ libssh2_channel_open_ex.3 \
libssh2_channel_process_startup.3 \ libssh2_channel_process_startup.3 \
libssh2_channel_read_ex.3 \ libssh2_channel_read_ex.3 \
libssh2_channel_receive_window_adjust.3 \
libssh2_channel_receive_window_adjust2.3 \
libssh2_channel_request_pty_ex.3 \ libssh2_channel_request_pty_ex.3 \
libssh2_channel_request_pty_size_ex.3 \
libssh2_channel_send_eof.3 \ libssh2_channel_send_eof.3 \
libssh2_channel_set_blocking.3 \ libssh2_channel_set_blocking.3 \
libssh2_channel_setenv_ex.3 \ libssh2_channel_setenv_ex.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_wait_closed.3 \ libssh2_channel_wait_closed.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_window_read_ex.3 \
libssh2_channel_window_write_ex.3 \
libssh2_channel_write_ex.3 \ libssh2_channel_write_ex.3 \
libssh2_channel_x11_req_ex.3 \ libssh2_channel_x11_req_ex.3 \
libssh2_free_host_entry.3 \
libssh2_host_entry_match.3 \
libssh2_hostkey_hash.3 \ libssh2_hostkey_hash.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_get.3 \
libssh2_knownhost_init.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_readfile.3 \
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_ex.3 \
libssh2_publickey_init.3 \
libssh2_publickey_list_fetch.3 \
libssh2_publickey_list_free.3 \
libssh2_publickey_remove_ex.3 \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \ libssh2_scp_recv.3 \
libssh2_scp_send_ex.3 \ libssh2_scp_send_ex.3 \
libssh2_session_abstract.3 \ libssh2_session_abstract.3 \
libssh2_session_block_directions.3 \ libssh2_session_block_directions.3 \
libssh2_session_callback_set.3 \ libssh2_session_callback_set.3 \
libssh2_session_free.3 \
libssh2_session_disconnect_ex.3 \ libssh2_session_disconnect_ex.3 \
libssh2_session_init.3 \ libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_hostkey.3 \
libssh2_session_init_ex.3 \
libssh2_session_last_errno.3 \ libssh2_session_last_errno.3 \
libssh2_session_last_error.3 \ libssh2_session_last_error.3 \
libssh2_session_method_pref.3 \ libssh2_session_method_pref.3 \
libssh2_session_methods.3 \ libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \ libssh2_session_set_blocking.3 \
libssh2_session_startup.3 \ libssh2_session_startup.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_sftp_close_handle.3 \ libssh2_sftp_close_handle.3 \
libssh2_sftp_fstat_ex.3 \ libssh2_sftp_fstat_ex.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_init.3 \ libssh2_sftp_init.3 \
libssh2_sftp_open_ex.3 \ libssh2_sftp_last_error.3 \
libssh2_sftp_mkdir_ex.3 \ libssh2_sftp_mkdir_ex.3 \
libssh2_sftp_open_ex.3 \
libssh2_sftp_read.3 \ libssh2_sftp_read.3 \
libssh2_sftp_readdir.3 \ libssh2_sftp_readdir_ex.3 \
libssh2_sftp_rename_ex.3 \ libssh2_sftp_rename_ex.3 \
libssh2_sftp_rmdir_ex.3 \ libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \ libssh2_sftp_seek.3 \
@@ -61,10 +89,11 @@ dist_man_MANS = \
libssh2_sftp_tell64.3 \ libssh2_sftp_tell64.3 \
libssh2_sftp_unlink_ex.3 \ libssh2_sftp_unlink_ex.3 \
libssh2_sftp_write.3 \ libssh2_sftp_write.3 \
libssh2_trace.3 \
libssh2_userauth_authenticated.3 \ libssh2_userauth_authenticated.3 \
libssh2_userauth_hostbased_fromfile_ex.3 \
libssh2_userauth_keyboard_interactive_ex.3 \ libssh2_userauth_keyboard_interactive_ex.3 \
libssh2_userauth_list.3 \ libssh2_userauth_list.3 \
libssh2_userauth_password_ex.3 \ libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey_fromfile.3 \ libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_base64_decode.3 \ libssh2_version.3
libssh2_trace.3

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_banner_set.3,v 1.1 2007/06/13 17:03:38 jehousley Exp $ .\" $Id: libssh2_banner_set.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_banner_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_banner_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,14 +11,14 @@ libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIbanner\fP - A pointer to a user defined banner \fIbanner\fP - A pointer to a user defined banner
Set the banner that will be sent to the remote host when the SSH session is Set the banner that will be sent to the remote host when the SSH session is
started with started with
.BR libssh2_session_startup(3) .BR libssh2_session_startup(3)
. This is optional; a banner corresponding to the protocol and libssh2 version will be sent by default. This is optional; a banner corresponding to the protocol and libssh2 version will be sent by default.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_base64_decode.3,v 1.2 2008/12/26 07:37:55 bagder Exp $ .\" $Id: libssh2_base64_decode.3,v 1.3 2009/02/17 16:22:51 dottedmag Exp $
.\" .\"
.TH libssh2_base64_decode 3 "23 Dec 2008" "libssh2 1.0" "libssh2 manual" .TH libssh2_base64_decode 3 "23 Dec 2008" "libssh2 1.0" "libssh2 manual"
.SH NAME .SH NAME
@@ -24,4 +24,4 @@ The memory that *dest points to is allocated by the malloc function libssh2
uses, but there's no way for an appliction to free this data in a safe and uses, but there's no way for an appliction to free this data in a safe and
reliable way! reliable way!
.SH RETURN VALUE .SH RETURN VALUE
0 if successful, -1 if any error occurred. 0 if successful, \-1 if any error occurred.

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_close.3,v 1.2 2007/11/29 09:57:22 bagder Exp $ .\" $Id: libssh2_channel_close.3,v 1.3 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_close 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_close 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -28,4 +28,4 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open(3) .BR libssh2_channel_open_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_direct_tcpip_ex.3,v 1.1 2007/06/13 17:22:15 jehousley Exp $ .\" $Id: libssh2_channel_direct_tcpip_ex.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_channel_direct_tcpip_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_direct_tcpip_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -13,16 +13,16 @@ LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port); libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port);
.SH DESCRIPTION .SH DESCRIPTION
/fIsession/fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
/fIhost/fP - Third party host to connect to using the SSH host as a proxy. \fIhost\fP - Third party host to connect to using the SSH host as a proxy.
/fIport/fP - Port on third party host to connect to. \fIport\fP - Port on third party host to connect to.
/fIshost/fP - Host to tell the SSH server the connection originated on. \fIshost\fP - Host to tell the SSH server the connection originated on.
/fIsport/fP - Port to tell the SSH server the connection originated from. \fIsport\fP - Port to tell the SSH server the connection originated from.
Tunnel a TCP/IP connection through the SSH transport via the remote host to Tunnel a TCP/IP connection through the SSH transport via the remote host to
a third party. Communication from the client to the SSH server remains a third party. Communication from the client to the SSH server remains
@@ -31,9 +31,7 @@ in cleartext.
.SH RETURN VALUE .SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors. Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_eof.3,v 1.1 2007/06/13 17:22:15 jehousley Exp $ .\" $Id: libssh2_channel_eof.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_eof 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_eof 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -8,11 +8,11 @@ libssh2_channel_eof - check a channel's EOF status
int int
libssh2_channel_eof(LIBSSH2_CHANNEL *channel); libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
.SH DESCRIPTION .SH DESCRIPTION
\fIchannel\fP - active channel stream to set closed status on. \fIchannel\fP - active channel stream to set closed status on.
Check if the remote host has sent an EOF status for the selected stream. Check if the remote host has sent an EOF status for the selected stream.
.SH RETURN VALUE .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.
.SH SEE ALSO
.BR libssh2_channel_close(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_forward_accept.3,v 1.5 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_channel_forward_accept.3,v 1.6 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_forward_accept 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_forward_accept 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,11 +11,11 @@ libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener);
.SH DESCRIPTION .SH DESCRIPTION
\fIlistener\fP is a forwarding listener instance as returned by \fIlistener\fP is a forwarding listener instance as returned by
\fBlibssh2_channel_forward_listen(3)\fP. \fBlibssh2_channel_forward_listen_ex(3)\fP.
.SH RETURN VALUE .SH RETURN VALUE
A newly allocated channel instance or NULL on failure. A newly allocated channel instance or NULL on failure.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call \fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call
would block. would block.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_forward_listen(3) .BR libssh2_channel_forward_listen_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_forward_cancel.3,v 1.1 2007/06/13 19:53:09 jehousley Exp $ .\" $Id: libssh2_channel_forward_cancel.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_forward_cancel 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_forward_cancel 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -10,8 +10,8 @@ int
libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener); libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
.SH DESCRIPTION .SH DESCRIPTION
/fIlistener/fP - Forwarding listener instance as returned by \fIlistener\fP - Forwarding listener instance as returned by
.BR libssh2_channel_forward_listen(3) .BR libssh2_channel_forward_listen_ex(3)
Instruct the remote host to stop listening for new connections on a previously requested host/port. Instruct the remote host to stop listening for new connections on a previously requested host/port.
@@ -26,4 +26,4 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_forward_listen(3) .BR libssh2_channel_forward_listen_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_handle_extended_data.3,v 1.1 2007/06/13 20:09:15 jehousley Exp $ .\" $Id: libssh2_channel_handle_extended_data.3,v 1.2 2009/03/26 15:41:16 bagder Exp $
.\" .\"
.TH libssh2_channel_handle_extended_data 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_handle_extended_data 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -10,6 +10,9 @@ void
libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode); libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode);
.SH DESCRIPTION .SH DESCRIPTION
This function is deprecated. Use the
\fIlibssh2_channel_handle_extended_data2(3)\fP function instead!
\fIchannel\fP - Active channel stream to change extended data handling on. \fIchannel\fP - Active channel stream to change extended data handling on.
\fIignore_mode\fP - One of the three LIBSSH2_CHANNEL_EXTENDED_DATA_* Constants. \fIignore_mode\fP - One of the three LIBSSH2_CHANNEL_EXTENDED_DATA_* Constants.
@@ -19,19 +22,16 @@ reading
.br .br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_MERGE\fP: Treat extended data and ordinary \fBLIBSSH2_CHANNEL_EXTENDED_DATA_MERGE\fP: Treat extended data and ordinary
data the same. Merge all substreams such that calls to data the same. Merge all substreams such that calls to
.BR libssh2_channel_read(3) \fIlibssh2_channel_read(3)\fP will pull from all substreams on a
will pull from all substreams on a first-in/first-out basis. first-in/first-out basis.
.br .br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE\fP: Discard all extended data as it \fBLIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE\fP: Discard all extended data as it
arrives. arrives.
Change how a channel deals with extended data packets. By default all Change how a channel deals with extended data packets. By default all extended
extended data is queued until read by data is queued until read by \fIlibssh2_channel_read_ex(3)\fP
.BR libssh2_channel_read_ex(3)
.SH RETURN VALUE .SH RETURN VALUE
None. None.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_handle_extended_data2(3) .BR libssh2_channel_handle_extended_data2(3)
.BR libssh2_channel_read_ex(3) .BR libssh2_channel_read_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_open_ex.3,v 1.1 2007/06/13 20:54:25 jehousley Exp $ .\" $Id: libssh2_channel_open_ex.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_channel_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_channel_open_session(session);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIchannel_type\fP - Channel type to open. Typically one of session, \fIchannel_type\fP - Channel type to open. Typically one of session,
direct-tcpip, or tcpip-forward. The SSH2 protocol allowed for additional direct-tcpip, or tcpip-forward. The SSH2 protocol allowed for additional

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_process_startup.3,v 1.1 2007/06/13 20:54:25 jehousley Exp $ .\" $Id: libssh2_channel_process_startup.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_process_startup 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_process_startup 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -31,19 +31,16 @@ defines shell, exec, and subsystem as standard process services.
\fImessage_len\fP - Length of message parameter. \fImessage_len\fP - Length of message parameter.
Initiate a request on a session type channel such as returned by Initiate a request on a session type channel such as returned by
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP - \fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP -
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)

View File

@@ -35,6 +35,9 @@ macros.
Actual number of bytes read or negative on failure. It returns Actual number of bytes read or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
Note that a return value of zero (0) can in fact be a legitimate value and
only signals that no payload data was read. It is not an error.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.

View File

@@ -0,0 +1,31 @@
.\" $Id: libssh2_channel_receive_window_adjust.3,v 1.3 2009/03/26 15:41:16 bagder Exp $
.\"
.TH libssh2_channel_receive_window_adjust 3 "15 Mar 2009" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_channel_receive_window_adjust - adjust the channel window
.SH SYNOPSIS
#include <libssh2.h>
unsigned long
libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
unsigned long adjustment,
unsigned char force);
.SH DESCRIPTION
This function is deprecated in 1.1. Use
\fIlibssh2_channel_receive_window_adjust2(3)\fP!
Adjust the receive window for a channel by adjustment bytes. If the amount to
be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
adjustment amount will be queued for a later packet.
.SH RETURN VALUE
Returns the new size of the receive window (as understood by remote end). Note
that the window value sent over the wire is strictly 32bit, but this API is
made to return a 'long' which may not be 32 bit on all platforms.
.SH ERRORS
In 1.0 and earlier, this function returns LIBSSH2_ERROR_EAGAIN for
non-blocking channels where it would otherwise block. However, that is a
negative number and this function only returns an unsigned value and this then
leads to a very strange value being returned.
.SH SEE ALSO
.BR libssh2_channel_window_read_ex(3)

View File

@@ -0,0 +1,29 @@
.\" $Id: libssh2_channel_receive_window_adjust2.3,v 1.1 2009/03/26 15:41:16 bagder Exp $
.\"
.TH libssh2_channel_receive_window_adjust2 3 "26 Mar 2009" "libssh2 1.1" "libssh2 manual"
.SH NAME
libssh2_channel_receive_window_adjust2 - adjust the channel window
.SH SYNOPSIS
#include <libssh2.h>
int
libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL * channel,
unsigned long adjustment,
unsigned char force,
unsigned int *window);
.SH DESCRIPTION
Adjust the receive window for a channel by adjustment bytes. If the amount to
be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
adjustment amount will be queued for a later packet.
This function stores the new size of the receive window (as understood by
remote end) in the variable 'window' points to.
.SH RETURN VALUE
Return 0 on success and a negative value on error. If used in non-blocking
mode it will return LIBSSH2_ERROR_EAGAIN when it would otherwise block.
.SH ERRORS
.SH AVAILABILITY
Added in libssh2 1.1 since the previous API has deficiencies.
.SH SEE ALSO
.BR libssh2_channel_window_read_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_request_pty_ex.3,v 1.1 2007/06/13 21:07:59 jehousley Exp $ .\" $Id: libssh2_channel_request_pty_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_request_pty_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_request_pty_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_channel_request_pty(LIBSSH2_CHANNEL *channel, char *term);
.SH DESCRIPTION .SH DESCRIPTION
\fIchannel\fP - Previously opened channel instance such as returned by \fIchannel\fP - Previously opened channel instance such as returned by
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
\fIterm\fP - Terminal emulation (e.g. vt102, ansi, etc...) \fIterm\fP - Terminal emulation (e.g. vt102, ansi, etc...)
@@ -35,18 +35,15 @@ libssh2_channel_request_pty(LIBSSH2_CHANNEL *channel, char *term);
Request a PTY on an established channel. Note that this does not make sense Request a PTY on an established channel. Note that this does not make sense
for all channel types and may be ignored by the server despite returning for all channel types and may be ignored by the server despite returning
success. success.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP - \fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP -
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)

View File

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

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_set_blocking.3,v 1.5 2007/06/14 17:23:13 jehousley Exp $ .\" $Id: libssh2_channel_set_blocking.3,v 1.6 2009/03/26 15:41:16 bagder Exp $
.\" .\"
.TH libssh2_channel_set_blocking 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_set_blocking 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -8,7 +8,6 @@ libssh2_channel_set_blocking - set or clear blocking mode on channel
void void
libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking); libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking);
.SH DESCRIPTION .SH DESCRIPTION
\fIchannel\fP - channel stream to set or clean blocking status on. \fIchannel\fP - channel stream to set or clean blocking status on.
@@ -18,10 +17,8 @@ make it non-blocking.
Currently this is just a short cut call to Currently this is just a short cut call to
.BR libssh2_session_set_blocking(3) .BR libssh2_session_set_blocking(3)
and therefore will affect the session and all channels. and therefore will affect the session and all channels.
.SH RETURN VALUE .SH RETURN VALUE
None None
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_set_blocking(3) .BR libssh2_session_set_blocking(3)
.BR libssh2_channel_read_ex(3) .BR libssh2_channel_read_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_setenv_ex.3,v 1.1 2007/06/13 21:30:15 jehousley Exp $ .\" $Id: libssh2_channel_setenv_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_setenv_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_setenv_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_channel_setenv(LIBSSH2_CHANNEL *channel, char *varname, const char *valu
.SH DESCRIPTION .SH DESCRIPTION
\fIchannel\fP - Previously opened channel instance such as returned by \fIchannel\fP - Previously opened channel instance such as returned by
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
\fIvarname\fP - Name of environment variable to set on the remote \fIvarname\fP - Name of environment variable to set on the remote
channel instance. channel instance.
@@ -25,8 +25,9 @@ channel instance.
\fIvalue_len\fP - Length of value parameter. \fIvalue_len\fP - Length of value parameter.
Set an environment variable in the remote channel's process space. Note that this does not make sense for all channel types and may be ignored by the server despite returning success. Set an environment variable in the remote channel's process space. Note that
this does not make sense for all channel types and may be ignored by the
server despite returning success.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
@@ -38,6 +39,5 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP - \fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP -
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)

View File

@@ -0,0 +1,26 @@
.\" $Id: libssh2_channel_window_read_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\"
.TH libssh2_channel_window_read_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_channel_window_read_ex - Check the status of the read window
.SH SYNOPSIS
#include <libssh2.h>
unsigned long
libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
unsigned long *read_avail,
unsigned long *window_size_initial)
.SH DESCRIPTION
Check the status of the read window. Returns the number of bytes which the
remote end may send without overflowing the window limit read_avail (if
passed) will be populated with the number of bytes actually available to be
read window_size_initial (if passed) will be populated with the
window_size_initial as defined by the channel_open request
.SH RETURN VALUE
The number of bytes which the remote end may send without overflowing the
window limit
.SH ERRORS
.SH SEE ALSO
.BR libssh2_channel_receive_window_adjust(3),
.BR libssh2_channel_window_write_ex(3)

View File

@@ -0,0 +1,23 @@
.\" $Id: libssh2_channel_window_write_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\"
.TH libssh2_channel_window_write_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_channel_window_write_ex - Check the status of the write window
.SH SYNOPSIS
#include <libssh2.h>
unsigned long
libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
unsigned long *window_size_initial)
.SH DESCRIPTION
Check the status of the write window Returns the number of bytes which may be
safely writen on the channel without blocking. 'window_size_initial' (if
passed) will be populated with the size of the initial window as defined by
the channel_open request
.SH RETURN VALUE
Number of bytes which may be safely writen on the channel without blocking.
.SH ERRORS
.SH SEE ALSO
.BR libssh2_channel_window_read_ex(3),
.BR libssh2_channel_receive_window_adjust(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_write_ex.3,v 1.5 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_channel_write_ex.3,v 1.6 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_write_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_write_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -41,7 +41,8 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_CHANNEL_CLOSED\fP - The channel has been closed. \fILIBSSH2_ERROR_CHANNEL_CLOSED\fP - The channel has been closed.
\fILIBSSH2_ERROR_CHANNEL_EOF_SENT\fP - The channel has been requested to be closed. \fILIBSSH2_ERROR_CHANNEL_EOF_SENT\fP - The channel has been requested to be
closed.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
.BR libssh2_channel_read(3) .BR libssh2_channel_read_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_channel_x11_req_ex.3,v 1.1 2007/06/13 21:30:15 jehousley Exp $ .\" $Id: libssh2_channel_x11_req_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_channel_x11_req_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_channel_x11_req_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel, int screen_number);
.SH DESCRIPTION .SH DESCRIPTION
\fIchannel\fP - Previously opened channel instance such as returned by \fIchannel\fP - Previously opened channel instance such as returned by
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
\fIsingle_connection\fP - non-zero to only forward a single connection. \fIsingle_connection\fP - non-zero to only forward a single connection.
@@ -26,8 +26,8 @@ libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel, int screen_number);
Request an X11 forwarding on \fIchannel\fP. To use X11 forwarding, Request an X11 forwarding on \fIchannel\fP. To use X11 forwarding,
.BR libssh2_session_callback_set(3) .BR libssh2_session_callback_set(3)
must first be called to set \fBLIBSSH2_CALLBACK_X11/fP. This callback will must first be called to set \fBLIBSSH2_CALLBACK_X11\fP. This callback will be
be invoked when the remote host accepts the X11 forwarding. invoked when the remote host accepts the X11 forwarding.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
@@ -42,5 +42,5 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP - \fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP -
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
.BR libssh2_session_callback_set(3) .BR libssh2_session_callback_set(3)

View File

@@ -0,0 +1,14 @@
.\" $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

@@ -0,0 +1,14 @@
.\" $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

@@ -1,4 +1,4 @@
.\" $Id: libssh2_hostkey_hash.3,v 1.1 2007/06/14 14:56:32 jehousley Exp $ .\" $Id: libssh2_hostkey_hash.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_hostkey_hash 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_hostkey_hash 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIhash_type\fP - One of: \fBLIBSSH2_HOSTKEY_HASH_MD5\fP or \fIhash_type\fP - One of: \fBLIBSSH2_HOSTKEY_HASH_MD5\fP or
\fBLIBSSH2_HOSTKEY_HASH_SHA1\fP. \fBLIBSSH2_HOSTKEY_HASH_SHA1\fP.
@@ -19,11 +19,9 @@ libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
Returns the computed digest of the remote system's hostkey. The length of Returns the computed digest of the remote system's hostkey. The length of
the returned string is hash_type specific (e.g. 16 bytes for MD5, the returned string is hash_type specific (e.g. 16 bytes for MD5,
20 bytes for SHA1). 20 bytes for SHA1).
.SH RETURN VALUE .SH RETURN VALUE
Computed hostkey hash value. or NULL if the session has not yet been started Computed hostkey hash value. or NULL if the session has not yet been started
up. (The hash consists of raw binary bytes, not hex digits, so is not up. (The hash consists of raw binary bytes, not hex digits, so is not
directly printable.) directly printable.)
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -0,0 +1,58 @@
.\" Copyright (c) 2009 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
#include <libssh2.h>
int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
char *host, char *salt,
char *key, size_t keylen,
int typemask,
struct libssh2_knownhost **store);
.SH DESCRIPTION
Adds a known host to the collection of known hosts identified by the 'hosts'
handle.
\fIhost\fP is a pointer the host name in plain text or hashed. If hashed, it
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
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.
\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, LIBSSH2_KNOWNHOST_TYPE_SHA1 or
LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
The key is encoded using one of the following encodings:
LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
The key is using one of these algorithms:
LIBSSH2_KNOWNHOST_KEY_RSA1, LIBSSH2_KNOWNHOST_KEY_SSHRSA or
LIBSSH2_KNOWNHOST_KEY_SSHDSS.
\fIstore\fP should point to a pointer that gets filled in to point to the
known host data after the addition. NULL can be passed if you don't care about
this pointer.
.SH RETURN VALUE
Returns a regular libssh2 error code, where negative values are error codes
and 0 indicates success.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_check(3)

View File

@@ -0,0 +1,57 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_check 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_check - check a host+key against the list of known hosts
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
char *host, 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.
\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
.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

@@ -0,0 +1,26 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_del 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_del - delete a known host entry
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_del(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost *entry);
.SH DESCRIPTION
Delete a known host entry from the collection of known hosts.
\fIentry\fP is a pointer to a struct that you can extract with
\fIlibssh2_knownhost_check(3)\fP or \fIlibssh2_knownhost_get(3)\fP.
.SH RETURN VALUE
Returns a regular libssh2 error code, where negative values are error codes
and 0 indicates success.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_add(3)
.BR libssh2_knownhost_check(3)

View File

@@ -0,0 +1,21 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_free 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_free - free a collection of known hosts
.SH SYNOPSIS
#include <libssh2.h>
void libssh2_knownhost_free(LIBSSH2_KNOWNHOSTS *hosts);
.SH DESCRIPTION
Free a collection of known hosts.
.SH RETURN VALUE
Returns a handle pointer or NULL if something went wrong. The returned handle
is used as input to all other known host related functions libssh2 provides.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_add(3)
.BR libssh2_knownhost_check(3)

View File

@@ -0,0 +1,35 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_get 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_get - get a known host off the collection of known hosts
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_get(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost **store,
struct libssh2_knownhost *prev):
.SH DESCRIPTION
\fIlibssh2_knownhost_get(3)\fP allows an application to iterate over all known
hosts in the collection.
\fIstore\fP should point to a pointer that gets filled in to point to the
known host data.
\fIprev\fP is a pointer to a previous 'struct libssh2_knownhost' as returned
by a previous invoke of this function, or NULL to get the first entry in the
internal collection.
.SH RETURN VALUE
Returns 0 if everything is fine and information about a host was stored in
the \fIstore\fP struct.
Returns 1 if it reached the end of hosts.
Returns negative values for error
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_readfile(3)
.BR libssh2_knownhost_writefile(3)
.BR libssh2_knownhost_add(3)

View File

@@ -0,0 +1,25 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_init 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_init - init a collection of known hosts
.SH SYNOPSIS
#include <libssh2.h>
LIBSSH2_KNOWNHOSTS *libssh2_knownhost_init(LIBSSH2_SESSION *session);
.SH DESCRIPTION
Init a collection of known hosts for this session. Returns the handle to an
internal representation of a known host collection.
Call \fBlibssh2_knownhost_free(3)\fP to free the collection again after you're
doing using it.
.SH RETURN VALUE
Returns a handle pointer or NULL if something went wrong. The returned handle
is used as input to all other known host related functions libssh2 provides.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_add(3)
.BR libssh2_knownhost_check(3)

View File

@@ -0,0 +1,29 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_readfile 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_readfile - parse a file of known hosts
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts,
const char *filename, int type);
.SH DESCRIPTION
Reads a collection of known hosts from a specified file and adds them to the
collection of known hosts.
\fIfilename\fP specifies which file to read
\fItype\fP specifies what file type it is, and
\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.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_check(3)

View File

@@ -0,0 +1,30 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_readline 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_readline - read a known host line
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts,
const char *line, size_t len, int type):
.SH DESCRIPTION
Tell libssh2 to read a buffer as it if is a line from a known hosts file.
\fIline\fP points to the start of the line
\fIlen\fP is the length of the line in bytes
\fItype\fP specifies what file type it is, and
\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.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_get(3)
.BR libssh2_knownhost_writeline(3)
.BR libssh2_knownhost_readfile(3)

View File

@@ -0,0 +1,29 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_writefile 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_writefile - write a collection of known hosts to a file
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts,
const char *filename, int type);
.SH DESCRIPTION
Writes all the known hosts to the specified file using the specified file
format.
\fIfilename\fP specifies what filename to create
\fItype\fP specifies what file type it is, and
\fILIBSSH2_KNOWNHOST_FILE_OPENSSH\fP is the only currently supported
format.
.SH RETURN VALUE
Returns a regular libssh2 error code, where negative values are error codes
and 0 indicates success.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_readfile(3)
.BR libssh2_knownhost_add(3)

View File

@@ -0,0 +1,46 @@
.\"
.\" Copyright (c) 2009 by Daniel Stenberg
.\"
.TH libssh2_knownhost_writeline 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_writeline - convert a known host to a line for storage
.SH SYNOPSIS
#include <libssh2.h>
libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
struct libssh2_knownhost *known,
char *buffer, size_t buflen,
size_t *outlen,
int type);
.SH DESCRIPTION
Converts a single known host to a single line of output for storage, using
the 'type' output format.
\fIknown\fP identifies which particular known host
\fIbuffer\fP points to an allocated buffer
\fIbuflen\fP is the size of the \fIbuffer\fP. See RETURN VALUE about the size.
\fIoutlen\fP must be a pointer to a size_t variable that will get the output
length of the stored data chunk. The number does not included the trailing
zero!
\fItype\fP specifies what file type it is, and
\fILIBSSH2_KNOWNHOST_FILE_OPENSSH\fP is the only currently supported
format.
.SH RETURN VALUE
Returns a regular libssh2 error code, where negative values are error codes
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
\fIoutlen\fP size will then hold the requested size.
.SH AVAILABILITY
Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_knownhost_get(3)
.BR libssh2_knownhost_readline(3)
.BR libssh2_knownhost_writefile(3)

View File

@@ -0,0 +1,14 @@
.\" $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

@@ -1,4 +1,4 @@
.\" $Id: libssh2_poll.3,v 1.3 2007/06/13 12:51:11 jehousley Exp $ .\" $Id: libssh2_poll.3,v 1.4 2009/04/14 21:38:36 bagder Exp $
.\" .\"
.TH libssh2_poll 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual" .TH libssh2_poll 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -8,6 +8,8 @@ libssh2_poll - poll for activity on a socket, channel or listener
int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout); int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout);
.SH DESCRIPTION .SH DESCRIPTION
This function is deprecated. Do note use.
Poll for activity on a socket, channel, listener, or any combination of these Poll for activity on a socket, channel, listener, or any combination of these
three types. The calling semantics for this function generally match three types. The calling semantics for this function generally match
\fIpoll(2)\fP however the structure of fds is somewhat more complex in order \fIpoll(2)\fP however the structure of fds is somewhat more complex in order

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_poll_channel_read.3,v 1.2 2007/06/13 12:51:11 jehousley Exp $ .\" $Id: libssh2_poll_channel_read.3,v 1.3 2009/04/14 21:38:36 bagder Exp $
.\" .\"
.TH libssh2_poll_channel_read 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual" .TH libssh2_poll_channel_read 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -8,6 +8,8 @@ libssh2_poll_channel_read - check if data is available
int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended); int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended);
.SH DESCRIPTION .SH DESCRIPTION
This function is deprecated. Do note use.
\fIlibssh2_poll_channel_read(3)\fP checks to see if data is available in the \fIlibssh2_poll_channel_read(3)\fP checks to see if data is available in the
\fIchannel\fP's read buffer. No attempt is made with this method to see if \fIchannel\fP's read buffer. No attempt is made with this method to see if
packets are available to be processed. For full polling support, use packets are available to be processed. For full polling support, use

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_scp_recv.3,v 1.1 2007/06/14 14:56:32 jehousley Exp $ .\" $Id: libssh2_scp_recv.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_scp_recv 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_scp_recv 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,30 +11,24 @@ libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIpath\fP - Full path and filename of file to transfer \fIpath\fP - Full path and filename of file to transfer. That is the remote
file name.
\fIsb\fP - Populated with remote file's size, mode, mtime, and atime \fIsb\fP - Populated with remote file's size, mode, mtime, and atime
Request a file from the remote host via SCP. This Request a file from the remote host via SCP.
function acts as a wrapper calling
.BR libssh2_channel_open_session(3)
,
.BR libssh2_channel_exec(3)
, and negotiating rcp protocol handshakes.
.SH RETURN VALUE .SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors. Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SCP_PROTOCOL\fP - \fILIBSSH2_ERROR_SCP_PROTOCOL\fP -
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block. \fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
block.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
.BR libssh2_channel_exec(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_scp_send_ex.3,v 1.1 2007/06/14 14:56:32 jehousley Exp $ .\" $Id: libssh2_scp_send_ex.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_scp_send_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_scp_send_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -8,15 +8,12 @@ libssh2_scp_send_ex - Send a file via SCP
LIBSSH2_CHANNEL * 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);
LIBSSH2_CHANNEL *
libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t size);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIpath\fP - Full path and filename of file to transfer \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 \fImode\fP - File access mode to create file with
@@ -28,13 +25,7 @@ ahead of time precisely)
\fIatime\fP - atime to assign to file being created (Set this and \fIatime\fP - atime to assign to file being created (Set this and
mtime to zero to instruct remote host to use current time). mtime to zero to instruct remote host to use current time).
Send a file to the remote host via SCP. This function Send a file to the remote host via SCP.
acts as a wrapper calling
.BR libssh2_channel_open_session(3)
,
.BR libssh2_channel_exec(3)
, and negotiating rcp protocol handshakes.
.SH RETURN VALUE .SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors. Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
@@ -45,8 +36,8 @@ Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
\fILIBSSH2_ERROR_SCP_PROTOCOL\fP - \fILIBSSH2_ERROR_SCP_PROTOCOL\fP -
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block. \fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
block.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_channel_open_session(3) .BR libssh2_channel_open_ex(3)
.BR libssh2_channel_exec(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_block_directions.3,v 1.2 2008/12/22 12:51:27 bagder Exp $ .\" $Id: libssh2_session_block_directions.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_block_directions 3 "1 Oct 2008" "libssh2 1.0" "libssh2 manual" .TH libssh2_session_block_directions 3 "1 Oct 2008" "libssh2 1.0" "libssh2 manual"
.SH NAME .SH NAME
@@ -9,7 +9,7 @@ libssh2_session_block_directions - get directions that socket should wait for be
int int
libssh2_session_block_directions(LIBSSH2_SESSION *session); libssh2_session_block_directions(LIBSSH2_SESSION *session);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fBlibssh2_session_init(3)\fP \fIsession\fP - Session instance as returned by \fBlibssh2_session_init_ex(3)\fP
When any of libssh2 functions return \fBLIBSSH2_ERROR_EAGAIN\fP an application When any of libssh2 functions return \fBLIBSSH2_ERROR_EAGAIN\fP an application
should wait for the socket to have data available for reading or should wait for the socket to have data available for reading or

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_callback_set.3,v 1.1 2007/06/14 15:26:58 jehousley Exp $ .\" $Id: libssh2_session_callback_set.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_callback_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_callback_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callbac
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIcbtype\fP - Callback type. One of the types listed in Callback Types. \fIcbtype\fP - Callback type. One of the types listed in Callback Types.
@@ -27,4 +27,4 @@ Pointer to previous callback handler. Returns NULL if no
prior callback handler was set. prior callback handler was set.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_disconnect_ex.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_session_disconnect_ex.3,v 1.5 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_disconnect_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_disconnect_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_session_disconnect(LIBSSH2_SESSION *session, const char *description);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIreason\fP - One of the Disconnect Reason constants. \fIreason\fP - One of the Disconnect Reason constants.
@@ -37,4 +37,4 @@ Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -0,0 +1,15 @@
.\" $Id: libssh2_session_flag.3,v 1.2 2009/03/23 13:17:49 bagder Exp $
.\"
.TH libssh2_session_flag 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_session_flag - TODO
.SH SYNOPSIS
int
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.
.SH RETURN VALUE
0
.SH ERRORS
Its mere existence is an error
.SH SEE ALSO

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_free.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_session_free.3,v 1.5 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_session_free 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_free 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -10,12 +10,11 @@ int
libssh2_session_free(LIBSSH2_SESSION *session); libssh2_session_free(LIBSSH2_SESSION *session);
.SH DESCRIPTION .SH DESCRIPTION
Frees resources associated with a session instance. Typically called after Frees resources associated with a session instance. Typically called after
.BR libssh2_session_disconnect(3) .BR libssh2_session_disconnect_ex(3)
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
.BR libssh2_session_disconnect(3) .BR libssh2_session_disconnect_ex(3)

View File

@@ -0,0 +1,14 @@
.\" $Id: libssh2_session_get_blocking.3,v 1.2 2009/03/23 13:20:48 bagder Exp $
.\"
.TH libssh2_session_get_blocking 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_session_get_blocking - TODO
.SH SYNOPSIS
int libssh2_session_get_blocking(LIBSSH2_SESSION *session);
.SH DESCRIPTION
Returns 0 if the state of the session has previously be set to non-blocking
and it returns 1 if the state was set to blocking.
.SH RETURN VALUE
See description.
.SH SEE ALSO
.BR libssh2_session_set_blocking(3)

View File

@@ -0,0 +1,23 @@
.\" $Id: session_hostkey.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_session_hostkey 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_session_hostkey - get the remote key
.SH SYNOPSIS
#include <libssh2.h>
const char *libssh2_session_hostkey(LIBSSH2_SESSION *session,
size_t *len, int *type);
.SH DESCRIPTION
Returns a pointer to the current host key, the value \fIlen\fP points to will
get the length of the key.
The value \fItype\fP points to the type of hostkey which is one of:
LIBSSH2_HOSTKEY_TYPE_RSA, LIBSSH2_HOSTKEY_TYPE_DSS, or
LIBSSH2_HOSTKEY_TYPE_UNKNOWN.
.SH RETURN VALUE
A pointer, or NULL if something went wrong.
.SH SEE ALSO
.BR libssh2_knownhost_check(3)
.BR libssh2_knownhost_add(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_init.3,v 1.6 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_session_init_ex.3,v 1.1 2009/03/16 14:40:37 bagder Exp $
.\" .\"
.TH libssh2_session_init_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_init_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_last_errno.3,v 1.1 2007/06/13 23:02:08 jehousley Exp $ .\" $Id: libssh2_session_last_errno.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_last_errno 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_last_errno 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_last_errno(LIBSSH2_SESSION *session);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
Determine the most recent error condition. Determine the most recent error condition.

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_last_error.3,v 1.1 2007/06/13 23:02:08 jehousley Exp $ .\" $Id: libssh2_session_last_error.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_last_error 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_last_error 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_last_error(LIBSSH2_SESSION *session, char **errmsg, int *errmsg_
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIerrmsg\fP - If not NULL, is populated by reference with the human \fIerrmsg\fP - If not NULL, is populated by reference with the human
readable form of the most recent error message. readable form of the most recent error message.

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_method_pref.3,v 1.1 2007/06/14 15:26:58 jehousley Exp $ .\" $Id: libssh2_session_method_pref.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_method_pref 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_method_pref 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_method_pref(LIBSSH2_SESSION *session, int method_type, const cha
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fImethod_type\fP - One of the Method Type constants. \fImethod_type\fP - One of the Method Type constants.
@@ -38,5 +38,5 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_METHOD_NOT_SUPPORTED\fP - The requested method is not supported. \fILIBSSH2_ERROR_METHOD_NOT_SUPPORTED\fP - The requested method is not supported.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
.BR libssh2_session_startup(3) .BR libssh2_session_startup(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_methods.3,v 1.1 2007/06/14 15:26:58 jehousley Exp $ .\" $Id: libssh2_session_methods.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_session_methods 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_methods 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_methods(LIBSSH2_SESSION *session, int method_type);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fImethod_type\fP - One of the Method Type constants. \fImethod_type\fP - One of the Method Type constants.
@@ -26,4 +26,4 @@ Negotiated method or NULL if the session has not yet been started.
\fILIBSSH2_ERROR_METHOD_NONE\fP - \fILIBSSH2_ERROR_METHOD_NONE\fP -
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_set_blocking.3,v 1.2 2008/07/03 10:58:53 bagder Exp $ .\" $Id: libssh2_session_set_blocking.3,v 1.3 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_session_set_blocking 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_set_blocking 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - session instance as returned by \fIsession\fP - session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIblocking\fP - Set to a non-zero value to make the channel block, or zero to \fIblocking\fP - Set to a non-zero value to make the channel block, or zero to
make it non-blocking. make it non-blocking.
@@ -29,4 +29,4 @@ anything.
None None
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_session_startup.3,v 1.6 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_session_startup.3,v 1.7 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_session_startup 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_session_startup 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_session_startup(LIBSSH2_SESSION *session, int socket);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIsocket\fP - Connected socket descriptor. Typically a TCP connection \fIsocket\fP - Connected socket descriptor. Typically a TCP connection
though the protocol allows for any reliable transport and the library will though the protocol allows for any reliable transport and the library will
@@ -39,4 +39,4 @@ the socket.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_free(3) .BR libssh2_session_free(3)
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_close_handle.3,v 1.1 2007/06/14 15:45:03 jehousley Exp $ .\" $Id: libssh2_sftp_close_handle.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_sftp_close_handle 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_close_handle 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -17,19 +17,13 @@ int
libssh2_sftp_closedir(LIBSSH2_SFTP_HANDLE *handle); libssh2_sftp_closedir(LIBSSH2_SFTP_HANDLE *handle);
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by \fIhandle\fP - SFTP File Handle as returned by \fBlibssh2_sftp_open_ex(3)\fP
.BR libssh2_sftp_open(3) or \fBlibssh2_sftp_opendir(3)\fP (which is a macro).
or
.BR libssh2_sftp_opendir(3)
Close an active LIBSSH2_SFTP_HANDLE. Because files and directories Close an active LIBSSH2_SFTP_HANDLE. Because files and directories share the
share the same underlying storage mechanism these methods may be used same underlying storage mechanism these methods may be used
interchangably. It is recommended that interchangably. \fBlibssh2_sftp_close(3)\fP and \fBlibssh2_sftp_closedir(3)\fP
.BR libssh2_sftp_close() are macros for \fBlibssh2_sftp_close_handle(3)\fP.
be used for files and that
.BR libssh2_sftp_closedir()
be used for directories so that future changes in the library
may cause minimal disruption.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
@@ -48,5 +42,4 @@ received on the socket, or an SFTP operation caused an errorcode to
be returned by the server. be returned by the server.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)
.BR libssh2_sftp_opendir(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_fstat_ex.3,v 1.1 2007/06/14 15:45:03 jehousley Exp $ .\" $Id: libssh2_sftp_fstat_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_sftp_fstat_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_fstat_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -18,7 +18,7 @@ libssh2_sftp_fsetstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attr
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by \fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)
\fIattrs\fP - Pointer to attribute structure to set file metadata \fIattrs\fP - Pointer to attribute structure to set file metadata
from or into depending on the value of setstat. from or into depending on the value of setstat.
@@ -28,12 +28,10 @@ with the data found in attrs according to the values of attrs->flags
and other relevant member attributes. and other relevant member attributes.
Get or Set statbuf type data for a given LIBSSH2_SFTP_HANDLE instance. Get or Set statbuf type data for a given LIBSSH2_SFTP_HANDLE instance.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. It returns Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@@ -44,6 +42,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 \fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to received on the socket, or an SFTP operation caused an errorcode to
be returned by the server. be returned by the server.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_init.3,v 1.7 2007/11/21 14:07:32 dottedmag Exp $ .\" $Id: libssh2_sftp_init.3,v 1.8 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_sftp_init 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_init 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -12,7 +12,7 @@ libssh2_sftp_init(LIBSSH2_SESSION *session);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
Open a channel and initialize the SFTP subsystem. Although the SFTP subsystem Open a channel and initialize the SFTP subsystem. Although the SFTP subsystem
operates over the same type of channel as those exported by the Channel API, operates over the same type of channel as those exported by the Channel API,
@@ -34,8 +34,8 @@ A pointer to the newly allocated SFTP instance or NULL on failure.
received on the socket, or an SFTP operation caused an errorcode to be received on the socket, or an SFTP operation caused an errorcode to be
returned by the server. returned by the server.
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block. \fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
block.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_shutdown(3) .BR libssh2_sftp_shutdown(3)
.BR libssh2_sftp_open_ex(3) .BR libssh2_sftp_open_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_mkdir_ex.3,v 1.6 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_sftp_mkdir_ex.3,v 1.7 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_sftp_mkdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_mkdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -12,7 +12,6 @@ libssh2_sftp_mkdir_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_le
int int
libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path, long mode); libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path, long mode);
.SH DESCRIPTION .SH DESCRIPTION
\fIsftp\fP - SFTP instance as returned by \fIsftp\fP - SFTP instance as returned by
.BR libssh2_sftp_init(3) .BR libssh2_sftp_init(3)
@@ -25,12 +24,10 @@ directory's parents must all exist priot to making this call.
\fImode\fP - directory creation mode (e.g. 0755). \fImode\fP - directory creation mode (e.g. 0755).
Create a directory on the remote file system. Create a directory on the remote file system.
.SH RETURN VALUE .SH RETURN VALUE
Return 0 on success or negative on failure. Return 0 on success or negative on failure.
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@@ -41,6 +38,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 \fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to be received on the socket, or an SFTP operation caused an errorcode to be
returned by the server. returned by the server.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_opendir(3) .BR libssh2_sftp_open_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_open_ex.3,v 1.9 2007/11/21 14:07:32 dottedmag Exp $ .\" $Id: libssh2_sftp_open_ex.3,v 1.10 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_sftp_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -46,8 +46,8 @@ failure.
received on the socket, or an SFTP operation caused an errorcode to be received on the socket, or an SFTP operation caused an errorcode to be
returned by the server. returned by the server.
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block. \fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
block.
.SH SEE ALSO .SH SEE ALSO
.BR libssh_sftp_close(3) .BR libssh2_sftp_close_handle(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_read.3,v 1.8 2007/06/13 16:41:33 jehousley Exp $ .\" $Id: libssh2_sftp_read.3,v 1.10 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_sftp_read 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_read 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -12,7 +12,7 @@ libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxle
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP is the SFTP File Handle as returned by \fIhandle\fP is the SFTP File Handle as returned by
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)
\fIbuffer\fP is a pointer to a pre-allocated buffer of at least \fIbuffer\fP is a pointer to a pre-allocated buffer of at least
@@ -23,10 +23,9 @@ after the POSIX
.BR read(2) .BR read(2)
function and uses the same calling semantics. function and uses the same calling semantics.
.BR libssh2_sftp_read(3) .BR libssh2_sftp_read(3)
will attempt to read as much as possible however it may not fill all of will attempt to read as much as possible however it may not fill all of buffer
buffer if the file pointer reaches the end or if the file pointer reaches the end or if further reads would cause the socket
if further reads would cause the socket to block. to block.
.SH RETURN VALUE .SH RETURN VALUE
Number of bytes actually populated into buffer, or negative on failure. Number of bytes actually populated into buffer, or negative on failure.
It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
@@ -41,7 +40,6 @@ 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 \fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to be received on the socket, or an SFTP operation caused an errorcode to be
returned by the server. returned by the server.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)
.BR libssh2_sftp_readnb(3) .BR libssh2_sftp_read(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_readdir.3,v 1.11 2007/07/04 10:44:40 jehousley Exp $ .\" $Id: libssh2_sftp_readdir_ex.3,v 1.2 2009/03/16 23:25:14 bagder Exp $
.\" .\"
.TH libssh2_sftp_readdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_readdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -15,7 +15,7 @@ libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_ma
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - is the SFTP File Handle as returned by \fIhandle\fP - is the SFTP File Handle as returned by
.BR libssh2_sftp_diropen(3) .BR libssh2_sftp_open_ex(3)
\fIbuffer\fP - is a pointer to a pre-allocated buffer of at least \fIbuffer\fP - is a pointer to a pre-allocated buffer of at least
\fIbuffer_maxlen\fP bytes to read data into. \fIbuffer_maxlen\fP bytes to read data into.
@@ -41,8 +41,8 @@ however, it uses a variable sized directory entry (filename) buffer and
returns statbuf type data in the same call. returns statbuf type data in the same call.
.SH RETURN VALUE .SH RETURN VALUE
Number of bytes actually populated into buffer, or negative on failure. It returns Number of bytes actually populated into buffer, or negative on failure. It
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While 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. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
.SH ERRORS .SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
@@ -54,7 +54,6 @@ 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 \fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to be received on the socket, or an SFTP operation caused an errorcode to be
returned by the server. returned by the server.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_opendir(3) .BR libssh2_sftp_open_ex(3),
.BR libssh2_sftp_closedir(3) .BR libssh2_sftp_close_handle(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_seek.3,v 1.3 2008/12/22 13:18:36 bagder Exp $ .\" $Id: libssh2_sftp_seek.3,v 1.5 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_sftp_seek 3 "22 Dec 2008" "libssh2 1.0" "libssh2 manual" .TH libssh2_sftp_seek 3 "22 Dec 2008" "libssh2 1.0" "libssh2 manual"
.SH NAME .SH NAME
@@ -15,7 +15,7 @@ libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset);
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by \fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)
\fIoffset\fP - Number of bytes from the beginning of file to seek to. \fIoffset\fP - Number of bytes from the beginning of file to seek to.
@@ -27,4 +27,4 @@ convenience offset during read/write operations.
.SH AVAILABILITY .SH AVAILABILITY
libssh2_sftp_seek64(3) was added in 1.0 libssh2_sftp_seek64(3) was added in 1.0
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_tell.3,v 1.2 2008/12/22 12:46:45 bagder Exp $ .\" $Id: libssh2_sftp_tell.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_sftp_tell 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_tell 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,12 +11,12 @@ size_t
libssh2_sftp_tell(LIBSSH2_SFTP_HANDLE *handle); libssh2_sftp_tell(LIBSSH2_SFTP_HANDLE *handle);
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by \fBlibssh2_sftp_open(3)\fP. \fIhandle\fP - SFTP File Handle as returned by \fBlibssh2_sftp_open_ex(3)\fP.
Returns the current offset of the file handle's internal pointer. Note that Returns the current offset of the file handle's internal pointer. Note that
this is now deprecated. Use the newer \fBlibssh2_sftp_tell64(3)\fP instead! this is now deprecated. Use the newer \fBlibssh2_sftp_tell64(3)\fP instead!
.SH RETURN VALUE .SH RETURN VALUE
Current offset from beginning of file in bytes. Current offset from beginning of file in bytes.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3), .BR libssh2_sftp_open_ex(3),
.BR libssh2_sftp_tell64(3) .BR libssh2_sftp_tell64(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_tell64.3,v 1.1 2008/12/22 12:46:45 bagder Exp $ .\" $Id: libssh2_sftp_tell64.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_sftp_tell64 3 "22 Dec 2008" "libssh2 1.0" "libssh2 manual" .TH libssh2_sftp_tell64 3 "22 Dec 2008" "libssh2 1.0" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_uint64_t
libssh2_sftp_tell64(LIBSSH2_SFTP_HANDLE *handle); libssh2_sftp_tell64(LIBSSH2_SFTP_HANDLE *handle);
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by \fBlibssh2_sftp_open(3)\fP \fIhandle\fP - SFTP File Handle as returned by \fBlibssh2_sftp_open_ex(3)\fP
Identify the current offset of the file handle's internal pointer. Identify the current offset of the file handle's internal pointer.
.SH RETURN VALUE .SH RETURN VALUE
@@ -19,5 +19,5 @@ Current offset from beginning of file in bytes.
.SH AVAILABILITY .SH AVAILABILITY
Added in libssh2 1.0 Added in libssh2 1.0
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3), .BR libssh2_sftp_open_ex(3),
.BR libssh2_sftp_tell(3) .BR libssh2_sftp_tell(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_sftp_write.3,v 1.2 2008/12/23 12:34:17 bagder Exp $ .\" $Id: libssh2_sftp_write.3,v 1.3 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_sftp_write 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_sftp_write 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -12,7 +12,7 @@ libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, size_t count
.SH DESCRIPTION .SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by \fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)
\fIbuffer\fP - Pre-initialized data buffer to write to the LIBSSH2_SFTP_HANDLE. \fIbuffer\fP - Pre-initialized data buffer to write to the LIBSSH2_SFTP_HANDLE.
@@ -38,4 +38,4 @@ received on the socket, or an SFTP operation caused an errorcode to
be returned by the server. be returned by the server.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_sftp_open(3) .BR libssh2_sftp_open_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_userauth_authenticated.3,v 1.1 2007/06/14 17:15:32 jehousley Exp $ .\" $Id: libssh2_userauth_authenticated.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_userauth_authenticated 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_userauth_authenticated 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_userauth_authenticated(LIBSSH2_SESSION *session);
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
Indicates whether or not the named session has been successfully authenticated. Indicates whether or not the named session has been successfully authenticated.
@@ -19,4 +19,4 @@ Indicates whether or not the named session has been successfully authenticated.
Returns 1 if authenticated and 0 if not. Returns 1 if authenticated and 0 if not.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

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

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_userauth_keyboard_interactive_ex.3,v 1.1 2008/03/08 18:26:32 dottedmag Exp $ .\" $Id: libssh2_userauth_keyboard_interactive_ex.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_userauth_keyboard_interactive_ex 3 "8 Mar 2008" "libssh2 0.19" "libssh2 manual" .TH libssh2_userauth_keyboard_interactive_ex 3 "8 Mar 2008" "libssh2 0.19" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION *session, const char *user
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIusername\fP - Name of user to attempt plain password authentication for. \fIusername\fP - Name of user to attempt plain password authentication for.
@@ -40,4 +40,4 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_userauth_list.3,v 1.1 2007/06/14 17:15:32 jehousley Exp $ .\" $Id: libssh2_userauth_list.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_userauth_list 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_userauth_list 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -11,7 +11,7 @@ libssh2_userauth_list(LIBSSH2_SESSION *session, const char *username, unsigned i
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIusername\fP - Username which will be used while authenticating. Note \fIusername\fP - Username which will be used while authenticating. Note
that most server implementations do not permit attempting authentication that most server implementations do not permit attempting authentication
@@ -40,4 +40,4 @@ internally managed by libssh2. On failure ruturns NULL.
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call \fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_userauth_password_ex.3,v 1.1 2007/06/14 17:15:32 jehousley Exp $ .\" $Id: libssh2_userauth_password_ex.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_userauth_password_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_userauth_password_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_userauth_password(LIBSSH2_SESSION *session, const char *username, const
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIusername\fP - Name of user to attempt plain password authentication for. \fIusername\fP - Name of user to attempt plain password authentication for.
@@ -47,4 +47,4 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_PASSWORD_EXPIRED\fP - \fILIBSSH2_ERROR_PASSWORD_EXPIRED\fP -
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

View File

@@ -1,4 +1,4 @@
.\" $Id: libssh2_userauth_publickey_fromfile.3,v 1.1 2007/06/14 17:15:32 jehousley Exp $ .\" $Id: libssh2_userauth_publickey_fromfile_ex.3,v 1.2 2009/03/17 10:34:27 bagder Exp $
.\" .\"
.TH libssh2_userauth_publickey_fromfile 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual" .TH libssh2_userauth_publickey_fromfile 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME .SH NAME
@@ -14,7 +14,7 @@ libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, const char *use
.SH DESCRIPTION .SH DESCRIPTION
\fIsession\fP - Session instance as returned by \fIsession\fP - Session instance as returned by
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)
\fIusername\fP - Remote user name to authenticate as. \fIusername\fP - Remote user name to authenticate as.
@@ -48,4 +48,4 @@ combination was invalid, or the signature for the supplied public
key was invalid. key was invalid.
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_session_init(3) .BR libssh2_session_init_ex(3)

38
docs/libssh2_version.3 Normal file
View File

@@ -0,0 +1,38 @@
.\" $Id: libssh2_version.3,v 1.1 2009/02/23 16:22:46 bagder Exp $
.\"
.TH libssh2_version 3 "23 Feb 2009" "libssh2 1.1" "libssh2 manual"
.SH NAME
libssh2_version - return the libssh2 version number
.SH SYNOPSIS
#include <libssh2.h>
const char *
libssh2_version(int required_version);
.SH DESCRIPTION
If \fIrequired_version\fP is lower than or equal to the version number of the
libssh2 in use, the version number of libssh2 is returned as a pointer to a
zero terminated string.
The \fIrequired_version\fP should be the version number as constructed by the
LIBSSH2_VERSION_NUM define in the libssh2.h public header file, which is a 24
bit number in the 0xMMmmpp format. MM for major, mm for minor and pp for patch
number.
.SH RETURN VALUE
The version number of libssh2 is returned as a pointer to a zero terminated
string or NULL if the \fIrequired_version\fP isn't fulfilled.
.SH EXAMPLE
To make sure you run with the correct libssh2 version:
.nf
if (!libssh2_version(LIBSSH2_VERSION_NUM)) {
fprintf (stderr, \&"Runtime libssh2 version too old!\&");
exit(1);
}
.fi
Unconditionally get the version number:
printf(\&"libssh2 version: %s\&", libssh2_version(0) );
.SH AVAILABILITY
This function was added in libssh2 1.1, in previous versions there way no way
to extract this info in run-time.

View File

@@ -1,7 +1,3 @@
Makefile
Makefile.in
.deps
.libs
*.gcno *.gcno
*.gcda *.gcda
scp scp
@@ -18,4 +14,5 @@ sftp_mkdir
sftp_mkdir_nonblock sftp_mkdir_nonblock
sftp_write sftp_write
sftp_write_nonblock sftp_write_nonblock
config.h.in
ssh2_exec

View File

@@ -8,7 +8,7 @@ noinst_PROGRAMS = ssh2 \
sftp_write sftp_write_nonblock \ sftp_write sftp_write_nonblock \
sftp_mkdir sftp_mkdir_nonblock \ sftp_mkdir sftp_mkdir_nonblock \
sftp_RW_nonblock \ sftp_RW_nonblock \
sftpdir sftpdir_nonblock sftpdir sftpdir_nonblock ssh2_exec
# the examples need the $(top_builddir)/src since when building outside of the # the examples need the $(top_builddir)/src since when building outside of the
# source dir they still need to reach the libssh2_config.h header # source dir they still need to reach the libssh2_config.h header

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: scp.c,v 1.11 2008/11/10 16:48:41 bagder Exp $ * $Id: scp.c,v 1.12 2009/04/28 10:35:30 bagder Exp $
* *
* Sample showing how to do a simple SCP transfer. * Sample showing how to do a simple SCP transfer.
*/ */
@@ -10,12 +10,12 @@
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
# ifdef HAVE_UNISTD_H # ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@@ -164,10 +164,8 @@ int main(int argc, char *argv[])
libssh2_session_free(session); libssh2_session_free(session);
#ifdef WIN32 #ifdef WIN32
Sleep(1000);
closesocket(sock); closesocket(sock);
#else #else
sleep(1);
close(sock); close(sock);
#endif #endif
fprintf(stderr, "all done\n"); fprintf(stderr, "all done\n");

View File

@@ -1,7 +1,12 @@
/* /*
* $Id: scp_nonblock.c,v 1.13 2008/11/10 16:48:41 bagder Exp $ * $Id: scp_nonblock.c,v 1.16 2009/04/28 10:35:30 bagder Exp $
* *
* Sample showing how to do SCP transfers in a non-blocking manner. * Sample showing how to do SCP transfers in a non-blocking manner.
*
* The sample code has default values for host name, user name, password
* and path to copy, but you can specify them on the command line like:
*
* "scp_nonblock 192.168.0.1 user password /tmp/secrets"
*/ */
#include "libssh2_config.h" #include "libssh2_config.h"
@@ -10,11 +15,14 @@
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
#endif #endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> # include <netinet/in.h>
#endif #endif
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SELECT_H
# include <sys/socket.h> # include <sys/select.h>
#endif #endif
# ifdef HAVE_UNISTD_H # ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
@@ -32,6 +40,43 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
/* diff in ms */
static long tvdiff(struct timeval newer, struct timeval older)
{
return (newer.tv_sec-older.tv_sec)*1000+
(newer.tv_usec-older.tv_usec)/1000;
}
static int waitsocket(int socket_fd, LIBSSH2_SESSION *session)
{
struct timeval timeout;
int rc;
fd_set fd;
fd_set *writefd = NULL;
fd_set *readfd = NULL;
int dir;
timeout.tv_sec = 10;
timeout.tv_usec = 0;
FD_ZERO(&fd);
FD_SET(socket_fd, &fd);
/* now make sure we wait in the correct direction */
dir = libssh2_session_block_directions(session);
if(dir & LIBSSH2_SESSION_BLOCK_INBOUND)
readfd = &fd;
if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
writefd = &fd;
rc = select(socket_fd + 1, readfd, writefd, NULL, &timeout);
return rc;
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
unsigned long hostaddr; unsigned long hostaddr;
@@ -44,7 +89,12 @@ int main(int argc, char *argv[])
const char *password="password"; const char *password="password";
const char *scppath="/tmp/TEST"; const char *scppath="/tmp/TEST";
struct stat fileinfo; struct stat fileinfo;
struct timeval start;
struct timeval end;
int rc; int rc;
int total = 0;
long time_ms;
int spin = 0;
#if defined(HAVE_IOCTLSOCKET) #if defined(HAVE_IOCTLSOCKET)
long flag = 1; long flag = 1;
#endif #endif
@@ -85,23 +135,6 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
/* We set the socket non-blocking. We do it after the connect just to
simplify the example code. */
#ifdef F_SETFL
/* FIXME: this can/should be done in a more portable manner */
rc = fcntl(sock, F_GETFL, 0);
fcntl(sock, F_SETFL, rc | O_NONBLOCK);
#elif defined(HAVE_IOCTLSOCKET)
ioctlsocket(sock, FIONBIO, &flag);
#else
#ifdef WIN32
u_long mode = 1;
ioctlsocket (sock, FIONBIO, &mode);
#else
#error "add support for setting the socket non-blocking here"
#endif
#endif
/* Create a session instance */ /* Create a session instance */
session = libssh2_session_init(); session = libssh2_session_init();
if (!session) if (!session)
@@ -110,10 +143,13 @@ int main(int argc, char *argv[])
/* Since we have set non-blocking, tell libssh2 we are non-blocking */ /* Since we have set non-blocking, tell libssh2 we are non-blocking */
libssh2_session_set_blocking(session, 0); libssh2_session_set_blocking(session, 0);
gettimeofday(&start, NULL);
/* ... start it up. This will trade welcome banners, exchange keys, /* ... start it up. This will trade welcome banners, exchange keys,
* and setup crypto, compression, and MAC layers * and setup crypto, compression, and MAC layers
*/ */
while ((rc = libssh2_session_startup(session, sock)) == LIBSSH2_ERROR_EAGAIN); while ((rc = libssh2_session_startup(session, sock)) ==
LIBSSH2_ERROR_EAGAIN);
if (rc) { if (rc) {
fprintf(stderr, "Failure establishing SSH session: %d\n", rc); fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
return -1; return -1;
@@ -133,7 +169,8 @@ int main(int argc, char *argv[])
if (auth_pw) { if (auth_pw) {
/* We could authenticate via password */ /* We could authenticate via password */
while ((rc = libssh2_userauth_password(session, username, password)) == LIBSSH2_ERROR_EAGAIN); while ((rc = libssh2_userauth_password(session, username, password)) ==
LIBSSH2_ERROR_EAGAIN);
if (rc) { if (rc) {
fprintf(stderr, "Authentication by password failed.\n"); fprintf(stderr, "Authentication by password failed.\n");
goto shutdown; goto shutdown;
@@ -141,36 +178,46 @@ int main(int argc, char *argv[])
} else { } else {
/* Or by public key */ /* Or by public key */
while ((rc = libssh2_userauth_publickey_fromfile(session, username, while ((rc = libssh2_userauth_publickey_fromfile(session, username,
"/home/username/.ssh/id_rsa.pub", "/home/username/"
"/home/username/.ssh/id_rsa", ".ssh/id_rsa.pub",
password)) == LIBSSH2_ERROR_EAGAIN); "/home/username/"
".ssh/id_rsa",
password)) ==
LIBSSH2_ERROR_EAGAIN);
if (rc) { if (rc) {
fprintf(stderr, "\tAuthentication by public key failed\n"); fprintf(stderr, "\tAuthentication by public key failed\n");
goto shutdown; goto shutdown;
} }
} }
#if 0
libssh2_trace(session, LIBSSH2_TRACE_CONN);
#endif
/* Request a file via SCP */ /* Request a file via SCP */
fprintf(stderr, "libssh2_scp_recv()!\n"); fprintf(stderr, "libssh2_scp_recv()!\n");
do { do {
channel = libssh2_scp_recv(session, scppath, &fileinfo); channel = libssh2_scp_recv(session, scppath, &fileinfo);
if ((!channel) && (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) { if (!channel) {
if(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
char *err_msg; char *err_msg;
libssh2_session_last_error(session, &err_msg, NULL, 0); libssh2_session_last_error(session, &err_msg, NULL, 0);
fprintf(stderr, "%s\n", err_msg); fprintf(stderr, "%s\n", err_msg);
goto shutdown; goto shutdown;
} }
else {
fprintf(stderr, "libssh2_scp_recv() spin\n");
waitsocket(sock, session);
}
}
} while (!channel); } while (!channel);
fprintf(stderr, "libssh2_scp_recv() is done, now receive data!\n"); fprintf(stderr, "libssh2_scp_recv() is done, now receive data!\n");
while(got < fileinfo.st_size) { while(got < fileinfo.st_size) {
char mem[1000]; char mem[1024*24];
struct timeval timeout;
int rc; int rc;
fd_set fd;
do { do {
int amount=sizeof(mem); int amount=sizeof(mem);
@@ -184,44 +231,39 @@ int main(int argc, char *argv[])
if (rc > 0) { if (rc > 0) {
write(1, mem, rc); write(1, mem, rc);
got += rc; got += rc;
total += rc;
} }
} while (rc > 0); } while (rc > 0);
if (rc == LIBSSH2_ERROR_EAGAIN) { if ((rc == LIBSSH2_ERROR_EAGAIN) && (got < fileinfo.st_size)) {
/* this is due to blocking that would occur otherwise /* this is due to blocking that would occur otherwise
so we loop on this condition */ so we loop on this condition */
timeout.tv_sec = 10; spin++;
timeout.tv_usec = 0; waitsocket(sock, session); /* now we wait */
FD_ZERO(&fd);
FD_SET(sock, &fd);
rc = select(sock+1, &fd, &fd, NULL, &timeout);
if (rc <= 0) {
/* negative is error
0 is timeout */
fprintf(stderr, "SCP timed out: %d\n", rc);
}
continue; continue;
} }
break; break;
} }
gettimeofday(&end, NULL);
time_ms = tvdiff(end, start);
printf("Got %d bytes in %ld ms = %.1f bytes/sec spin: %d\n", total,
time_ms, total/(time_ms/1000.0), spin );
libssh2_channel_free(channel); libssh2_channel_free(channel);
channel = NULL; channel = NULL;
shutdown: shutdown:
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing"); libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing");
libssh2_session_free(session); libssh2_session_free(session);
#ifdef WIN32 #ifdef WIN32
Sleep(1000);
closesocket(sock); closesocket(sock);
#else #else
sleep(1);
close(sock); close(sock);
#endif #endif
fprintf(stderr, "all done\n"); fprintf(stderr, "all done\n");

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: scp_write.c,v 1.6 2008/11/10 16:48:41 bagder Exp $ * $Id: scp_write.c,v 1.7 2009/04/28 10:35:30 bagder Exp $
* *
* Sample showing how to do a simple SCP transfer. * Sample showing how to do a simple SCP transfer.
*/ */
@@ -10,12 +10,12 @@
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
# ifdef HAVE_UNISTD_H # ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
FILE *local; FILE *local;
int rc; int rc;
char mem[1024]; char mem[1024];
size_t nread; size_t nread, sent;
char *ptr; char *ptr;
struct stat fileinfo; struct stat fileinfo;
@@ -142,8 +142,8 @@ int main(int argc, char *argv[])
} }
} }
/* Request a file via SCP */ /* Send a file via scp. The mode parameter must only have permissions! */
channel = libssh2_scp_send(session, scppath, 0x1FF & fileinfo.st_mode, channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777,
(unsigned long)fileinfo.st_size); (unsigned long)fileinfo.st_size);
if (!channel) { if (!channel) {
@@ -159,13 +159,20 @@ int main(int argc, char *argv[])
break; break;
} }
ptr = mem; ptr = mem;
sent = 0;
do { do {
/* write data in a loop until we block */ /* write the same data over and over, until error or completion */
rc = libssh2_channel_write(channel, ptr, nread); rc = libssh2_channel_write(channel, ptr, nread);
ptr += rc; if (rc < 0) {
nread -= nread; fprintf(stderr, "ERROR %d\n", rc);
} while (rc > 0); } else {
/* rc indicates how many bytes were written this time */
sent += rc;
}
} while (rc > 0 && sent < nread);
ptr += sent;
nread -= sent;
} while (1); } while (1);
fprintf(stderr, "Sending EOF\n"); fprintf(stderr, "Sending EOF\n");
@@ -186,10 +193,8 @@ int main(int argc, char *argv[])
libssh2_session_free(session); libssh2_session_free(session);
#ifdef WIN32 #ifdef WIN32
Sleep(1000);
closesocket(sock); closesocket(sock);
#else #else
sleep(1);
close(sock); close(sock);
#endif #endif
fprintf(stderr, "all done\n"); fprintf(stderr, "all done\n");

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