summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-11 19:37:11 +0000
committerSadie Powell <sadie@witchery.services>2024-03-11 19:39:47 +0000
commit02355546ff4a76a10049f9c7f03d0b778b247dba (patch)
tree072b150c8f46b0038f1d21b423ca57319cbde338 /modules
parent6ad3430ac41fdd3669d1f4d23e8a0a3adba22c2b (diff)
Reject registrations and password changes if password encryption fails.
Diffstat (limited to 'modules')
-rw-r--r--modules/nickserv/ns_register.cpp9
-rw-r--r--modules/nickserv/ns_set.cpp17
2 files changed, 20 insertions, 6 deletions
diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp
index 599e50e45..0f5fc5533 100644
--- a/modules/nickserv/ns_register.cpp
+++ b/modules/nickserv/ns_register.cpp
@@ -211,10 +211,17 @@ public:
source.Reply(MAIL_X_INVALID, email.c_str());
else
{
+ Anope::string encpass;
+ if (!Anope::Encrypt(pass, encpass))
+ {
+ source.Reply(_("Accounts can not be registered right now. Please try again later."));
+ return;
+ }
+
auto *nc = new NickCore(u_nick);
auto *na = new NickAlias(u_nick, nc);
- Anope::Encrypt(pass, nc->pass);
nc->email = email;
+ nc->pass = encpass;
if (u)
{
diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp
index d38c62051..ed3708d16 100644
--- a/modules/nickserv/ns_set.cpp
+++ b/modules/nickserv/ns_set.cpp
@@ -148,9 +148,13 @@ public:
return;
}
- Log(LOG_COMMAND, source, this) << "to change their password";
+ if (!Anope::Encrypt(param, source.nc->pass))
+ {
+ source.Reply(_("Passwords can not be changed right now. Please try again later."));
+ return;
+ }
- Anope::Encrypt(param, source.nc->pass);
+ Log(LOG_COMMAND, source, this) << "to change their password";
source.Reply(_("Password for \002%s\002 changed."), source.nc->display.c_str());
}
@@ -218,10 +222,13 @@ public:
return;
}
- Log(LOG_ADMIN, source, this) << "to change the password of " << nc->display;
+ if (!Anope::Encrypt(params[1], nc->pass))
+ {
+ source.Reply(_("Passwords can not be changed right now. Please try again later."));
+ return;
+ }
- Anope::Encrypt(params[1], nc->pass);
- Anope::string tmp_pass;
+ Log(LOG_ADMIN, source, this) << "to change the password of " << nc->display;
source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str());
}