Commit Graph

169 Commits

Author SHA1 Message Date
Kamil Dudka
b31e35aba6 examples: use stderr for messages, stdout for data
Reported by: Karel Srot
Bug: https://bugzilla.redhat.com/867462
2012-10-22 13:39:58 +02:00
Steven Dake
a46ef85a56 In examples/x11.c, Make sure sizeof passed to read operation is correct
sizeof(buf) expands to 8 or 4 (since its a pointer).  This variable may
have been static in the past, leading to this error.

Signed-off-by: Steven Dake <sdake@redhat.com>
2012-03-13 22:19:54 +01:00
Steven Dake
626f91da07 Fix suspicious sizeof usage in examples/x11.c
In the x11 example, sizeof(buf) = 8UL (on x86_64), when this should
probably represent the buffer size available.  I am not sure how to
test that this change is actually correct, however.

Signed-off-by: Steven Dake <sdake@redhat.com>
2012-03-13 22:19:18 +01:00
Peter Stuge
aa8f2cbf33 example/x11: Set raw terminal mode manually instead of with cfmakeraw()
OpenSolaris has no cfmakeraw() so to make the example more portable
we simply do the equivalent operations on struct termios ourselves.

Thanks to Tom Weber for reporting this problem, and finding a solution.
2012-02-29 22:27:18 +01:00
Peter Stuge
4774d500e7 example/x11: Build only when sys/un.h is found by configure
The example can't be built on systems without AF_UNIX sockets.
2012-02-13 00:40:24 +01:00
Peter Stuge
e394987911 Add a tcpip-forward example which demonstrates remote port forwarding 2012-02-02 17:25:45 +01:00
Peter Stuge
effbb72192 example/subsystem_netconf.c: Return error when read buffer is too small
Also remove a little redundancy in the read loop condition.
2012-02-01 11:35:05 +01:00
Peter Stuge
0ebe6f44bd example/subsystem_netconf.c: Add a missing newline in an error message 2012-02-01 11:35:00 +01:00
Daniel Stenberg
09139ef065 ssh2_exec: skip error outputs for EAGAIN
Since the example uses non-blocking mode, it will just flood the output
with this "nonsense" error.
2011-12-08 10:54:46 +01:00
Kamil Dudka
c0974e5ca3 example/sftp_RW_nonblock: do not ignore LIBSSH2_ERROR_EAGAIN
Bug: https://bugzilla.redhat.com/745420
2011-10-24 22:22:57 +02:00
Peter Stuge
c292378327 example/ssh2_agent: Print host key fingerprint before authentication
Also moves the comment about not being authenticated to before the
agent authentication takes place, so that it better matches the code.
2011-10-05 16:55:58 +02:00
Mikhail Gusarov
d343e3405a Add missing .gitignore entries 2011-09-12 15:38:03 +02:00
Guenter Knauf
46792a9fca Added casts to silent compiler warnings. 2011-09-10 16:38:51 +02:00
Guenter Knauf
b5cd8fe120 Fixed uint64_t printf. 2011-09-10 16:29:29 +02:00
Guenter Knauf
26a9aca598 Removed unused var. 2011-09-10 15:24:08 +02:00
Guenter Knauf
bff91fe2a0 Added 2 samples not mentioned. 2011-09-10 15:20:06 +02:00
Guenter Knauf
e399a852b9 Removed unused var. 2011-09-10 14:48:06 +02:00
Guenter Knauf
3fb3ba571b Kill stupid gcc 3.x uninitialized warning. 2011-09-10 14:22:08 +02:00
Daniel Stenberg
7ed53e21fd libssh2_session_startup(3) => libssh2_session_handshake(3)
Propagate for the current function in docs and examples.
libssh2_session_startup() is deprecated.
2011-09-09 23:17:04 +02:00
Daniel Stenberg
87f79f177f remove embedded CVS/svn tags 2011-09-09 16:12:04 +02:00
Guenter Knauf
50d451e307 Fix for systems which need sys/select.h. 2011-09-08 13:53:05 +02:00
Daniel Stenberg
420f0b7793 subsystem_netconf.c: fix compiler warnings 2011-08-21 15:24:55 +02:00
Henrik Nordstrom
2fe1770d9f Avoid reuse after free when closing X11 channels 2011-08-16 10:27:49 +02:00
Peter Stuge
b232eeb598 example/subsystem_netconf.c: Add missing #include <string.h> 2011-07-17 08:04:52 +02:00
Peter Stuge
f922df9e1b example/subsystem_netconf.c: Discard ]]>]]> and return only XML response 2011-07-17 08:00:48 +02:00
Peter Stuge
7e47bd6640 example/subsystem_netconf.c: Fix uninitialized variable bug 2011-07-17 07:18:39 +02:00
Peter Stuge
4ae907cdef example: Add subsystem_netconf.c
This example demonstrates how to use libssh2 to send a request to
the NETCONF subsystem available e.g. in JunOS.

