New password digest format.
This commit is contained in:
parent
af2b8b61d0
commit
60dcb19e87
|
@ -161,7 +161,7 @@ module XGen
|
|||
auth['authenticate'] = 1
|
||||
auth['user'] = username
|
||||
auth['nonce'] = nonce
|
||||
auth['key'] = Digest::MD5.hexdigest("#{nonce}#{username}#{hash_password(password)}")
|
||||
auth['key'] = Digest::MD5.hexdigest("#{nonce}#{username}#{hash_password(username, password)}")
|
||||
ok?(db_command(auth))
|
||||
end
|
||||
|
||||
|
@ -461,8 +461,8 @@ module XGen
|
|||
|
||||
private
|
||||
|
||||
def hash_password(plaintext)
|
||||
Digest::MD5.hexdigest("mongo#{plaintext}")
|
||||
def hash_password(username, plaintext)
|
||||
Digest::MD5.hexdigest("#{username}:mongo:#{plaintext}")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = 'mongo'
|
||||
s.version = '0.4.2'
|
||||
s.version = '0.4.3'
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = 'Simple pure-Ruby driver for the 10gen Mongo DB'
|
||||
s.description = 'A pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'
|
||||
|
|
|
@ -24,7 +24,7 @@ class DBTest < Test::Unit::TestCase
|
|||
@spongebob_password = 'squarepants'
|
||||
@users = @db.collection('system.users')
|
||||
@users.clear
|
||||
@users.insert(:user => @spongebob, :pwd => @db.send(:hash_password, @spongebob_password))
|
||||
@users.insert(:user => @spongebob, :pwd => @db.send(:hash_password, @spongebob, @spongebob_password))
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
Loading…
Reference in New Issue