Permalink
Browse files

make sure that ClearPassword string is handled.

When you set a clear password in the config, the
`couch_passwords:hash_admin_password/1` get a string instead of a
binary.
  • Loading branch information...
1 parent 03d176c commit 27eb739e038f25fc0a1bd02e0969a688e3fa4278 @benoitc benoitc committed May 7, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 apps/couch/src/couch_passwords.erl
View
4 apps/couch/src/couch_passwords.erl
@@ -30,8 +30,8 @@ simple(Password, Salt) ->
hash_admin_password(ClearPassword) ->
Iterations = couch_config:get("couch_httpd_auth", "iterations", "10000"),
Salt = couch_uuids:random(),
- DerivedKey = couch_passwords:pbkdf2(?b2l(ClearPassword), Salt,
- list_to_integer(Iterations)),
+ DerivedKey = couch_passwords:pbkdf2(couch_util:to_binary(ClearPassword),
+ Salt ,list_to_integer(Iterations)),
?l2b("-pbkdf2-" ++ ?b2l(DerivedKey) ++ ","
++ ?b2l(Salt) ++ ","
++ Iterations).

0 comments on commit 27eb739

Please sign in to comment.