Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
38384bd9
Commit
38384bd9
authored
Mar 24, 2015
by
Sašo Stanovnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The new fingerprint format wis incompatible with the previous regex.
parent
05d4658b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
app/models/key.rb
app/models/key.rb
+11
-4
No files found.
app/models/key.rb
View file @
38384bd9
...
@@ -83,6 +83,7 @@ class Key < ActiveRecord::Base
...
@@ -83,6 +83,7 @@ class Key < ActiveRecord::Base
cmd_status
=
0
cmd_status
=
0
cmd_output
=
''
cmd_output
=
''
explicit_fingerprint_algorithm
=
false
Tempfile
.
open
(
'gitlab_key_file'
)
do
|
file
|
Tempfile
.
open
(
'gitlab_key_file'
)
do
|
file
|
file
.
puts
key
file
.
puts
key
file
.
rewind
file
.
rewind
...
@@ -90,7 +91,6 @@ class Key < ActiveRecord::Base
...
@@ -90,7 +91,6 @@ class Key < ActiveRecord::Base
# OpenSSH 6.8 introduces a new default output format for fingerprints.
# OpenSSH 6.8 introduces a new default output format for fingerprints.
# Check the version and decide which command to use.
# Check the version and decide which command to use.
version_output
,
version_status
=
popen
(
%W(ssh -V)
)
version_output
,
version_status
=
popen
(
%W(ssh -V)
)
explicit_fingerprint_algorithm
=
false
if
version_status
.
zero?
if
version_status
.
zero?
out
,
_
=
version_output
.
scan
/.*?(\d)\.(\d).*?,/
out
,
_
=
version_output
.
scan
/.*?(\d)\.(\d).*?,/
major
,
minor
=
out
[
0
],
out
[
1
]
major
,
minor
=
out
[
0
],
out
[
1
]
...
@@ -107,9 +107,16 @@ class Key < ActiveRecord::Base
...
@@ -107,9 +107,16 @@ class Key < ActiveRecord::Base
end
end
if
cmd_status
.
zero?
if
cmd_status
.
zero?
if
explicit_fingerprint_algorithm
cmd_output
.
gsub
/(MD5:)(\h{2}:)+\h{2}/
do
|
match
|
match
.
slice!
/^MD5:/
self
.
fingerprint
=
match
end
else
cmd_output
.
gsub
/(\h{2}:)+\h{2}/
do
|
match
|
cmd_output
.
gsub
/(\h{2}:)+\h{2}/
do
|
match
|
self
.
fingerprint
=
match
self
.
fingerprint
=
match
end
end
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment