New password digest format.

This commit is contained in:
Jim Menard 2009-01-30 16:49:19 -05:00
parent af2b8b61d0
commit 60dcb19e87
3 changed files with 5 additions and 5 deletions

View File

@ -161,7 +161,7 @@ module XGen
auth['authenticate'] = 1 auth['authenticate'] = 1
auth['user'] = username auth['user'] = username
auth['nonce'] = nonce 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)) ok?(db_command(auth))
end end
@ -461,8 +461,8 @@ module XGen
private private
def hash_password(plaintext) def hash_password(username, plaintext)
Digest::MD5.hexdigest("mongo#{plaintext}") Digest::MD5.hexdigest("#{username}:mongo:#{plaintext}")
end end
end end

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = 'mongo' s.name = 'mongo'
s.version = '0.4.2' s.version = '0.4.3'
s.platform = Gem::Platform::RUBY s.platform = Gem::Platform::RUBY
s.summary = 'Simple pure-Ruby driver for the 10gen Mongo DB' 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.' s.description = 'A pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'

View File

@ -24,7 +24,7 @@ class DBTest < Test::Unit::TestCase
@spongebob_password = 'squarepants' @spongebob_password = 'squarepants'
@users = @db.collection('system.users') @users = @db.collection('system.users')
@users.clear @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 end
def teardown def teardown