summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Skousen <seth.skousen@mx.com>2020-03-12 08:23:03 -0600
committerSeth Skousen <seth.skousen@mx.com>2020-03-12 08:23:03 -0600
commit4f6d2d0bbba4ea4e023e02e46dd6f4a9a4b457a4 (patch)
tree09c06bb83aab22646cb6834805b7098f5775d449
parentf54f71937caaab7afa330c228154e0013496c030 (diff)
downloadnet-ssh-4f6d2d0bbba4ea4e023e02e46dd6f4a9a4b457a4.tar.gz
Only limit value if on JRuby
-rw-r--r--lib/net/ssh/authentication/certificate.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/net/ssh/authentication/certificate.rb b/lib/net/ssh/authentication/certificate.rb
index 63e77ec..82e37e9 100644
--- a/lib/net/ssh/authentication/certificate.rb
+++ b/lib/net/ssh/authentication/certificate.rb
@@ -31,10 +31,11 @@ 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)
- # 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
+
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)