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 2023/10/25 13:27:17 UTC
[couchdb] 03/07: give couch_password_hasher:hash a clearer name
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch decouple_offline_hash_strength_from_online
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 6fce968e5d6f2ca07f30d5e6f32372d0cb9c53c5
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu Oct 19 14:18:44 2023 +0100
give couch_password_hasher:hash a clearer name
---
src/couch/src/couch_password_hasher.erl | 14 +++++++-------
src/couch/src/couch_server.erl | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/couch/src/couch_password_hasher.erl b/src/couch/src/couch_password_hasher.erl
index 000497694..b34bc52d9 100644
--- a/src/couch/src/couch_password_hasher.erl
+++ b/src/couch/src/couch_password_hasher.erl
@@ -24,7 +24,7 @@
code_change/3
]).
--export([hash/1]).
+-export([hash_admin_passwords/1]).
-record(state, {}).
@@ -32,9 +32,9 @@
%%% Public functions
%%%===================================================================
--spec hash(Persist :: boolean()) -> Reply :: term().
-hash(Persist) ->
- gen_server:cast(?MODULE, {hash_passwords, Persist}).
+-spec hash_admin_passwords(Persist :: boolean()) -> Reply :: term().
+hash_admin_passwords(Persist) ->
+ gen_server:cast(?MODULE, {hash_admin_passwords, Persist}).
%%%===================================================================
%%% Spawning and gen_server implementation
@@ -50,8 +50,8 @@ init(_Args) ->
handle_call(Msg, _From, #state{} = State) ->
{stop, {invalid_call, Msg}, {invalid_call, Msg}, State}.
-handle_cast({hash_passwords, Persist}, State) ->
- hash_admin_passwords(Persist),
+handle_cast({hash_admin_passwords, Persist}, State) ->
+ hash_admin_passwords_int(Persist),
{noreply, State};
handle_cast(Msg, State) ->
{stop, {invalid_cast, Msg}, State}.
@@ -63,7 +63,7 @@ code_change(_OldVsn, #state{} = State, _Extra) ->
%%% Internal functions
%%%===================================================================
-hash_admin_passwords(Persist) ->
+hash_admin_passwords_int(Persist) ->
lists:foreach(
fun({User, ClearPassword}) ->
HashedPassword = couch_passwords:hash_admin_password(ClearPassword),
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 7dbbe4af1..94f36baab 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -357,7 +357,7 @@ handle_config_change("couchdb_engines", _, _, _, N) ->
{ok, N};
handle_config_change("admins", _, _, Persist, 1 = N) ->
% async hashing on couch_server with number 1 only
- couch_password_hasher:hash(Persist),
+ couch_password_hasher:hash_admin_passwords(Persist),
{ok, N};
handle_config_change("httpd", "authentication_handlers", _, _, 1 = N) ->
couch_httpd:stop(),