-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timestamp overflow problem #708
Comments
Hi @rlnsh, Can you please provide more specifics as to what sort of defect you believe is present in JSch? Thanks, |
In the SftpATTRS class, the mtime and atime fields are int type, and the maximum value is 2147483647. If the server time is changed to January 20, 2038, the obtained mtime and atime are negative values, and the time rollback occurs. |
Hi @rlnsh, You are aware that this fields are specified in the SFTP standard to which JSch adheres as Thanks, |
ok, i see, Thanks! |
The uint32 in the c language in sftp has an unsigned bit and its maximum value is 4294967295. Therefore, java receives packets of the long type. |
I'm not sure what point you are attempting to make? |
If the file date is January 20, 2038, but the mtime obtained by SftpATTRS is incorrect, the timestamp returns a negative number. |
It's the caller's responsibility to correctly interpret the |
Since JSch uses a pure java SSH implementation, there's no reason why this can't be done. Even the original README cites a TODO to support SFTP v4. To my knowledge there has not been any mention of supporting SFTP v4 or later since the fork. Lines 185 to 189 in e7c4d5c
However, given that most SSH servers use OpenSSH, which only supports SFTP up to v3 and whose developers have no intention to move on to later versions in the near future, implementing support for SFTP v4 in JSch would not solve your issue unless your SSH servers supports it (e.g. ProFTPD) If you absolutely need SFTPv4 or above, you might want to look into Apache Mina. imo JSch will continue to cater more to developers maintaining legacy code |
I personally have no plans to implement SFTPv4, since it isn't supported by OpenSSH. |
The jsch library will get the modified time of the file will have a timestamp overflow problem, such as after January 19, 2038, will have a negative timestamp time rollback problem. Hope the author can fix the problem next time, tTime field is currently an int and needs to be adjusted to a long type.
The text was updated successfully, but these errors were encountered: