summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-07 19:16:26 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-07 19:18:52 +0200
commit257799728473f26ebfadf42327b8ba2afddb6335 (patch)
tree812a0a922285e981b951fb07483d713594cab3f0 /src
parentacc3a85174d22b8f90d92cb2aace260cddba39e6 (diff)
downloadmanaserv-257799728473f26ebfadf42327b8ba2afddb6335.tar.gz
manaserv-257799728473f26ebfadf42327b8ba2afddb6335.tar.xz
manaserv-257799728473f26ebfadf42327b8ba2afddb6335.zip
Revert "Added a method of updating the passwords of an existing database"
Assumed to be no longer necessary. This reverts commit a09d4aa14c6a7b4486080b4cfbe1c76c4fae6fd2.
Diffstat (limited to 'src')
-rw-r--r--src/account-server/storage.cpp48
-rw-r--r--src/account-server/storage.hpp2
2 files changed, 0 insertions, 50 deletions
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp
index c104b4f..cdf466d 100644
--- a/src/account-server/storage.cpp
+++ b/src/account-server/storage.cpp
@@ -34,7 +34,6 @@
#include "utils/functors.h"
#include "utils/logger.h"
#include "utils/xml.hpp"
-#include "utils/sha256.h"
static const char *DEFAULT_ITEM_FILE = "items.xml";
@@ -139,13 +138,6 @@ void Storage::open()
std::ostringstream sql;
sql << "DELETE FROM " << ONLINE_USERS_TBL_NAME;
mDb->execSql(sql.str());
-
- /* Uncomment this and run the account server once to update existing
- * password hashes. Making backup of the database is recommended, since
- * it doesn't check whether the passwords are already hashed, and the
- * operation is not reversible!
- */
- //updatePasswordHashes();
}
catch (const DbConnectionFailure& e) {
std::ostringstream errmsg;
@@ -164,46 +156,6 @@ void Storage::close()
}
/**
- * Temporary function to hash all account passwords, for updating a database
- * of accounts to the change to hashing passwords on both the server and the
- * client.
- */
-void Storage::updatePasswordHashes()
-{
- using namespace dal;
-
- std::ostringstream sql2;
- sql2 << "SELECT id, password FROM " << ACCOUNTS_TBL_NAME;
-
- const RecordSet &results = mDb->execSql(sql2.str());
- if (!results.isEmpty()) {
- std::vector<std::pair <unsigned, std::string > > hashed;
-
- const unsigned nRows = results.rows();
-
- for (unsigned row = 0; row < nRows; row++)
- {
- string_to< unsigned > toUint;
- const int id = toUint(results(row, 0));
- const std::string password = results(row, 1);
- const std::string hashedPassword = sha256(password);
-
- hashed.push_back(std::pair<unsigned, std::string >(id, hashedPassword));
- }
-
- for (unsigned i = 0; i < hashed.size(); ++i)
- {
- std::ostringstream setsql;
- setsql << "UPDATE " << ACCOUNTS_TBL_NAME << " SET password = '"
- << hashed[i].second << "' WHERE id = '" << hashed[i].first << "'";
- mDb->execSql(setsql.str());
- }
-
- std::cout << "Hashed the passwords of " << nRows << " accounts!" << std::endl;
- }
-}
-
-/**
* Gets an account from a prepared SQL statement
*
* @return the account found
diff --git a/src/account-server/storage.hpp b/src/account-server/storage.hpp
index 204e6c9..989f1b9 100644
--- a/src/account-server/storage.hpp
+++ b/src/account-server/storage.hpp
@@ -49,8 +49,6 @@ class Storage
void open();
void close();
- void updatePasswordHashes();
-
Account *getAccount(const std::string &userName);
Account *getAccount(int accountID);