diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-03 20:16:23 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-03 20:16:23 +0200 |
commit | fca6c1a831393e173706a5b5c798c35dc5f7d3e6 (patch) | |
tree | 38b4b6f59a10736e869eaf460020bf28b4bc8c3d /src/Common | |
parent | 23d4cc1dfa5602c266f2f3d71f845f9ef0789b89 (diff) | |
download | mad-fca6c1a831393e173706a5b5c798c35dc5f7d3e6.tar mad-fca6c1a831393e173706a5b5c798c35dc5f7d3e6.zip |
Thread-Sicherheit verbessert
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/AuthManager.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Common/AuthManager.cpp b/src/Common/AuthManager.cpp index c4cace7..38ac9e3 100644 --- a/src/Common/AuthManager.cpp +++ b/src/Common/AuthManager.cpp @@ -77,16 +77,20 @@ std::vector<std::string> AuthManager::getSubMethods(const std::string &method) t boost::shared_ptr<AuthContext> AuthManager::authenticate(const std::string &method, const std::string &subMethod, const std::string &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response, boost::shared_ptr<AuthContext> context) throw(Core::Exception) { - boost::lock_guard<boost::shared_mutex> lock(mutex); + std::map<std::string, boost::shared_ptr<AuthBackend> >::iterator backend; - response.clear(); + { + boost::lock_guard<boost::shared_mutex> lock(mutex); - std::map<std::string, boost::shared_ptr<AuthBackend> >::iterator backend = backends.find(method); - if(backend == backends.end()) - throw Core::Exception(Core::Exception::NOT_IMPLEMENTED); + response.clear(); - if(!provider) - throw Core::Exception(Core::Exception::NOT_AVAILABLE); + backend = backends.find(method); + if(backend == backends.end()) + throw Core::Exception(Core::Exception::NOT_IMPLEMENTED); + + if(!provider) + throw Core::Exception(Core::Exception::NOT_AVAILABLE); + } return backend->second->authenticate(provider, subMethod, user, data, response, context); } |