diff options
author | Badlop <badlop@process-one.net> | 2015-06-25 13:39:45 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2015-06-25 13:39:45 +0200 |
commit | 4ae1b4db03f4cea0fd1d7639ac58eb58cbb19efd (patch) | |
tree | 0abc751d40cb8aa0fc0d333dda25550203da10c7 /src | |
parent | Add xep definition to mod_mam (diff) |
When passwords are scrammed, report check_password_hash cannot work (#559)
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_admin_extra.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index 6fbf762eb..436108ead 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -515,12 +515,16 @@ set_password(User, Host, Password) -> %% Copied some code from ejabberd_commands.erl check_password_hash(User, Host, PasswordHash, HashMethod) -> AccountPass = ejabberd_auth:get_password_s(User, Host), - AccountPassHash = case HashMethod of - "md5" -> get_md5(AccountPass); - "sha" -> get_sha(AccountPass); + AccountPassHash = case {AccountPass, HashMethod} of + {A, _} when is_tuple(A) -> scrammed; + {_, "md5"} -> get_md5(AccountPass); + {_, "sha"} -> get_sha(AccountPass); _ -> undefined end, case AccountPassHash of + scrammed -> + ?ERROR_MSG("Passwords are scrammed, and check_password_hash can not work.", []), + throw(passwords_scrammed_command_cannot_work); undefined -> error; PasswordHash -> ok; _ -> error |