diff --git a/README b/README index b1149c7..7f6a936 100644 --- a/README +++ b/README @@ -4,6 +4,8 @@ libssh2 - SSH2 library Version 0.9 ----------- + Fixed SFTP to be properly BC with version 1 and 2 servers. + Fixed libssh2_poll() to recognized closed sessions/channels. Added libssh2_channel_window_read_ex() and libssh2_channel_window_write_ex() diff --git a/src/sftp.c b/src/sftp.c index e5c7471..a8e58aa 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -1032,6 +1032,11 @@ LIBSSH2_API int libssh2_sftp_rename_ex(LIBSSH2_SFTP *sftp, char *source_filenam source_filename_len(4) + dest_filename_len(4) + flags(4) */ unsigned char *packet, *s, *data; + if (sftp->version < 2) { + libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, "Server does not support RENAME", 0); + return -1; + } + s = packet = LIBSSH2_ALLOC(session, packet_len); if (!packet) { libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for FXP_RENAME packet", 0); @@ -1275,6 +1280,12 @@ LIBSSH2_API int libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path, in unsigned char *packet, *s, *data; unsigned char link_responses[2] = { SSH_FXP_NAME, SSH_FXP_STATUS }; + if ((sftp->version < 3) && + (link_type != LIBSSH2_SFTP_REALPATH)) { + libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, "Server does not support SYMLINK or READLINK", 0); + return -1; + } + s = packet = LIBSSH2_ALLOC(session, packet_len); if (!packet) { libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for SYMLINK/READLINK/REALPATH packet", 0);