summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-08-08 22:30:00 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-08-08 22:30:00 -0400
commitd05afb3ca376d0683409c992e4a1cf5a665517dc (patch)
tree8f6eaf0777e712eb57e830fcb33d1b81e6621ee7 /src
parentbbff5ae4d3961d5c2bff61e7d989c4a69c17ffc7 (diff)
Fix an error in db-upgrade on sha256 encrypted passwords.
Diffstat (limited to 'src')
-rw-r--r--src/tools/db-upgrade.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/db-upgrade.cpp b/src/tools/db-upgrade.cpp
index fe9480803..eb7a1a978 100644
--- a/src/tools/db-upgrade.cpp
+++ b/src/tools/db-upgrade.cpp
@@ -2,6 +2,7 @@
#include <vector>
#include <iostream>
#include <fstream>
+#include <cstring>
#ifndef _WIN32
static const std::string C_LBLUE = "\033[1;34m";
@@ -193,9 +194,9 @@ int main(int argc, char *argv[])
size_t colon = password.find(':');
if (colon != std::string::npos && password.substr(0, colon) != "plain")
{
- std::string hash = password.substr(colon + 1), iv;
+ std::string hash = password.substr(colon + 1), iv, hashm = password.substr(0, colon);
unsigned len;
- if (password.substr(0, colon) == "sha256")
+ if (hashm == "sha256")
{
colon = hash.find(':');
iv = hash.substr(colon + 1);
@@ -218,7 +219,7 @@ int main(int argc, char *argv[])
else
hash.clear();
delete [] hash_decoded;
- password = password.substr(0, colon + 1);
+ password = hashm + ":";
if (!hash.empty())
password += hash;
if (!iv.empty())
@@ -236,6 +237,8 @@ int main(int argc, char *argv[])
out << line << std::endl;
}
+ std::cout << "Upgrade complete!" << std::endl;
+
in.close();
out.close();