Hello community, here is the log from the commit of package libssh2_org for openSUSE:Factory checked in at 2011-10-25 16:08:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libssh2_org (Old) and /work/SRC/openSUSE:Factory/.libssh2_org.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libssh2_org", Maintainer is "CrRodriguez@novell.com" Changes: -------- --- /work/SRC/openSUSE:Factory/libssh2_org/libssh2_org.changes 2011-10-03 09:24:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libssh2_org.new/libssh2_org.changes 2011-10-25 16:08:54.000000000 +0200 @@ -1,0 +2,10 @@ +Fri Oct 21 18:15:49 UTC 2011 - crrodriguez@opensuse.org + +- Update to version 1.3.0 +* sftp_read: advance offset correctly for buffered copies +* libssh2_sftp_seek64: flush packetlist and buffered data +* _libssh2_packet_add: adjust window size when truncating +* sftp_read: a short read is not end of file + + +------------------------------------------------------------------- Old: ---- libssh2-1.2.9.tar.bz2 New: ---- libssh2-1.3.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libssh2_org.spec ++++++ --- /var/tmp/diff_new_pack.DETzXz/_old 2011-10-25 16:08:56.000000000 +0200 +++ /var/tmp/diff_new_pack.DETzXz/_new 2011-10-25 16:08:56.000000000 +0200 @@ -19,7 +19,7 @@ Summary: A library implementing the SSH2 protocol Name: libssh2_org -Version: 1.2.9 +Version: 1.3.0 Release: 3 License: BSD3c Url: http://www.libssh2.org/ ++++++ libssh2-1.2.9.tar.bz2 -> libssh2-1.3.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/Makefile.am new/libssh2-1.3.0/Makefile.am --- old/libssh2-1.2.9/Makefile.am 2010-08-27 20:00:00.000000000 +0200 +++ new/libssh2-1.3.0/Makefile.am 2011-09-06 22:55:47.000000000 +0200 @@ -26,10 +26,9 @@ vms/readme.vms vms/libssh2_config.h -WIN32FILES = win32/Makefile.win32 win32/libssh2.dsw \ -win32/config.mk win32/Makefile win32/test/Makefile.win32 \ -win32/libssh2_config.h win32/tests.dsp win32/rules.mk $(DSP) \ -win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc \ +WIN32FILES = win32/libssh2.dsw win32/config.mk win32/Makefile \ +win32/libssh2_config.h win32/tests.dsp win32/rules.mk $(DSP) \ +win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc \ win32/Makefile.Watcom EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/Makefile.in new/libssh2-1.3.0/Makefile.in --- old/libssh2-1.2.9/Makefile.in 2011-08-16 10:48:11.000000000 +0200 +++ new/libssh2-1.3.0/Makefile.in 2011-09-06 22:56:31.000000000 +0200 @@ -243,10 +243,9 @@ vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \ vms/readme.vms vms/libssh2_config.h -WIN32FILES = win32/Makefile.win32 win32/libssh2.dsw \ -win32/config.mk win32/Makefile win32/test/Makefile.win32 \ -win32/libssh2_config.h win32/tests.dsp win32/rules.mk $(DSP) \ -win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc \ +WIN32FILES = win32/libssh2.dsw win32/config.mk win32/Makefile \ +win32/libssh2_config.h win32/tests.dsp win32/rules.mk $(DSP) \ +win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc \ win32/Makefile.Watcom EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \ @@ -484,7 +483,7 @@ distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkdir_p) $(distdir)/. $(distdir)/include $(distdir)/m4 $(distdir)/nw $(distdir)/nw/test $(distdir)/vms $(distdir)/win32 $(distdir)/win32/test + $(mkdir_p) $(distdir)/. $(distdir)/include $(distdir)/m4 $(distdir)/nw $(distdir)/nw/test $(distdir)/vms $(distdir)/win32 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/NEWS new/libssh2-1.3.0/NEWS --- old/libssh2-1.2.9/NEWS 2011-08-16 10:48:12.000000000 +0200 +++ new/libssh2-1.3.0/NEWS 2011-09-06 22:56:34.000000000 +0200 @@ -1,5 +1,87 @@ Changelog for the libssh2 project. Generated with git2news.pl +Version 1.3.0 (6 Sep 2011) + +Daniel Stenberg (6 Sep 2011) +- Makefile.am: the Makefile.win32 files are gone + +- RELEASE-NOTES: updated for 1.3.0 + +- sftp_read: a short read is not end of file + + A returned READ packet that is short will now only reduce the + offset. + + This is a temporary fix as it is slightly better than the previous + approach but still not very good. + +- [liuzl brought this change] + + _libssh2_packet_add: adjust window size when truncating + + When receiving more data than what the window size allows on a + particular channel, make sure that the window size is adjusted in that + case too. Previously it would only adjust the window in the non-error + case. + +Guenter Knauf (29 Aug 2011) +- Silent compiler warning with MinGW64. + +- Fixed link to native Win32 awk tool. + +- Renamed MinGW makefiles. + +- Some MinGW makefile tweaks. + + Enable build without GNU tools and with MinGW64 compiler. + +- Fixed aes_ctr_do_cipher() signature. + +Daniel Stenberg (26 Aug 2011) +- [liuzl brought this change] + + libssh2_sftp_seek64: flush packetlist and buffered data + + When seeking to a new position, flush the packetlist and buffered data + to prevent already received or pending data to wrongly get used when + sftp-reading from the new offset within the file. + +- sftp_read: advance offset correctly for buffered copies + + In the case where a read packet has been received from the server, but + the entire contents couldn't be copied to the user-buffer, the data is + instead buffered and copied to the user's buffer in the next invocation + of sftp_read(). When that "extra" copy is made, the 'offset' pointer was + not advanced accordingly. + + The biggest impact of this flaw was that the 'already' variable at the + top of the function that figures out how much data "ahead" that has + already been asked for would slowly go more and more out of sync, which + could lead to the file not being read all the way to the end. + + This problem was most noticable in cases where the application would + only try to read the exact file size amount, like curl does. In the + examples libssh2 provides the sftp read function is most often called + with a fixed size large buffer and then the bug would not appear as + easily. + + This bug was introduced in the SFTP rewrite in 1.2.8. + + Bug: http://curl.haxx.se/mail/lib-2011-08/0305.html + http://www.libssh2.org/mail/libssh2-devel-archive-2011-08/0085.shtml + +- wrap some long lines < 80 columns + +- LIBSSH2_RECV: fix typo, use the RECV_FD macro + +- subsystem_netconf.c: fix compiler warnings + +- [Henrik Nordstrom brought this change] + + Custom callbacks for performing low level socket I/O + +- version bump: start working towards 1.3.0 + Version 1.2.9 (16 Aug 2011) Daniel Stenberg (16 Aug 2011) @@ -4110,84 +4192,3 @@ Bug: 1703464 - Since uint32_t is used, inttypes.h should be included. - -- * Convert all the code to properly work with a socket in - non-blocking mode. All functions either return - LIBSSH2_ERROR_EAGAIN or return NULL and set the error code - to be LIBSSH2_ERROR_EAGAIN instead of blocking, when in - non-blocking mode. - -- In the code rewrite - libssh2_kex_method_diffie_hellman_group14_sha1_key_exchange() lost two - initializer routines, restore them. - -- To simplify the user's error interface always use LIBSSH2_ERROR_EAGAIN. - LIBSSH2CHANNEL_EAGAIN and LIBSSH2SFTP_EAGAIN are still valid, but are - defined as LIBSSH2_ERROR_EAGAIN. - -- libssh2_session_disconnect_ex() should be returning PACKET_EAGAIN instead - of LIBSSH2_ERROR_EAGAIN, so it matches the other functions return values. - -- When shutting down sub-systems and closing the channel try our best - to free any memory still allocated in the state variables - -- Remove 2 last files - -- Remove the removed files - -- Finish making SFTP fully non-blocking capable. - - Functions that return an "int", and friends, return LIBSSH2SFTP_EAGAIN. - Functions that return a structure return NULL and set the error to - LIBSSH2_ERROR_EAGAIN - -- Make libssh2_sftp_write() be fully non-blocking. The state of the socket - is fully honored. LIBSSH2SFTP_EAGAIN is returned when the call would - block. - -- Modify the code to truely support non-blocking. Propogate the EAGAIN error - all the way up to the user interface. All code modules bug sftp.c have - been completed. - - Functions that return an "int", or similar return LIBSSH2CHANNEL_EAGAIN to - indicate some part of the call would block, in non-blocking mode. - - Functions that return a structure, like "LIBSSH2_CHANNEL *", return NULL - and set the libssh2 error. The error can be obtained with either - libssh2_session_last_error() or libssh2_session_last_errno(). Either of - these will return the error code of LIBSSH2_ERROR_EAGAIN if the - call would block, in non-blocking mode. - - The current state of a function and some variable are keep in the - structures so that on the next call the operation that would block can - be retried again with the same data. - -- libssh2_packet_read() was checking the "errno" even when recv() didn't - return an error. "errno" should have been zero by the recv() call but - doesn't seem to be on all systems. Only check when recv() says there - is an error. - - Bug: 1703467 - Patch: 1703468 - -- Initially the libssh2 code was indented with tabs of 4 spaces. Some of - the recent commits converted the tabs to 4 spaces, which matched the - initial indent size. Other commits converted the tabs to 8 spaces, this - didn't match. - - All the code has been converted to 4 space indents. No changes to line - lengths or actual code was performed. This is in preperation to my up - coming non-blocking work so my commits should only be code changes and - line lengths in the code I am working on. - -Daniel Stenberg (8 May 2007) -- Eberhard Mattes' fix for libssh2_packet_read() for when reading very small - chunks at a time. - -Dan Fandrich (1 May 2007) -- Fix building out of the source tree. - -Guenter Knauf (26 Apr 2007) -- include libssh_config.h to get the configure vars in. - -- changed to configure defines to control inclusion of headers from libssh2_config.h. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/RELEASE-NOTES new/libssh2-1.3.0/RELEASE-NOTES --- old/libssh2-1.2.9/RELEASE-NOTES 2011-08-16 10:30:00.000000000 +0200 +++ new/libssh2-1.3.0/RELEASE-NOTES 2011-09-06 22:47:32.000000000 +0200 @@ -1,35 +1,19 @@ -libssh2 1.2.9 +libssh2 1.3.0 This release includes the following changes: - o Added libssh2_session_set_timeout() and libssh2_session_get_timeout() - to make blocking calls get a timeout + o Added custom callbacks for performing low level socket I/O This release includes the following bugfixes: - 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 + o sftp_read: advance offset correctly for buffered copies + o libssh2_sftp_seek64: flush packetlist and buffered data + o _libssh2_packet_add: adjust window size when truncating + o sftp_read: a short read is not end of file This release would not have looked like this without help, code, reports and advice from friends like these: - Alfred Gebert, Dan Fandrich, Douglas Masterson, Guenter Knauf, Matt Lilley, - Mikhail Gusarov, Peter Stuge, zl liu, Paul Howarth, Mark Smith, Bill Segall, - Henrik Nordstr�m + Henrik Nordstrom, liuzl, Guenter Knauf Thanks! (and sorry if I forgot to mention someone) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/docs/libssh2_session_callback_set.3 new/libssh2-1.3.0/docs/libssh2_session_callback_set.3 --- old/libssh2-1.2.9/docs/libssh2_session_callback_set.3 2010-11-10 14:05:15.000000000 +0100 +++ new/libssh2-1.3.0/docs/libssh2_session_callback_set.3 2011-08-25 19:59:47.000000000 +0200 @@ -33,6 +33,12 @@ function returns 0, the packet will be accepted nonetheless. .IP LIBSSH2_CALLBACK_X11 Called when an X11 connection has been accepted +.IP LIBSSH2_CALLBACK_SEND +Called when libssh2 wants to send some data on the connection. +Can be set to a custom function to handle I/O your own way. +.IP LIBSSH2_CALLBACK_RECV +Called when libssh2 wants to receive some data from the connection. +Can be set to a custom function to handle I/O your own way. .SH RETURN VALUE Pointer to previous callback handler. Returns NULL if no prior callback handler was set or the callback type was unknown. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/example/subsystem_netconf.c new/libssh2-1.3.0/example/subsystem_netconf.c --- old/libssh2-1.2.9/example/subsystem_netconf.c 2011-08-11 14:36:05.000000000 +0200 +++ new/libssh2-1.3.0/example/subsystem_netconf.c 2011-08-25 16:46:56.000000000 +0200 @@ -25,7 +25,7 @@ #endif #ifndef INADDR_NONE -#define INADDR_NONE (in_addr_t)-1 +#define INADDR_NONE (in_addr_t)~0 #endif const char *keyfile1 = "/home/username/.ssh/id_rsa.pub"; @@ -41,7 +41,7 @@ AUTH_PUBLICKEY }; -int netconf_write(LIBSSH2_CHANNEL *channel, const char *buf, size_t len) +static int netconf_write(LIBSSH2_CHANNEL *channel, const char *buf, size_t len) { int i; ssize_t wr = 0; @@ -53,12 +53,13 @@ return -1; } wr += i; - } while (i > 0 && wr < len); + } while (i > 0 && wr < (ssize_t)len); return 0; } -int netconf_read_until(LIBSSH2_CHANNEL *channel, const char *endtag, char *buf, size_t buflen) +static int netconf_read_until(LIBSSH2_CHANNEL *channel, const char *endtag, + char *buf, size_t buflen) { ssize_t len, rd = 0; char *endreply, *specialsequence = NULL; @@ -97,7 +98,6 @@ { int rc, sock = -1, i, auth = AUTH_NONE; struct sockaddr_in sin; - socklen_t sinlen; const char *fingerprint; char *userauthlist; LIBSSH2_SESSION *session; @@ -106,12 +106,9 @@ ssize_t len; #ifdef WIN32 - char sockopt; WSADATA wsadata; WSAStartup(MAKEWORD(2,0), &wsadata); -#else - int sockopt; #endif if (argc > 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/include/libssh2.h new/libssh2-1.3.0/include/libssh2.h --- old/libssh2-1.2.9/include/libssh2.h 2011-08-16 10:48:12.000000000 +0200 +++ new/libssh2-1.3.0/include/libssh2.h 2011-09-06 22:56:34.000000000 +0200 @@ -46,13 +46,13 @@ 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.9" +#define LIBSSH2_VERSION "1.3.0" /* 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 9 +#define LIBSSH2_VERSION_MINOR 3 +#define LIBSSH2_VERSION_PATCH 0 /* 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 0x010209 +#define LIBSSH2_VERSION_NUM 0x010300 /* * This is the date and time when the full source package was created. The @@ -80,7 +80,7 @@ * * "Mon Feb 12 11:35:33 UTC 2007" */ -#define LIBSSH2_TIMESTAMP "Tue Aug 16 08:48:11 UTC 2011" +#define LIBSSH2_TIMESTAMP "Tue Sep 6 20:56:30 UTC 2011" #ifndef LIBSSH2_VERSION_ONLY @@ -237,12 +237,22 @@ void name(LIBSSH2_SESSION *session, void **session_abstract, \ LIBSSH2_CHANNEL *channel, void **channel_abstract) +/* I/O callbacks */ +#define LIBSSH2_RECV_FUNC(name) ssize_t name(int socket, \ + void *buffer, size_t length, \ + int flags, void **abstract) +#define LIBSSH2_SEND_FUNC(name) ssize_t name(int socket, \ + const void *buffer, size_t length,\ + int flags, void **abstract) + /* libssh2_session_callback_set() constants */ #define LIBSSH2_CALLBACK_IGNORE 0 #define LIBSSH2_CALLBACK_DEBUG 1 #define LIBSSH2_CALLBACK_DISCONNECT 2 #define LIBSSH2_CALLBACK_MACERROR 3 #define LIBSSH2_CALLBACK_X11 4 +#define LIBSSH2_CALLBACK_SEND 5 +#define LIBSSH2_CALLBACK_RECV 6 /* libssh2_session_method_pref() constants */ #define LIBSSH2_METHOD_KEX 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/nw/Makefile.netware new/libssh2-1.3.0/nw/Makefile.netware --- old/libssh2-1.2.9/nw/Makefile.netware 2011-05-02 22:27:29.000000000 +0200 +++ new/libssh2-1.3.0/nw/Makefile.netware 2011-08-31 10:45:12.000000000 +0200 @@ -79,7 +79,7 @@ CP = cp -afv # RM = rm -f # Here you can find a native Win32 binary of the original awk: -# http://www.gknw.net/development/prgtools/awk-20070501.zip +# http://www.gknw.net/development/prgtools/awk-20100523.zip AWK = awk # If you want to mark the target as MTSAFE you will need a tool for # generating the xdc data for the linker; here's a minimal tool: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/nw/test/Makefile.netware new/libssh2-1.3.0/nw/test/Makefile.netware --- old/libssh2-1.2.9/nw/test/Makefile.netware 2011-01-03 00:07:44.000000000 +0100 +++ new/libssh2-1.3.0/nw/test/Makefile.netware 2011-08-31 10:45:12.000000000 +0200 @@ -73,7 +73,7 @@ CP = cp -afv # RM = rm -f # Here you can find a native Win32 binary of the original awk: -# http://www.gknw.net/development/prgtools/awk-20070501.zip +# http://www.gknw.net/development/prgtools/awk-20100523.zip AWK = awk # If you want to mark the target as MTSAFE you will need a tool for # generating the xdc data for the linker; here's a minimal tool: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/agent.c new/libssh2-1.3.0/src/agent.c --- old/libssh2-1.2.9/src/agent.c 2011-06-20 00:08:51.000000000 +0200 +++ new/libssh2-1.3.0/src/agent.c 2011-08-25 19:59:47.000000000 +0200 @@ -177,7 +177,7 @@ /* Send the length of the request */ if (transctx->state == agent_NB_state_request_created) { _libssh2_htonu32(buf, transctx->request_len); - rc = _libssh2_send(agent->fd, buf, sizeof buf, 0); + rc = LIBSSH2_SEND_FD(agent->session, agent->fd, buf, sizeof buf, 0); if (rc == -EAGAIN) return LIBSSH2_ERROR_EAGAIN; else if (rc < 0) @@ -188,7 +188,7 @@ /* Send the request body */ if (transctx->state == agent_NB_state_request_length_sent) { - rc = _libssh2_send(agent->fd, transctx->request, + rc = LIBSSH2_SEND_FD(agent->session, agent->fd, transctx->request, transctx->request_len, 0); if (rc == -EAGAIN) return LIBSSH2_ERROR_EAGAIN; @@ -200,7 +200,7 @@ /* Receive the length of a response */ if (transctx->state == agent_NB_state_request_sent) { - rc = _libssh2_recv(agent->fd, buf, sizeof buf, 0); + rc = LIBSSH2_RECV_FD(agent->session, agent->fd, buf, sizeof buf, 0); if (rc < 0) { if (rc == -EAGAIN) return LIBSSH2_ERROR_EAGAIN; @@ -218,7 +218,7 @@ /* Receive the response body */ if (transctx->state == agent_NB_state_response_length_received) { - rc = _libssh2_recv(agent->fd, transctx->response, + rc = LIBSSH2_RECV_FD(agent->session, agent->fd, transctx->response, transctx->response_len, 0); if (rc < 0) { if (rc == -EAGAIN) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/libssh2_priv.h new/libssh2-1.3.0/src/libssh2_priv.h --- old/libssh2-1.2.9/src/libssh2_priv.h 2011-06-29 21:29:27.000000000 +0200 +++ new/libssh2-1.3.0/src/libssh2_priv.h 2011-08-25 22:40:36.000000000 +0200 @@ -163,13 +163,31 @@ session->ssh_msg_debug((session), (always_display), (message), \ (message_len), (language), (language_len), \ &(session)->abstract) -#define LIBSSH2_DISCONNECT(session, reason, message, message_len, language, language_len) \ - session->ssh_msg_disconnect((session), (reason), (message), (message_len), (language), (language_len), &(session)->abstract) - -#define LIBSSH2_MACERROR(session, data, datalen) session->macerror((session), (data), (datalen), &(session)->abstract) -#define LIBSSH2_X11_OPEN(channel, shost, sport) channel->session->x11(((channel)->session), (channel), (shost), (sport), (&(channel)->session->abstract)) - -#define LIBSSH2_CHANNEL_CLOSE(session, channel) channel->close_cb((session), &(session)->abstract, (channel), &(channel)->abstract) +#define LIBSSH2_DISCONNECT(session, reason, message, message_len, \ + language, language_len) \ + session->ssh_msg_disconnect((session), (reason), (message), \ + (message_len), (language), (language_len), \ + &(session)->abstract) + +#define LIBSSH2_MACERROR(session, data, datalen) \ + session->macerror((session), (data), (datalen), &(session)->abstract) +#define LIBSSH2_X11_OPEN(channel, shost, sport) \ + channel->session->x11(((channel)->session), (channel), \ + (shost), (sport), (&(channel)->session->abstract)) + +#define LIBSSH2_CHANNEL_CLOSE(session, channel) \ + channel->close_cb((session), &(session)->abstract, \ + (channel), &(channel)->abstract) + +#define LIBSSH2_SEND_FD(session, fd, buffer, length, flags) \ + session->send(fd, buffer, length, flags, &session->abstract) +#define LIBSSH2_RECV_FD(session, fd, buffer, length, flags) \ + session->recv(fd, buffer, length, flags, &session->abstract) + +#define LIBSSH2_SEND(session, buffer, length, flags) \ + LIBSSH2_SEND_FD(session, session->socket_fd, buffer, length, flags) +#define LIBSSH2_RECV(session, buffer, length, flags) \ + LIBSSH2_RECV_FD(session, session->socket_fd, buffer, length, flags) typedef struct _LIBSSH2_KEX_METHOD LIBSSH2_KEX_METHOD; typedef struct _LIBSSH2_HOSTKEY_METHOD LIBSSH2_HOSTKEY_METHOD; @@ -539,6 +557,8 @@ LIBSSH2_DISCONNECT_FUNC((*ssh_msg_disconnect)); LIBSSH2_MACERROR_FUNC((*macerror)); LIBSSH2_X11_OPEN_FUNC((*x11)); + LIBSSH2_SEND_FUNC((*send)); + LIBSSH2_RECV_FUNC((*recv)); /* Method preferences -- NULL yields "load order" */ char *kex_prefs; @@ -794,8 +814,10 @@ /* session.flag helpers */ #ifdef MSG_NOSIGNAL -#define LIBSSH2_SOCKET_SEND_FLAGS(session) (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL) -#define LIBSSH2_SOCKET_RECV_FLAGS(session) (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL) +#define LIBSSH2_SOCKET_SEND_FLAGS(session) \ + (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL) +#define LIBSSH2_SOCKET_RECV_FLAGS(session) \ + (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL) #else /* If MSG_NOSIGNAL isn't defined we're SOL on blocking SIGPIPE */ #define LIBSSH2_SOCKET_SEND_FLAGS(session) 0 @@ -972,9 +994,9 @@ #define SSH_OPEN_RESOURCE_SHORTAGE 4 ssize_t _libssh2_recv(libssh2_socket_t socket, void *buffer, - size_t length, int flags); + size_t length, int flags, void **abstract); ssize_t _libssh2_send(libssh2_socket_t socket, const void *buffer, - size_t length, int flags); + size_t length, int flags, void **abstract); #define LIBSSH2_READ_TIMEOUT 60 /* generic timeout in seconds used when waiting for more data to arrive */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/misc.c new/libssh2-1.3.0/src/misc.c --- old/libssh2-1.2.9/src/misc.c 2011-08-11 14:36:05.000000000 +0200 +++ new/libssh2-1.3.0/src/misc.c 2011-08-25 19:59:47.000000000 +0200 @@ -94,7 +94,7 @@ * Replacement for the standard recv, return -errno on failure. */ ssize_t -_libssh2_recv(libssh2_socket_t sock, void *buffer, size_t length, int flags) +_libssh2_recv(libssh2_socket_t sock, void *buffer, size_t length, int flags, void **abstract) { ssize_t rc = recv(sock, buffer, length, flags); #ifdef WIN32 @@ -126,7 +126,7 @@ */ ssize_t _libssh2_send(libssh2_socket_t sock, const void *buffer, size_t length, - int flags) + int flags, void **abstract) { ssize_t rc = send(sock, buffer, length, flags); #ifdef WIN32 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/openssl.c new/libssh2-1.3.0/src/openssl.c --- old/libssh2-1.2.9/src/openssl.c 2010-12-22 14:32:23.000000000 +0100 +++ new/libssh2-1.3.0/src/openssl.c 2011-08-31 10:45:12.000000000 +0200 @@ -257,7 +257,7 @@ static int aes_ctr_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, - unsigned int inl) /* encrypt/decrypt data */ + size_t inl) /* encrypt/decrypt data */ { aes_ctr_ctx *c = EVP_CIPHER_CTX_get_app_data(ctx); unsigned char b1[AES_BLOCK_SIZE]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/packet.c new/libssh2-1.3.0/src/packet.c --- old/libssh2-1.2.9/src/packet.c 2010-12-15 21:56:47.000000000 +0100 +++ new/libssh2-1.3.0/src/packet.c 2011-08-31 10:45:12.000000000 +0200 @@ -706,6 +706,7 @@ "Remote sent more data than current " "window allows, truncating"); datalen = channelp->remote.window_size + data_head; + channelp->remote.window_size = 0; } else /* Now that we've received it, shrink our window */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/scp.c new/libssh2-1.3.0/src/scp.c --- old/libssh2-1.2.9/src/scp.c 2011-05-02 22:27:29.000000000 +0200 +++ new/libssh2-1.3.0/src/scp.c 2011-08-31 10:45:12.000000000 +0200 @@ -889,7 +889,7 @@ session->scpSend_response_len = snprintf((char *) session->scpSend_response, LIBSSH2_SCP_RESPONSE_BUFLEN, "T%ld 0 %ld 0\n", - mtime, atime); + (long)mtime, (long)atime); _libssh2_debug(session, LIBSSH2_TRACE_SCP, "Sent %s", session->scpSend_response); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/session.c new/libssh2-1.3.0/src/session.c --- old/libssh2-1.2.9/src/session.c 2011-08-11 14:36:05.000000000 +0200 +++ new/libssh2-1.3.0/src/session.c 2011-08-25 22:41:09.000000000 +0200 @@ -115,7 +115,7 @@ /* no incoming block yet! */ session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_INBOUND; - ret = _libssh2_recv(session->socket_fd, &c, 1, + ret = LIBSSH2_RECV(session, &c, 1, LIBSSH2_SOCKET_RECV_FLAGS(session)); if (ret < 0) { if(session->api_block_mode || (ret != -EAGAIN)) @@ -227,7 +227,7 @@ /* no outgoing block yet! */ session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_OUTBOUND; - ret = _libssh2_send(session->socket_fd, + ret = LIBSSH2_SEND(session, banner + session->banner_TxRx_total_send, banner_len - session->banner_TxRx_total_send, LIBSSH2_SOCKET_SEND_FLAGS(session)); @@ -481,6 +481,8 @@ session->alloc = local_alloc; session->free = local_free; session->realloc = local_realloc; + session->send = _libssh2_send; + session->recv = _libssh2_recv; session->abstract = abstract; session->api_timeout = 0; /* timeout-free API by default */ session->api_block_mode = 1; /* blocking API by default */ @@ -532,6 +534,15 @@ session->x11 = callback; return oldcb; + case LIBSSH2_CALLBACK_SEND: + oldcb = session->send; + session->send = callback; + return oldcb; + + case LIBSSH2_CALLBACK_RECV: + oldcb = session->recv; + session->recv = callback; + return oldcb; } _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Setting Callback %d", cbtype); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/sftp.c new/libssh2-1.3.0/src/sftp.c --- old/libssh2-1.2.9/src/sftp.c 2011-04-13 13:59:40.000000000 +0200 +++ new/libssh2-1.3.0/src/sftp.c 2011-09-04 17:42:18.000000000 +0200 @@ -1098,6 +1098,7 @@ total_read += copy; filep->data_left -= copy; + filep->offset += copy; if(filep->data_left) return total_read; @@ -1241,9 +1242,12 @@ return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, "SFTP Protocol badness"); - if(rc32 != chunk->len) - /* a short read means this is the last read in the file */ - filep->eof = TRUE; + if(rc32 != chunk->len) { + /* a short read does not imply end of file, but we must adjust + the offset_sent since it was advanced with a full + chunk->len before */ + filep->offset_sent -= (chunk->len - rc32); + } if(total_read + rc32 > buffer_size) { /* figure out the overlap amount */ @@ -1858,8 +1862,18 @@ LIBSSH2_API void libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset) { - if(handle) + if(handle) { handle->u.file.offset = handle->u.file.offset_sent = offset; + /* discard all pending requests and currently read data */ + sftp_packetlist_flush(handle); + + /* free the left received buffered data */ + if (handle->u.file.data_left) { + LIBSSH2_FREE(handle->sftp->channel->session, handle->u.file.data); + handle->u.file.data_left = handle->u.file.data_len = 0; + handle->u.file.data = NULL; + } + } } /* libssh2_sftp_seek diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/src/transport.c new/libssh2-1.3.0/src/transport.c --- old/libssh2-1.2.9/src/transport.c 2011-02-26 10:57:56.000000000 +0100 +++ new/libssh2-1.3.0/src/transport.c 2011-08-25 19:59:47.000000000 +0200 @@ -357,7 +357,7 @@ /* now read a big chunk from the network into the temp buffer */ nread = - _libssh2_recv(session->socket_fd, &p->buf[remainbuf], + LIBSSH2_RECV(session, &p->buf[remainbuf], PACKETBUFSIZE - remainbuf, LIBSSH2_SOCKET_RECV_FLAGS(session)); if (nread <= 0) { @@ -610,7 +610,7 @@ /* number of bytes left to send */ length = p->ototal_num - p->osent; - rc = _libssh2_send(session->socket_fd, &p->outbuf[p->osent], length, + rc = LIBSSH2_SEND(session, &p->outbuf[p->osent], length, LIBSSH2_SOCKET_SEND_FLAGS(session)); if (rc < 0) _libssh2_debug(session, LIBSSH2_TRACE_SOCKET, @@ -823,7 +823,7 @@ session->local.seqno++; - ret = _libssh2_send(session->socket_fd, p->outbuf, total_length, + ret = LIBSSH2_SEND(session, p->outbuf, total_length, LIBSSH2_SOCKET_SEND_FLAGS(session)); if (ret < 0) _libssh2_debug(session, LIBSSH2_TRACE_SOCKET, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/win32/Makefile.win32 new/libssh2-1.3.0/win32/Makefile.win32 --- old/libssh2-1.2.9/win32/Makefile.win32 2011-05-02 22:27:29.000000000 +0200 +++ new/libssh2-1.3.0/win32/Makefile.win32 1970-01-01 01:00:00.000000000 +0100 @@ -1,264 +0,0 @@ -######################################################################### -# -## Makefile for building libssh2 (Win32 version - gnu make) -## Use: make -f Makefile.win32 [help|all|clean|dev|devclean|dist|distclean|dll|objclean] -## -## Comments to: Guenter Knauf http://www.gknw.net/phpbb -# -######################################################################### - -# Edit the path below to point to the base of your Zlib sources. -ifndef ZLIB_PATH -ZLIB_PATH = ../../zlib-1.2.5 -endif -# since currently always enabled in libssh2_config.h set here too! -WITH_ZLIB = 1 - -# Edit the path below to point to the base of your OpenSSL package. -ifndef OPENSSL_PATH -OPENSSL_PATH = ../../openssl-0.9.8r -endif - -# Edit the path below to point to your Distribution folder. -ifndef DISTDIR -DISTDIR = libssh2-$(LIBSSH2_VERSION_STR)-bin-w32 -endif -DISTARC = $(DISTDIR).zip - -# Edit the path below to point to your Development folder. -ifndef DEVLDIR -DEVLDIR = libssh2-$(LIBSSH2_VERSION_STR)-dev-w32 -endif -DEVLARC = $(DEVLDIR).zip - -# Edit the vars below to change target settings. -TARGET = libssh2 -VERSION = $(LIBSSH2_VERSION) -COPYR = (c) $(LIBSSH2_COPYRIGHT_STR) -WWWURL = http://www.libssh2.org/ -DESCR = libssh2 $(LIBSSH2_VERSION_STR) -#STACK = 64000 - -# must be equal to DEBUG or NDEBUG -ifndef DB - DB = NDEBUG - # DB = DEBUG -endif -# Optimization: -O<n> or debugging: -g -ifeq ($(DB),NDEBUG) - OPT = -O2 - OBJDIR = release -else - OPT = -g - OPT += -DLIBSSH2DEBUG - OBJDIR = debug -endif - -# Include the version info retrieved from libssh2.h --include $(OBJDIR)/version.inc - -# The following line defines your compiler. -ifdef METROWERKS - CC = mwcc -else - CC = $(CROSSPREFIX)gcc -endif -CP = cp -afv -# RM = rm -f -MD = mkdir -# Here you can find a native Win32 binary of the original awk: -# http://www.gknw.net/development/prgtools/awk-20070501.zip -AWK = awk -ZIP = zip -qzr9 - -# Global flags for all compilers -CFLAGS = $(OPT) -D$(DB) -DWIN32 -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H - -ifeq ($(CC),mwcc) -LD = mwld -RC = mwwinrc -LDFLAGS = -nostdlib -AR = $(LD) -ARFLAGS = -nostdlib -library -o -LIBEXT = lib -#RANLIB = -LIBPATH += -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support" -LDLIBS += -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib -LDLIBS += -lkernel32.lib -luser32.lib -lwsock32.lib -RCFLAGS = -CFLAGS += -nostdinc -gccinc -msgstyle gcc -inline off -opt nointrinsics -proc 586 -CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support" -CFLAGS += -w on,nounused,nounusedexpr # -ansi strict -else -LD = $(CROSSPREFIX)gcc -RC = $(CROSSPREFIX)windres -LDFLAGS = -s -shared -Wl,--out-implib,$(TARGET)dll.a -AR = $(CROSSPREFIX)ar -ARFLAGS = -cq -LIBEXT = a -RANLIB = $(CROSSPREFIX)ranlib -#LDLIBS += -lwsock32 -LDLIBS += -lws2_32 -RCFLAGS = -DLIBSSH2_VERSION_ONLY -I. -I ../include -O coff -i -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall # -pedantic -endif - -INCLUDES = -I. -I../include -INCLUDES += -I$(OPENSSL_PATH)/outinc -I$(OPENSSL_PATH)/outinc/openssl - -ifdef LINK_STATIC -LDLIBS += $(OPENSSL_PATH)/out/libcrypto.$(LIBEXT) $(OPENSSL_PATH)/out/libssl.$(LIBEXT) -else -LDLIBS += $(OPENSSL_PATH)/out/libeay32.$(LIBEXT) $(OPENSSL_PATH)/out/libssl32.$(LIBEXT) -endif - -ifdef WITH_ZLIB - INCLUDES += -I$(ZLIB_PATH) - LDLIBS += $(ZLIB_PATH)/libz.$(LIBEXT) -endif - -CFLAGS += $(INCLUDES) - -ifeq ($(findstring /sh,$(SHELL)),/sh) -DL = ' -DS = / -else -XX = -DS = $(XX)\$(XX) -endif - -vpath %.c . ../src - -# include Makefile.inc to get CSOURCES define -include ../Makefile.inc - -OBJECTS := $(patsubst %.c,%.o,$(CSOURCES)) -OBJS := $(addprefix $(OBJDIR)/,$(OBJECTS)) -OBJL = $(OBJS) $(OBJDIR)/$(TARGET).res - -all: lib dll - -dll: prebuild $(TARGET).dll - -lib: prebuild $(TARGET).$(LIBEXT) - -prebuild: $(OBJDIR) $(OBJDIR)/version.inc -# libssh2_config.h - -test: all - $(MAKE) -C test -f Makefile.win32 - -$(OBJDIR)/%.o: %.c -# @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJDIR)/version.inc: ../include/libssh2.h $(OBJDIR) - @echo Creating $@ - @$(AWK) -f ../get_ver.awk $< > $@ - -dist: all $(DISTDIR) $(DISTDIR)/readme.txt - @-mkdir $(DISTDIR)$(DS)bin - @-$(CP) ../INSTALL $(DISTDIR) - @-$(CP) ../LICENSE $(DISTDIR) - @-$(CP) ../README $(DISTDIR) - @$(CP) $(TARGET).dll $(DISTDIR)/bin - @echo Creating $(DISTARC) - @$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt - -dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt - @-mkdir $(DEVLDIR)$(DS)bin - @-mkdir $(DEVLDIR)$(DS)include - @-mkdir $(DEVLDIR)$(DS)win32 - @-$(CP) ../INSTALL $(DEVLDIR) - @-$(CP) ../LICENSE $(DEVLDIR) - @-$(CP) ../README $(DEVLDIR) - @$(CP) $(TARGET).dll $(DEVLDIR)/bin - @$(CP) ../include/*.h $(DEVLDIR)/include - @$(CP) libssh2_config.h $(DEVLDIR)/include - @$(CP) *.$(LIBEXT) $(DEVLDIR)/win32 - @echo Creating $(DEVLARC) - @$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt - -distclean: clean - -$(RM) -r $(DISTDIR) - -$(RM) $(DISTARC) - -devclean: clean - -$(RM) -r $(DEVLDIR) - -$(RM) $(DEVLARC) - -objclean: all - -$(RM) -r $(OBJDIR) - -testclean: clean - $(MAKE) -C test -f Makefile.win32 clean - -clean: -# -$(RM) libssh2_config.h - -$(RM) $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT) - -$(RM) -r $(OBJDIR) - -$(OBJDIR): - @$(MD) $@ - -$(DISTDIR): - @$(MD) $@ - -$(DEVLDIR): - @$(MD) $@ - -$(TARGET).$(LIBEXT): $(OBJS) - @echo Creating $@ - @-$(RM) $@ - @$(AR) $(ARFLAGS) $@ $^ -ifdef RANLIB - @$(RANLIB) $@ -endif - -$(TARGET).dll $(TARGET)dll.a: $(OBJL) - @echo Linking $@ - @-$(RM) $@ - @$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS) - - -$(OBJDIR)/%.res: %.rc - @echo Creating $@ - @$(RC) $(RCFLAGS) $< -o $@ - - -$(DISTDIR)/readme.txt: Makefile.win32 - @echo Creating $@ - @echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@ - @echo $(DL)libssh version $(LIBSSH2_VERSION_STR)$(DL) >> $@ - @echo $(DL)Please download the complete libssh package for$(DL) >> $@ - @echo $(DL)any further documentation:$(DL) >> $@ - @echo $(DL)$(WWWURL)$(DL) >> $@ - -$(DEVLDIR)/readme.txt: Makefile.win32 - @echo Creating $@ - @echo $(DL)This is a development distribution for Win32 platform.$(DL) > $@ - @echo $(DL)libssh version $(LIBSSH2_VERSION_STR)$(DL) >> $@ - @echo $(DL)Please download the complete libssh package for$(DL) >> $@ - @echo $(DL)any further documentation:$(DL) >> $@ - @echo $(DL)$(WWWURL)$(DL) >> $@ - -help: $(OBJDIR)/version.inc - @echo $(DL)===========================================================$(DL) - @echo $(DL)OpenSSL path = $(OPENSSL_PATH)$(DL) - @echo $(DL)Zlib path = $(ZLIB_PATH)$(DL) - @echo $(DL)===========================================================$(DL) - @echo $(DL)libssh $(LIBSSH2_VERSION_STR) - available targets are:$(DL) - @echo $(DL)$(MAKE) all$(DL) - @echo $(DL)$(MAKE) dll$(DL) - @echo $(DL)$(MAKE) lib$(DL) - @echo $(DL)$(MAKE) clean$(DL) - @echo $(DL)$(MAKE) dev$(DL) - @echo $(DL)$(MAKE) devclean$(DL) - @echo $(DL)$(MAKE) dist$(DL) - @echo $(DL)$(MAKE) distclean$(DL) - @echo $(DL)$(MAKE) objclean$(DL) - @echo $(DL)$(MAKE) test$(DL) - @echo $(DL)===========================================================$(DL) - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libssh2-1.2.9/win32/test/Makefile.win32 new/libssh2-1.3.0/win32/test/Makefile.win32 --- old/libssh2-1.2.9/win32/test/Makefile.win32 2011-01-03 00:07:44.000000000 +0100 +++ new/libssh2-1.3.0/win32/test/Makefile.win32 1970-01-01 01:00:00.000000000 +0100 @@ -1,208 +0,0 @@ -######################################################################### -# -## Makefile for building libssh2 samples (Win32 version - gnu make) -## Use: make -f Makefile.win32 [help] -## -## Comments to: Guenter Knauf http://www.gknw.net/phpbb -# -######################################################################### - -# Edit the path below to point to the base of your Zlib sources. -ifndef ZLIB_PATH -ZLIB_PATH = ../../../zlib-1.2.5 -endif - -# Edit the path below to point to the base of your OpenSSL package. -ifndef OPENSSL_PATH -OPENSSL_PATH = ../../../openssl-0.9.8q -endif - -# Edit the var below to enable static linking of libssh2 and libz -LINK_STATIC = 1 - -# Edit the vars below to change target settings. -TARGETS = scp.exe sftp.exe sftpdir.exe ssh2.exe -VERSION = $(LIBSSH2_VERSION) -COPYR = (c) 2004-2010 The libssh2 project and its contributors. -WWWURL = http://www.libssh2.org/ -DESCR = libssh2 $(subst .def,,$(notdir $@)) $(LIBSSH2_VERSION_STR) -#STACK = 64000 - -# must be equal to DEBUG or NDEBUG -ifndef DB - DB = NDEBUG - # DB = DEBUG -endif -# Optimization: -O<n> or debugging: -g -ifeq ($(DB),NDEBUG) - OPT = -O2 - OBJDIR = release -else - OPT = -g - OBJDIR = debug -endif - -# Include the version info retrieved from libssh2.h --include $(OBJDIR)/version.inc - -# The following line defines your compiler. -ifdef METROWERKS - CC = mwcc -else - CC = $(CROSSPREFIX)gcc -endif -CP = cp -afv -# RM = rm -f -# Here you can find a native Win32 binary of the original awk: -# http://www.gknw.net/development/prgtools/awk-20070501.zip -AWK = awk -ZIP = zip -qzr9 - -# Global flags for all compilers -CFLAGS = $(OPT) -D$(DB) -DWIN32 -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H -CFLAGS += -DWINSOCK_VERSION=MAKEWORD(2,0) - -ifeq ($(CC),mwcc) -LD = mwld -RC = mwwinrc -LDFLAGS = -nostdlib -AR = $(LD) -ARFLAGS = -nostdlib -library -o -LIBEXT = lib -LIBPATH += -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support" -LDLIBS += -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib -LDLIBS += -lkernel32.lib -luser32.lib -lwsock32.lib -RCFLAGS = -CFLAGS += -nostdinc -gccinc -msgstyle gcc -inline off -opt nointrinsics -proc 586 -CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support" -CFLAGS += -w on,nounused,nounusedexpr # -ansi strict -else -LD = $(CROSSPREFIX)gcc -RC = $(CROSSPREFIX)windres -LDFLAGS = -s -AR = $(CROSSPREFIX)ar -ARFLAGS = -cq -LIBEXT = a -#LDLIBS += -lwsock32 -LDLIBS += -lws2_32 -RCFLAGS = -O coff -i -CFLAGS += -fno-strict-aliasing -CFLAGS += -Wall #-Wno-unused #-pedantic -endif - -INCLUDES = -I.. -I../../include -INCLUDES += -I$(OPENSSL_PATH)/outinc -I$(OPENSSL_PATH)/outinc/openssl -#LIBPATH += -L$(OPENSSL_PATH)/out -LIBPATH += -L.. - -ifdef LINK_STATIC - LDLIBS += -llibssh2 - #LDLIBS += $(OPENSSL_PATH)/out/libcrypto.$(LIBEXT) $(OPENSSL_PATH)/out/libssl.$(LIBEXT) -else - LDLIBS += -llibssh2dll - #LDLIBS += $(OPENSSL_PATH)/out/libeay32.$(LIBEXT) $(OPENSSL_PATH)/out/libssl32.$(LIBEXT) -endif - -ifdef WITH_ZLIB - INCLUDES += -I$(ZLIB_PATH) - #LIBPATH = -L$(ZLIB_PATH) -#ifdef LINK_STATIC -# LDLIBS += $(ZLIB_PATH)/libz.$(LIBEXT) -#else -# LDLIBS += $(ZLIB_PATH)/libzdll.$(LIBEXT) -#endif -endif - -CFLAGS += $(INCLUDES) - -ifeq ($(findstring /sh,$(SHELL)),/sh) -DL = ' -DS = / -else -DS = \\ -endif - -vpath %.c ../../example - -.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.rc $(OBJDIR)/%.res - - -all: prebuild $(TARGETS) - -prebuild: $(OBJDIR) $(OBJDIR)/version.inc - -$(OBJDIR)/%.o: %.c -# @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJDIR)/version.inc: ../../include/libssh2.h $(OBJDIR) - @echo Creating $@ - @$(AWK) -f ../../get_ver.awk $< > $@ - -objclean: - -$(RM) -r $(OBJDIR) - -clean: objclean - -$(RM) $(TARGETS) - -$(OBJDIR): - @mkdir $@ - -%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.res - @echo Linking $@ - @-$(RM) $@ - $(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS) - -$(OBJDIR)/%.res: $(OBJDIR)/%.rc - @echo Creating $@ - @$(RC) $(RCFLAGS) $< -o $@ - -$(OBJDIR)/%.rc: Makefile.win32 $(OBJDIR)/version.inc - @echo $(DL)1 VERSIONINFO$(DL) > $@ - @echo $(DL) FILEVERSION $(LIBSSH2_VERSION),0$(DL) >> $@ - @echo $(DL) PRODUCTVERSION $(LIBSSH2_VERSION),0$(DL) >> $@ - @echo $(DL) FILEFLAGSMASK 0x3fL$(DL) >> $@ - @echo $(DL) FILEOS 0x40004L$(DL) >> $@ - @echo $(DL) FILEFLAGS 0x0L$(DL) >> $@ - @echo $(DL) FILETYPE 0x1L$(DL) >> $@ - @echo $(DL) FILESUBTYPE 0x0L$(DL) >> $@ - @echo $(DL)BEGIN$(DL) >> $@ - @echo $(DL) BLOCK "StringFileInfo"$(DL) >> $@ - @echo $(DL) BEGIN$(DL) >> $@ - @echo $(DL) BLOCK "040904E4"$(DL) >> $@ - @echo $(DL) BEGIN$(DL) >> $@ - @echo $(DL) VALUE "LegalCopyright","$(COPYR)\0"$(DL) >> $@ -ifdef COMPANY - @echo $(DL) VALUE "CompanyName","$(COMPANY)\0"$(DL) >> $@ -endif - @echo $(DL) VALUE "ProductName","$(notdir $(@:.rc=.exe))\0"$(DL) >> $@ - @echo $(DL) VALUE "ProductVersion","$(LIBSSH2_VERSION_STR)\0"$(DL) >> $@ - @echo $(DL) VALUE "License","Released under GPL.\0"$(DL) >> $@ - @echo $(DL) VALUE "FileDescription","$(DESCR)\0"$(DL) >> $@ - @echo $(DL) VALUE "FileVersion","$(LIBSSH2_VERSION_STR)\0"$(DL) >> $@ - @echo $(DL) VALUE "InternalName","$(notdir $(@:.rc=))\0"$(DL) >> $@ - @echo $(DL) VALUE "OriginalFilename","$(notdir $(@:.rc=.exe))\0"$(DL) >> $@ - @echo $(DL) VALUE "WWW","$(WWWURL)\0"$(DL) >> $@ - @echo $(DL) END$(DL) >> $@ - @echo $(DL) END$(DL) >> $@ - @echo $(DL) BLOCK "VarFileInfo"$(DL) >> $@ - @echo $(DL) BEGIN$(DL) >> $@ - @echo $(DL) VALUE "Translation", 0x409, 1252$(DL) >> $@ - @echo $(DL) END$(DL) >> $@ - @echo $(DL)END$(DL) >> $@ -ifdef ICON - @echo $(DL)10 ICON DISCARDABLE "$(ICON)"$(DL) >> $@ -endif - -help: $(OBJDIR)/version.inc - @echo $(DL)===========================================================$(DL) - @echo $(DL)OpenSSL path = $(OPENSSL_PATH)$(DL) - @echo $(DL)Zlib path = $(ZLIB_PATH)$(DL) - @echo $(DL)===========================================================$(DL) - @echo $(DL)libssh $(LIBSSH2_VERSION_STR) - available targets are:$(DL) - @echo $(DL)$(MAKE) all$(DL) - @echo $(DL)$(MAKE) clean$(DL) - @echo $(DL)$(MAKE) objclean$(DL) - @echo $(DL)===========================================================$(DL) - - -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org