diff options
author | Adam <Adam@anope.org> | 2012-08-09 23:28:02 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-08-09 23:28:02 -0400 |
commit | fde42899e76009db978e2007a0a8a1ffc5f0f83d (patch) | |
tree | f36bd3d90331b4c7354614895d0dee0dbf5cff61 | |
parent | f7bf2fa9604d93f36a0025d9890d174ad2576a6a (diff) |
Fixed db_old loading encrypted passwords from 1.8
-rw-r--r-- | modules/database/db_old.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index d0aceb9f3..2550bce78 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -143,11 +143,10 @@ static void my_b64_encode(const Anope::string &src, Anope::string &target) } } -static Anope::string Hex(const std::string &data) +static Anope::string Hex(const char *data, size_t l) { const char hextable[] = "0123456789abcdef"; - size_t l = data.length(); std::string rv; for (size_t i = 0; i < l; ++i) { @@ -393,8 +392,12 @@ static void LoadNicks() READ(read_buffer(pwbuf, f)); if (hashm == "plain") my_b64_encode(pwbuf, nc->pass); + else if (hashm == "md5" || hashm == "oldmd5") + nc->pass = Hex(pwbuf, 16); + else if (hashm == "sha1") + nc->pass = Hex(pwbuf, 20); else - nc->pass = Hex(pwbuf); + nc->pass = Hex(pwbuf, strlen(pwbuf)); nc->pass = hashm + ":" + nc->pass; READ(read_string(buffer, f)); |