rvc 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rvc/known_hosts.rb +6 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.3
|
data/lib/rvc/known_hosts.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
require 'digest/sha2'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'rbconfig'
|
3
4
|
|
4
5
|
module RVC
|
5
6
|
|
6
7
|
class KnownHosts
|
8
|
+
def initialize
|
9
|
+
@ignore_permissions = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
10
|
+
end
|
11
|
+
|
7
12
|
def filename
|
8
13
|
File.join(ENV['HOME'], ".rvc", "known_hosts");
|
9
14
|
end
|
@@ -20,7 +25,7 @@ class KnownHosts
|
|
20
25
|
expected_hashed_host = hash_host protocol, hostname
|
21
26
|
expected_hashed_public_key = hash_public_key public_key
|
22
27
|
if File.exists? filename
|
23
|
-
fail "bad permissions on
|
28
|
+
fail "bad permissions on #{filename}, expected 0600" unless @ignore_permissions or File.stat(filename).mode & 0666 == 0600
|
24
29
|
File.readlines(filename).each_with_index do |l,i|
|
25
30
|
hashed_host, hashed_public_key = l.split
|
26
31
|
next unless hashed_host == expected_hashed_host
|