summaryrefslogtreecommitdiffstats
path: root/src/modules/AuthBackendChallengeResponse
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/AuthBackendChallengeResponse')
-rw-r--r--src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.cpp4
-rw-r--r--src/modules/AuthBackendChallengeResponse/AuthBackendChallengeResponse.h4
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;