Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-15 15:40:30 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-15 15:40:30 +0300
commit345e32d332fd06e3c99b21660d3bf2939ba62ce5 (patch)
treec3f11a0fb904f458ecf0e44686ed79c093bd532d /app
parentd2a895dad80b5f7e12bb930fc92750d6848f7b21 (diff)
parent076494646d30cefd396e0d6a0ae879a31aecb454 (diff)
Merge branch 'sstanovnik-openssh_fix' into 'master'
Fix generating SSH key fingerprints with OpenSSH 6.8. Replaces https://github.com/gitlabhq/gitlabhq/pull/9008. Fixes gitlab-org/gitlab-ce#1289. cc @jacobvosmaer See merge request !519
Diffstat (limited to 'app')
-rw-r--r--app/models/key.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/app/models/key.rb b/app/models/key.rb
index e2e59296eed..016eee86992 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -16,7 +16,6 @@ require 'digest/md5'
class Key < ActiveRecord::Base
include Sortable
- include Gitlab::Popen
belongs_to :user
@@ -79,20 +78,9 @@ class Key < ActiveRecord::Base
def generate_fingerprint
self.fingerprint = nil
- return unless key.present?
-
- cmd_status = 0
- cmd_output = ''
- Tempfile.open('gitlab_key_file') do |file|
- file.puts key
- file.rewind
- cmd_output, cmd_status = popen(%W(ssh-keygen -lf #{file.path}), '/tmp')
- end
-
- if cmd_status.zero?
- cmd_output.gsub /(\h{2}:)+\h{2}/ do |match|
- self.fingerprint = match
- end
- end
+
+ return unless self.key.present?
+
+ self.fingerprint = Gitlab::KeyFingerprint.new(self.key).fingerprint
end
end