diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-01-30 16:37:54 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-01-30 16:37:54 -0500 |
commit | 6658305fbf6942f1f1294d0bffeaec9adb1bf03a (patch) | |
tree | 060e2e1f202bce70516e2d5a49d677380fa3c2b4 | |
parent | d46942c358f42379d2c4596403dbec8522b1e755 (diff) | |
download | mongo-6658305fbf6942f1f1294d0bffeaec9adb1bf03a.tar.gz |
SERVER-39202 Improve deterministic calculation of key container names
-rw-r--r-- | src/mongo/util/net/ssl_manager_windows.cpp | 8 |
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()); |