summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/util/net/ssl_manager_windows.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/util/net/ssl_manager_windows.cpp b/src/mongo/util/net/ssl_manager_windows.cpp
index e5f88e026e7..cfdc226c53f 100644
--- a/src/mongo/util/net/ssl_manager_windows.cpp
+++ b/src/mongo/util/net/ssl_manager_windows.cpp
@@ -48,6 +48,7 @@
#include "mongo/config.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_parameters.h"
+#include "mongo/platform/atomic_word.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/debug_util.h"
@@ -798,10 +799,13 @@ StatusWith<UniqueCertificateWithPrivateKey> readCertPEMFile(StringData fileName,
// Create the right Crypto context depending on whether we running in a server or outside.
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa375195(v=vs.85).aspx
if (isSSLServer) {
- // Generate a unique name for our key container
+ // Generate a unique name for each key container
// Use the the log file if possible
if (!serverGlobalParams.logpath.empty()) {
- wstr = toNativeString(serverGlobalParams.logpath.c_str());
+ static AtomicWord<int> counter{0};
+ std::string keyContainerName = str::stream() << serverGlobalParams.logpath
+ << counter.fetchAndAdd(1);
+ wstr = toNativeString(keyContainerName.c_str());
} else {
auto us = UUID::gen().toString();
wstr = toNativeString(us.c_str());