From 994ec9e1cba547bed6eef02f996ca2a7beaf777a Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sun, 23 Jun 2024 16:51:52 -0400 Subject: add upstream 13.7 --- libssh2/libssh2_wrap.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libssh2/libssh2_wrap.h') diff --git a/libssh2/libssh2_wrap.h b/libssh2/libssh2_wrap.h index fcb49855..2c99ac13 100644 --- a/libssh2/libssh2_wrap.h +++ b/libssh2/libssh2_wrap.h @@ -107,6 +107,20 @@ inline int libssh2_sftp_readlink(LIBSSH2_SFTP* sftp, const std::string& path, ch return libssh2_sftp_symlink_ex(sftp, path.c_str(), static_cast(path.size()), buf, static_cast(bufSize), LIBSSH2_SFTP_READLINK); } +#undef libssh2_sftp_symlink +inline int libssh2_sftp_symlink(LIBSSH2_SFTP* sftp, const std::string& path, const std::string_view buf) +{ + return libssh2_sftp_symlink_ex(sftp, + /* CAVEAT: https://www.sftp.net/spec/openssh-sftp-extensions.txt + "When OpenSSH's sftp-server was implemented, the order of the arguments + to the SSH_FXP_SYMLINK method was inadvertently reversed." + + => of course libssh2 didn't get the memo: fix this shit: */ + /**/ buf .data (), static_cast(buf .size()), + const_cast(path.c_str()), static_cast(path.size()), + LIBSSH2_SFTP_SYMLINK); +} + #undef libssh2_sftp_rename inline int libssh2_sftp_rename(LIBSSH2_SFTP* sftp, const std::string& pathFrom, const std::string& pathTo, long flags) { -- cgit