diff options
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) { |