Compare commits
45 Commits
libssh2-1.
...
libssh2-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
07d7a85bdb | ||
![]() |
95d69d3a81 | ||
![]() |
2fe1770d9f | ||
![]() |
3c71ad4fce | ||
![]() |
79f48e4881 | ||
![]() |
49453c9ae2 | ||
![]() |
b232eeb598 | ||
![]() |
f922df9e1b | ||
![]() |
7e47bd6640 | ||
![]() |
4ae907cdef | ||
![]() |
01d199180a | ||
![]() |
7e18862eae | ||
![]() |
45ffdcfe3c | ||
![]() |
dadc05fdfd | ||
![]() |
733bf877f8 | ||
![]() |
2db7d9c655 | ||
![]() |
9a24b03402 | ||
![]() |
81d53de4dc | ||
![]() |
5b004a4b67 | ||
![]() |
da64618c9a | ||
![]() |
566894494b | ||
![]() |
0723dab4d7 | ||
![]() |
67ba8713a6 | ||
![]() |
dade304c47 | ||
![]() |
6e8229a221 | ||
![]() |
821fb6ca71 | ||
![]() |
59673a111e | ||
![]() |
5b66a5f38d | ||
![]() |
ce8f0b29a4 | ||
![]() |
26dad4590b | ||
![]() |
4ed1e9d96b | ||
![]() |
c5ec167881 | ||
![]() |
e652b4c7b8 | ||
![]() |
cc84d875eb | ||
![]() |
c01737e679 | ||
![]() |
4825171919 | ||
![]() |
d881e7e8ef | ||
![]() |
5dc5c80a39 | ||
![]() |
9f477073bc | ||
![]() |
78498e0588 | ||
![]() |
0b0aa209f6 | ||
![]() |
aa07cdee9a | ||
![]() |
274fb2169c | ||
![]() |
f0a37bdadc | ||
![]() |
1249dd2272 |
@@ -1,44 +1,35 @@
|
||||
libssh2 1.2.8
|
||||
libssh2 1.2.9
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o added libssh2_free, libssh2_channel_get_exit_signal and
|
||||
libssh2_session_handshake
|
||||
o SFTP read/write remade and now MUCH faster, especially on high latency
|
||||
connections
|
||||
o added new examples: ssh2_echo.c, sftp_append.c and sftp_write_sliding.c
|
||||
o userauth: derive publickey from private
|
||||
o NEWS: now generated from git
|
||||
o Added libssh2_session_set_timeout() and libssh2_session_get_timeout()
|
||||
to make blocking calls get a timeout
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o Support unlimited number of host names in a single line of the
|
||||
known_hosts file.
|
||||
o fix memory leak in userauth_keyboard_interactive()
|
||||
o fix memory leaks (two times cipher_data) for each sftp session
|
||||
o session_startup: manage server data before server identification
|
||||
o SCP: allow file names with bytes > 126
|
||||
o scp_recv: improved treatment of channel_read() returning zero
|
||||
o libssh2_userauth_authenticated: make it work as documented
|
||||
o variable size cleanup: match internal variable sizes better with the sizes
|
||||
of the fields used on the wire
|
||||
o channel_request_pty_size: fix reqPTY_state
|
||||
o sftp_symlink: return error if receive buffer too small
|
||||
o sftp_readdir: return error if buffer is too small
|
||||
o libssh2_knownhost_readfile.3: clarify return value
|
||||
o configure: stop using the deprecated AM_INIT_AUTOMAKE syntax
|
||||
o Fixed Win32 makefile which was now broken at resource build
|
||||
o kex_agree_hostkey: fix NULL pointer derefence
|
||||
o _libssh2_ntohu64: fix conversion from network bytes to uint64
|
||||
o ssize_t: proper typedef with MSVC compilers
|
||||
o zlib: Add debug tracing of zlib errors
|
||||
o decomp: increase decompression buffer sizes
|
||||
o configure and pkg-config: fix $VERSION
|
||||
o s/\.NF/.nf/ to fix wrong macro name caught by man --warnings
|
||||
o keepalive: add first basic man pages
|
||||
o sftp_write: flush the packetlist on error
|
||||
o sftp_write: clean offsets on error
|
||||
o msvcproj: added libs and debug stuff
|
||||
o SCP: fix incorrect error code
|
||||
o session_startup: init state properly
|
||||
o sftp_write_sliding: send the complete file
|
||||
o userauth_keyboard_interactive: skip code on zero length auth
|
||||
o _libssh2_wait_socket: fix timeouts for poll() uses
|
||||
o agent_list_identities: fix out of scope access
|
||||
o _libssh2_recv(): handle ENOENT error as EAGAIN
|
||||
o userauth_keyboard_interactive: fix buffer overflow
|
||||
o removed man pages for non-existing functions!
|
||||
o gettimeofday: fix name space pollution
|
||||
o _libssh2_channel_write: handle window_size == 0 better
|
||||
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Alexander Lamaison, Alfred Gebert, Guenter Knauf, Dan Fandrich,
|
||||
Daniel Stenberg, Jasmeet Bagga, Joey Degges, Mark Smith, Peter Stuge,
|
||||
Pierre Joye, Simon Josefsson, TJ Saunders, Tommy Lindgren
|
||||
Alfred Gebert, Dan Fandrich, Douglas Masterson, Guenter Knauf, Matt Lilley,
|
||||
Mikhail Gusarov, Peter Stuge, zl liu, Paul Howarth, Mark Smith, Bill Segall,
|
||||
Henrik Nordstr<74>m
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
10
configure.ac
10
configure.ac
@@ -15,12 +15,14 @@ if test "x$SED" = "xsed-was-not-found-by-configure"; then
|
||||
fi
|
||||
|
||||
dnl figure out the libssh2 version
|
||||
VERSION=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h`
|
||||
LIBSSH2VER=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h`
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_MSG_CHECKING([libssh2 version])
|
||||
AC_MSG_RESULT($VERSION)
|
||||
AC_MSG_RESULT($LIBSSH2VER)
|
||||
|
||||
AB_VERSION=$VERSION
|
||||
AC_SUBST(LIBSSH2VER)
|
||||
|
||||
AB_VERSION=$LIBSSH2VER
|
||||
|
||||
AB_INIT
|
||||
|
||||
@@ -289,7 +291,7 @@ AC_OUTPUT
|
||||
|
||||
AC_MSG_NOTICE([summary of build options:
|
||||
|
||||
version: ${VERSION}
|
||||
version: ${LIBSSH2VER}
|
||||
Host type: ${host}
|
||||
Install prefix: ${prefix}
|
||||
Compiler: ${CC}
|
||||
|
@@ -25,8 +25,8 @@ dist_man_MANS = \
|
||||
libssh2_channel_forward_listen.3 \
|
||||
libssh2_channel_forward_listen_ex.3 \
|
||||
libssh2_channel_free.3 \
|
||||
libssh2_channel_get_exit_status.3 \
|
||||
libssh2_channel_get_exit_signal.3 \
|
||||
libssh2_channel_get_exit_status.3 \
|
||||
libssh2_channel_handle_extended_data.3 \
|
||||
libssh2_channel_handle_extended_data2.3 \
|
||||
libssh2_channel_ignore_extended_data.3 \
|
||||
@@ -61,10 +61,10 @@ dist_man_MANS = \
|
||||
libssh2_channel_x11_req_ex.3 \
|
||||
libssh2_exit.3 \
|
||||
libssh2_free.3 \
|
||||
libssh2_free_host_entry.3 \
|
||||
libssh2_host_entry_match.3 \
|
||||
libssh2_hostkey_hash.3 \
|
||||
libssh2_init.3 \
|
||||
libssh2_keepalive_config.3 \
|
||||
libssh2_keepalive_send.3 \
|
||||
libssh2_knownhost_add.3 \
|
||||
libssh2_knownhost_addc.3 \
|
||||
libssh2_knownhost_check.3 \
|
||||
@@ -77,7 +77,6 @@ dist_man_MANS = \
|
||||
libssh2_knownhost_readline.3 \
|
||||
libssh2_knownhost_writefile.3 \
|
||||
libssh2_knownhost_writeline.3 \
|
||||
libssh2_new_host_entry.3 \
|
||||
libssh2_poll.3 \
|
||||
libssh2_poll_channel_read.3 \
|
||||
libssh2_publickey_add.3 \
|
||||
@@ -90,8 +89,8 @@ dist_man_MANS = \
|
||||
libssh2_publickey_shutdown.3 \
|
||||
libssh2_scp_recv.3 \
|
||||
libssh2_scp_send.3 \
|
||||
libssh2_scp_send_ex.3 \
|
||||
libssh2_scp_send64.3 \
|
||||
libssh2_scp_send_ex.3 \
|
||||
libssh2_session_abstract.3 \
|
||||
libssh2_session_block_directions.3 \
|
||||
libssh2_session_callback_set.3 \
|
||||
@@ -100,6 +99,7 @@ dist_man_MANS = \
|
||||
libssh2_session_flag.3 \
|
||||
libssh2_session_free.3 \
|
||||
libssh2_session_get_blocking.3 \
|
||||
libssh2_session_get_timeout.3 \
|
||||
libssh2_session_hostkey.3 \
|
||||
libssh2_session_init.3 \
|
||||
libssh2_session_init_ex.3 \
|
||||
@@ -108,6 +108,7 @@ dist_man_MANS = \
|
||||
libssh2_session_method_pref.3 \
|
||||
libssh2_session_methods.3 \
|
||||
libssh2_session_set_blocking.3 \
|
||||
libssh2_session_set_timeout.3 \
|
||||
libssh2_session_startup.3 \
|
||||
libssh2_sftp_close.3 \
|
||||
libssh2_sftp_close_handle.3 \
|
||||
|
@@ -6,7 +6,8 @@ libssh2_channel_direct_tcpip - convenience macro for \fIlibssh2_channel_direct_t
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_direct_tcpip(arguments)
|
||||
LIBSSH2_CHANNEL *
|
||||
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +17,4 @@ See \fIlibssh2_channel_direct_tcpip_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_direct_tcpip_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_direct_tcpip_ex(3)\fP
|
||||
.BR libssh2_channel_direct_tcpip_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_exec - convenience macro for \fIlibssh2_channel_process_startup(
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_exec(arguments)
|
||||
int libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *command);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_process_startup(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_process_startup(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_process_startup(3)\fP
|
||||
.BR libssh2_channel_process_startup(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_flush - convenience macro for \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_flush(arguments)
|
||||
int libssh2_channel_flush(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.BR libssh2_channel_flush_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_flush_stderr - convenience macro for \fIlibssh2_channel_flush_ex
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_flush_stderr(arguments)
|
||||
int libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_flush_ex(3)\fP
|
||||
.BR libssh2_channel_flush_ex(3)
|
||||
|
@@ -15,7 +15,8 @@ libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener);
|
||||
.SH RETURN VALUE
|
||||
A newly allocated channel instance or NULL on failure.
|
||||
.SH ERRORS
|
||||
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call
|
||||
would block.
|
||||
When this function returns NULL use \fIlibssh2_session_last_errno(3)\fP to
|
||||
extract the error code. If that code is \fILIBSSH2_ERROR_EAGAIN\fP, the
|
||||
session is set to do non-blocking I/O but the call would block.
|
||||
.SH SEE ALSO
|
||||
.BR libssh2_channel_forward_listen_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_forward_listen - convenience macro for \fIlibssh2_channel_forwar
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_forward_listen(arguments)
|
||||
int libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_forward_listen_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_forward_listen_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_forward_listen_ex(3)\fP
|
||||
.BR libssh2_channel_forward_listen_ex(3)
|
||||
|
@@ -9,6 +9,9 @@ libssh2_channel_ignore_extended_data - convenience macro for \fIlibssh2_channel_
|
||||
libssh2_channel_ignore_extended_data(arguments)
|
||||
|
||||
.SH DESCRIPTION
|
||||
This function is deprecated. Use the
|
||||
\fIlibssh2_channel_handle_extended_data2(3)\fP function instead!
|
||||
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
underlying function \fIlibssh2_channel_handle_extended_data(3)\fP.
|
||||
.SH RETURN VALUE
|
||||
@@ -16,4 +19,4 @@ See \fIlibssh2_channel_handle_extended_data(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_handle_extended_data(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_handle_extended_data(3)\fP
|
||||
.BR libssh2_channel_handle_extended_data(3)
|
||||
|
@@ -6,7 +6,8 @@ libssh2_channel_open_session - convenience macro for \fIlibssh2_channel_open_ex(
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_open_session(arguments)
|
||||
LIBSSH2_CHANNEL *
|
||||
libssh2_channel_open_session(LIBSSH2_SESSION *session);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +17,4 @@ See \fIlibssh2_channel_open_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_open_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_open_ex(3)\fP
|
||||
.BR libssh2_channel_open_ex(3)
|
||||
|
@@ -4,20 +4,14 @@
|
||||
.SH NAME
|
||||
libssh2_channel_process_startup - request a shell on a channel
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <libssh2.h>
|
||||
|
||||
int
|
||||
libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *request, unsigned int request_len, const char *message, unsigned int message_len);
|
||||
|
||||
int
|
||||
libssh2_channel_shell(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
int
|
||||
libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *message);
|
||||
|
||||
int
|
||||
libssh2_channel_subsystem(LIBSSH2_CHANNEL *channel, const char *message);
|
||||
|
||||
int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
|
||||
const char *request,
|
||||
unsigned int request_len,
|
||||
const char *message,
|
||||
unsigned int message_len);
|
||||
.SH DESCRIPTION
|
||||
\fIchannel\fP - Active session channel instance.
|
||||
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_read - convenience macro for \fIlibssh2_channel_read_ex(3)\fP ca
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_read(arguments)
|
||||
ssize_t libssh2_channel_read(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_read_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_read_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_read_ex(3)\fP
|
||||
.BR libssh2_channel_read_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_read_stderr - convenience macro for \fIlibssh2_channel_read_ex(3
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_read_stderr(arguments)
|
||||
ssize_t libssh2_channel_read_stderr(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_read_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_read_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_read_ex(3)\fP
|
||||
.BR libssh2_channel_read_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_request_pty - convenience macro for \fIlibssh2_channel_request_p
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_request_pty(arguments)
|
||||
int libssh2_channel_request_pty(LIBSSH2_SESSION *session, const char *term);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_request_pty_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_request_pty_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_request_pty_ex(3)\fP
|
||||
.BR libssh2_channel_request_pty_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_request_pty_size - convenience macro for \fIlibssh2_channel_requ
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_request_pty_size(arguments)
|
||||
int libssh2_channel_request_pty_size(LIBSSH2_CHANNEL *channel, int width, int height);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_request_pty_size_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_request_pty_size_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_request_pty_size_ex(3)\fP
|
||||
.BR libssh2_channel_request_pty_size_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_setenv - convenience macro for \fIlibssh2_channel_setenv_ex(3)\f
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_setenv(arguments)
|
||||
int libssh2_channel_setenv(LIBSSH2_CHANNEL *channel, const char *varname, const char *value);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_setenv_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_setenv_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_setenv_ex(3)\fP
|
||||
.BR libssh2_channel_setenv_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_shell - convenience macro for \fIlibssh2_channel_process_startup
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_shell(arguments)
|
||||
int libssh2_channel_shell(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_process_startup(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_process_startup(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_process_startup(3)\fP
|
||||
.BR libssh2_channel_process_startup(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_subsystem - convenience macro for \fIlibssh2_channel_process_sta
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_subsystem(arguments)
|
||||
int libssh2_channel_subsystem(LIBSSH2_CHANNEL *channel, const char *subsystem);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_process_startup(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_process_startup(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_process_startup(3)\fP
|
||||
.BR libssh2_channel_process_startup(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_window_read - convenience macro for \fIlibssh2_channel_window_re
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_window_read(arguments)
|
||||
unsigned long libssh2_channel_window_read(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_window_read_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_window_read_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_window_read_ex(3)\fP
|
||||
.BR libssh2_channel_window_read_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_window_write - convenience macro for \fIlibssh2_channel_window_w
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_window_write(arguments)
|
||||
unsigend long libssh2_channel_window_write(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_window_write_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_window_write_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_window_write_ex(3)\fP
|
||||
.BR libssh2_channel_window_write_ex(3)
|
||||
|
@@ -7,8 +7,8 @@ libssh2_channel_write - convenience macro for \fIlibssh2_channel_write_ex(3)\fP
|
||||
.nf
|
||||
#include <libssh2.h>
|
||||
|
||||
#define libssh2_channel_write(channel, buf, buflen) \\
|
||||
libssh2_channel_write_ex((channel), 0, (buf), (buflen))
|
||||
ssize_t libssh2_channel_write(LIBSSH2_CHANNEL *channel, const char *buf, size_t buflen);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
underlying function \fIlibssh2_channel_write_ex(3)\fP.
|
||||
@@ -17,4 +17,4 @@ See \fIlibssh2_channel_write_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_write_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_write_ex(3)\fP
|
||||
.BR libssh2_channel_write_ex(3)
|
||||
|
@@ -7,8 +7,8 @@ libssh2_channel_write_stderr - convenience macro for \fIlibssh2_channel_write_ex
|
||||
.nf
|
||||
#include <libssh2.h>
|
||||
|
||||
#define libssh2_channel_write_stderr(channel, buf, buflen) \\
|
||||
libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen))
|
||||
ssize_t libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel, const char *buf, size_t buflen);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
underlying function \fIlibssh2_channel_write_ex(3)\fP.
|
||||
@@ -17,4 +17,4 @@ See \fIlibssh2_channel_write_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_write_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_write_ex(3)\fP
|
||||
.BR libssh2_channel_write_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_channel_x11_req - convenience macro for \fIlibssh2_channel_x11_req_ex(3)
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_channel_x11_req(arguments)
|
||||
int libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel, int screen_number);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_channel_x11_req_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_channel_x11_req_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_channel_x11_req_ex(3)\fP
|
||||
.BR libssh2_channel_x11_req_ex(3)
|
||||
|
@@ -1,14 +0,0 @@
|
||||
.\" $Id: libssh2_free_host_entry.3,v 1.1 2009/03/16 15:00:45 bagder Exp $
|
||||
.\"
|
||||
.TH libssh2_free_host_entry 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_free_host_entry - TODO
|
||||
.SH SYNOPSIS
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.SH RETURN VALUE
|
||||
|
||||
.SH ERRORS
|
||||
|
||||
.SH SEE ALSO
|
@@ -1,14 +0,0 @@
|
||||
.\" $Id: libssh2_host_entry_match.3,v 1.1 2009/03/16 15:00:45 bagder Exp $
|
||||
.\"
|
||||
.TH libssh2_host_entry_match 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_host_entry_match - TODO
|
||||
.SH SYNOPSIS
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.SH RETURN VALUE
|
||||
|
||||
.SH ERRORS
|
||||
|
||||
.SH SEE ALSO
|
27
docs/libssh2_keepalive_config.3
Normal file
27
docs/libssh2_keepalive_config.3
Normal file
@@ -0,0 +1,27 @@
|
||||
.TH libssh2_keepalive_config 3 "12 Apr 2011" "libssh2 1.2.5" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_keepalive_config - short function description
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
.nf
|
||||
|
||||
void libssh2_keepalive_config(LIBSSH2_SESSION *session,
|
||||
int want_reply,
|
||||
unsigned interval);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
Set how often keepalive messages should be sent. \fBwant_reply\fP indicates
|
||||
whether the keepalive messages should request a response from the server.
|
||||
\fBinterval\fP is number of seconds that can pass without any I/O, use 0 (the
|
||||
default) to disable keepalives. To avoid some busy-loop corner-cases, if you
|
||||
specify an interval of 1 it will be treated as 2.
|
||||
|
||||
Note that non-blocking applications are responsible for sending the keepalive
|
||||
messages using \fBlibssh2_keepalive_send(3)\fP.
|
||||
.SH RETURN VALUE
|
||||
Nothing
|
||||
.SH AVAILABILITY
|
||||
Added in libssh2 1.2.5
|
||||
.SH SEE ALSO
|
||||
.BR libssh2_keepalive_send(3)
|
||||
|
20
docs/libssh2_keepalive_send.3
Normal file
20
docs/libssh2_keepalive_send.3
Normal file
@@ -0,0 +1,20 @@
|
||||
.\" $Id: keepalive_send.3,v 1.4 2007/06/13 16:41:33 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_keepalive_send 3 "13 Apr 2011" "libssh2 1.2.5" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_keepalive_send - short function description
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
.nf
|
||||
|
||||
int libssh2_keepalive_send(LIBSSH2_SESSION *session,
|
||||
int *seconds_to_next);
|
||||
.SH DESCRIPTION
|
||||
Send a keepalive message if needed. \fBseconds_to_next\fP indicates how many
|
||||
seconds you can sleep after this call before you need to call it again.
|
||||
.SH RETURN VALUE
|
||||
Returns 0 on success, or LIBSSH2_ERROR_SOCKET_SEND on I/O errors.
|
||||
.SH AVAILABILITY
|
||||
Added in libssh2 1.2.5
|
||||
.SH SEE ALSO
|
||||
.BR libssh2_keepalive_config(3)
|
@@ -1,14 +0,0 @@
|
||||
.\" $Id: libssh2_new_host_entry.3,v 1.1 2009/03/16 15:00:45 bagder Exp $
|
||||
.\"
|
||||
.TH libssh2_new_host_entry 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_new_host_entry - TODO
|
||||
.SH SYNOPSIS
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.SH RETURN VALUE
|
||||
|
||||
.SH ERRORS
|
||||
|
||||
.SH SEE ALSO
|
@@ -6,7 +6,10 @@ libssh2_publickey_add - convenience macro for \fIlibssh2_publickey_add_ex(3)\fP
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_publickey_add(arguments)
|
||||
int libssh2_publickey_add(LIBSSH2_PUBLICKEY *pkey,
|
||||
const unsigned char *name,
|
||||
const unsigned char *blob, unsigned long blob_len, char overwrite,
|
||||
unsigned long num_attrs, const libssh2_publickey_attribute attrs[]);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +19,4 @@ See \fIlibssh2_publickey_add_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_publickey_add_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_publickey_add_ex(3)\fP
|
||||
.BR libssh2_publickey_add_ex(3)
|
||||
|
@@ -2,13 +2,26 @@
|
||||
.\"
|
||||
.TH libssh2_publickey_add_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_publickey_add_ex - TODO
|
||||
libssh2_publickey_add_ex - Add a public key entry
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
int
|
||||
libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name,
|
||||
unsigned long name_len, const unsigned char *blob,
|
||||
unsigned long blob_len, char overwrite,
|
||||
unsigned long num_attrs,
|
||||
const libssh2_publickey_attribute attrs[])
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
TBD
|
||||
.SH RETURN VALUE
|
||||
|
||||
Returns 0 on success, negative on failure.
|
||||
.SH ERRORS
|
||||
|
||||
LIBSSH2_ERROR_BAD_USE
|
||||
LIBSSH2_ERROR_ALLOC,
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
LIBSSH2_ERROR_SOCKET_SEND,
|
||||
LIBSSH2_ERROR_SOCKET_TIMEOUT,
|
||||
LIBSSH2_ERROR_PUBLICKEY_PROTOCOL,
|
||||
.SH SEE ALSO
|
||||
|
@@ -6,7 +6,9 @@ libssh2_publickey_remove - convenience macro for \fIlibssh2_publickey_remove_ex(
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_publickey_remove(arguments)
|
||||
int libssh2_publickey_remove(LIBSSH2_PUBLICKEY *pkey,
|
||||
const unsigned char *name, unsigned long name_len,
|
||||
const unsigned char *blob, unsigned long blob_len);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +18,4 @@ See \fIlibssh2_publickey_remove_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_publickey_remove_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_publickey_remove_ex(3)\fP
|
||||
.BR libssh2_publickey_remove_ex(3)
|
||||
|
@@ -6,7 +6,8 @@ libssh2_scp_send - convenience macro for \fIlibssh2_scp_send_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_scp_send(arguments)
|
||||
LIBSSH2_CHANNEL *
|
||||
libssh2_scp_send(LIBSSH2_SESSION *session, const char *path, int mode, size_t size);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +17,4 @@ See \fIlibssh2_scp_send_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_scp_send_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_scp_send_ex(3)\fP
|
||||
.BR libssh2_scp_send_ex(3)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\"
|
||||
.TH libssh2_session_block_directions 3 "1 Oct 2008" "libssh2 1.0" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_session_block_directions - get directions that socket should wait for before calling libssh2 function again
|
||||
libssh2_session_block_directions - get directions to wait for
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
@@ -26,6 +26,6 @@ LIBSSH2_SESSION_BLOCK_OUTBOUND: Outbound direction blocked.
|
||||
Application should wait for data to be available for socket prior to calling a
|
||||
libssh2 function again. If \fBLIBSSH2_SESSION_BLOCK_INBOUND\fP is set select
|
||||
should contain the session socket in readfds set. Correspondingly in case of
|
||||
\fBLIBSSH2_SESSION_BLOCK_INBOUND\fP writefds set should contain the socket.
|
||||
\fBLIBSSH2_SESSION_BLOCK_OUTBOUND\fP writefds set should contain the socket.
|
||||
.SH AVAILABILITY
|
||||
Added in 1.0
|
||||
|
@@ -6,7 +6,7 @@ libssh2_session_disconnect - convenience macro for \fIlibssh2_session_disconnect
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_session_disconnect(arguments)
|
||||
int libssh2_session_disconnect(LIBSSH2_SESSION *session, const char *description);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_session_disconnect_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_session_disconnect_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_session_disconnect_ex(3)\fP
|
||||
.BR libssh2_session_disconnect_ex(3)
|
||||
|
19
docs/libssh2_session_get_timeout.3
Normal file
19
docs/libssh2_session_get_timeout.3
Normal file
@@ -0,0 +1,19 @@
|
||||
.TH libssh2_session_get_timeout 3 "4 May 2011" "libssh2 1.2.9" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_session_get_timeout - get the timeout for blocking functions
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
.nf
|
||||
long libssh2_session_get_timeout(LIBSSH2_SESSION *session);
|
||||
.SH DESCRIPTION
|
||||
Returns the \fBtimeout\fP (in milliseconds) for how long a blocking the
|
||||
libssh2 function calls may wait until they consider the situation an error and
|
||||
return LIBSSH2_ERROR_TIMEOUT.
|
||||
|
||||
By default libssh2 has no timeout (zero) for blocking functions.
|
||||
.SH RETURN VALUE
|
||||
The value of the timeout setting.
|
||||
.SH AVAILABILITY
|
||||
Added in 1.2.9
|
||||
.SH SEE ALSO
|
||||
.BR libssh2_session_set_timeout(3)
|
@@ -6,7 +6,8 @@ libssh2_session_init - convenience macro for \fIlibssh2_session_init_ex(3)\fP ca
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_session_init(arguments)
|
||||
LIBSSH2_SESSION *
|
||||
libssh2_session_init(void);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +17,4 @@ See \fIlibssh2_session_init_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_session_init_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_session_init_ex(3)\fP
|
||||
.BR libssh2_session_init_ex(3)
|
||||
|
20
docs/libssh2_session_set_timeout.3
Normal file
20
docs/libssh2_session_set_timeout.3
Normal file
@@ -0,0 +1,20 @@
|
||||
.TH libssh2_session_set_timeout 3 "4 May 2011" "libssh2 1.2.9" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_session_set_timeout - set timeout for blocking functions
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
.nf
|
||||
void libssh2_session_set_timeout(LIBSSH2_SESSION *session, long timeout);
|
||||
.SH DESCRIPTION
|
||||
Set the \fBtimeout\fP in milliseconds for how long a blocking the libssh2
|
||||
function calls may wait until they consider the situation an error and return
|
||||
LIBSSH2_ERROR_TIMEOUT.
|
||||
|
||||
By default or if you set the timeout to zero, libssh2 has no timeout for
|
||||
blocking functions.
|
||||
.SH RETURN VALUE
|
||||
Nothing
|
||||
.SH AVAILABILITY
|
||||
Added in 1.2.9
|
||||
.SH SEE ALSO
|
||||
.BR libssh2_session_get_timeout(3)
|
@@ -6,7 +6,7 @@ libssh2_sftp_close - convenience macro for \fIlibssh2_sftp_close_handle(3)\fP ca
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_close(arguments)
|
||||
int libssh2_sftp_close(LIBSSH2_SFTP_HANDLE *handle);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.BR libssh2_sftp_close_handle(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_closedir - convenience macro for \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_closedir(arguments)
|
||||
int libssh2_sftp_closedir(LIBSSH2_SFTP_HANDLE *handle)
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_close_handle(3)\fP
|
||||
.BR libssh2_sftp_close_handle(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_fsetstat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP cal
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_fsetstat(arguments)
|
||||
int libssh2_sftp_fsetstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.BR libssh2_sftp_fstat_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_fstat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_fstat(arguments)
|
||||
int libssh2_sftp_fstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.BR libssh2_sftp_fstat_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_lstat - convenience macro for \fIlibssh2_sftp_stat_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_lstat(arguments)
|
||||
int libssh2_sftp_lstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_stat_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_stat_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_stat_ex(3)\fP
|
||||
.BR libssh2_sftp_stat_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_mkdir - convenience macro for \fIlibssh2_sftp_mkdir_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_mkdir(arguments)
|
||||
int libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path, long mode);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_mkdir_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_mkdir_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_mkdir_ex(3)\fP
|
||||
.BR libssh2_sftp_mkdir_ex(3)
|
||||
|
@@ -6,7 +6,8 @@ libssh2_sftp_open - convenience macro for \fIlibssh2_sftp_open_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_open(arguments)
|
||||
LIBSSH2_SFTP_HANDLE *
|
||||
libssh2_sftp_open(LIBSSH2_SFTP *sftp, const char *path, unsigned long flags, long mode);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +17,4 @@ See \fIlibssh2_sftp_open_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_open_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_open_ex(3)\fP
|
||||
.BR libssh2_sftp_open_ex(3)
|
||||
|
@@ -6,7 +6,8 @@ libssh2_sftp_opendir - convenience macro for \fIlibssh2_sftp_open_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_opendir(arguments)
|
||||
LIBSSH2_SFTP_HANDLE *
|
||||
libssh2_sftp_opendir(LIBSSH2_SFTP *sftp, const char *path);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +17,4 @@ See \fIlibssh2_sftp_open_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_open_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_open_ex(3)\fP
|
||||
.BR libssh2_sftp_open_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_readdir - convenience macro for \fIlibssh2_sftp_readdir_ex(3)\fP ca
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_readdir(arguments)
|
||||
int libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ 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
|
||||
.BR libssh2_sftp_readdir_ex(3)
|
||||
|
@@ -18,4 +18,4 @@ See \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.BR libssh2_sftp_symlink_ex(3)
|
||||
|
@@ -18,4 +18,4 @@ See \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.BR libssh2_sftp_symlink_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_rename - convenience macro for \fIlibssh2_sftp_rename_ex(3)\fP call
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_rename(arguments)
|
||||
int libssh2_sftp_rename(LIBSSH2_SFTP *sftp, const char *source_filename, const char *destination_filename);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_rename_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_rename_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_rename_ex(3)\fP
|
||||
.BR libssh2_sftp_rename_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_rewind - convenience macro for \fIlibssh2_sftp_seek64(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_rewind(arguments)
|
||||
int libssh2_sftp_rewind(LINBSSH2_SFTP_HANDLE *handle);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_seek64(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_seek64(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_seek64(3)\fP
|
||||
.BR libssh2_sftp_seek64(3)
|
||||
|
@@ -17,4 +17,4 @@ See \fIlibssh2_sftp_rmdir_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_rmdir_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_rmdir_ex(3)\fP
|
||||
.BR libssh2_sftp_rmdir_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_setstat - convenience macro for \fIlibssh2_sftp_stat_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_setstat(arguments)
|
||||
int libssh2_sftp_setstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attr);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_stat_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_stat_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_stat_ex(3)\fP
|
||||
.BR libssh2_sftp_stat_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_stat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_stat(arguments)
|
||||
int libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_STFP_ATTRIBUTES *attrs);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_fstat_ex(3)\fP
|
||||
.BR libssh2_sftp_fstat_ex(3)
|
||||
|
@@ -18,4 +18,4 @@ See \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_symlink_ex(3)\fP
|
||||
.BR libssh2_sftp_symlink_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_sftp_unlink - convenience macro for \fIlibssh2_sftp_unlink_ex(3)\fP call
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_sftp_unlink(arguments)
|
||||
int libssh2_sftp_unlink(LIBSSH2_SFTP *sftp, const char *filename);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_sftp_unlink_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_sftp_unlink_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_sftp_unlink_ex(3)\fP
|
||||
.BR libssh2_sftp_unlink_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_userauth_hostbased_fromfile - convenience macro for \fIlibssh2_userauth_
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_userauth_hostbased_fromfile(arguments)
|
||||
int libssh2_userauth_hostbased_fromfile(LIBSSH2_SESSION *session, const char *username, const char *publickey, const char *privatekey, const char *passphrase, const char *hostname);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +16,4 @@ See \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_userauth_hostbased_fromfile_ex(3)\fP
|
||||
.BR libssh2_userauth_hostbased_fromfile_ex(3)
|
||||
|
@@ -6,7 +6,11 @@ libssh2_userauth_keyboard_interactive - convenience macro for \fIlibssh2_useraut
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_userauth_keyboard_interactive(arguments)
|
||||
int
|
||||
libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION* session,
|
||||
const char *username,
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*response_callback)));
|
||||
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +20,4 @@ See \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_userauth_keyboard_interactive_ex(3)\fP
|
||||
.BR libssh2_userauth_keyboard_interactive_ex(3)
|
||||
|
@@ -2,44 +2,59 @@
|
||||
.\"
|
||||
.TH libssh2_userauth_keyboard_interactive_ex 3 "8 Mar 2008" "libssh2 0.19" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_userauth_keyboard_interactive_ex - authenticate a session using a challenge-response authentication
|
||||
libssh2_userauth_keyboard_interactive_ex - authenticate a session using
|
||||
keyboard-interactive authentication
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
#include <libssh2.h>
|
||||
|
||||
int
|
||||
libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(*response_callback));
|
||||
|
||||
int
|
||||
libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION *session, const char *username, LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(*response_callback));
|
||||
|
||||
libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
unsigned int username_len,
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(*response_callback));
|
||||
.SH DESCRIPTION
|
||||
\fIsession\fP - Session instance as returned by
|
||||
.BR libssh2_session_init_ex(3)
|
||||
\fIsession\fP - Session instance as returned by
|
||||
\fIlibssh2_session_init_ex(3)\fP.
|
||||
|
||||
\fIusername\fP - Name of user to attempt plain password authentication for.
|
||||
\fIusername\fP - Name of user to attempt keyboard-interactive authentication
|
||||
for.
|
||||
|
||||
\fIusername_len\fP - Length of username parameter.
|
||||
|
||||
\fIresponse_callback\fP - As authentication proceeds, host issues several (1 or more) challenges and requires responses. This callback will be called at this moment. Callback is responsible to obtain responses for the challenges, fill the provided data structure and then return control. Responses will be sent to the host. String values will be free(3)ed by the library.
|
||||
\fIresponse_callback\fP - As authentication proceeds, the host issues several
|
||||
(1 or more) challenges and requires responses. This callback will be called at
|
||||
this moment. The callback is responsible to obtain responses for the
|
||||
challenges, fill the provided data structure and then return
|
||||
control. Responses will be sent to the host. String values will be free(3)ed
|
||||
by the library. The callback prototype must match this:
|
||||
|
||||
.nf
|
||||
void response(const char *name,
|
||||
int name_len, const char *instruction,
|
||||
int instruction_len,
|
||||
int num_prompts,
|
||||
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
||||
void **abstract);
|
||||
.fi
|
||||
|
||||
Attempts keyboard-interactive (challenge/response) authentication.
|
||||
|
||||
Note that many SSH servers will always issue single "password" challenge,
|
||||
requesting actual password as response, but it is not required by the protocol,
|
||||
and various authentication schemes, such as smartcard authentication may use
|
||||
keyboard-interactive authentication type too.
|
||||
|
||||
Note that many SSH servers will always issue a single "password" challenge,
|
||||
requesting actual password as response, but it is not required by the
|
||||
protocol, and various authentication schemes, such as smartcard authentication
|
||||
may use keyboard-interactive authentication type too.
|
||||
.SH RETURN VALUE
|
||||
Return 0 on success or negative on failure. It returns
|
||||
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
|
||||
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
|
||||
|
||||
Return 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN
|
||||
when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative
|
||||
number, it isn't really a failure per se.
|
||||
.SH ERRORS
|
||||
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
|
||||
|
||||
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
|
||||
|
||||
\fLIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - failed, invalid username/password or public/private key.
|
||||
|
||||
\fLIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - failed, invalid username/password
|
||||
or public/private key.
|
||||
.SH SEE ALSO
|
||||
.BR libssh2_session_init_ex(3)
|
||||
|
@@ -6,7 +6,9 @@ libssh2_userauth_password - convenience macro for \fIlibssh2_userauth_password_e
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_userauth_password(arguments)
|
||||
int libssh2_userauth_password(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +18,4 @@ See \fIlibssh2_userauth_password_ex(3)\fP
|
||||
.SH ERRORS
|
||||
See \fIlibssh2_userauth_password_ex(3)\fP
|
||||
.SH SEE ALSO
|
||||
.BR \fIlibssh2_userauth_password_ex(3)\fP
|
||||
.BR libssh2_userauth_password_ex(3)
|
||||
|
@@ -6,7 +6,7 @@ libssh2_userauth_publickey - authenticate using a callback function
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
.NF
|
||||
.nf
|
||||
int libssh2_userauth_publickey(LIBSSH2_SESSION *session,
|
||||
const char *user,
|
||||
const unsigned char *pubkeydata,
|
||||
|
@@ -6,7 +6,12 @@ libssh2_userauth_publickey_fromfile - convenience macro for \fIlibssh2_userauth_
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
libssh2_userauth_publickey_fromfile(arguments)
|
||||
int
|
||||
libssh2_userauth_publickey_fromfile(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase);
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a macro defined in a public libssh2 header file that is using the
|
||||
@@ -16,4 +21,4 @@ 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
|
||||
.BR libssh2_userauth_publickey_fromfile_ex(3)
|
||||
|
9
example/.gitignore
vendored
9
example/.gitignore
vendored
@@ -23,3 +23,12 @@ ssh2_agent
|
||||
libssh2_config.h
|
||||
libssh2_config.h.in
|
||||
stamp-h2
|
||||
sftp_append
|
||||
ssh2_echo
|
||||
subsystem_netconf
|
||||
test-scp
|
||||
test-sftp_append
|
||||
test-sftp_nonblock
|
||||
test-sftp_write
|
||||
test-sftp_write_nonblock
|
||||
test-ssh2_echo
|
||||
|
@@ -6,7 +6,8 @@ EXTRA_DIST = libssh2_config.h.in
|
||||
noinst_PROGRAMS = direct_tcpip ssh2 scp scp_nonblock scp_write \
|
||||
scp_write_nonblock sftp sftp_nonblock sftp_write sftp_write_nonblock \
|
||||
sftp_mkdir sftp_mkdir_nonblock sftp_RW_nonblock sftpdir \
|
||||
sftpdir_nonblock ssh2_exec ssh2_agent ssh2_echo sftp_append
|
||||
sftpdir_nonblock ssh2_exec ssh2_agent ssh2_echo sftp_append \
|
||||
subsystem_netconf
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/example
|
||||
LDADD = $(top_builddir)/src/libssh2.la
|
||||
|
@@ -235,9 +235,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else {
|
||||
prev = nread;
|
||||
if(rc > nread) {
|
||||
fprintf(stderr, "MOO %d > %d\n", (int)rc, (int)nread);
|
||||
}
|
||||
|
||||
/* rc indicates how many bytes were written this time */
|
||||
nread -= rc;
|
||||
ptr += rc;
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: sftp_write_nonblock.c,v 1.14 2009/04/28 10:35:30 bagder Exp $
|
||||
*
|
||||
* Sample showing how to do SFTP non-blocking write transfers.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
@@ -237,7 +235,11 @@ int main(int argc, char *argv[])
|
||||
nread = fread(&mem[memuse], 1, sizeof(mem)-memuse, local);
|
||||
if (nread <= 0) {
|
||||
/* end of file */
|
||||
break;
|
||||
if (memuse > 0)
|
||||
/* the previous sending is not finished */
|
||||
nread = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
memuse += nread;
|
||||
total += nread;
|
||||
@@ -245,19 +247,19 @@ int main(int argc, char *argv[])
|
||||
/* write data in a loop until we block */
|
||||
while ((rc = libssh2_sftp_write(sftp_handle, mem, memuse)) ==
|
||||
LIBSSH2_ERROR_EAGAIN) {
|
||||
waitsocket(sock, session);
|
||||
waitsocket(sock, session);
|
||||
}
|
||||
if(rc < 0)
|
||||
break;
|
||||
break;
|
||||
|
||||
if(memuse - rc) {
|
||||
/* make room for more data at the end of the buffer */
|
||||
memmove(&mem[0], &mem[rc], memuse - rc);
|
||||
memuse -= rc;
|
||||
/* make room for more data at the end of the buffer */
|
||||
memmove(&mem[0], &mem[rc], memuse - rc);
|
||||
memuse -= rc;
|
||||
}
|
||||
else
|
||||
/* 'mem' was consumed fully */
|
||||
memuse = 0;
|
||||
/* 'mem' was consumed fully */
|
||||
memuse = 0;
|
||||
|
||||
} while (rc > 0);
|
||||
|
||||
|
274
example/subsystem_netconf.c
Normal file
274
example/subsystem_netconf.c
Normal file
@@ -0,0 +1,274 @@
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#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";
|
||||
const char *password = "";
|
||||
|
||||
const char *server_ip = "127.0.0.1";
|
||||
|
||||
enum {
|
||||
AUTH_NONE = 0,
|
||||
AUTH_PASSWORD,
|
||||
AUTH_PUBLICKEY
|
||||
};
|
||||
|
||||
int netconf_write(LIBSSH2_CHANNEL *channel, const char *buf, size_t len)
|
||||
{
|
||||
int i;
|
||||
ssize_t wr = 0;
|
||||
|
||||
do {
|
||||
i = libssh2_channel_write(channel, buf, len);
|
||||
if (i < 0) {
|
||||
fprintf(stderr, "libssh2_channel_write: %d\n", i);
|
||||
return -1;
|
||||
}
|
||||
wr += i;
|
||||
} while (i > 0 && wr < len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int netconf_read_until(LIBSSH2_CHANNEL *channel, const char *endtag, char *buf, size_t buflen)
|
||||
{
|
||||
ssize_t len, rd = 0;
|
||||
char *endreply, *specialsequence = NULL;
|
||||
|
||||
memset(buf, 0, buflen);
|
||||
|
||||
do {
|
||||
len = libssh2_channel_read(channel, buf + rd, buflen - rd);
|
||||
if (LIBSSH2_ERROR_EAGAIN == len)
|
||||
continue;
|
||||
else if (len < 0) {
|
||||
fprintf(stderr, "libssh2_channel_read: %d", (int)len);
|
||||
return -1;
|
||||
}
|
||||
rd += len;
|
||||
|
||||
/* read more data until we see a rpc-reply closing tag followed by
|
||||
* the special sequence ]]>]]> */
|
||||
|
||||
/* really, this MUST be replaced with proper XML parsing! */
|
||||
|
||||
endreply = strstr(buf, endtag);
|
||||
if (endreply)
|
||||
specialsequence = strstr(endreply, "]]>]]>");
|
||||
|
||||
} while (!endreply || !specialsequence);
|
||||
|
||||
/* discard the special sequence so that only XML is returned */
|
||||
rd = specialsequence - buf;
|
||||
buf[rd] = 0;
|
||||
|
||||
return rd;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int rc, sock = -1, i, auth = AUTH_NONE;
|
||||
struct sockaddr_in sin;
|
||||
socklen_t sinlen;
|
||||
const char *fingerprint;
|
||||
char *userauthlist;
|
||||
LIBSSH2_SESSION *session;
|
||||
LIBSSH2_CHANNEL *channel = NULL;
|
||||
char buf[1048576]; /* avoid any buffer reallocation for simplicity */
|
||||
ssize_t len;
|
||||
|
||||
#ifdef WIN32
|
||||
char sockopt;
|
||||
WSADATA wsadata;
|
||||
|
||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
||||
#else
|
||||
int sockopt;
|
||||
#endif
|
||||
|
||||
if (argc > 1)
|
||||
server_ip = argv[1];
|
||||
if (argc > 2)
|
||||
username = argv[2];
|
||||
if (argc > 3)
|
||||
password = argv[3];
|
||||
|
||||
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;
|
||||
if (INADDR_NONE == (sin.sin_addr.s_addr = inet_addr(server_ip))) {
|
||||
fprintf(stderr, "inet_addr: Invalid IP address \"%s\"\n", server_ip);
|
||||
return -1;
|
||||
}
|
||||
sin.sin_port = htons(830);
|
||||
if (connect(sock, (struct sockaddr*)(&sin),
|
||||
sizeof(struct sockaddr_in)) != 0) {
|
||||
fprintf(stderr, "Failed to connect to %s!\n", inet_ntoa(sin.sin_addr));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Create a session instance */
|
||||
session = libssh2_session_init();
|
||||
if(!session) {
|
||||
fprintf(stderr, "Could not initialize SSH session!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_startup(session, sock);
|
||||
if(rc) {
|
||||
fprintf(stderr, "Error when starting up SSH session: %d\n", rc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* At this point we havn't yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
for(i = 0; i < 20; i++)
|
||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
/* check what authentication methods are available */
|
||||
userauthlist = libssh2_userauth_list(session, username, strlen(username));
|
||||
printf("Authentication methods: %s\n", userauthlist);
|
||||
if (strstr(userauthlist, "password"))
|
||||
auth |= AUTH_PASSWORD;
|
||||
if (strstr(userauthlist, "publickey"))
|
||||
auth |= AUTH_PUBLICKEY;
|
||||
|
||||
/* check for options */
|
||||
if(argc > 4) {
|
||||
if ((auth & AUTH_PASSWORD) && !strcasecmp(argv[4], "-p"))
|
||||
auth = AUTH_PASSWORD;
|
||||
if ((auth & AUTH_PUBLICKEY) && !strcasecmp(argv[4], "-k"))
|
||||
auth = AUTH_PUBLICKEY;
|
||||
}
|
||||
|
||||
if (auth & AUTH_PASSWORD) {
|
||||
if (libssh2_userauth_password(session, username, password)) {
|
||||
fprintf(stderr, "Authentication by password failed.\n");
|
||||
goto shutdown;
|
||||
}
|
||||
} else if (auth & AUTH_PUBLICKEY) {
|
||||
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1,
|
||||
keyfile2, password)) {
|
||||
printf("Authentication by public key failed!\n");
|
||||
goto shutdown;
|
||||
}
|
||||
printf("Authentication by public key succeeded.\n");
|
||||
} else {
|
||||
printf("No supported authentication methods found!\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* open a channel */
|
||||
channel = libssh2_channel_open_session(session);
|
||||
if (!channel) {
|
||||
fprintf(stderr, "Could not open the channel!\n"
|
||||
"(Note that this can be a problem at the server!"
|
||||
" Please review the server logs.)\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* execute the subsystem on our channel */
|
||||
if (libssh2_channel_subsystem(channel, "netconf")) {
|
||||
fprintf(stderr, "Could not execute the \"netconf\" subsystem!\n"
|
||||
"(Note that this can be a problem at the server!"
|
||||
" Please review the server logs.)\n");
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* NETCONF: http://tools.ietf.org/html/draft-ietf-netconf-ssh-06 */
|
||||
|
||||
printf("Sending NETCONF client <hello>\n");
|
||||
snprintf(buf, sizeof(buf),
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<hello>"
|
||||
"<capabilities>"
|
||||
"<capability>urn:ietf:params:xml:ns:netconf:base:1.0</capability>"
|
||||
"</capabilities>"
|
||||
"</hello>\n"
|
||||
"]]>]]>\n%n", &len);
|
||||
if (-1 == netconf_write(channel, buf, len))
|
||||
goto shutdown;
|
||||
|
||||
printf("Reading NETCONF server <hello>\n");
|
||||
len = netconf_read_until(channel, "</hello>", buf, sizeof(buf));
|
||||
if (-1 == len)
|
||||
goto shutdown;
|
||||
|
||||
printf("Got %d bytes:\n----------------------\n%s", len, buf);
|
||||
|
||||
printf("Sending NETCONF <rpc>\n");
|
||||
snprintf(buf, sizeof(buf),
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
|
||||
"<get-interface-information><terse/></get-interface-information>"
|
||||
"</rpc>\n"
|
||||
"]]>]]>\n%n", &len);
|
||||
if (-1 == netconf_write(channel, buf, len))
|
||||
goto shutdown;
|
||||
|
||||
printf("Reading NETCONF <rpc-reply>\n");
|
||||
len = netconf_read_until(channel, "</rpc-reply>", buf, sizeof(buf));
|
||||
if (-1 == len)
|
||||
goto shutdown;
|
||||
|
||||
printf("Got %d bytes:\n----------------------\n%s", len, buf);
|
||||
|
||||
shutdown:
|
||||
if (channel)
|
||||
libssh2_channel_free(channel);
|
||||
libssh2_session_disconnect(session, "Client disconnecting normally");
|
||||
libssh2_session_free(session);
|
||||
|
||||
#ifdef WIN32
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
|
||||
libssh2_exit();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -408,14 +408,16 @@ main (int argc, char *argv[])
|
||||
current_node = NULL;
|
||||
|
||||
while (current_node != NULL) {
|
||||
struct chan_X11_list *next_node;
|
||||
rc = x11_send_receive(current_node->chan, current_node->sock);
|
||||
next_node = current_node->next;
|
||||
if (rc == -1){
|
||||
shutdown(current_node->sock,SHUT_RDWR);
|
||||
close(current_node->sock);
|
||||
remove_node(current_node);
|
||||
|
||||
}
|
||||
current_node = current_node->next;
|
||||
|
||||
current_node = next_node;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -40,19 +40,19 @@
|
||||
#ifndef LIBSSH2_H
|
||||
#define LIBSSH2_H 1
|
||||
|
||||
#define LIBSSH2_COPYRIGHT "2004-2010 The libssh2 project and its contributors."
|
||||
#define LIBSSH2_COPYRIGHT "2004-2011 The libssh2 project and its contributors."
|
||||
|
||||
/* We use underscore instead of dash when appending DEV in dev versions just
|
||||
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.8_DEV"
|
||||
#define LIBSSH2_VERSION "1.2.9_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 8
|
||||
#define LIBSSH2_VERSION_PATCH 9
|
||||
|
||||
/* This is the numeric version of the libssh2 version number, meant for easier
|
||||
parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will
|
||||
@@ -69,7 +69,7 @@
|
||||
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 0x010208
|
||||
#define LIBSSH2_VERSION_NUM 0x010209
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
@@ -87,7 +87,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
# include <BaseTsd.h>
|
||||
# include <WinSock2.h>
|
||||
#endif
|
||||
@@ -705,6 +705,10 @@ LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
|
||||
LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
|
||||
int blocking);
|
||||
|
||||
LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
|
||||
long timeout);
|
||||
LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
|
||||
|
||||
/* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
|
||||
LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
|
||||
int ignore_mode);
|
||||
|
@@ -9,8 +9,8 @@ includedir=@includedir@
|
||||
|
||||
Name: libssh2
|
||||
URL: http://www.libssh2.org/
|
||||
Description: Library for SSH based connunication
|
||||
Version: @VERSION@
|
||||
Description: Library for SSH-based communication
|
||||
Version: @LIBSSH2VER@
|
||||
Libs: -L${libdir} -lssh2 @LDFLAGS@ @LIBS@
|
||||
Libs.private: @LIBS@
|
||||
Cflags: -I${includedir}
|
||||
|
2
maketgz
2
maketgz
@@ -68,7 +68,7 @@ fi
|
||||
# Generate the changelog
|
||||
#
|
||||
echo "generate NEWS"
|
||||
git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./log2changes.pl > NEWS.dist
|
||||
git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./git2news.pl > NEWS.dist
|
||||
|
||||
############################################################################
|
||||
#
|
||||
|
@@ -19,7 +19,7 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8q
|
||||
OPENSSL_PATH = ../../openssl-0.9.8r
|
||||
endif
|
||||
|
||||
# Edit the path below to point to your Distribution folder.
|
||||
|
@@ -486,13 +486,13 @@ agent_list_identities(LIBSSH2_AGENT *agent)
|
||||
ssize_t len, num_identities;
|
||||
unsigned char *s;
|
||||
int rc;
|
||||
unsigned char c = SSH2_AGENTC_REQUEST_IDENTITIES;
|
||||
|
||||
/* Create a request to list identities */
|
||||
if (transctx->state == agent_NB_state_init) {
|
||||
unsigned char c = SSH2_AGENTC_REQUEST_IDENTITIES;
|
||||
transctx->request = &c;
|
||||
transctx->request_len = 1;
|
||||
transctx->state = agent_NB_state_request_created;
|
||||
transctx->request = &c;
|
||||
transctx->request_len = 1;
|
||||
transctx->state = agent_NB_state_request_created;
|
||||
}
|
||||
|
||||
/* Make sure to be re-called as a result of EAGAIN. */
|
||||
|
@@ -2022,7 +2022,7 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
|
||||
if(channel->local.window_size <= 0)
|
||||
/* there's no room for data so we stop */
|
||||
return 0;
|
||||
return (rc==LIBSSH2_ERROR_EAGAIN?rc:0);
|
||||
|
||||
channel->write_bufwrite = buflen;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 by Daniel Stenberg
|
||||
* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
@@ -617,7 +617,7 @@ static int oldstyle_hostline(LIBSSH2_KNOWNHOSTS *hosts,
|
||||
|
||||
if(name > host) {
|
||||
namelen = 0;
|
||||
--name; // skip comma
|
||||
--name; /* skip comma */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2004-2008, 2010, Sara Golemon <sarag@libssh2.org>
|
||||
* Copyright (c) 2009 by Daniel Stenberg
|
||||
* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||
* Copyright (c) 2010 Simon Josefsson
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -559,6 +559,9 @@ struct _LIBSSH2_SESSION
|
||||
/* this is set to TRUE if a blocking API behavior is requested */
|
||||
int api_block_mode;
|
||||
|
||||
/* Timeout used when blocking API behavior is active */
|
||||
long api_timeout;
|
||||
|
||||
/* Server's public key */
|
||||
const LIBSSH2_HOSTKEY_METHOD *hostkey;
|
||||
void *server_hostkey_abstract;
|
||||
|
23
src/misc.c
23
src/misc.c
@@ -108,8 +108,14 @@ _libssh2_recv(libssh2_socket_t sock, void *buffer, size_t length, int flags)
|
||||
return -errno;
|
||||
}
|
||||
#else
|
||||
if (rc < 0 )
|
||||
return -errno;
|
||||
if (rc < 0 ){
|
||||
/* Sometimes the first recv() function call sets errno to ENOENT on
|
||||
Solaris and HP-UX */
|
||||
if ( errno == ENOENT )
|
||||
return -EAGAIN;
|
||||
else
|
||||
return -errno;
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
@@ -418,7 +424,7 @@ _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
|
||||
}
|
||||
}
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
_libssh2_gettimeofday(&now, NULL);
|
||||
if(!firstsec) {
|
||||
firstsec = now.tv_sec;
|
||||
}
|
||||
@@ -557,16 +563,15 @@ void _libssh2_list_insert(struct list_node *after, /* insert before this */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(LIBSSH2_WIN32) && !defined(__MINGW32__)
|
||||
/* this define is defined in misc.h for the correct platforms */
|
||||
#ifdef LIBSSH2_GETTIMEOFDAY_WIN32
|
||||
/*
|
||||
* gettimeofday
|
||||
* Implementation according to:
|
||||
* The Open Group Base Specifications Issue 6
|
||||
* IEEE Std 1003.1, 2004 Edition
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
@@ -585,9 +590,7 @@ void _libssh2_list_insert(struct list_node *after, /* insert before this */
|
||||
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
|
||||
#define _W32_FT_OFFSET (116444736000000000)
|
||||
|
||||
|
||||
int __cdecl gettimeofday(struct timeval *tp,
|
||||
void *tzp)
|
||||
int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp)
|
||||
{
|
||||
union {
|
||||
unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
|
||||
|
15
src/misc.h
15
src/misc.h
@@ -1,6 +1,6 @@
|
||||
#ifndef __LIBSSH2_MISC_H
|
||||
#define __LIBSSH2_MISC_H
|
||||
/* Copyright (c) 2009-2010 by Daniel Stenberg
|
||||
/* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -78,4 +78,17 @@ void _libssh2_htonu32(unsigned char *buf, uint32_t val);
|
||||
void _libssh2_store_u32(unsigned char **buf, uint32_t value);
|
||||
void _libssh2_store_str(unsigned char **buf, const char *str, size_t len);
|
||||
|
||||
#if defined(LIBSSH2_WIN32) && !defined(__MINGW32__)
|
||||
/* provide a private one */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp);
|
||||
#define HAVE_LIBSSH2_GETTIMEOFDAY
|
||||
#define LIBSSH2_GETTIMEOFDAY_WIN32 /* enable the win32 implementation */
|
||||
#else
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#define _libssh2_gettimeofday(x,y) gettimeofday(x,y)
|
||||
#define HAVE_LIBSSH2_GETTIMEOFDAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _LIBSSH2_MISC_H */
|
||||
|
12
src/scp.c
12
src/scp.c
@@ -272,6 +272,8 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, struct stat * sb)
|
||||
{
|
||||
int cmd_len;
|
||||
int rc;
|
||||
int tmp_err_code;
|
||||
const char *tmp_err_msg;
|
||||
|
||||
if (session->scpRecv_state == libssh2_NB_state_idle) {
|
||||
session->scpRecv_mode = 0;
|
||||
@@ -741,8 +743,12 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, struct stat * sb)
|
||||
return session->scpRecv_channel;
|
||||
/* fall-through */
|
||||
scp_recv_error:
|
||||
tmp_err_code = session->err_code;
|
||||
tmp_err_msg = session->err_msg;
|
||||
while (libssh2_channel_free(session->scpRecv_channel) ==
|
||||
LIBSSH2_ERROR_EAGAIN);
|
||||
session->err_code = tmp_err_code;
|
||||
session->err_msg = tmp_err_msg;
|
||||
session->scpRecv_channel = NULL;
|
||||
session->scpRecv_state = libssh2_NB_state_idle;
|
||||
return NULL;
|
||||
@@ -774,6 +780,8 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
|
||||
{
|
||||
int cmd_len;
|
||||
int rc;
|
||||
int tmp_err_code;
|
||||
const char *tmp_err_msg;
|
||||
|
||||
if (session->scpSend_state == libssh2_NB_state_idle) {
|
||||
session->scpSend_command_len =
|
||||
@@ -1034,8 +1042,12 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
|
||||
return session->scpSend_channel;
|
||||
/* fall-through */
|
||||
scp_send_error:
|
||||
tmp_err_code = session->err_code;
|
||||
tmp_err_msg = session->err_msg;
|
||||
while (libssh2_channel_free(session->scpSend_channel) ==
|
||||
LIBSSH2_ERROR_EAGAIN);
|
||||
session->err_code = tmp_err_code;
|
||||
session->err_msg = tmp_err_msg;
|
||||
session->scpSend_channel = NULL;
|
||||
session->scpSend_state = libssh2_NB_state_idle;
|
||||
return NULL;
|
||||
|
168
src/session.c
168
src/session.c
@@ -56,6 +56,7 @@
|
||||
#include "session.h"
|
||||
#include "channel.h"
|
||||
#include "mac.h"
|
||||
#include "misc.h"
|
||||
|
||||
/* libssh2_default_alloc
|
||||
*/
|
||||
@@ -481,6 +482,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
|
||||
session->free = local_free;
|
||||
session->realloc = local_realloc;
|
||||
session->abstract = abstract;
|
||||
session->api_timeout = 0; /* timeout-free API by default */
|
||||
session->api_block_mode = 1; /* blocking API by default */
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_TRANS,
|
||||
"New session resource allocated");
|
||||
@@ -542,11 +544,14 @@ libssh2_session_callback_set(LIBSSH2_SESSION * session,
|
||||
* Utility function that waits for action on the socket. Returns 0 when ready
|
||||
* to run again or error on timeout.
|
||||
*/
|
||||
int _libssh2_wait_socket(LIBSSH2_SESSION *session)
|
||||
int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
|
||||
{
|
||||
int rc;
|
||||
int seconds_to_next;
|
||||
int dir;
|
||||
int has_timeout;
|
||||
long ms_to_next = 0;
|
||||
long elapsed_ms;
|
||||
|
||||
/* since libssh2 often sets EAGAIN internally before this function is
|
||||
called, we can decrease some amount of confusion in user programs by
|
||||
@@ -557,64 +562,82 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
|
||||
rc = libssh2_keepalive_send (session, &seconds_to_next);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
else {
|
||||
/* figure out what to wait for */
|
||||
dir = libssh2_session_block_directions(session);
|
||||
|
||||
if(!dir) {
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
|
||||
"Nothing to wait for in wait_socket");
|
||||
/* To avoid that we hang below just because there's nothing set to
|
||||
wait for, we timeout on 1 second to also avoid busy-looping
|
||||
during this condition */
|
||||
seconds_to_next = 1;
|
||||
}
|
||||
{
|
||||
#ifdef HAVE_POLL
|
||||
struct pollfd sockets[1];
|
||||
ms_to_next = seconds_to_next * 1000;
|
||||
|
||||
sockets[0].fd = session->socket_fd;
|
||||
sockets[0].events = 0;
|
||||
sockets[0].revents = 0;
|
||||
/* figure out what to wait for */
|
||||
dir = libssh2_session_block_directions(session);
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_INBOUND)
|
||||
sockets[0].events |= POLLIN;
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
|
||||
sockets[0].events |= POLLOUT;
|
||||
|
||||
rc = poll(sockets, 1, seconds_to_next ?
|
||||
seconds_to_next * 1000 : -1);
|
||||
#else
|
||||
fd_set rfd;
|
||||
fd_set wfd;
|
||||
fd_set *writefd = NULL;
|
||||
fd_set *readfd = NULL;
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = seconds_to_next;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
|
||||
FD_ZERO(&rfd);
|
||||
FD_SET(session->socket_fd, &rfd);
|
||||
readfd = &rfd;
|
||||
}
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND) {
|
||||
FD_ZERO(&wfd);
|
||||
FD_SET(session->socket_fd, &wfd);
|
||||
writefd = &wfd;
|
||||
}
|
||||
|
||||
/* Note that this COULD be made to use a timeout that perhaps
|
||||
could be customizable by the app or something... */
|
||||
rc = select(session->socket_fd + 1, readfd, writefd, NULL,
|
||||
seconds_to_next ? &tv : NULL);
|
||||
#endif
|
||||
}
|
||||
if(!dir) {
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
|
||||
"Nothing to wait for in wait_socket");
|
||||
/* To avoid that we hang below just because there's nothing set to
|
||||
wait for, we timeout on 1 second to also avoid busy-looping
|
||||
during this condition */
|
||||
ms_to_next = 1000;
|
||||
}
|
||||
|
||||
if (session->api_timeout > 0 &&
|
||||
(seconds_to_next == 0 ||
|
||||
seconds_to_next > session->api_timeout)) {
|
||||
time_t now = time (NULL);
|
||||
elapsed_ms = (long)(1000*difftime(start_time, now));
|
||||
if (elapsed_ms > session->api_timeout) {
|
||||
session->err_code = LIBSSH2_ERROR_TIMEOUT;
|
||||
return LIBSSH2_ERROR_TIMEOUT;
|
||||
}
|
||||
ms_to_next = (session->api_timeout - elapsed_ms);
|
||||
has_timeout = 1;
|
||||
}
|
||||
else if (ms_to_next > 0) {
|
||||
has_timeout = 1;
|
||||
}
|
||||
else
|
||||
has_timeout = 0;
|
||||
|
||||
#ifdef HAVE_POLL
|
||||
{
|
||||
struct pollfd sockets[1];
|
||||
|
||||
sockets[0].fd = session->socket_fd;
|
||||
sockets[0].events = 0;
|
||||
sockets[0].revents = 0;
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_INBOUND)
|
||||
sockets[0].events |= POLLIN;
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
|
||||
sockets[0].events |= POLLOUT;
|
||||
|
||||
rc = poll(sockets, 1, has_timeout?ms_to_next: -1);
|
||||
}
|
||||
#else
|
||||
{
|
||||
fd_set rfd;
|
||||
fd_set wfd;
|
||||
fd_set *writefd = NULL;
|
||||
fd_set *readfd = NULL;
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = ms_to_next / 1000;
|
||||
tv.tv_usec = (ms_to_next - tv.tv_sec*1000) * 1000;
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
|
||||
FD_ZERO(&rfd);
|
||||
FD_SET(session->socket_fd, &rfd);
|
||||
readfd = &rfd;
|
||||
}
|
||||
|
||||
if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND) {
|
||||
FD_ZERO(&wfd);
|
||||
FD_SET(session->socket_fd, &wfd);
|
||||
writefd = &wfd;
|
||||
}
|
||||
|
||||
rc = select(session->socket_fd + 1, readfd, writefd, NULL,
|
||||
has_timeout ? &tv : NULL);
|
||||
}
|
||||
#endif
|
||||
if(rc <= 0) {
|
||||
/* timeout (or error), bail out with a timeout error */
|
||||
session->err_code = LIBSSH2_ERROR_TIMEOUT;
|
||||
@@ -657,12 +680,11 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
|
||||
"Failed sending banner");
|
||||
}
|
||||
session->startup_state = libssh2_NB_state_sent;
|
||||
session->banner_TxRx_state = libssh2_NB_state_idle;
|
||||
}
|
||||
|
||||
if (session->startup_state == libssh2_NB_state_sent) {
|
||||
do {
|
||||
session->banner_TxRx_state = libssh2_NB_state_idle;
|
||||
|
||||
rc = banner_receive(session);
|
||||
if (rc)
|
||||
return _libssh2_error(session, rc,
|
||||
@@ -1281,6 +1303,28 @@ libssh2_session_get_blocking(LIBSSH2_SESSION * session)
|
||||
return session->api_block_mode;
|
||||
}
|
||||
|
||||
|
||||
/* libssh2_session_set_timeout
|
||||
*
|
||||
* Set a session's timeout (in msec) for blocking mode,
|
||||
* or 0 to disable timeouts.
|
||||
*/
|
||||
LIBSSH2_API void
|
||||
libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
|
||||
{
|
||||
session->api_timeout = timeout;
|
||||
}
|
||||
|
||||
/* libssh2_session_get_timeout
|
||||
*
|
||||
* Returns a session's timeout, or 0 if disabled
|
||||
*/
|
||||
LIBSSH2_API long
|
||||
libssh2_session_get_timeout(LIBSSH2_SESSION * session)
|
||||
{
|
||||
return session->api_timeout;
|
||||
}
|
||||
|
||||
/*
|
||||
* libssh2_poll_channel_read
|
||||
*
|
||||
@@ -1530,13 +1574,13 @@ libssh2_poll(LIBSSH2_POLLFD * fds, unsigned int nfds, long timeout)
|
||||
}
|
||||
#ifdef HAVE_POLL
|
||||
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef HAVE_LIBSSH2_GETTIMEOFDAY
|
||||
{
|
||||
struct timeval tv_begin, tv_end;
|
||||
|
||||
gettimeofday((struct timeval *) &tv_begin, NULL);
|
||||
_libssh2_gettimeofday((struct timeval *) &tv_begin, NULL);
|
||||
sysret = poll(sockets, nfds, timeout_remaining);
|
||||
gettimeofday((struct timeval *) &tv_end, NULL);
|
||||
_libssh2_gettimeofday((struct timeval *) &tv_end, NULL);
|
||||
timeout_remaining -= (tv_end.tv_sec - tv_begin.tv_sec) * 1000;
|
||||
timeout_remaining -= (tv_end.tv_usec - tv_begin.tv_usec) / 1000;
|
||||
}
|
||||
@@ -1590,13 +1634,13 @@ libssh2_poll(LIBSSH2_POLLFD * fds, unsigned int nfds, long timeout)
|
||||
#elif defined(HAVE_SELECT)
|
||||
tv.tv_sec = timeout_remaining / 1000;
|
||||
tv.tv_usec = (timeout_remaining % 1000) * 1000;
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
#ifdef HAVE_LIBSSH2_GETTIMEOFDAY
|
||||
{
|
||||
struct timeval tv_begin, tv_end;
|
||||
|
||||
gettimeofday((struct timeval *) &tv_begin, NULL);
|
||||
_libssh2_gettimeofday((struct timeval *) &tv_begin, NULL);
|
||||
sysret = select(maxfd+1, &rfds, &wfds, NULL, &tv);
|
||||
gettimeofday((struct timeval *) &tv_end, NULL);
|
||||
_libssh2_gettimeofday((struct timeval *) &tv_end, NULL);
|
||||
|
||||
timeout_remaining -= (tv_end.tv_sec - tv_begin.tv_sec) * 1000;
|
||||
timeout_remaining -= (tv_end.tv_usec - tv_begin.tv_usec) / 1000;
|
||||
|
@@ -53,15 +53,16 @@
|
||||
*/
|
||||
#define BLOCK_ADJUST(rc,sess,x) \
|
||||
do { \
|
||||
rc = x; \
|
||||
/* the order of the check below is important to properly deal with the
|
||||
case when the 'sess' is freed */ \
|
||||
if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \
|
||||
break; \
|
||||
rc = _libssh2_wait_socket(sess); \
|
||||
if(rc) \
|
||||
break; \
|
||||
} while(1)
|
||||
time_t entry_time = time (NULL); \
|
||||
do { \
|
||||
rc = x; \
|
||||
/* the order of the check below is important to properly deal with \
|
||||
the case when the 'sess' is freed */ \
|
||||
if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \
|
||||
break; \
|
||||
rc = _libssh2_wait_socket(sess, entry_time); \
|
||||
} while(!rc); \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* For functions that returns a pointer, we need to check if the API is
|
||||
@@ -69,21 +70,22 @@
|
||||
* immediately. If the API is blocking and we get a NULL we check the errno
|
||||
* and *only* if that is EAGAIN we loop and wait for socket action.
|
||||
*/
|
||||
#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
|
||||
#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
|
||||
do { \
|
||||
time_t entry_time = time (NULL); \
|
||||
int rc; \
|
||||
ptr = x; \
|
||||
if(!sess->api_block_mode || \
|
||||
(ptr != NULL) || \
|
||||
(libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
|
||||
break; \
|
||||
rc = _libssh2_wait_socket(sess); \
|
||||
if(rc) \
|
||||
break; \
|
||||
} while(1)
|
||||
do { \
|
||||
ptr = x; \
|
||||
if(!sess->api_block_mode || \
|
||||
(ptr != NULL) || \
|
||||
(libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
|
||||
break; \
|
||||
rc = _libssh2_wait_socket(sess, entry_time); \
|
||||
} while(!rc); \
|
||||
} while(0)
|
||||
|
||||
|
||||
int _libssh2_wait_socket(LIBSSH2_SESSION *session);
|
||||
int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time);
|
||||
|
||||
/* this is the lib-internal set blocking function */
|
||||
int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking);
|
||||
|
20
src/sftp.c
20
src/sftp.c
@@ -1,6 +1,6 @@
|
||||
/* Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org>
|
||||
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
|
||||
* Copyright (c) 2009-2010 by Daniel Stenberg
|
||||
* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
@@ -1677,11 +1677,27 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer,
|
||||
|
||||
chunk = next;
|
||||
}
|
||||
else
|
||||
else {
|
||||
/* flush all pending packets from the outgoing list */
|
||||
sftp_packetlist_flush(handle);
|
||||
|
||||
/* since we return error now, the applicaton will not get any
|
||||
outstanding data acked, so we need to rewind the offset to
|
||||
where the application knows it has reached with acked data */
|
||||
handle->u.file.offset -= handle->u.file.acked;
|
||||
|
||||
/* then reset the offset_sent to be the same as the offset */
|
||||
handle->u.file.offset_sent = handle->u.file.offset;
|
||||
|
||||
/* clear the acked counter since we can have no pending data to
|
||||
ack after an error */
|
||||
handle->u.file.acked = 0;
|
||||
|
||||
/* the server returned an error for that written chunk, propagate
|
||||
this back to our parent function */
|
||||
return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
|
||||
"FXP write failed");
|
||||
}
|
||||
}
|
||||
|
||||
/* if there were acked data in a previous call that wasn't returned then,
|
||||
|
166
src/userauth.c
166
src/userauth.c
@@ -1,6 +1,6 @@
|
||||
/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
|
||||
* Copyright (c) 2005 Mikhail Gusarov <dottedmag@dottedmag.net>
|
||||
* Copyright (c) 2009-2010 by Daniel Stenberg
|
||||
* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
@@ -1447,44 +1447,50 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
|
||||
}
|
||||
|
||||
/* server requested PAM-like conversation */
|
||||
|
||||
s = session->userauth_kybd_data + 1;
|
||||
|
||||
/* string name (ISO-10646 UTF-8) */
|
||||
session->userauth_kybd_auth_name_len = _libssh2_ntohu32(s);
|
||||
s += 4;
|
||||
session->userauth_kybd_auth_name =
|
||||
LIBSSH2_ALLOC(session, session->userauth_kybd_auth_name_len);
|
||||
if (!session->userauth_kybd_auth_name) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive 'name' request field");
|
||||
goto cleanup;
|
||||
if(session->userauth_kybd_auth_name_len) {
|
||||
session->userauth_kybd_auth_name =
|
||||
LIBSSH2_ALLOC(session,
|
||||
session->userauth_kybd_auth_name_len);
|
||||
if (!session->userauth_kybd_auth_name) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive 'name' "
|
||||
"request field");
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(session->userauth_kybd_auth_name, s,
|
||||
session->userauth_kybd_auth_name_len);
|
||||
s += session->userauth_kybd_auth_name_len;
|
||||
}
|
||||
memcpy(session->userauth_kybd_auth_name, s,
|
||||
session->userauth_kybd_auth_name_len);
|
||||
s += session->userauth_kybd_auth_name_len;
|
||||
|
||||
/* string instruction (ISO-10646 UTF-8) */
|
||||
session->userauth_kybd_auth_instruction_len = _libssh2_ntohu32(s);
|
||||
s += 4;
|
||||
session->userauth_kybd_auth_instruction =
|
||||
LIBSSH2_ALLOC(session,
|
||||
session->userauth_kybd_auth_instruction_len);
|
||||
if (!session->userauth_kybd_auth_instruction) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive 'instruction' "
|
||||
"request field");
|
||||
goto cleanup;
|
||||
if(session->userauth_kybd_auth_instruction_len) {
|
||||
session->userauth_kybd_auth_instruction =
|
||||
LIBSSH2_ALLOC(session,
|
||||
session->userauth_kybd_auth_instruction_len);
|
||||
if (!session->userauth_kybd_auth_instruction) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive 'instruction' "
|
||||
"request field");
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(session->userauth_kybd_auth_instruction, s,
|
||||
session->userauth_kybd_auth_instruction_len);
|
||||
s += session->userauth_kybd_auth_instruction_len;
|
||||
}
|
||||
memcpy(session->userauth_kybd_auth_instruction, s,
|
||||
session->userauth_kybd_auth_instruction_len);
|
||||
s += session->userauth_kybd_auth_instruction_len;
|
||||
|
||||
/* string language tag (as defined in [RFC-3066]) */
|
||||
language_tag_len = _libssh2_ntohu32(s);
|
||||
s += 4;
|
||||
|
||||
/* ignoring this field as deprecated */
|
||||
s += language_tag_len;
|
||||
|
||||
@@ -1492,53 +1498,56 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
|
||||
session->userauth_kybd_num_prompts = _libssh2_ntohu32(s);
|
||||
s += 4;
|
||||
|
||||
session->userauth_kybd_prompts =
|
||||
LIBSSH2_ALLOC(session,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_PROMPT) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
if (!session->userauth_kybd_prompts) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive prompts array");
|
||||
goto cleanup;
|
||||
}
|
||||
memset(session->userauth_kybd_prompts, 0,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_PROMPT) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
|
||||
session->userauth_kybd_responses =
|
||||
LIBSSH2_ALLOC(session,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_RESPONSE) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
if (!session->userauth_kybd_responses) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive responses array");
|
||||
goto cleanup;
|
||||
}
|
||||
memset(session->userauth_kybd_responses, 0,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_RESPONSE) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
|
||||
for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
|
||||
/* string prompt[1] (ISO-10646 UTF-8) */
|
||||
session->userauth_kybd_prompts[i].length = _libssh2_ntohu32(s);
|
||||
s += 4;
|
||||
session->userauth_kybd_prompts[i].text =
|
||||
if(session->userauth_kybd_num_prompts) {
|
||||
session->userauth_kybd_prompts =
|
||||
LIBSSH2_ALLOC(session,
|
||||
session->userauth_kybd_prompts[i].length);
|
||||
if (!session->userauth_kybd_prompts[i].text) {
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_PROMPT) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
if (!session->userauth_kybd_prompts) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive prompt message");
|
||||
"keyboard-interactive prompts array");
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(session->userauth_kybd_prompts[i].text, s,
|
||||
session->userauth_kybd_prompts[i].length);
|
||||
s += session->userauth_kybd_prompts[i].length;
|
||||
memset(session->userauth_kybd_prompts, 0,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_PROMPT) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
|
||||
/* boolean echo[1] */
|
||||
session->userauth_kybd_prompts[i].echo = *s++;
|
||||
session->userauth_kybd_responses =
|
||||
LIBSSH2_ALLOC(session,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_RESPONSE) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
if (!session->userauth_kybd_responses) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive responses array");
|
||||
goto cleanup;
|
||||
}
|
||||
memset(session->userauth_kybd_responses, 0,
|
||||
sizeof(LIBSSH2_USERAUTH_KBDINT_RESPONSE) *
|
||||
session->userauth_kybd_num_prompts);
|
||||
|
||||
for(i = 0; i != session->userauth_kybd_num_prompts; ++i) {
|
||||
/* string prompt[1] (ISO-10646 UTF-8) */
|
||||
session->userauth_kybd_prompts[i].length =
|
||||
_libssh2_ntohu32(s);
|
||||
s += 4;
|
||||
session->userauth_kybd_prompts[i].text =
|
||||
LIBSSH2_ALLOC(session,
|
||||
session->userauth_kybd_prompts[i].length);
|
||||
if (!session->userauth_kybd_prompts[i].text) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"Unable to allocate memory for "
|
||||
"keyboard-interactive prompt message");
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(session->userauth_kybd_prompts[i].text, s,
|
||||
session->userauth_kybd_prompts[i].length);
|
||||
s += session->userauth_kybd_prompts[i].length;
|
||||
|
||||
/* boolean echo[1] */
|
||||
session->userauth_kybd_prompts[i].echo = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
response_callback(session->userauth_kybd_auth_name,
|
||||
@@ -1595,10 +1604,9 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
|
||||
rc = _libssh2_transport_send(session, session->userauth_kybd_data,
|
||||
session->userauth_kybd_packet_len,
|
||||
NULL, 0);
|
||||
if (rc == LIBSSH2_ERROR_EAGAIN) {
|
||||
if (rc == LIBSSH2_ERROR_EAGAIN)
|
||||
return _libssh2_error(session, LIBSSH2_ERROR_EAGAIN,
|
||||
"Would block");
|
||||
}
|
||||
if (rc) {
|
||||
_libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
|
||||
"Unable to send userauth-keyboard-interactive"
|
||||
@@ -1633,14 +1641,22 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
|
||||
}
|
||||
}
|
||||
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_prompts);
|
||||
session->userauth_kybd_prompts = NULL;
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_responses);
|
||||
session->userauth_kybd_responses = NULL;
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_auth_name);
|
||||
session->userauth_kybd_auth_name = NULL;
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_auth_instruction);
|
||||
session->userauth_kybd_auth_instruction = NULL;
|
||||
if(session->userauth_kybd_prompts) {
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_prompts);
|
||||
session->userauth_kybd_prompts = NULL;
|
||||
}
|
||||
if(session->userauth_kybd_responses) {
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_responses);
|
||||
session->userauth_kybd_responses = NULL;
|
||||
}
|
||||
if(session->userauth_kybd_auth_name) {
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_auth_name);
|
||||
session->userauth_kybd_auth_name = NULL;
|
||||
}
|
||||
if(session->userauth_kybd_auth_instruction) {
|
||||
LIBSSH2_FREE(session, session->userauth_kybd_auth_instruction);
|
||||
session->userauth_kybd_auth_instruction = NULL;
|
||||
}
|
||||
|
||||
if (session->userauth_kybd_auth_failure) {
|
||||
session->userauth_kybd_state = libssh2_NB_state_idle;
|
||||
|
@@ -70,7 +70,7 @@ ZLIB_ROOT = ..\..\zlib-1.2.5
|
||||
!ifdef %openssl_root
|
||||
OPENSSL_ROOT = $(%openssl_root)
|
||||
!else
|
||||
OPENSSL_ROOT = ..\..\openssl-0.9.8q
|
||||
OPENSSL_ROOT = ..\..\openssl-0.9.8r
|
||||
!endif
|
||||
|
||||
#!ifdef %use_zlib
|
||||
|
@@ -16,7 +16,7 @@ WITH_ZLIB = 1
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8q
|
||||
OPENSSL_PATH = ../../openssl-0.9.8r
|
||||
endif
|
||||
|
||||
# Edit the path below to point to your Distribution folder.
|
||||
|
@@ -57,7 +57,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib libeay32.lib ssleay32.lib zlib.lib /nologo /dll /map /debug /machine:I386 /out:"Release_dll/libssh2.dll"
|
||||
# ADD LINK32 gdi32.lib advapi32.lib user32.lib kernel32.lib ws2_32.lib libeay32.lib zlib.lib /nologo /dll /map /debug /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "libssh2 - Win32 DLL Debug"
|
||||
|
||||
@@ -73,7 +73,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /D "LIBSSH2DEBUG" /YX /FD /GZ /c
|
||||
# SUBTRACT CPP /WX /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
@@ -84,7 +84,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib libeay32.lib ssleay32.lib zlib.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug_dll/libssh2.dll" /pdbtype:sept
|
||||
# ADD LINK32 gdi32.lib advapi32.lib user32.lib kernel32.lib ws2_32.lib libeay32.lib zlib.lib /nologo /dll /incremental:no /map /debug /machine:I386 /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ELSEIF "$(CFG)" == "libssh2 - Win32 LIB Release"
|
||||
@@ -124,7 +124,7 @@ LIB32=link.exe -lib
|
||||
# PROP Intermediate_Dir "Debug_lib"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /D "LIBSSH2DEBUG" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
Reference in New Issue
Block a user