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/modules/AuthBackendChallengeResponse | |
parent | 23d4cc1dfa5602c266f2f3d71f845f9ef0789b89 (diff) | |
download | mad-fca6c1a831393e173706a5b5c798c35dc5f7d3e6.tar mad-fca6c1a831393e173706a5b5c798c35dc5f7d3e6.zip |
Thread-Sicherheit verbessert
Diffstat (limited to 'src/modules/AuthBackendChallengeResponse')
-rw-r--r-- | src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.cpp | 4 | ||||
-rw-r--r-- | src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.cpp b/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.cpp index 5878362..fc6bd47 100644 --- a/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.cpp +++ b/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.cpp @@ -21,6 +21,8 @@ #include <Common/Hash.h> +#include <boost/thread/locks.hpp> + namespace Mad { namespace Modules { namespace AuthBackendChallengeResponse { @@ -30,6 +32,8 @@ const std::string AuthBackendChallengeResponse::methodName = "Challenge-Response AuthBackendChallengeResponse::AuthContextChallengeResponse::AuthContextChallengeResponse(AuthBackendChallengeResponse *backend) : authenticated(false) { challenge.reserve(32); + boost::lock_guard<boost::mutex> lock(backend->mutex); + for(int i = 0; i < 32; ++i) challenge.push_back(backend->randomGenerator()); } diff --git a/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.h b/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.h index a32cc98..dc1b60a 100644 --- a/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.h +++ b/src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.h @@ -33,6 +33,8 @@ #include <boost/random/uniform_int.hpp> #include <boost/random/variate_generator.hpp> +#include <boost/thread/mutex.hpp> + namespace Mad { namespace Modules { namespace AuthBackendChallengeResponse { @@ -58,6 +60,8 @@ class MAD_MODULE_EXPORT AuthBackendChallengeResponse : public Common::AuthBacken Common::Application *application; + boost::mutex mutex; + boost::mt19937 rng; boost::uniform_int<boost::uint8_t> byteDistribution; boost::variate_generator<boost::mt19937&, boost::uniform_int<boost::uint8_t> > randomGenerator; |