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
Daniel Stenberg
9251642ef3
pedantic: make the code C90 clean
2010-05-03 22:16:01 +02:00
Peter Stuge
79b97c67c7
Do proper keyboard-interactive user dialog in the sftp.c example
2010-05-03 15:36:16 +02:00
Daniel Stenberg
a3f3347c12
knownhost: support [host]:port in knownhost file
...
OpenSSH has ways to add hosts to the knownhosts file that include
a specific port number which makes the key associated with only
that specific host+port pair. libssh2 previously did not support
this, and I was forced to add a new function to the API to
properly expose this ability to applications:
libssh2_knownhost_checkp()
To *add* such hosts to the knownhosts file, you make sure to pass
on the host name in that manner to the libssh2_knownhost_addc()
function.
2010-05-02 16:56:31 +02:00
Daniel Stenberg
7bbefe0660
examples: avoid use of uninitialized variable 'sock'
2010-04-30 12:30:24 +02:00
Daniel Stenberg
6c85370428
Uninitialized argument
2010-04-29 22:01:32 +02:00
Daniel Stenberg
23f02aad11
sftpdir: removed dead assignment
2010-04-29 22:00:05 +02:00
Daniel Stenberg
6a44eff0b5
ssh2_agent: avoid using 'session' uninitialized on failures
2010-04-28 09:13:22 +02:00
Daniel Stenberg
0862a1a39a
examples: remove assignments of variable rc that's never used
2010-04-28 09:05:19 +02:00
Daniel Stenberg
c28fa65424
bugfix: avoid using the socket if it failed to create one
2010-04-27 15:18:40 +02:00
Daniel Stenberg
03815483be
bugfix: potential use of NULL pointer
2010-04-27 15:10:48 +02:00
Daniel Stenberg
cb42be1a9c
examples: fixed and made them more similar
...
The channel read/write functions can return 0 in legitimate cases
without it being an error, and we need to loop properly if they
return short.
2010-04-26 16:49:30 +02:00
Daniel Stenberg
26d1698320
scp_write_nonblock: Value stored to 'nread' is never read
2010-04-24 12:58:34 +02:00
Daniel Stenberg
7dfeadef97
scp_write: Value stored to 'ptr' is never read
2010-04-24 12:57:32 +02:00
Daniel Stenberg
5804444936
scp_write_nonblock: Value stored to 'ptr' is never read
2010-04-24 12:56:53 +02:00
Daniel Stenberg
ee5dd3561d
sftp_mkdir: less silly output but show failures
2010-04-24 12:56:13 +02:00
Daniel Stenberg
21a01c96f8
remove unused variable
2010-04-17 13:38:07 +02:00
Simon Josefsson
5456163507
Fix build problem.
2010-03-19 09:40:50 +01:00
Simon Josefsson
7301036421
Eat our own dog food, call libssh2_init and libssh2_exit in the examples.
2010-03-19 09:35:00 +01:00
Simon Josefsson
e4232e531b
Silence compiler warning.
2010-02-23 15:49:47 +01:00
Daniel Stenberg
b4f12e153a
show more verbose error when SCP send fails
2010-02-21 19:29:23 +01:00
Daniel Stenberg
dea503df73
improved error handling
2010-02-21 19:08:14 +01:00
Peter Stuge
2149244cfe
Fix resource and memory leaks in examples as reported by cppcheck
...
Thanks to Ettl Martin for the report and patch. This fixes #132
2010-02-16 13:21:57 +01:00
Dave McCaldon
ea914c8b72
Resolve compile issues on Solaris x64 and UltraSPARC
...
Solaris builds of libssh2-1.2.3 failed on both x64 and UltraSPARC
platforms because of two problems:
1) src/agent.c:145 sun is a reserved word when using the SUNWspro compiler
2) example/direct_tcpip.c:84 INADDR_NONE is not defined
2010-02-09 11:19:52 +01:00
Daniel Stenberg
91841731af
fix building out of source tree by proving better include path
...
when building out of source tree, we provide -I$(top_builddir)/example
since the libssh2_config.h gets generated in that dir
2010-02-03 19:21:12 +01:00
Peter Stuge
68a900d27a
Detect when the forwarded connection is closed in example/direct_tcpip.c
2010-01-30 00:45:56 +01:00
Peter Stuge
e4b7baa885
Fix example/direct_tcpip.c to work also on WIN32
...
read() and write() are no good for WIN32 sockets, use recv() and send().
2010-01-30 00:35:05 +01:00
Peter Stuge
2622bbaf33
Ignore libssh2_config.h.in and stamp-h2 in example/ and remove .cvsignore
2010-01-30 00:25:46 +01:00
Peter Stuge
d3dbe4c81e
Simplify WIN32 ifdefs in example/direct_tcpip.c to allow standalone compile
2010-01-30 00:01:51 +01:00
Peter Stuge
6df87e64b7
Use LIBSSH2_HOSTKEY_HASH_SHA1 instead of _MD5 in examples and tests
...
MD5 support is optional and may not always be available, while SHA1 is both
required and recommended.
2010-01-29 23:06:31 +01:00
Peter Stuge
6c543545fe
Make example/direct_tcpip.c compile for win32
...
One warning from FD_SET() remains, it is also in some other examples.
2010-01-29 20:35:24 +01:00
Daniel Stenberg
9f4292433a
ignore more generated files
2010-01-20 19:46:36 +01:00
Daniel Stenberg
7f27b0822d
cleanup includes
...
We now produce a local libssh2_config.h file in this dir for the
examples to use so I cleaned up the include path at the same time.
2010-01-13 22:21:09 +01:00
Daniel Stenberg
e3d8c1cfed
generate a libssh2_config.h in the example dir
...
buildconf copies the template to example/ and configure makes sure
to generate a proper file from it and the direct_tcpip.c example
is the first one to use it - to make sure it builds fine on more
paltforms
2010-01-13 13:46:56 +01:00
Simon Josefsson
11a114ee7c
Remove redundant #includes and reorder sys/types.h include.
2010-01-13 11:03:26 +01:00
Peter Stuge
bd0505d6b9
Add a direct-tcpip example which shows local port forwarding
2009-12-24 02:18:39 +01:00
Daiki Ueno
c573af83de
Don't request userauthlist after authentication.
2009-12-23 07:59:37 +09:00
Daiki Ueno
db26c4eace
Add an example to use ssh-agent API.
...
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2009-12-21 12:19:33 +01:00
Simon Josefsson
b5e358618b
Move examples from example/simple to example/.
2009-12-19 10:54:45 +01: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
Peter Stuge
3cc2f143c1
Fix scp examples to loop correctly over libssh2_channel_write()
2009-09-20 01:35:19 +02:00