diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
commit | a7a285eb61dd83afc892bc1d64ffe14b9f1426a3 (patch) | |
tree | 08d2efcaec46e5f5702d9e336a0e8ba7e636aff9 /src/modules/AuthProviderFile | |
parent | b40ba0cf91603b695f1f2380cbd39966a458f22f (diff) | |
download | mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.tar mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.zip |
Completely migrate to Unicode String class
Diffstat (limited to 'src/modules/AuthProviderFile')
-rw-r--r-- | src/modules/AuthProviderFile/AuthProviderFile.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/AuthProviderFile/AuthProviderFile.cpp b/src/modules/AuthProviderFile/AuthProviderFile.cpp index b006cdc..177d633 100644 --- a/src/modules/AuthProviderFile/AuthProviderFile.cpp +++ b/src/modules/AuthProviderFile/AuthProviderFile.cpp @@ -54,13 +54,14 @@ void AuthProviderFile::readFile(const std::string &name) { continue; } - Core::String password = match[2].str().c_str(); + Core::String username = Core::String::fromLocale(match[1].str()); + Core::String password = Core::String::fromLocale(match[2].str()); if(filehash.isEmpty()) { - std::string utf8pass = password.extractUTF8(); + std::string utf8pass = password.toUTF8(); boost::lock_guard<boost::mutex> lock(mutex); - userMap.insert(std::make_pair(match[1].str().c_str(), std::vector<boost::uint8_t>(utf8pass.begin(), utf8pass.end()))); + userMap.insert(std::make_pair(username, std::vector<boost::uint8_t>(utf8pass.begin(), utf8pass.end()))); } else { std::vector<boost::uint8_t> data; @@ -81,7 +82,7 @@ void AuthProviderFile::readFile(const std::string &name) { if(!data.empty()) { boost::lock_guard<boost::mutex> lock(mutex); - userMap.insert(std::make_pair(match[1].str().c_str(), data)); + userMap.insert(std::make_pair(username, data)); } } } @@ -99,7 +100,7 @@ bool AuthProviderFile::handleConfigEntry(const Core::ConfigEntry &entry, bool /* filehash = entry[1][0]; if(!Common::Hash::isHashSupported(filehash)) - application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Unsupported hash '%s'", filehash.extract().c_str()); + application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Unsupported hash '%s'", filehash.toLocale().c_str()); } } else if(entry[1].getKey().matches("File")) { @@ -126,7 +127,7 @@ void AuthProviderFile::configFinished() { hashes.push_back("Clear"); for(std::vector<Core::String>::iterator file = files.begin(); file != files.end(); ++file) - readFile(file->extract()); + readFile(file->toLocale()); } bool AuthProviderFile::checkPassword(const Core::String &user, const std::vector<boost::uint8_t> &data, const Core::String &hash) throw(Core::Exception) { |