See also http://tools.ietf.org/html/draft-ietf-netconf-ssh-06
2011-07-17 07:08:48 +02:00
Daniel Stenberg
59673a111e sftp_write_sliding.c: indent fix
Use the standard indenting and removed CVS leftover comment
2011-05-10 10:17:32 +02:00
zl liu
5b66a5f38d sftp_write_sliding: send the complete file
When reaching the end of file there can still be data left not sent.
2011-05-10 10:16:05 +02:00
Daniel Stenberg
5dc5c80a39 example/.gitignore: ignore built binaries 2011-04-13 11:29:08 +02:00
Daniel Stenberg
0b0aa209f6 scp_write_nonblock.c: remove pointless check
libssh2_channel_write() cannot return a value that is larger than the
input length value
2011-04-12 10:46:47 +02:00
Guenter Knauf
aa4f861643 Expanded tabs to spaces. 2010-12-22 14:27:55 +01:00
Daniel Stenberg
5ee38702a0 ssh2_echo: Value stored to 'exitcode' is never read 2010-12-15 21:58:43 +01:00
Daniel Stenberg
499b989d46 sftp_append: new example doing SFTP append 2010-12-10 23:49:16 +01:00
Daniel Stenberg
b0c32a85fc sftp_write_sliding.c: new example
This is an example that is very similar to sftp_write_nonblock.c, with
the exception that this uses

1 - a larger upload buffer

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

These are two key issues to make libssh2 SFTP uploads really perform
well at this point in time.
2010-12-05 00:06:39 +01:00
Daniel Stenberg
ac6d0fb706 ssh2_echo: new example
This is a new example snippet. The code is largely based on ssh2_exec,
and is written by Tommy Lindgren. I edited it into C90 compliance and to
conform to libssh2 indent style and some more.
2010-11-13 23:11:39 +01:00
Daniel Stenberg
160453cee4 SCP: on failure, show the numerical error reason
By calling libssh2_session_last_errno()
2010-11-10 17:26:38 +01:00
Daniel Stenberg
82fa5d2167 SFTP: provide the numerical error reason on failure 2010-11-10 17:26:02 +01:00
Daniel Stenberg
1d2a5b8456 sftp_write: enlarge buffer to perform better 2010-11-10 15:00:55 +01:00
Daniel Stenberg
024b5d29f5 bugfix: avoid use of uninitialized value 2010-11-01 22:58:12 +01:00
Daniel Stenberg
d9cdd8c0a7 scp_write_nonblock: use select() instead of busyloop
Make this example nicer by not busylooping.
2010-10-22 13:37:14 +02:00
Dan Fandrich
784db8e987 Added header file to allow compiling in older environments 2010-10-20 22:19:38 -07:00
Tommy Lindgren
6140ec2de3 Add libssh2_channel_get_exit_signal.
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2010-10-13 15:31:06 +02:00
Guenter Knauf
4b878e7cf8 Added include for sys/select.h to get fd.set on some platforms. 2010-08-17 01:34:32 +02:00
Daniel Stenberg
4b8013a8a7 example: treat the libssh2_channel_read() return code properly
A short read is not an error. Only negative values are errors!
2010-08-02 00:20:24 +02:00
Daniel Stenberg
1785d0d6f3 scp_write_nonblock: add transfer time info
Using the same timing logic and output format as
sftp_write_nonblock allows us to very easily run benchmarks on
SCP vs SFTP uploads using libssh2.
2010-06-11 16:05:22 +02:00
Daniel Stenberg
31d71a94f2 sftp_write_nonblock: select() on socket, use *BIG* buffer, time transfer
The select() is just to make it nicer so that it doesn't
crazy-loop on EAGAIN. The buffer size thing is mostly to verify
that this really work as supposed.

Transfer timing is just a minor thing, but it can just as well be
there and help us time and work on performance easier using out
of the box examples.
2010-06-11 16:03:33 +02:00
Guenter Knauf
2c1c751ad1 moved MSVC strdup define to libssh2_config.h which we include already. 2010-06-10 02:31:48 +02:00
Daniel Stenberg
4e10882e06 example: fix strdup() for MSVC compiles
MSVC has a _strdup() that we better use. This was reported in bug
2010-06-07 13:36:12 +02:00
Daniel Stenberg
f285438022 direct_tcpip: bring back inclusion of libssh2_config.h
In order to increase portability of this example, I'm bringing
the inclusion of libssh2_config.h back, and I also added an
require that header for this example to compile.

I also made all code lines fit within 80 columns.
2010-06-03 13:55:54 +02:00