aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-07-19 19:39:17 +0100
committerGravatar Sadie Powell2021-07-19 19:39:17 +0100
commitf9c273457d6c507013bd22169aad08445839bf4e (patch)
tree173bdf77d65f29cc551bb8fc5f0f898aab8b388e /src/modules
parentFix using the wrong variable for the ciphersuites in ssl_openssl. (diff)
Handle exceptions from hash providers in password_hash.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_password_hash.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp
index 86611d908..322923959 100644
--- a/src/modules/m_password_hash.cpp
+++ b/src/modules/m_password_hash.cpp
@@ -71,9 +71,17 @@ class CommandMkpasswd : public Command
return CMD_FAILURE;
}
- std::string hexsum = hp->Generate(parameters[1]);
- user->WriteNotice(parameters[0] + " hashed password for " + parameters[1] + " is " + hexsum);
- return CMD_SUCCESS;
+ try
+ {
+ std::string hexsum = hp->Generate(parameters[1]);
+ user->WriteNotice(parameters[0] + " hashed password for " + parameters[1] + " is " + hexsum);
+ return CMD_SUCCESS;
+ }
+ catch (const ModuleException& error)
+ {
+ user->WriteNotice("*** " + name + ": " + error.GetReason());
+ return CMD_FAILURE;
+ }
}
};