Compare commits

..

196 Commits

Author SHA1 Message Date
Daniel Stenberg
6e40af7bea NEWS: add the 1.2.6 release details 2010-06-10 10:19:31 +02:00
Daniel Stenberg
5e46c864dc RELEASE-NOTES: 1.2.6 details added 2010-06-10 10:15:46 +02:00
Guenter Knauf
a4fdf0de01 fixed libssh2.dsw to use the generated libssh2.dsp; removed old *.dsp files. 2010-06-10 02:43:49 +02:00
Guenter Knauf
2c1c751ad1 moved MSVC strdup define to libssh2_config.h which we include already. 2010-06-10 02:31:48 +02:00
Guenter Knauf
f682684fdd added missing source files to src/NMakefile. 2010-06-10 02:28:47 +02:00
Daniel Stenberg
0ad1a52a09 libssh2_poll: refer to poll(3) and select(3) instead 2010-06-08 08:37:37 +02:00
Daniel Stenberg
4e10882e06 example: fix strdup() for MSVC compiles
MSVC has a _strdup() that we better use. This was reported in bug
2010-06-07 13:36:12 +02:00
Daniel Stenberg
eeeebd02e7 SFTP: fail init SFTP if session isn't authenticated
Alexander Lamaison filed bug #172
(http://trac.libssh2.org/ticket/172), and pointed out that SFTP
init would do bad if the session isn't yet authenticated at the
time of the call, so we now check for this situation and returns
an error if detected. Calling sftp_init() at this point is bad
usage to start with.
2010-06-07 13:10:51 +02:00
Daniel Stenberg
f285438022 direct_tcpip: bring back inclusion of libssh2_config.h
In order to increase portability of this example, I'm bringing
the inclusion of libssh2_config.h back, and I also added an
require that header for this example to compile.

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

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

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

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

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

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

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

 _libssh2_store_u32
 _libssh2_store_u64
 _libssh2_store_str

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

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

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

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

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

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

The function no longer calls the libssh2_* function again, but
properly uses the internal sftp_* instead.
2010-04-15 01:15:35 +02:00
Daniel Stenberg
7f740368f4 channel/transport: we now drain the outgoing send buffer when we ignore EAGAIN
When we ignore the EAGAIN from the transport layer within channel_write, we
now drain the outgoing transport layer buffer so that remainders in that
won't cause any problems in the next invoke of _libssh2_transport_write()
2010-04-15 01:12:22 +02:00
Daniel Stenberg
8b63dc9e59 channel_write: if data has been sent, don't return EAGAIN
When sending data in a loop, we must not return EAGAIN if we
managed to send data in an earlier round. This was reported in
bug #126 => http://libssh2.stuge.se/ticket/126
2010-04-14 23:35:40 +02:00
Simon Josefsson
77fa740674 Fix OpenSSL AES-128-CTR detection.
Patch from Paul Howarth <paul@city-fan.org>.
2010-04-14 14:04:45 +02:00
Daniel Stenberg
32cf14b512 version in header file now says 1.2.6-DEV 2010-04-13 23:39:39 +02:00
Daniel Stenberg
44cd934fa2 1.2.6: clean the RELEASE-NOTES for next release round 2010-04-13 23:38:21 +02:00
Daniel Stenberg
339ad5ccd3 NEWS: add the stuff from the version 1.2.5 RELEASE-NOTES 2010-04-13 23:37:47 +02:00
Daniel Stenberg
0ecd0eb37c channel_close: no longer wait for the SSH_MSG_CHANNEL_CLOSE message
As the packet may simply not arrive we cannot have the close
function wait for it unconditionally.
2010-04-13 22:59:52 +02:00
Daniel Stenberg
f514bcac53 less code duplication in the poll vs select code flows
libssh2_keepalive_send and libssh2_session_block_directions are
now used outside of the #ifdef blocks.
2010-04-13 10:45:01 +02:00
Daniel Stenberg
79ee2f339e make it C90 compliant 2010-04-12 22:09:38 +02:00
Daniel Stenberg
12fd204ae4 updated with all changes and bugs since 1.2.4 2010-04-11 14:58:19 +02:00
Daniel Stenberg
2386a5a21c Added LIBSSH2_SFTP_S_IS***() macros and updated docs
libssh2_sftp_fstat_ex.3 is now extended quite a lot to describe a
lot of the struct and the bits it uses and how to test for them.
2010-04-11 11:26:16 +02:00
Daniel Stenberg
8b7e22cb33 sftp_init() deal with _libssh2_channel_write() returns short
When _libssh2_channel_write() is asked to send off 9 bytes, the
code needs to deal with the situation where less than 9 bytes
were sent off and prepare to send the remaining piece at a later
time.
2010-04-01 20:25:49 +02:00
Daniel Stenberg
1d49f1bc21 handle a NULL password as if it was ""
libssh2_userauth_publickey_fromfile_ex() takes a "passphrase"
but didn't deal with it being set to NULL.
2010-03-29 17:19:58 +02:00
Daniel Stenberg
1711917c2c Reduce used window sizes by factor 10
As reported in bug report #166 http://libssh2.stuge.se/ticket/166
by 'ptjm', the maximum window size must be less crazy for libssh2
to do better with more server implementations. I did not do any
testing to see how this changes raw SCP performance, but the
maximum window size is still almost 4MB. This also has the upside
that libssh2 will use less memory.
2010-03-28 15:36:58 +02:00
Peter Stuge
b6ed60d2cc Correctly clear blocking flag after sending multipart packet
commit 7317edab61 cleared the outbound
blocking bit when send_existing() returned PACKET_NONE and *ret=0, as
opposed to before even calling send_existing(), but because *ret=1 when
sending parts 2..n of an existing packet, the bit would only be cleared
when calling libssh2_transport_write() for a new packet.

Clear the direction flag after the final part of a packet has been sent.
2010-03-28 01:35:55 +01:00
Daniel Stenberg
79acf60ae6 Added man page for libssh2_knownhost_addc()
Added mention in libssh2_knownhost_add() docs that
libssh2_knownhost_addc() is the preferred function now.
2010-03-24 15:39:46 +01:00
Daniel Stenberg
7810656564 at next soname bump remove libssh2_knownhost_add() 2010-03-24 15:39:13 +01:00
Daniel Stenberg
4bc10aa728 ignore TAGS ("make tags" makes them) 2010-03-24 15:38:44 +01:00
Daniel Stenberg
5512d0d593 fix memory leak
we must not assign the pointer a NULL since it keeps allocated
data and at least parts of an error string
2010-03-23 23:16:08 +01:00
Daniel Stenberg
05f9fb878e fixed the pattern for avoiding the poll check
added some comments about known problems with poll on darwin
2010-03-23 22:50:53 +01:00
Daniel Stenberg
f314f3b5fd avoid checking for poll on some systems
darwin and interix are known to have broken poll implementations
so we skip the check on those and thus have them use select
unconditionally
2010-03-23 22:00:31 +01:00
Daniel Stenberg
eb4407975c ignore libssh2.dsp 2010-03-23 21:59:12 +01:00
Simon Josefsson
6d253324be Fix logic in "on-the-fly" crypto init. 2010-03-23 21:09:32 +01:00
Simon Josefsson
aebcc45a37 Make sure keepalive is working even when poll is used. 2010-03-23 21:08:47 +01:00
Paul Querna
1decccbb52 Use poll when available on blocking API.
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2010-03-23 20:48:58 +01:00
Peter Stuge
4c09324b02 Fix speling 2010-03-20 02:45:46 +01:00
Daniel Stenberg
6d4b1bbb45 fix NULL dereference when window adjusting a non-existing channel
Suyog Jadhav pointed out that when receiving a window adjust to
a channel not found, the code would reference a NULL pointer.
Now it will instead output a message about that fact.
2010-03-19 14:58:05 +01: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
fa4017c613 Fix init/exit logic. Add self-test of it. 2010-03-19 09:27:19 +01:00
Daniel Stenberg
2e3f380ff2 fix typo 2010-03-19 09:23:47 +01:00
Simon Josefsson
6c3c3e1b49 Add man page for libssh2_init and libssh2_exit. Fix libssh2_exit prototype. 2010-03-19 09:21:48 +01:00
Simon Josefsson
55ede3b41b Shorten constant a bit. More documentation. 2010-03-19 09:17:42 +01:00
Simon Josefsson
d00283927f Fix namespace pollution. 2010-03-19 09:14:21 +01:00
Simon Josefsson
9ea5b0625e Add global init/exit points, to do crypto initialization in one place.
By Lars Nordin.
2010-03-19 09:05:52 +01:00
Daniel Stenberg
1b1b4ac387 libssh2 is released under the Modifed BSD license, not GPL 2010-03-14 23:30:46 +01:00
Alexander Lamaison
9abf81de97 Add libssh2_knownhost_addc to handle comments.
Comments in known_hosts file were not handle properly.  They were parsed as
part of the key causing key matching to return a mismatch if the entry had a
comment.  This adds a new API function that takes an optional comment and
changes libssh2_knownhost_readline to parse the comment as pass it to the
new function.

Fixes #164.
2010-03-14 19:52:00 +00:00
Alexander Lamaison
c585828d2b Fix gettimeofday to compile with Visual C++ 6.
Reported by Steven Van Ingelgem.
2010-03-12 11:29:31 +00:00
Simon Josefsson
e54786cf2e Add. 2010-03-10 18:50:29 +01:00
Simon Josefsson
4cfeade243 keepalive.c: Fix libssh2_error usage. 2010-03-10 13:16:32 +01:00
Simon Josefsson
60ff0a2ade Fix typo in last commit. 2010-03-10 13:13:48 +01:00
Simon Josefsson
64c97765a5 Tidy up build option notice. 2010-03-10 13:13:19 +01:00
Simon Josefsson
ab66ff488b Add entry about keep alive stuff. 2010-03-10 13:10:57 +01:00
Simon Josefsson
0d331aade1 Add keep-alive support. 2010-03-10 13:08:42 +01:00
Alexander Lamaison
69520e1564 Untabify. 2010-03-07 17:12:56 +00:00
Alexander Lamaison
f87f4ab836 Fix memory leak in libssh2_knownhost_add. 2010-03-07 16:20:07 +00:00
Daniel Stenberg
b3556c2e0c change 'int' to 'libssh2_socket_t' in the public API for sockets 2010-03-06 19:51:58 +01:00
Daniel Stenberg
1f406feaa4 reduce code duplication and return underlying error better 2010-03-03 23:57:22 +01:00
Daniel Stenberg
c0436fc602 acknowledge when _libssh2_packet_requirev() returns error
when _libssh2_packet_requirev() returns an error when waiting for
SSH_MSG_USERAUTH_SUCCESS or SSH_MSG_USERAUTH_FAILURE, it is an
error and it should be treated as such
2010-03-03 23:44:54 +01:00
Daniel Stenberg
0034a83e4c wrap long lines 2010-03-03 23:44:24 +01:00
Daniel Stenberg
f0f4ba92f0 polished the phrasing in two error strings 2010-03-03 23:37:58 +01:00
Daniel Stenberg
c29ba827e4 silence picky compiler warnings 2010-03-03 23:33:25 +01:00
Daniel Stenberg
a03e1b0457 silence picky compiler warnings 2010-03-03 23:32:56 +01:00
Daniel Stenberg
d4a768af4e removed libssh2_error()'s forth argument
libssh2_error() no longer allocates a string and only accepts a const
error string. I also made a lot of functions use the construct of
return libssh2_error(...) instead of having one call to
libssh2_error() and then a separate return call. In several of those
cases I then also changed the former -1 return code to a more
detailed one - something that I think will not change behaviors
anywhere but it's worth keeping an eye open for any such.
2010-03-03 23:04:05 +01:00
Daniel Stenberg
d377c3065a repaired --enable-debug 2010-03-03 22:51:15 +01:00
Simon Josefsson
51fcb11d60 Make ./configure output a summary of build options. 2010-03-01 17:01:47 +01:00
Daniel Stenberg
8bbc109e52 let the err_msg in the session struct be const too 2010-03-01 13:16:19 +01:00
Simon Josefsson
0ef84144ac Revert #ifdef change that pulled in AES-CTR code when explicitly disabled. 2010-03-01 13:09:18 +01:00
Daniel Stenberg
ef27023eb9 fix #ifdefs 2010-03-01 11:42:38 +01:00
Daniel Stenberg
a9621548f8 make function match the new proto 2010-03-01 11:42:04 +01:00
Simon Josefsson
a925bdd5bb Improve AES-CTR check. 2010-03-01 11:38:50 +01:00
Daniel Stenberg
3420e9858c use const to silence a bazillion warnings 2010-03-01 11:05:40 +01:00
Simon Josefsson
2de339b2f7 Use AES-CTR from OpenSSL when available.
Reported by Lars Nordin <Lars.Nordin@SDlabs.se>.
2010-03-01 10:34:00 +01:00
Simon Josefsson
c46cbd46e2 Make it possible to disable DSA.
Patch from Lars Nordin <Lars.Nordin@SDlabs.se>.
2010-03-01 10:30:22 +01:00
Peter Stuge
16af813b81 Send and receive channel EOF before sending SSH_MSG_CHANNEL_CLOSE
Sending SSH_MSG_CHANNEL_CLOSE without channel EOF is explicitly allowed
in RFC 4254, but some non-conforming servers will hang or time out when
the channel is closed before EOF.

Other common clients send and receive EOF before closing, there are no
drawbacks, and some servers need it to work correctly.
2010-03-01 06:43:53 +01:00
Alexander Lamaison
a2157c8391 Style improvements to knownhost error handling.
Made improvements as suggested by Peter Stuge: http://www.libssh2.org/mail/libssh2-devel-archive-2010-02/0161.shtml.
2010-02-26 18:47:54 +00:00
Alexander Lamaison
942a40b482 Call libssh2_error for every knownhost API failure.
The libssh2 API calls should set the last error code and a message when
returning a failure by calling libssh2_error.  This changeset adds these
calls to the libssh2_knownhost_* API as well as libssh2_base64_decode.

This change also makes libssh2_error into a function rather than a macro.
Its implementation is moved to misc.c.  This function returns the error
code passed to it allowing callers to return the error value directly
without duplicating the error code.
2010-02-24 13:45:00 +00:00
Alexander Lamaison
ef096220ce Fix LIBSSH2_ALLOC checks.
These appear to be cut-and paste errors where the wrong variable is checked
for NULLness after calling LIBSSH2_ALLOC.
2010-02-23 22:00:40 +00:00
Simon Josefsson
e4232e531b Silence compiler warning. 2010-02-23 15:49:47 +01:00
Simon Josefsson
cdc1366b2c Make it portable; test uses = for string comparison (not ==). Indent. 2010-02-23 15:27:18 +01:00
Alexander Lamaison
3e1a95392e libssh2_knownhost_del: fix write to freed memory.
When removing a known host, libssh2_knownhost_del would remove the node from the linked list, free its memory and then overwrite the struct parameter (which indicated which node to remove) with 0.  However, this struct is actually allocated within the just-freed node meaning we're writing to freed memory.  This made Windows very upset.

The fix is simply to overwrite the struct first before freeing the memory.
2010-02-22 14:50:08 +00:00
Daniel Stenberg
b4f12e153a show more verbose error when SCP send fails 2010-02-21 19:29:23 +01:00
Daniel Stenberg
bd5519c7a2 libssh2_socket_t is done, a library-free function is needed 2010-02-21 19:20:07 +01:00
Daniel Stenberg
05b1bb3cd3 clarify that this frees all data associated with a session 2010-02-21 19:16:30 +01:00
Daniel Stenberg
dea503df73 improved error handling 2010-02-21 19:08:14 +01:00
Daniel Stenberg
c5609acb17 add missing libssh2_error() calls
To make sure the public API is functional and that the
BLOCK_ADJUST_ERRNO() macro works correctly we MUST make sure to
call libssh2_error() when we return errors.
2010-02-18 13:20:11 +01:00
Daniel Stenberg
37c08983a3 fix memory leak in userauth_keyboard_interactive()
Mr anonymous in bug #125 pointed out that the userauth_keyboard_interactive()
function does in fact assign the same pointer a second time to a new allocated
buffer without properly freeing the previous one, which caused a memory leak.
2010-02-18 13:04:29 +01:00
Daniel Stenberg
72ae0866cb added missing error codes
To allow the libssh2_session_last_error() function to work as
documented, userauth_password() now better makes sure to call
libssh2_error() everywhere before it returns error.

Pointed out by mr anonymous in bug #128
2010-02-18 00:01:33 +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
Daniel Stenberg
a491017f5a mention the new man pages for macros 2010-02-15 14:29:04 +01:00
Daniel Stenberg
ec699ef684 added man pages for API macros
all #defined macros in the public headers are considered to be part
of the API and I've generated individual man pages for each of them
to A) make it easier to figure out what each function/macro actually
is for so that automated lookups work better and for B) make sure we
have all public functions document (both macros and functions) to
make it easier for us to work away from all the macros in a future
release.
2010-02-15 14:24:40 +01:00
Daniel Stenberg
514104b37d Committed the patch by Yoichi Iwaki in bug #2929647
Committed the patch by Yoichi Iwaki in bug #2929647, which fixed a memory
leak when an 'outbuf' was still allocated when a session was freed.
2010-02-15 00:15:30 +01:00
Daniel Stenberg
4d13c6e59b free "outbuf" when killing a session
Fix memoary leak: if there was an "output" still allocated when a
session was torn down it needs to be freed in session_free()

