A quick brief, I am working with one of the implementations of SFTP server for .NET i.e. NSoftware IPWorks SSH. I wanted to deduce the APPEND operation invoked by the client and do some logic on that. I quickly implemented the SSH client using Renci's SSH.NET package and was able to deduce the APPEND operation on the SFTP server.
But, the thing turned sideways when I used JCraft's JSch a Java implementation of SSH2. When I invoked the APPEND operation using JSch, the bitmask which notifies the current operation being performed was different from what I was expecting. I was expecting the flag value as 14 which notifies the APPEND call but I got it as 10 which clearly messed up my logic.
Going through the implementation of APPEND call in JSch I found out that the SSH_FXF_APPEND bitmask is commented out and there's no explanation as well.
private void sendOPENA(byte[] path) throws Exception{
sendOPEN(path, SSH_FXF_WRITE|/*SSH_FXF_APPEND|*/SSH_FXF_CREAT);
}
According to SSH RFP below are the bitmask values for the operations. https://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#page-17
#define SSH_FXF_READ 0x00000001
#define SSH_FXF_WRITE 0x00000002
#define SSH_FXF_APPEND 0x00000004
#define SSH_FXF_CREAT 0x00000008
#define SSH_FXF_TRUNC 0x00000010
#define SSH_FXF_EXCL 0x00000020
#define SSH_FXF_TEXT 0x00000040
Does someone know what is going on here because all implementations should be consistent with the RFP?
User contributions licensed under CC BY-SA 3.0