diff options
author | Miklós Fazekas <mfazekas@szemafor.com> | 2020-03-16 18:33:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 18:33:21 +0100 |
commit | fc91300d7ee6299ba2fe4039cc8085aec9edb7f3 (patch) | |
tree | 9abb385fd458ef367759a4e3987bfa809754d0c0 | |
parent | 66308cd284da302806176a2625b7e9417148d5c7 (diff) | |
parent | 4f6d2d0bbba4ea4e023e02e46dd6f4a9a4b457a4 (diff) | |
download | net-ssh-fc91300d7ee6299ba2fe4039cc8085aec9edb7f3.tar.gz |
Merge pull request #746 from sskousen/master
Limit cert.valid_before to max supported by JRuby
-rw-r--r-- | lib/net/ssh/authentication/certificate.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/net/ssh/authentication/certificate.rb b/lib/net/ssh/authentication/certificate.rb index ecf5df8..82e37e9 100644 --- a/lib/net/ssh/authentication/certificate.rb +++ b/lib/net/ssh/authentication/certificate.rb @@ -31,7 +31,16 @@ module Net cert.key_id = buffer.read_string cert.valid_principals = buffer.read_buffer.read_all(&:read_string) cert.valid_after = Time.at(buffer.read_int64) - cert.valid_before = Time.at(buffer.read_int64) + + cert.valid_before = if RUBY_PLATFORM == "java" + # 0x20c49ba5e353f7 = 0x7fffffffffffffff/1000, the largest value possible for JRuby + # JRuby Time.at multiplies the arg by 1000, and then stores it in a signed long. + # 0x20c49ba5e353f7 = 292278994-08-17 01:12:55 -0600 + Time.at([0x20c49ba5e353f7, buffer.read_int64].min) + else + Time.at(buffer.read_int64) + end + cert.critical_options = read_options(buffer) cert.extensions = read_options(buffer) cert.reserved = buffer.read_string |