Patch by Yoichi Iwaki in bug #2929647
2010-02-15 00:12:10 +01:00
Daniel Stenberg
72a28f6b16 the working version name is now 1.2.5_DEV 2010-02-13 17:18:55 +01:00
Daniel Stenberg
c889058cb3 updated info for 1.2.4 2010-02-13 17:10:30 +01:00
Dan Fandrich
69c876e210 Allow compiling with OpenSSL when AES isn't available. 2010-02-10 14:49:17 -08:00
Dave McCaldon
10f5c70ac0 Fix Tru64 socklen_t compile issue with example/direct_tcpip.c
Building libssh2-1.2.3 on Tru64 fails at line 48 and 166 because socklen_t
isn't defined on Tru64 unless _POSIX_PII_SOCKET is defined.

This patch updates configure.ac to add -D_POSIX_PII_SOCKET when building
on Tru64 platform(s).
2010-02-09 11:45:40 +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
64a6c255ec towards 1.2.4 now 2010-02-03 19:36:19 +01:00
141 changed files with 7342 additions and 3709 deletions

1
.gitignore vendored
View File

@@ -32,3 +32,4 @@ install-sh
mkinstalldirs
tags
libssh2.pc
TAGS

View File

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

View File

@@ -21,13 +21,18 @@ VCPROJ = win32/libssh2.vcproj
DISTCLEANFILES = $(DSP)
VMSFILES = vms/libssh2_make_example.dcl vms/libssh2_make_help.dcl \
vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \
vms/readme.vms vms/libssh2_config.h
WIN32FILES = win32/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 \
maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in
maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in $(VMSFILES)
ACLOCAL_AMFLAGS = -I m4

View File

@@ -1,5 +1,7 @@
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 agent.c openssl.c libgcrypt.c pem.c
version.c knownhost.c agent.c openssl.c libgcrypt.c pem.c keepalive.c \
global.c
HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h comp.h mac.h misc.h
HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h \
comp.h mac.h misc.h packet.h userauth.h session.h

73
NEWS
View File

@@ -1,3 +1,76 @@
libssh2 1.2.6 (June 10, 2010)
This release includes the following changes:
o Added libssh2_sftp_statvfs() and libssh2_sftp_fstatvfs()
o Added libssh2_knownhost_checkp()
o Added libssh2_scp_send64()
This release includes the following bugfixes:
o wait_socket: make c89 compliant and use two fd_sets for select()
o OpenSSL AES-128-CTR detection
o proper keyboard-interactive user dialog in the sftp.c example
o build procedure for VMS
o fixed libssh2.dsw to use the generated libssh2.dsp
o several Windows-related build fixes
o fail to init SFTP if session isn't already authenticated
o many tiny fixes that address clang-analyzer warnings
o sftp_open: deal with short channel_write calls
o libssh2_publickey_init: fixed to work better non-blocking
o sftp_close_handle: add precation to not access NULL pointer
o sftp_readdir: simplified and bugfixed
o channel_write: if data has been sent, don't return EAGAIN
Version 1.2.5 (April 13, 2010)
This release includes the following changes:
o Added Add keep-alive support: libssh2_keepalive_config() and
libssh2_keepalive_send()
o Added libssh2_knownhost_addc(), libssh2_init() and libssh2_exit()
o Added LIBSSH2_SFTP_S_IS***() macros
This release includes the following bugfixes:
o fix memory leak in libssh2_session_startup()
o added missing error codes - shown as hangs in blocking mode
o fix memory leak in userauth_keyboard_interactive()
o libssh2_knownhost_del: fix write to freed memory
o Send and receive channel EOF before sending SSH_MSG_CHANNEL_CLOSE
o Use AES-CTR from OpenSSL when available
o Fixed gettimeofday to compile with Visual C++ 6
o NULL dereference when window adjusting a non-existing channel
o avoid using poll on interix and mac os x systems
o fix scp memory leak
o Correctly clear blocking flag after sending multipart packet
o Reduce used window sizes by factor 10
o libssh2_userauth_publickey_fromfile_ex() handles a NULL password
o sftp_init() deal with _libssh2_channel_write() short returns
o Use poll instead of select when available. By Paul Querna.
o Add APIs to have libssh2 automatically send keep-alive requests.
The APIs are libssh2_keepalive_config, and libssh2_keepalive_send.
By Simon Josefsson.
o Add global init/exit points, to do crypto initialization in one place.
The APIs are libssh2_init and libssh2_exit. By Lars Nordin.
* (February 15 2010) Daniel Stenberg:
- Added 46 new man pages for public convenience macros. The man pages are
just short redirects to the actual underlying function. The were all
initially created by a script.
- Committed the patch by Yoichi Iwaki in bug #2929647, which fixed a memory
leak when an 'outbuf' was still allocated when a session was freed.
Version 1.2.4 (February 13, 2010)
o Resolve compile issues on Solaris x64 and UltraSPARC
o Allow compiling with OpenSSL when AES isn't available
o Fix Tru64 socklen_t compile issue with example/direct_tcpip.c
Version 1.2.3 (February 3, 2010)
o Added libssh2_trace_sethandler()

View File

