You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2015/06/03 20:42:09 UTC
couch commit: updated refs/heads/master to 3d97e77
Repository: couchdb-couch
Updated Branches:
refs/heads/master e19b262d4 -> 3d97e7792
Replace password_scheme and iterations field
Previously we introduced duplicates
COUCHDB-2710
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/3d97e779
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/3d97e779
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/3d97e779
Branch: refs/heads/master
Commit: 3d97e7792ca081dcd66e5ea5561d3a09309cbd53
Parents: e19b262
Author: Robert Newson <rn...@apache.org>
Authored: Wed Jun 3 19:38:13 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Jun 3 19:38:13 2015 +0100
----------------------------------------------------------------------
src/couch_users_db.erl | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/3d97e779/src/couch_users_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_users_db.erl b/src/couch_users_db.erl
index 3b76862..ade1955 100644
--- a/src/couch_users_db.erl
+++ b/src/couch_users_db.erl
@@ -66,11 +66,12 @@ save_doc(#doc{body={Body}} = Doc) ->
Iterations = list_to_integer(config:get("couch_httpd_auth", "iterations", "1000")),
Salt = couch_uuids:random(),
DerivedKey = couch_passwords:pbkdf2(ClearPassword, Salt, Iterations),
- Body0 = [{?PASSWORD_SCHEME, ?PBKDF2}, {?ITERATIONS, Iterations}|Body],
- Body1 = ?replace(Body0, ?DERIVED_KEY, DerivedKey),
- Body2 = ?replace(Body1, ?SALT, Salt),
- Body3 = proplists:delete(?PASSWORD, Body2),
- Doc#doc{body={Body3}}
+ Body0 = ?replace(Body, ?PASSWORD_SCHEME, ?PBKDF2),
+ Body1 = ?replace(Body0, ?ITERATIONS, Iterations),
+ Body2 = ?replace(Body1, ?DERIVED_KEY, DerivedKey),
+ Body3 = ?replace(Body2, ?SALT, Salt),
+ Body4 = proplists:delete(?PASSWORD, Body3),
+ Doc#doc{body={Body4}}
end.
% If the doc is a design doc