@@ -1,27 +1,32 @@
libssh2 1.2.3
libssh2 1.2.6
This release includes the following changes:
o ssh-agent support with the new libssh2_agent_* functions
o Added libssh2_trace_sethandler()
o Added the direct_tcpip.c and ssh2_agent.c examples
o Added libssh2_sftp_statvfs() and libssh2_sftp_fstatvfs()
o Added libssh2_knownhost_checkp()
o Added libssh2_scp_send64()
This release includes the following bugfixes:
o Fixed memory leak in userauth_publickey
o Fixed publickey authentication regression
o Silenced several compiler warnings
o avoid returning data to memory already freed
o transport layer fix for bogus -39 (LIBSSH2_ERROR_BAD_USE) errors
o Fixed padding in ssh-dss signature blob encoding
o Fixed direction blocking flag problems
o Fixed memory leak in sftp_fstat()
o wait_socket: make c89 compliant and use two fd_sets for select()
o OpenSSL AES-128-CTR detection
o proper keyboard-interactive user dialog in the sftp.c example
o build procedure for VMS
o fixed libssh2.dsw to use the generated libssh2.dsp
o several Windows-related build fixes
o fail to init SFTP if session isn't already authenticated
o many tiny fixes that address clang-analyzer warnings
o sftp_open: deal with short channel_write calls
o libssh2_publickey_init: fixed to work better non-blocking
o sftp_close_handle: add precation to not access NULL pointer
o sftp_readdir: simplified and bugfixed
o channel_write: if data has been sent, don't return EAGAIN
This release would not have looked like this without help, code, reports and
advice from friends like these:
Simon Josefsson, Peter Stuge, Daiki Ueno, Dave McCaldon,
Alexander Lamaison
Alexander Lamaison, Guenter Knauf, Dan Fandrich, Grubsky Grigory,
Joey Degges, Jose Baars, Mikhail Gusarov, Peter Stuge, Simon Josefsson,
Daniel Stenberg
Thanks! (and sorry if I forgot to mention someone)

26
TODO
View File

@@ -2,11 +2,12 @@ Things TODO
===========
* make sure the windowing code adapts better to slow situations so that it
doesn't then use as much memory as today
doesn't then use as much memory as today. Possibly by an app-controllable
"Window mode"?
* Introduce a 'libssh2_socket_t' type for sockets in internal code
* Provide a libssh2_scp_send() API for files larger than 4GB (32bit size)
* Introduce a function that can free data that is returned allocated from the
lib, like when libssh2_session_last_error() is asked to return the string
with 'want_buf' set to non-zero.
* Add more info to the man pages.
@@ -41,4 +42,19 @@ At next SONAME bump
* Rename a few function:
libssh2_hostkey_hash => libssh2_session_hostkey_hash
libssh2_banner_set => libssh2_session_banner_set
libssh2_banner_set => libssh2_session_banner_set
* change 'int' to 'libssh2_socket_t' in the public API for sockets.
* Use 'size_t' for string lengths in all functions.
* Add a comment field to struct libssh2_knownhost.
* remove the existing libssh2_knownhost_add() function and rename
libssh2_knownhost_addc to become the new libssh2_knownhost_add instead
* remove the existing libssh2_scp_send_ex() function and rename
libssh2_scp_send64 to become the new libssh2_scp_send instead.
* remove the existing libssh2_knownhost_check() functin and rename
libssh2_knownhost_checkp() to become the new libssh2_knownhost_check instead

View File

@@ -2,20 +2,15 @@
LIBTOOLIZE="libtoolize"
if [ "x`which $LIBTOOLIZE`" == "x" ];
then
LIBTOOLIZE="glibtoolize";
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
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
${AUTOHEADER:-autoheader}

View File

@@ -41,6 +41,9 @@ case "$host" in
;;
*hpux*)
;;
*osf*)
CFLAGS="$CFLAGS -D_POSIX_PII_SOCKET"
;;
*)
;;
esac
@@ -108,6 +111,14 @@ if test "$ac_cv_libgcrypt" = "yes"; then
fi
AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes")
# Not all OpenSSL have AES-CTR functions.
if test "$ac_cv_libssl" = "yes"; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $LIBSSL"
AC_CHECK_FUNCS(EVP_aes_128_ctr)
LDFLAGS="$save_LDFLAGS"
fi
# Look for Libz
if test "$use_libz" != "no"; then
AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])
@@ -144,12 +155,12 @@ AC_MSG_CHECKING([whether to enable pedantic and debug compiler options])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable pedantic and debug options])
AC_HELP_STRING([--disable-debug],[Disable debug options]),
[ case "$enableval" in
[ case "$enable_debug" in
no)
AC_MSG_RESULT(no)
;;
*) AC_MSG_RESULT(yes)
enable_debug=yes
CPPFLAGS="$CPPFLAGS -DLIBSSH2DEBUG"
CFLAGS="$CFLAGS -g"
@@ -159,6 +170,7 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
;;
esac
],
enable_debug=no
AC_MSG_RESULT(no)
)
@@ -217,7 +229,25 @@ case $host in
;;
esac
AC_CHECK_FUNCS(poll gettimeofday select strtoll)
case $host in
*darwin*|*interix*)
dnl poll() does not work on these platforms
dnl Interix: "does provide poll(), but the implementing developer must
dnl have been in a bad mood, because poll() only works on the /proc
dnl filesystem here"
dnl Mac OS X's poll has funny behaviors, like:
dnl not being able to do poll on no fildescriptors (10.3?)
dnl not being able to poll on some files (like anything in /dev)
dnl not having reliable timeout support
dnl inconsistent return of POLLHUP where other implementations give POLLIN
AC_MSG_NOTICE([poll use is disabled on this platform])
;;
*)
AC_CHECK_FUNCS(poll)
;;
esac
AC_CHECK_FUNCS(gettimeofday select strtoll)
dnl Check for select() into ws2_32 for Msys/Mingw
if test "$ac_cv_func_select" != "yes"; then
@@ -256,3 +286,17 @@ AC_CONFIG_FILES([Makefile
docs/Makefile
libssh2.pc])
AC_OUTPUT
AC_MSG_NOTICE([summary of build options:
version: ${VERSION}
Host type: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
Compiler flags: ${CFLAGS}
Library types: Shared=${enable_shared}, Static=${enable_static}
Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no}
Debug build: $enable_debug
Path to sshd: $ac_cv_path_SSHD (only for self-tests)
libz compression: $ac_cv_libz
])

View File

@@ -13,41 +13,64 @@ dist_man_MANS = \
libssh2_banner_set.3 \
libssh2_base64_decode.3 \
libssh2_channel_close.3 \
libssh2_channel_direct_tcpip.3 \
libssh2_channel_direct_tcpip_ex.3 \
libssh2_channel_eof.3 \
libssh2_channel_exec.3 \
libssh2_channel_flush.3 \
libssh2_channel_flush_ex.3 \
libssh2_channel_flush_stderr.3 \
libssh2_channel_forward_accept.3 \
libssh2_channel_forward_cancel.3 \
libssh2_channel_forward_listen.3 \
libssh2_channel_forward_listen_ex.3 \
libssh2_channel_free.3 \
libssh2_channel_get_exit_status.3 \
libssh2_channel_handle_extended_data.3 \
libssh2_channel_handle_extended_data2.3 \
libssh2_channel_ignore_extended_data.3 \
libssh2_channel_open_ex.3 \
libssh2_channel_open_session.3 \
libssh2_channel_process_startup.3 \
libssh2_channel_read.3 \
libssh2_channel_read_ex.3 \
libssh2_channel_read_stderr.3 \
libssh2_channel_receive_window_adjust.3 \
libssh2_channel_receive_window_adjust2.3 \
libssh2_channel_request_pty.3 \
libssh2_channel_request_pty_ex.3 \
libssh2_channel_request_pty_size.3 \
libssh2_channel_request_pty_size_ex.3 \
libssh2_channel_send_eof.3 \
libssh2_channel_set_blocking.3 \
libssh2_channel_setenv.3 \
libssh2_channel_setenv_ex.3 \
libssh2_channel_shell.3 \
libssh2_channel_subsystem.3 \
libssh2_channel_wait_closed.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_window_read.3 \
libssh2_channel_window_read_ex.3 \
libssh2_channel_window_write.3 \
libssh2_channel_window_write_ex.3 \
libssh2_channel_write.3 \
libssh2_channel_write_ex.3 \
libssh2_channel_write_stderr.3 \
libssh2_channel_x11_req.3 \
libssh2_channel_x11_req_ex.3 \
libssh2_exit.3 \
libssh2_free_host_entry.3 \
libssh2_host_entry_match.3 \
libssh2_hostkey_hash.3 \
libssh2_init.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_addc.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_checkp.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_get.3 \
libssh2_knownhost_init.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_readfile.3 \
libssh2_knownhost_readline.3 \
libssh2_knownhost_writefile.3 \
@@ -55,22 +78,28 @@ dist_man_MANS = \
libssh2_new_host_entry.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_publickey_add.3 \
libssh2_publickey_add_ex.3 \
libssh2_publickey_init.3 \
libssh2_publickey_list_fetch.3 \
libssh2_publickey_list_free.3 \
libssh2_publickey_remove.3 \
libssh2_publickey_remove_ex.3 \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \
libssh2_scp_send.3 \
libssh2_scp_send_ex.3 \
libssh2_scp_send64.3 \
libssh2_session_abstract.3 \
libssh2_session_block_directions.3 \
libssh2_session_callback_set.3 \
libssh2_session_disconnect.3 \
libssh2_session_disconnect_ex.3 \
libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_hostkey.3 \
libssh2_session_init.3 \
libssh2_session_init_ex.3 \
libssh2_session_last_errno.3 \
libssh2_session_last_error.3 \
@@ -78,30 +107,54 @@ dist_man_MANS = \
libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \
libssh2_session_startup.3 \
libssh2_sftp_close.3 \
libssh2_sftp_close_handle.3 \
libssh2_sftp_closedir.3 \
libssh2_sftp_fsetstat.3 \
libssh2_sftp_fstat.3 \
libssh2_sftp_fstat_ex.3 \
libssh2_sftp_fstatvfs.3 \
libssh2_sftp_init.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_lstat.3 \
libssh2_sftp_mkdir.3 \
libssh2_sftp_mkdir_ex.3 \
libssh2_sftp_open.3 \
libssh2_sftp_open_ex.3 \
libssh2_sftp_opendir.3 \
libssh2_sftp_read.3 \
libssh2_sftp_readdir.3 \
libssh2_sftp_readdir_ex.3 \
libssh2_sftp_readlink.3 \
libssh2_sftp_realpath.3 \
libssh2_sftp_rename.3 \
libssh2_sftp_rename_ex.3 \
libssh2_sftp_rewind.3 \
libssh2_sftp_rmdir.3 \
libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \
libssh2_sftp_setstat.3 \
libssh2_sftp_shutdown.3 \
libssh2_sftp_stat.3 \
libssh2_sftp_stat_ex.3 \
libssh2_sftp_statvfs.3 \
libssh2_sftp_symlink.3 \
libssh2_sftp_symlink_ex.3 \
libssh2_sftp_tell.3 \
libssh2_sftp_tell64.3 \
libssh2_sftp_unlink.3 \
libssh2_sftp_unlink_ex.3 \
libssh2_sftp_write.3 \
libssh2_trace.3 \
libssh2_trace_sethandler.3 \
libssh2_userauth_authenticated.3 \
libssh2_userauth_hostbased_fromfile.3 \
libssh2_userauth_hostbased_fromfile_ex.3 \
libssh2_userauth_keyboard_interactive.3 \
libssh2_userauth_keyboard_interactive_ex.3 \
libssh2_userauth_list.3 \
libssh2_userauth_password.3 \
libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey_fromfile.3 \
libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_version.3

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_direct_tcpip 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_direct_tcpip - convenience macro for \fIlibssh2_channel_direct_tcpip_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_direct_tcpip(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_direct_tcpip_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_direct_tcpip_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_direct_tcpip_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_direct_tcpip_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_exec 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_exec - convenience macro for \fIlibssh2_channel_process_startup(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_exec(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_process_startup(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_process_startup(3)\fP
.SH ERRORS
See \fIlibssh2_channel_process_startup(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_process_startup(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_flush 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_flush - convenience macro for \fIlibssh2_channel_flush_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_flush(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_flush_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_flush_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_flush_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_flush_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_flush_stderr 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_flush_stderr - convenience macro for \fIlibssh2_channel_flush_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_flush_stderr(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_flush_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_flush_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_flush_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_flush_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_forward_listen 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_forward_listen - convenience macro for \fIlibssh2_channel_forward_listen_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_forward_listen(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_forward_listen_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_forward_listen_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_forward_listen_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_forward_listen_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_ignore_extended_data 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_ignore_extended_data - convenience macro for \fIlibssh2_channel_handle_extended_data(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_ignore_extended_data(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_handle_extended_data(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_handle_extended_data(3)\fP
.SH ERRORS
See \fIlibssh2_channel_handle_extended_data(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_handle_extended_data(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_open_session 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_open_session - convenience macro for \fIlibssh2_channel_open_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_open_session(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_open_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_open_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_open_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_open_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_read 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_read - convenience macro for \fIlibssh2_channel_read_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_read(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_read_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_read_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_read_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_read_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_read_stderr 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_read_stderr - convenience macro for \fIlibssh2_channel_read_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_read_stderr(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_read_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_read_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_read_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_read_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_request_pty 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_request_pty - convenience macro for \fIlibssh2_channel_request_pty_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_request_pty(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_request_pty_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_request_pty_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_request_pty_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_request_pty_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_request_pty_size 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_request_pty_size - convenience macro for \fIlibssh2_channel_request_pty_size_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_request_pty_size(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_request_pty_size_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_request_pty_size_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_request_pty_size_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_request_pty_size_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_setenv 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_setenv - convenience macro for \fIlibssh2_channel_setenv_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_setenv(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_setenv_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_setenv_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_setenv_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_setenv_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_shell 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_shell - convenience macro for \fIlibssh2_channel_process_startup(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_shell(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_process_startup(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_process_startup(3)\fP
.SH ERRORS
See \fIlibssh2_channel_process_startup(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_process_startup(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_subsystem 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_subsystem - convenience macro for \fIlibssh2_channel_process_startup(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_subsystem(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_process_startup(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_process_startup(3)\fP
.SH ERRORS
See \fIlibssh2_channel_process_startup(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_process_startup(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_window_read 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_window_read - convenience macro for \fIlibssh2_channel_window_read_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_window_read(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_window_read_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_window_read_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_window_read_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_window_read_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_window_write 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_window_write - convenience macro for \fIlibssh2_channel_window_write_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_window_write(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_window_write_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_window_write_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_window_write_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_window_write_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_write 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_write - convenience macro for \fIlibssh2_channel_write_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_write(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_write_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_write_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_write_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_write_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_write_stderr 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_write_stderr - convenience macro for \fIlibssh2_channel_write_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_write_stderr(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_write_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_write_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_write_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_write_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_channel_x11_req 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_channel_x11_req - convenience macro for \fIlibssh2_channel_x11_req_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_channel_x11_req(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_x11_req_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_channel_x11_req_ex(3)\fP
.SH ERRORS
See \fIlibssh2_channel_x11_req_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_channel_x11_req_ex(3)\fP

14
docs/libssh2_exit.3 Normal file
View File

@@ -0,0 +1,14 @@
.TH libssh2_exit 3 "19 Mar 2010" "libssh2 1.2.5" "libssh2 manual"
.SH NAME
libssh2_exit - global library deinitialization
.SH SYNOPSIS
#include <libssh2.h>
void
libssh2_exit(void);
.SH DESCRIPTION
Exit the libssh2 functions and free's all memory used internal.
.SH AVAILABILITY
Added in libssh2 1.2.5
.SH SEE ALSO
.BR libssh2_init(3)

20
docs/libssh2_init.3 Normal file
View File

@@ -0,0 +1,20 @@
.TH libssh2_init 3 "19 Mar 2010" "libssh2 1.2.5" "libssh2 manual"
.SH NAME
libssh2_init - global library initialization
.SH SYNOPSIS
#include <libssh2.h>
#define LIBSSH2_INIT_NO_CRYPTO 0x0001
int
libssh2_init(int flags);
.SH DESCRIPTION
Initialize the libssh2 functions. This typically initialize the
crypto library. It uses a global state, and is not thread safe -- you
must make sure this function is not called concurrently.
.SH RETURN VALUE
Returns 0 if succeeded, or a negative value for error.
.SH AVAILABILITY
Added in libssh2 1.2.5
.SH SEE ALSO
.BR libssh2_exit(3)

View File

@@ -1,10 +1,11 @@
.\" Copyright (c) 2009 by Daniel Stenberg
.\" Copyright (c) 2009, 2010 by Daniel Stenberg
.\"
.TH libssh2_knownhost_add 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_add - add a known host
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
@@ -13,6 +14,11 @@ int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
int typemask,
struct libssh2_knownhost **store);
.SH DESCRIPTION
We discourage use of this function as of libssh2 1.2.5. Instead we strongly
urge users to use \fIlibssh2_knownhost_addc(3)\fP instead, which as a more
complete API. \fIlibssh2_knownhost_add(3)\fP is subject for removal in a
future release.
Adds a known host to the collection of known hosts identified by the 'hosts'
handle.
@@ -51,8 +57,10 @@ this pointer.
Returns a regular libssh2 error code, where negative values are error codes
and 0 indicates success.
.SH AVAILABILITY
Added in libssh2 1.2
Added in libssh2 1.2, deprecated since libssh2 1.2.5. Use
\fIlibssh2_knownhost_addc(3)\fP instead!
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_check(3)
.BR libssh2_knownhost_addc(3)

View File

@@ -0,0 +1,68 @@
.\" Copyright (c) 2009, 2010 by Daniel Stenberg
.\"
.TH libssh2_knownhost_add 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.SH NAME
libssh2_knownhost_add - add a known host
.SH SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
char *host, char *salt,
char *key, size_t keylen,
const char *comment, size_t commentlen,
int typemask,
struct libssh2_knownhost **store);
.SH DESCRIPTION
Adds a known host to the collection of known hosts identified by the 'hosts'
handle.
\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.
If you want to add a key for a specific port number for the given host, you
must provide the host name like '[host]:port' with the actual characters '['
and ']' enclosing the host name and a colon separating the host part from the
port number. For example: \&"[host.example.com]:222".
\fIsalt\fP is a pointer to the salt used for the host hashing, if the host is
provided hashed. If the host is provided in plain text, salt has no meaning.
The salt has to be provided base64 encoded with a trailing zero byte.
\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
\fIcomment\fP is a pointer to a comment for the key.
\fIcommentlen\fP is the total size in bytes of the comment pointed to by the \fIcomment\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.5
.SH SEE ALSO
.BR libssh2_knownhost_init(3)
.BR libssh2_knownhost_free(3)
.BR libssh2_knownhost_check(3)

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_publickey_add 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_publickey_add - convenience macro for \fIlibssh2_publickey_add_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_publickey_add(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_publickey_add_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_publickey_add_ex(3)\fP
.SH ERRORS
See \fIlibssh2_publickey_add_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_publickey_add_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_publickey_remove 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_publickey_remove - convenience macro for \fIlibssh2_publickey_remove_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_publickey_remove(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_publickey_remove_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_publickey_remove_ex(3)\fP
.SH ERRORS
See \fIlibssh2_publickey_remove_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_publickey_remove_ex(3)\fP

19
docs/libssh2_scp_send.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_scp_send 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_scp_send - convenience macro for \fIlibssh2_scp_send_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_scp_send(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_scp_send_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_scp_send_ex(3)\fP
.SH ERRORS
See \fIlibssh2_scp_send_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_scp_send_ex(3)\fP

49
docs/libssh2_scp_send64.3 Normal file
View File

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

View File

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

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_session_disconnect 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_session_disconnect - convenience macro for \fIlibssh2_session_disconnect_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_session_disconnect(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_session_disconnect_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_session_disconnect_ex(3)\fP
.SH ERRORS
See \fIlibssh2_session_disconnect_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_session_disconnect_ex(3)\fP

View File

@@ -9,7 +9,7 @@ libssh2_session_free - frees resources associated with a session instance
int
libssh2_session_free(LIBSSH2_SESSION *session);
.SH DESCRIPTION
Frees resources associated with a session instance. Typically called after
Frees all resources associated with a session instance. Typically called after
.BR libssh2_session_disconnect_ex(3)
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_session_init 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_session_init - convenience macro for \fIlibssh2_session_init_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_session_init(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_session_init_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_session_init_ex(3)\fP
.SH ERRORS
See \fIlibssh2_session_init_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_session_init_ex(3)\fP

19
docs/libssh2_sftp_close.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_close 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_close - convenience macro for \fIlibssh2_sftp_close_handle(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_close(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_close_handle(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_close_handle(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_close_handle(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_close_handle(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_closedir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_closedir - convenience macro for \fIlibssh2_sftp_close_handle(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_closedir(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_close_handle(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_close_handle(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_close_handle(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_close_handle(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_fsetstat 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_fsetstat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_fsetstat(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_fstat_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_fstat_ex(3)\fP

19
docs/libssh2_sftp_fstat.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_fstat 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_fstat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_fstat(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_fstat_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_fstat_ex(3)\fP

View File

@@ -2,32 +2,88 @@
.\"
.TH libssh2_sftp_fstat_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.SH NAME
libssh2_sftp_fstat_ex - get or set attributes on a file handle
libssh2_sftp_fstat_ex - get or set attributes on an SFTP file handle
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
int
libssh2_sftp_fstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs)
int
libssh2_sftp_fsetstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs)
libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle,
LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
#define libbssh2_sftp_fstat(handle, attrs) \\
libssh2_sftp_fstat_ex((handle), (attrs), 0)
#define libssh2_sftp_fsetstat(handle, attrs) \\
libssh2_sftp_fstat_ex((handle), (attrs), 1)
.fi
.SH DESCRIPTION
\fIhandle\fP - SFTP File Handle as returned by
.BR libssh2_sftp_open_ex(3)
\fIattrs\fP - Pointer to attribute structure to set file metadata
from or into depending on the value of setstat.
\fIattrs\fP - Pointer to an LIBSSH2_SFTP_ATTRIBUTES structure to set file
metadata from or into depending on the value of setstat.
\fIsetstat\fP - When non-zero, the file's metadata will be updated
with the data found in attrs according to the values of attrs->flags
and other relevant member attributes.
Get or Set statbuf type data for a given LIBSSH2_SFTP_HANDLE instance.
.SH DATA TYPES
LIBSSH2_SFTP_ATTRIBUTES is a typedefed struct that is defined as below
.nf
struct _LIBSSH2_SFTP_ATTRIBUTES {
/* If flags & ATTR_* bit is set, then the value in this
* struct will be meaningful Otherwise it should be ignored
*/
unsigned long flags;
/* size of file, in bytes */
libssh2_uint64_t filesize;
/* numerical representation of the user and group owner of
* the file
*/
unsigned long uid, gid;
/* bitmask of permissions */
unsigned long permissions;
/* access time and modified time of file */
unsigned long atime, mtime;
};
.fi
You will find a full set of defines and macros to identify flags and
permissions on the \fBlibssh2_sftp.h\fP header file, but some of the
most common ones are:
To check for specific user permissions, the set of defines are in the
pattern LIBSSH2_SFTP_S_I<action><who> where <action> is R, W or X for
read, write and excutable and <who> is USR, GRP and OTH for user,
group and other. So, you check for a user readable file, use the bit
\fILIBSSH2_SFTP_S_IRUSR\fP while you want to see if it is executable
for other, you use \fILIBSSH2_SFTP_S_IXOTH\fP and so on.
To check for specific file types, you would previously (before libssh2
1.2.5) use the standard posix S_IS***() macros, but since 1.2.5
libssh2 offers its own set of macros for this functionality:
.IP LIBSSH2_SFTP_S_ISLNK
Test for a symbolic link
.IP LIBSSH2_SFTP_S_ISREG
Test for a regular file
.IP LIBSSH2_SFTP_S_ISDIR
Test for a directory
.IP LIBSSH2_SFTP_S_ISCHR
Test for a character special file
.IP LIBSSH2_SFTP_S_ISBLK
Test for a block special file
.IP LIBSSH2_SFTP_S_ISFIFO
Test for a pipe or FIFO special file
.IP LIBSSH2_SFTP_S_ISSOCK
Test for a socket
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
@@ -42,5 +98,9 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
\fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
received on the socket, or an SFTP operation caused an errorcode to
be returned by the server.
.SH AVAILABILITY
This function has been around since forever, but most of the
LIBSSH2_SFTP_S_* defines were introduced in libssh2 0.14 and the
LIBSSH2_SFTP_S_IS***() macros were introduced in libssh2 1.2.5.
.SH SEE ALSO
.BR libssh2_sftp_open_ex(3)

View File

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

View File

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

19
docs/libssh2_sftp_lstat.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_lstat 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_lstat - convenience macro for \fIlibssh2_sftp_stat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_lstat(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_stat_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_stat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_stat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_stat_ex(3)\fP

19
docs/libssh2_sftp_mkdir.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_mkdir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_mkdir - convenience macro for \fIlibssh2_sftp_mkdir_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_mkdir(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_mkdir_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_mkdir_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_mkdir_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_mkdir_ex(3)\fP

19
docs/libssh2_sftp_open.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_open 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_open - convenience macro for \fIlibssh2_sftp_open_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_open(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_open_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_open_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_open_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_open_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_opendir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_opendir - convenience macro for \fIlibssh2_sftp_open_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_opendir(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_open_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_open_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_open_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_open_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_readdir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_readdir - convenience macro for \fIlibssh2_sftp_readdir_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_readdir(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_readdir_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_readdir_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_readdir_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_readdir_ex(3)\fP

View File

@@ -4,16 +4,22 @@
.SH NAME
libssh2_sftp_readdir_ex - read directory data from an SFTP handle
.SH SYNOPSIS
.nf
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, char *longentry, size_t longentry_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
int
libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle,
char *buffer, size_t buffer_maxlen,
char *longentry, size_t longentry_maxlen,
LIBSSH2_SFTP_ATTRIBUTES *attrs);
#define libssh2_sftp_readdir(h, b, bl, a) \\
libssh2_sftp_readdir_ex((h), (b), (bl), NULL, 0, (a))
.SH DESCRIPTION
Reads a block of data from a LIBSSH2_SFTP_HANDLE and returns file entry
information for the next entry, if any.
\fIhandle\fP - is the SFTP File Handle as returned by
.BR libssh2_sftp_open_ex(3)
@@ -25,25 +31,22 @@ filename is longer than the space provided by buffer_maxlen it will be
truncated to fit.
\fIlongentry\fP - is a pointer to a pre-allocated buffer of at least
\fIlongentry_maxlen\fP bytes to read data into.
\fIlongentry_maxlen\fP bytes to read data into. The format of the `longname'
field is unspecified by SFTP protocol. It MUST be suitable for use in the
output of a directory listing command (in fact, the recommended operation for
a directory listing command is to simply display this data).
\fIlongentry_maxlen\fP - is the length of longentry in bytes. If the length
of the full directory entry is longer than the space provided by
longentry_maxlen it will be truncated to fit.
\fIlongentry_maxlen\fP - is the length of longentry in bytes. If the length of
the full directory entry is longer than the space provided by
\fIlongentry_maxlen\fP it will be truncated to fit.
\fIattrs\fP - is a pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate
statbuf style data into.
Read a block of data from a LIBSSH2_SFTP_HANDLE. This method is modeled
after the POSIX
.BR readdir(2)
however, it uses a variable sized directory entry (filename) buffer and
returns statbuf type data in the same call.
.SH RETURN VALUE
Number of bytes actually populated into buffer, or negative on failure. It
returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
Number of bytes actually populated into buffer (not counting the terminating
zero), or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would
otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't
really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_readlink 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_readlink - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_readlink(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_symlink_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_symlink_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_realpath 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_realpath - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_realpath(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_symlink_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_symlink_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_rename 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_rename - convenience macro for \fIlibssh2_sftp_rename_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_rename(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_rename_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_rename_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_rename_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_rename_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_rewind 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_rewind - convenience macro for \fIlibssh2_sftp_seek64(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_rewind(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_seek64(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_seek64(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_seek64(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_seek64(3)\fP

19
docs/libssh2_sftp_rmdir.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_rmdir 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_rmdir - convenience macro for \fIlibssh2_sftp_rmdir_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_rmdir(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_rmdir_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_rmdir_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_rmdir_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_rmdir_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_setstat 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_setstat - convenience macro for \fIlibssh2_sftp_stat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_setstat(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_stat_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_stat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_stat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_stat_ex(3)\fP

19
docs/libssh2_sftp_stat.3 Normal file
View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_stat 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_stat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_stat(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_fstat_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_fstat_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_fstat_ex(3)\fP

View File

@@ -25,7 +25,7 @@ libssh2_sftp_setstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUT
\fIpath\fP - Remote filesystem object to stat/lstat/setstat.
\fIpath_len\fP - Lenght of the name of the remote filesystem object
\fIpath_len\fP - Length of the name of the remote filesystem object
to stat/lstat/setstat.
\fIstat_type\fP - One of the three constants specifying the type of

View File

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

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_symlink 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_symlink - convenience macro for \fIlibssh2_sftp_symlink_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_symlink(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_symlink_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_symlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_symlink_ex(3)\fP

View File

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

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_sftp_unlink 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_sftp_unlink - convenience macro for \fIlibssh2_sftp_unlink_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_sftp_unlink(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_sftp_unlink_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_sftp_unlink_ex(3)\fP
.SH ERRORS
See \fIlibssh2_sftp_unlink_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_sftp_unlink_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_userauth_hostbased_fromfile 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_userauth_hostbased_fromfile - convenience macro for \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_hostbased_fromfile(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_userauth_keyboard_interactive 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_userauth_keyboard_interactive - convenience macro for \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_keyboard_interactive(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_userauth_password 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_userauth_password - convenience macro for \fIlibssh2_userauth_password_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_password(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_userauth_password_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_userauth_password_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_password_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_password_ex(3)\fP

View File

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

View File

@@ -0,0 +1,19 @@
.\" $Id: template.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
.\"
.TH libssh2_userauth_publickey_fromfile 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.SH NAME
libssh2_userauth_publickey_fromfile - convenience macro for \fIlibssh2_userauth_publickey_fromfile_ex(3)\fP calls
.SH SYNOPSIS
#include <libssh2.h>
libssh2_userauth_publickey_fromfile(arguments)
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_userauth_publickey_fromfile_ex(3)\fP.
.SH RETURN VALUE
See \fIlibssh2_userauth_publickey_fromfile_ex(3)\fP
.SH ERRORS
See \fIlibssh2_userauth_publickey_fromfile_ex(3)\fP
.SH SEE ALSO
.BR \fIlibssh2_userauth_publickey_fromfile_ex(3)\fP

View File

@@ -1,3 +1,4 @@
#include "libssh2_config.h"
#include <libssh2.h>
#ifdef WIN32
@@ -18,6 +19,14 @@
#include <unistd.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifndef INADDR_NONE
#define INADDR_NONE (in_addr_t)-1
#endif
const char *keyfile1 = "/home/username/.ssh/id_rsa.pub";
const char *keyfile2 = "/home/username/.ssh/id_rsa";
const char *username = "username";
@@ -77,6 +86,12 @@ int main(int argc, char *argv[])
if (argc > 7)
remote_destport = atoi(argv[7]);
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/* Connect to SSH server */
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
sin.sin_family = AF_INET;
@@ -140,7 +155,8 @@ int main(int argc, char *argv[])
goto shutdown;
}
} else if (auth & AUTH_PUBLICKEY) {
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)) {
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1,
keyfile2, password)) {
printf("\tAuthentication by public key failed!\n");
goto shutdown;
}
@@ -187,8 +203,9 @@ int main(int argc, char *argv[])
channel = libssh2_channel_direct_tcpip_ex(session, remote_desthost,
remote_destport, shost, sport);
if (!channel) {
fprintf(stderr, "Could not open the direct-tcpip channel!\n");
fprintf(stderr, "(Note that this can be a problem at the server! Please review the server logs.)\n");
fprintf(stderr, "Could not open the direct-tcpip channel!\n"
"(Note that this can be a problem at the server!"
" Please review the server logs.)\n");
goto shutdown;
}
@@ -267,5 +284,8 @@ shutdown:
#else
close(sock);
#endif
libssh2_exit();
return 0;
}

View File

@@ -68,6 +68,12 @@ int main(int argc, char *argv[])
scppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/* Ultra basic "connect to port 22 on localhost"
* Your code is responsible for creating the socket establishing the
* connection
@@ -169,5 +175,8 @@ int main(int argc, char *argv[])
close(sock);
#endif
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -121,6 +121,12 @@ int main(int argc, char *argv[])
scppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/* Ultra basic "connect to port 22 on localhost"
* Your code is responsible for creating the socket establishing the
* connection
@@ -267,5 +273,8 @@ shutdown:
close(sock);
#endif
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
int sock, i, auth_pw = 1;
struct sockaddr_in sin;
const char *fingerprint;
LIBSSH2_SESSION *session;
LIBSSH2_SESSION *session = NULL;
LIBSSH2_CHANNEL *channel;
const char *username="username";
const char *password="password";
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
FILE *local;
int rc;
char mem[1024];
size_t nread, sent;
size_t nread;
char *ptr;
struct stat fileinfo;
@@ -75,10 +75,16 @@ int main(int argc, char *argv[])
scppath = argv[5];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
local = fopen(loclfile, "rb");
if (!local) {
fprintf(stderr, "Can't local file %s\n", loclfile);
goto shutdown;
fprintf(stderr, "Can't open local file %s\n", loclfile);
return -1;
}
stat(loclfile, &fileinfo);
@@ -88,6 +94,10 @@ int main(int argc, char *argv[])
* connection
*/
sock = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == sock) {
fprintf(stderr, "failed to create socket!\n");
return -1;
}
sin.sin_family = AF_INET;
sin.sin_port = htons(22);
@@ -147,7 +157,10 @@ int main(int argc, char *argv[])
(unsigned long)fileinfo.st_size);
if (!channel) {
fprintf(stderr, "Unable to open a session\n");
char *errmsg;
int errlen;
int err = libssh2_session_last_error(session, &errmsg, &errlen, 0);
fprintf(stderr, "Unable to open a session: (%d) %s\n", err, errmsg);
goto shutdown;
}
@@ -159,20 +172,21 @@ int main(int argc, char *argv[])
break;
}
ptr = mem;
sent = 0;
do {
/* write the same data over and over, until error or completion */
rc = libssh2_channel_write(channel, ptr, nread);
if (rc < 0) {
fprintf(stderr, "ERROR %d\n", rc);
} else {
/* rc indicates how many bytes were written this time */
sent += rc;
break;
}
} while (rc > 0 && sent < nread);
ptr += sent;
nread -= sent;
else {
/* rc indicates how many bytes were written this time */
ptr += rc;
nread -= rc;
}
} while (nread);
} while (1);
fprintf(stderr, "Sending EOF\n");
@@ -189,14 +203,20 @@ int main(int argc, char *argv[])
shutdown:
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
libssh2_session_free(session);
if(session) {
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
libssh2_session_free(session);
}
#ifdef WIN32
closesocket(sock);
#else
close(sock);
#endif
if (local)
fclose(local);
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
int sock, i, auth_pw = 1;
struct sockaddr_in sin;
const char *fingerprint;
LIBSSH2_SESSION *session;
LIBSSH2_SESSION *session = NULL;
LIBSSH2_CHANNEL *channel;
const char *username="username";
const char *password="password";
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
long flag = 1;
#endif
char mem[1024];
size_t nread, sent;
size_t nread;
char *ptr;
struct stat fileinfo;
@@ -79,10 +79,16 @@ int main(int argc, char *argv[])
scppath = argv[5];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
local = fopen(loclfile, "rb");
if (!local) {
fprintf(stderr, "Can't local file %s\n", loclfile);
goto shutdown;
return -1;
}
stat(loclfile, &fileinfo);
@@ -176,7 +182,6 @@ int main(int argc, char *argv[])
break;
}
ptr = mem;
sent = 0;
do {
/* write the same data over and over, until error or completion */
@@ -185,14 +190,14 @@ int main(int argc, char *argv[])
continue;
} else if (rc < 0) {
fprintf(stderr, "ERROR %d\n", rc);
break;
} else {
/* rc indicates how many bytes were written this time */
sent += rc;
nread -= rc;
ptr += rc;
}
} while (rc > 0 && sent < nread);
ptr += sent;
nread -= sent;
} while (1);
} while (nread);
} while (!nread); /* only continue if nread was drained */
fprintf(stderr, "Sending EOF\n");
while (libssh2_channel_send_eof(channel) == LIBSSH2_ERROR_EAGAIN);
@@ -208,8 +213,9 @@ int main(int argc, char *argv[])
shutdown:
while ((rc = libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing")) == LIBSSH2_ERROR_EAGAIN);
while (libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing") ==
LIBSSH2_ERROR_EAGAIN);
libssh2_session_free(session);
#ifdef WIN32
@@ -218,5 +224,8 @@ int main(int argc, char *argv[])
close(sock);
#endif
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -52,17 +52,45 @@ static void kbd_callback(const char *name, int name_len,
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
void **abstract)
{
(void)name;
(void)name_len;
(void)instruction;
(void)instruction_len;
if (num_prompts == 1) {
responses[0].text = strdup(password);
responses[0].length = strlen(password);
}
(void)prompts;
int i;
size_t n;
char buf[1024];
(void)abstract;
} /* kbd_callback */
printf("Performing keyboard-interactive authentication.\n");
printf("Authentication name: '");
fwrite(name, 1, name_len, stdout);
printf("'\n");
printf("Authentication instruction: '");
fwrite(instruction, 1, instruction_len, stdout);
printf("'\n");
printf("Number of prompts: %d\n\n", num_prompts);
for (i = 0; i < num_prompts; i++) {
printf("Prompt %d from server: '", i);
fwrite(prompts[i].text, 1, prompts[i].length, stdout);
printf("'\n");
printf("Please type response: ");
fgets(buf, sizeof(buf), stdin);
n = strlen(buf);
while (n > 0 && strchr("\r\n", buf[n - 1]))
n--;
buf[n] = 0;
responses[i].text = strdup(buf);
responses[i].length = n;
printf("Response %d from user is '", i);
fwrite(responses[i].text, 1, responses[i].length, stdout);
printf("'\n\n");
}
printf("Done. Sending keyboard-interactive responses to server now.\n");
}
int main(int argc, char *argv[])
@@ -98,6 +126,13 @@ int main(int argc, char *argv[])
if(argc > 4) {
sftppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/*
* The application code is responsible for creating the socket
* and establishing the connection
@@ -241,5 +276,8 @@ int main(int argc, char *argv[])
close(sock);
#endif
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -72,6 +72,12 @@ int main(int argc, char *argv[])
WSAStartup(MAKEWORD(2,0), &wsadata);
#endif
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/* Ultra basic "connect to port 22 on localhost"
* The application is responsible for creating the socket establishing
* the connection
@@ -240,7 +246,7 @@ int main(int argc, char *argv[])
nread);
ptr += rc;
nread -= nread;
} while (rc > 0);
} while (rc >= 0);
if(rc != LIBSSH2_ERROR_EAGAIN) {
/* error or end of file */
@@ -283,6 +289,11 @@ int main(int argc, char *argv[])
#else
close(sock);
#endif
if (tempstorage)
fclose(tempstorage);
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -70,6 +70,12 @@ int main(int argc, char *argv[])
sftppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/*
* The application code is responsible for creating the socket
* and establishing the connection
@@ -129,7 +135,6 @@ int main(int argc, char *argv[])
}
}
fprintf(stderr, "libssh2_sftp_init()!\n");
sftp_session = libssh2_sftp_init(session);
if (!sftp_session) {
@@ -140,13 +145,15 @@ int main(int argc, char *argv[])
/* Since we have not set non-blocking, tell libssh2 we are blocking */
libssh2_session_set_blocking(session, 1);
fprintf(stderr, "libssh2_sftp_mkdir()!\n");
/* Make a directory via SFTP */
rc = libssh2_sftp_mkdir(sftp_session, sftppath,
LIBSSH2_SFTP_S_IRWXU|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IXGRP|
LIBSSH2_SFTP_S_IROTH|LIBSSH2_SFTP_S_IXOTH);
if(rc)
fprintf(stderr, "libssh2_sftp_mkdir failed: %d\n", rc);
libssh2_sftp_shutdown(sftp_session);
shutdown:
@@ -159,6 +166,9 @@ int main(int argc, char *argv[])
#else
close(sock);
#endif
printf("all done\n");
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -73,6 +73,12 @@ int main(int argc, char *argv[])
sftppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/*
* The application code is responsible for creating the socket
* and establishing the connection
@@ -145,13 +151,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "libssh2_sftp_mkdirnb()!\n");
/* Make a directory via SFTP */
while ((rc = libssh2_sftp_mkdir(sftp_session, sftppath,
LIBSSH2_SFTP_S_IRWXU|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IXGRP|
LIBSSH2_SFTP_S_IROTH|LIBSSH2_SFTP_S_IXOTH))
== LIBSSH2_ERROR_EAGAIN) {
;
}
while (libssh2_sftp_mkdir(sftp_session, sftppath,
LIBSSH2_SFTP_S_IRWXU|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IXGRP|
LIBSSH2_SFTP_S_IROTH|LIBSSH2_SFTP_S_IXOTH)
== LIBSSH2_ERROR_EAGAIN);
libssh2_sftp_shutdown(sftp_session);
@@ -165,6 +169,9 @@ int main(int argc, char *argv[])
#else
close(sock);
#endif
printf("all done\n");
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -121,6 +121,13 @@ int main(int argc, char *argv[])
if (argc > 4) {
sftppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/*
* The application code is responsible for creating the socket
* and establishing the connection
@@ -258,8 +265,8 @@ int main(int argc, char *argv[])
shutdown:
printf("libssh2_session_disconnect\n");
while ((rc = libssh2_session_disconnect(session,
"Normal Shutdown, Thank you")) ==
while (libssh2_session_disconnect(session,
"Normal Shutdown, Thank you") ==
LIBSSH2_ERROR_EAGAIN);
libssh2_session_free(session);
@@ -269,5 +276,8 @@ shutdown:
close(sock);
#endif
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -79,10 +79,16 @@ int main(int argc, char *argv[])
sftppath = argv[5];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
local = fopen(loclfile, "rb");
if (!local) {
printf("Can't local file %s\n", loclfile);
goto shutdown;
return -1;
}
/*
@@ -179,17 +185,18 @@ int main(int argc, char *argv[])
do {
/* write data in a loop until we block */
rc = libssh2_sftp_write(sftp_handle, ptr, nread);
if(rc < 0)
break;
ptr += rc;
nread -= nread;
} while (rc > 0);
} while (1);
nread -= rc;
} while (nread);
} while (rc > 0);
fclose(local);
libssh2_sftp_close(sftp_handle);
libssh2_sftp_shutdown(sftp_session);
shutdown:
shutdown:
libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing");
libssh2_session_free(session);
@@ -199,6 +206,11 @@ int main(int argc, char *argv[])
#else
close(sock);
#endif
printf("all done\n");
if (local)
fclose(local);
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -82,10 +82,16 @@ int main(int argc, char *argv[])
sftppath = argv[5];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
local = fopen(loclfile, "rb");
if (!local) {
printf("Can't local file %s\n", loclfile);
goto shutdown;
return -1;
}
/*
@@ -193,9 +199,9 @@ int main(int argc, char *argv[])
;
}
ptr += rc;
nread -= nread;
} while (rc > 0);
} while (1);
nread -= rc;
} while (nread);
} while (rc > 0);
fclose(local);
libssh2_sftp_close(sftp_handle);
@@ -203,7 +209,8 @@ int main(int argc, char *argv[])
shutdown:
while ((rc = libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing")) == LIBSSH2_ERROR_EAGAIN);
while (libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing")
== LIBSSH2_ERROR_EAGAIN);
libssh2_session_free(session);
#ifdef WIN32
@@ -212,5 +219,8 @@ shutdown:
close(sock);
#endif
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -70,6 +70,13 @@ int main(int argc, char *argv[])
if(argc > 4) {
sftppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/*
* The application code is responsible for creating the socket
* and establishing the connection
@@ -114,7 +121,7 @@ int main(int argc, char *argv[])
if (auth_pw) {
/* We could authenticate via password */
if ((i = libssh2_userauth_password(session, username, password))) {
if (libssh2_userauth_password(session, username, password)) {
printf("Authentication by password failed.\n");
goto shutdown;
}
@@ -211,6 +218,9 @@ int main(int argc, char *argv[])
#else
close(sock);
#endif
printf("all done\n");
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -73,6 +73,13 @@ int main(int argc, char *argv[])
if(argc > 4) {
sftppath = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/*
* The application code is responsible for creating the socket
* and establishing the connection
@@ -224,5 +231,8 @@ int main(int argc, char *argv[])
close(sock);
#endif
printf("all done\n");
libssh2_exit();
return 0;
}

View File

@@ -68,7 +68,7 @@ static void kbd_callback(const char *name, int name_len,
int main(int argc, char *argv[])
{
unsigned long hostaddr;
int sock, i, auth_pw = 0;
int rc, sock, i, auth_pw = 0;
struct sockaddr_in sin;
const char *fingerprint;
char *userauthlist;
@@ -93,6 +93,12 @@ int main(int argc, char *argv[])
password = argv[3];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/* Ultra basic "connect to port 22 on localhost". Your code is
* responsible for creating the socket establishing the connection
*/
@@ -247,5 +253,8 @@ int main(int argc, char *argv[])
close(sock);
#endif
printf("all done!\n");
libssh2_exit();
return 0;
}

View File

@@ -41,11 +41,11 @@ const char *username="username";
int main(int argc, char *argv[])
{
unsigned long hostaddr;
int sock = -1, i, j, rc;
int sock = -1, i, rc;
struct sockaddr_in sin;
const char *fingerprint;
char *userauthlist;
LIBSSH2_SESSION *session;
LIBSSH2_SESSION *session = NULL;
LIBSSH2_CHANNEL *channel;
LIBSSH2_AGENT *agent = NULL;
struct libssh2_agent_publickey *identity, *prev_identity = NULL;
@@ -65,6 +65,12 @@ int main(int argc, char *argv[])
username = argv[2];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
/* Ultra basic "connect to port 22 on localhost". Your code is
* responsible for creating the socket establishing the connection
*/
@@ -212,9 +218,11 @@ int main(int argc, char *argv[])
libssh2_agent_disconnect(agent);
libssh2_agent_free(agent);
libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing");
libssh2_session_free(session);
if(session) {
libssh2_session_disconnect(session,
"Normal Shutdown, Thank you for playing");
libssh2_session_free(session);
}
if (sock != -1) {
#ifdef WIN32
@@ -225,5 +233,8 @@ int main(int argc, char *argv[])
}
printf("all done!\n");
libssh2_exit();
return rc;
}

View File

@@ -109,6 +109,12 @@ int main(int argc, char *argv[])
commandline = argv[4];
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
hostaddr = inet_addr(hostname);
/* Ultra basic "connect to port 22 on localhost"
@@ -161,12 +167,21 @@ int main(int argc, char *argv[])
fingerprint = libssh2_session_hostkey(session, &len, &type);
if(fingerprint) {
struct libssh2_knownhost *host;
int check = libssh2_knownhost_check(nh, (char *)hostname,
(char *)fingerprint, len,
#if LIBSSH2_VERSION_NUM >= 0x010206
/* introduced in 1.2.6 */
int check = libssh2_knownhost_checkp(nh, hostname, 22,
fingerprint, len,
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
LIBSSH2_KNOWNHOST_KEYENC_RAW,
&host);
#else
/* 1.2.5 or older */
int check = libssh2_knownhost_check(nh, hostname,
fingerprint, len,
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
LIBSSH2_KNOWNHOST_KEYENC_RAW,
&host);
#endif
fprintf(stderr, "Host check: %d, key: %s\n", check,
(check <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
host->key:"<none>");
@@ -289,6 +304,8 @@ shutdown:
close(sock);
#endif
fprintf(stderr, "all done\n");
libssh2_exit();
return 0;
}

View File

@@ -121,11 +121,16 @@ static void x11_callback(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel,
/* Connect to the local unix domain */
ptr = strrchr(display, ':');
temp_buff = (char *) calloc(strlen(ptr+1), sizeof(char));
if (!temp_buff) {
perror("calloc");
return;
}
memcpy(temp_buff, ptr+1, strlen(ptr+1));
display_port = atoi(temp_buff);
free(temp_buff);
sock = socket(AF_UNIX,SOCK_STREAM, 0);
if (sock <0)
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
return;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
@@ -272,6 +277,12 @@ main (int argc, char *argv[])
fprintf (stderr, "DEBUG is ON: %d\n", set_debug_on);
}
rc = libssh2_init (0);
if (rc != 0) {
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
return 1;
}
sock = socket (AF_INET, SOCK_STREAM, 0);
sin.sin_family = AF_INET;
@@ -429,5 +440,8 @@ main (int argc, char *argv[])
channel = NULL;
}
_normal_mode();
libssh2_exit();
return 0;
}

View File

@@ -1,5 +1,6 @@
/* Copyright (c) 2004-2009, Sara Golemon <sarag@libssh2.org>
* Copyright (c) 2009 by Daniel Stenberg
* Copyright (c) 2010 Simon Josefsson <simon@josefsson.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms,
@@ -68,16 +69,18 @@ extern "C" {
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
# include <sys/bsdskt.h>
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
#endif
#if defined(LIBSSH2_WIN32) && defined(_MSC_VER) && (_MSC_VER <= 1400)
#if defined(LIBSSH2_WIN32) && defined(_MSC_VER)
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 libssh2_uint64_t;
typedef __int64 libssh2_int64_t;
typedef unsigned int uint32_t;
#ifndef _SSIZE_T_DEFINED
# ifndef _SSIZE_T_DEFINED
typedef int ssize_t;
#define _SSIZE_T_DEFINED
# define _SSIZE_T_DEFINED
#endif
#else
typedef unsigned long long libssh2_uint64_t;
@@ -88,13 +91,13 @@ typedef long long libssh2_int64_t;
to make the BANNER define (used by src/session.c) be a valid SSH
banner. Release versions have no appended strings and may of course not
have dashes either. */
#define LIBSSH2_VERSION "1.2.2_DEV"
#define LIBSSH2_VERSION "1.2.6_DEV"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBSSH2_VERSION_MAJOR 1
#define LIBSSH2_VERSION_MINOR 2
#define LIBSSH2_VERSION_PATCH 2
#define LIBSSH2_VERSION_PATCH 6
/* This is the numeric version of the libssh2 version number, meant for easier
parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will
@@ -111,7 +114,7 @@ typedef long long libssh2_int64_t;
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
*/
#define LIBSSH2_VERSION_NUM 0x010202
#define LIBSSH2_VERSION_NUM 0x010206
/*
* This is the date and time when the full source package was created. The
@@ -368,6 +371,32 @@ typedef struct _LIBSSH2_POLLFD {
#define LIBSSH2_ERROR_OUT_OF_BOUNDARY -41
#define LIBSSH2_ERROR_AGENT_PROTOCOL -42
/* Global API */
#define LIBSSH2_INIT_NO_CRYPTO 0x0001
/*
* libssh2_init()
*
* Initialize the libssh2 functions. This typically initialize the
* crypto library. It uses a global state, and is not thread safe --
* you must make sure this function is not called concurrently.
*
* Flags can be:
* 0: Normal initialize
* LIBSSH2_INIT_NO_CRYPTO: Do not initialize the crypto library (ie.
* OPENSSL_add_cipher_algoritms() for OpenSSL
*
* Returns 0 if succeeded, or a negative value for error.
*/
LIBSSH2_API int libssh2_init(int flags);
/*
* libssh2_exit()
*
* Exit the libssh2 functions and free's all memory used internal.
*/
LIBSSH2_API void libssh2_exit(void);
/* Session API */
LIBSSH2_API LIBSSH2_SESSION *
libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
@@ -683,6 +712,10 @@ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session,
const char *path, int mode,
size_t size, long mtime,
long atime);
LIBSSH2_API LIBSSH2_CHANNEL *
libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
libssh2_int64_t size, time_t mtime, time_t atime);
#define libssh2_scp_send(session, path, mode, size) \
libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
@@ -718,7 +751,7 @@ libssh2_knownhost_init(LIBSSH2_SESSION *session);
*
* Add a host and its associated key to the collection of known hosts.
*
* The 'type' argument specifies on what format the given host is:
* The 'type' argument specifies on what format the given host and keys are:
*
* plain - ascii "hostname.domain.tld"
* sha1 - SHA1(<salt> <host>) base64-encoded!
@@ -731,6 +764,8 @@ libssh2_knownhost_init(LIBSSH2_SESSION *session);
* a custom type is used, salt is ignored and you must provide the host
* pre-hashed when checking for it in the libssh2_knownhost_check() function.
*
* The keylen parameter may be omitted (zero) if the key is provided as a
* NULL-terminated base64-encoded string.
*/
/* host format (2 bits) */
@@ -758,6 +793,41 @@ libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
const char *key, size_t keylen, int typemask,
struct libssh2_knownhost **store);
/*
* libssh2_knownhost_addc
*
* Add a host and its associated key to the collection of known hosts.
*
* Takes a comment argument that may be NULL. A NULL comment indicates
* there is no comment and the entry will end directly after the key
* when written out to a file. An empty string "" comment will indicate an
* empty comment which will cause a single space to be written after the key.
*
* The 'type' argument specifies on what format the given host and keys are:
*
* plain - ascii "hostname.domain.tld"
* sha1 - SHA1(<salt> <host>) base64-encoded!
* custom - another hash
*
* If 'sha1' is selected as type, the salt must be provided to the salt
* argument. This too base64 encoded.
*
* The SHA-1 hash is what OpenSSH can be told to use in known_hosts files. If
* a custom type is used, salt is ignored and you must provide the host
* pre-hashed when checking for it in the libssh2_knownhost_check() function.
*
* The keylen parameter may be omitted (zero) if the key is provided as a
* NULL-terminated base64-encoded string.
*/
LIBSSH2_API int
libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
const char *host,
const char *salt,
const char *key, size_t keylen,
const char *comment, size_t commentlen, int typemask,
struct libssh2_knownhost **store);
/*
* libssh2_knownhost_check
*
@@ -788,6 +858,15 @@ libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
int typemask,
struct libssh2_knownhost **knownhost);
/* this function is identital to the above one, but also takes a port
argument that allows libssh2 to do a better check */
LIBSSH2_API int
libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
const char *host, int port,
const char *key, size_t keylen,
int typemask,
struct libssh2_knownhost **knownhost);
/*
* libssh2_knownhost_del
*
@@ -939,8 +1018,8 @@ libssh2_agent_list_identities(LIBSSH2_AGENT *agent);
*/
LIBSSH2_API int
libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
struct libssh2_agent_publickey **store,
struct libssh2_agent_publickey *prev);
struct libssh2_agent_publickey **store,
struct libssh2_agent_publickey *prev);
/*
* libssh2_agent_userauth()
@@ -951,8 +1030,8 @@ libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
*/
LIBSSH2_API int
libssh2_agent_userauth(LIBSSH2_AGENT *agent,
const char *username,
struct libssh2_agent_publickey *identity);
const char *username,
struct libssh2_agent_publickey *identity);
/*
* libssh2_agent_disconnect()
@@ -973,6 +1052,35 @@ libssh2_agent_disconnect(LIBSSH2_AGENT *agent);
LIBSSH2_API void
libssh2_agent_free(LIBSSH2_AGENT *agent);
/*
* libssh2_keepalive_config()
*
* Set how often keepalive messages should be sent. WANT_REPLY
* indicates whether the keepalive messages should request a response
* from the server. INTERVAL is number of seconds that can pass
* without any I/O, use 0 (the default) to disable keepalives. To
* avoid some busy-loop corner-cases, if you specify an interval of 1
* it will be treated as 2.
*
* Note that non-blocking applications are responsible for sending the
* keepalive messages using libssh2_keepalive_send().
*/
LIBSSH2_API void libssh2_keepalive_config (LIBSSH2_SESSION *session,
int want_reply,
unsigned interval);
/*
* libssh2_keepalive_send()
*
* Send a keepalive message if needed. SECONDS_TO_NEXT indicates how
* many seconds you can sleep after this call before you need to call
* it again. Returns 0 on success, or LIBSSH2_ERROR_SOCKET_SEND on
* I/O errors.
*/
LIBSSH2_API int libssh2_keepalive_send (LIBSSH2_SESSION *session,
int *seconds_to_next);
/* NOTE NOTE NOTE
libssh2_trace() has no function in builds that aren't built with debug
enabled

View File

@@ -59,6 +59,7 @@ extern "C" {
typedef struct _LIBSSH2_SFTP LIBSSH2_SFTP;
typedef struct _LIBSSH2_SFTP_HANDLE LIBSSH2_SFTP_HANDLE;
typedef struct _LIBSSH2_SFTP_ATTRIBUTES LIBSSH2_SFTP_ATTRIBUTES;
typedef struct _LIBSSH2_SFTP_STATVFS LIBSSH2_SFTP_STATVFS;
/* Flags for open_ex() */
#define LIBSSH2_SFTP_OPENFILE 0
@@ -86,6 +87,10 @@ typedef struct _LIBSSH2_SFTP_ATTRIBUTES LIBSSH2_SFTP_ATTRIBUTES;
#define LIBSSH2_SFTP_ATTR_ACMODTIME 0x00000008
#define LIBSSH2_SFTP_ATTR_EXTENDED 0x80000000
/* SFTP statvfs flag bits */
#define LIBSSH2_SFTP_ST_RDONLY 0x00000001
#define LIBSSH2_SFTP_ST_NOSUID 0x00000002
struct _LIBSSH2_SFTP_ATTRIBUTES {
/* If flags & ATTR_* bit is set, then the value in this struct will be
* meaningful Otherwise it should be ignored
@@ -98,6 +103,20 @@ struct _LIBSSH2_SFTP_ATTRIBUTES {
unsigned long atime, mtime;
};
struct _LIBSSH2_SFTP_STATVFS {
libssh2_uint64_t f_bsize; /* file system block size */
libssh2_uint64_t f_frsize; /* fragment size */
libssh2_uint64_t f_blocks; /* size of fs in f_frsize units */
libssh2_uint64_t f_bfree; /* # free blocks */
libssh2_uint64_t f_bavail; /* # free blocks for non-root */
libssh2_uint64_t f_files; /* # inodes */
libssh2_uint64_t f_ffree; /* # free inodes */
libssh2_uint64_t f_favail; /* # free inodes for non-root */
libssh2_uint64_t f_fsid; /* file system ID */
libssh2_uint64_t f_flag; /* mount flags */
libssh2_uint64_t f_namemax; /* maximum filename length */
};
/* SFTP filetypes */
#define LIBSSH2_SFTP_TYPE_REGULAR 1
#define LIBSSH2_SFTP_TYPE_DIRECTORY 2
@@ -142,6 +161,22 @@ struct _LIBSSH2_SFTP_ATTRIBUTES {
#define LIBSSH2_SFTP_S_IWOTH 0000002 /* W for other */
#define LIBSSH2_SFTP_S_IXOTH 0000001 /* X for other */
/* macros to check for specific file types, added in 1.2.5 */
#define LIBSSH2_SFTP_S_ISLNK(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFLNK)
#define LIBSSH2_SFTP_S_ISREG(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFREG)
#define LIBSSH2_SFTP_S_ISDIR(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFDIR)
#define LIBSSH2_SFTP_S_ISCHR(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFCHR)
#define LIBSSH2_SFTP_S_ISBLK(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFBLK)
#define LIBSSH2_SFTP_S_ISFIFO(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFIFO)
#define LIBSSH2_SFTP_S_ISSOCK(m) \
(((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFSOCK)
/* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open())
* Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */
#define LIBSSH2_FXF_READ 0x00000001
@@ -253,6 +288,14 @@ LIBSSH2_API int libssh2_sftp_unlink_ex(LIBSSH2_SFTP *sftp,
#define libssh2_sftp_unlink(sftp, filename) \
libssh2_sftp_unlink_ex((sftp), (filename), strlen(filename))
LIBSSH2_API int libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle,
LIBSSH2_SFTP_STATVFS *st);
LIBSSH2_API int libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp,
const char *path,
size_t path_len,
LIBSSH2_SFTP_STATVFS *st);
LIBSSH2_API int libssh2_sftp_mkdir_ex(LIBSSH2_SFTP *sftp,
const char *path,
unsigned int path_len, long mode);

View File

@@ -16,12 +16,12 @@ endif
# Edit the path below to point to the base of your Zlib sources.
ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.3
ZLIB_PATH = ../../zlib-1.2.5
endif
# Edit the path below to point to the base of your OpenSSL package.
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../openssl-0.9.8k
OPENSSL_PATH = ../../openssl-0.9.8n
endif
# Edit the path below to point to your Distribution folder.
@@ -39,7 +39,7 @@ DEVLARC = $(DEVLDIR).zip
# Edit the vars below to change NLM target settings.
TARGET = libssh2
VERSION = $(LIBSSH2_VERSION)
COPYR = Copyright (c) 2004-2009 Sara Golemon <sarag@libssh2.org>
COPYR = Copyright (c) 2004-2010 The libssh2 project and its contributors.
WWWURL = http://www.libssh2.org/
DESCR = libssh2 $(LIBSSH2_VERSION_STR) ($(LIBARCH)) - $(WWWURL)
MTSAFE = YES

View File

@@ -16,12 +16,12 @@ endif
# Edit the path below to point to the base of your Zlib sources.
ifndef ZLIB_PATH
ZLIB_PATH = ../../../zlib-1.2.3
ZLIB_PATH = ../../../zlib-1.2.5
endif
# Edit the path below to point to the base of your OpenSSL package.
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../../openssl-0.9.8k
OPENSSL_PATH = ../../../openssl-0.9.8n
endif
# Edit the var below to enable static linking of libssh2 and libz
@@ -31,7 +31,7 @@ LINK_STATIC = 1
SAMPLES = ../../example
TARGETS := $(filter-out x11.nlm,$(patsubst $(SAMPLES)/%.c,%.nlm,$(strip $(wildcard $(SAMPLES)/*.c))))
VERSION = $(LIBSSH2_VERSION)
COPYR = Copyright (c) 2004-2009, Sara Golemon <sarag@libssh2.org>
COPYR = Copyright (c) 2004-2010 The libssh2 project and its contributors.
WWWURL = http://www.libssh2.org/
DESCR = libssh2 $(notdir $(@:.def=)) $(LIBSSH2_VERSION_STR) ($(LIBARCH)) - $(WWWURL)
MTSAFE = YES

View File

@@ -6,7 +6,9 @@ OBJECTS = \
$(INTDIR)\channel.obj \
$(INTDIR)\comp.obj \
$(INTDIR)\crypt.obj \
$(INTDIR)\global.obj \
$(INTDIR)\hostkey.obj \
$(INTDIR)\keepalive.obj \
$(INTDIR)\kex.obj \
$(INTDIR)\mac.obj \
$(INTDIR)\misc.obj \

View File

@@ -47,6 +47,7 @@
support them. */
#undef PF_UNIX
#endif
#include "userauth.h"
/* Requests from client to agent for protocol 1 key operations */
#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
@@ -142,7 +143,7 @@ static int
agent_connect_unix(LIBSSH2_AGENT *agent)
{
const char *path;
struct sockaddr_un sun;
struct sockaddr_un s_un;
path = getenv("SSH_AUTH_SOCK");
if (!path) {
@@ -154,9 +155,9 @@ agent_connect_unix(LIBSSH2_AGENT *agent)
return -1;
}
sun.sun_family = AF_UNIX;
strncpy (sun.sun_path, path, sizeof sun.sun_path);
if (connect(agent->fd, (struct sockaddr*)(&sun), sizeof sun) != 0) {
s_un.sun_family = AF_UNIX;
strncpy (s_un.sun_path, path, sizeof s_un.sun_path);
if (connect(agent->fd, (struct sockaddr*)(&s_un), sizeof s_un) != 0) {
close (agent->fd);
return -1;
}
@@ -167,7 +168,7 @@ agent_connect_unix(LIBSSH2_AGENT *agent)
static int
agent_transact_unix(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
{
unsigned char buf[4], *s;
unsigned char buf[4];
int rc;
/* Send the length of the request */
@@ -203,8 +204,8 @@ agent_transact_unix(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
return -1;
}
transctx->response_len = _libssh2_ntohu32(buf);
s = transctx->response = LIBSSH2_ALLOC(agent->session,
transctx->response_len);
transctx->response = LIBSSH2_ALLOC(agent->session,
transctx->response_len);
if (!transctx->response) {
return LIBSSH2_ERROR_ALLOC;
}
@@ -267,6 +268,7 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
char mapname[23];
HANDLE filemap;
unsigned char *p;
unsigned char *p2;
int id;
COPYDATASTRUCT cds;
@@ -283,9 +285,9 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
if (filemap == NULL || filemap == INVALID_HANDLE_VALUE) {
return -1;
}
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
_libssh2_htonu32(p, transctx->request_len);
memcpy(p + 4, transctx->request, transctx->request_len);
p2 = p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
_libssh2_store_str(&p2, transctx->request, transctx->request_len);
cds.dwData = PAGEANT_COPYDATA_ID;
cds.cbData = 1 + strlen(mapname);
cds.lpData = mapname;
@@ -337,7 +339,7 @@ static struct {
#ifdef PF_UNIX
{"Unix", &agent_ops_unix},
#endif /* PF_UNIX */
{NULL}
{NULL, NULL}
};
static int
@@ -361,18 +363,14 @@ agent_sign(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
*s++ = SSH2_AGENTC_SIGN_REQUEST;
/* key blob */
_libssh2_htonu32(s, identity->external.blob_len);
s += 4;
memcpy(s, identity->external.blob, identity->external.blob_len);
s += identity->external.blob_len;
_libssh2_store_str(&s, (const char *)identity->external.blob,
identity->external.blob_len);
/* data */
_libssh2_htonu32(s, data_len);
s += 4;
memcpy(s, data, data_len);
s += data_len;
_libssh2_store_str(&s, (const char *)data, data_len);
/* flags */
_libssh2_htonu32(s, 0);
s += 4;
_libssh2_store_u32(&s, 0);
transctx->request_len = s - transctx->request;
transctx->state = agent_NB_state_request_created;
}
@@ -618,8 +616,8 @@ libssh2_agent_init(LIBSSH2_SESSION *session)
agent = LIBSSH2_ALLOC(session, sizeof *agent);
if (!agent) {
libssh2_error(session, LIBSSH2_ERROR_ALLOC,
"Unable to allocate space for agent connection", 0);
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
"Unable to allocate space for agent connection");
return NULL;
}
memset(agent, 0, sizeof *agent);
@@ -720,11 +718,12 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent,
memset(&agent->transctx, 0, sizeof agent->transctx);
agent->identity = identity->node;
}
return libssh2_userauth_publickey(agent->session, username,
identity->blob,
identity->blob_len,
agent_sign,
&abstract);
return _libssh2_userauth_publickey(agent->session, username,
strlen(username),
identity->blob,
identity->blob_len,
agent_sign,
&abstract);
}
/*

File diff suppressed because it is too large Load Diff

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