From 213f27b7cb23486e62fecbb59659b9ec1a36a8c0 Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Mon, 29 Jul 2013 15:16:32 -0400 Subject: SERVER-9518 Change internalSecurity to store a User object --- src/mongo/db/auth/security_key.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/mongo/db/auth/security_key.cpp') diff --git a/src/mongo/db/auth/security_key.cpp b/src/mongo/db/auth/security_key.cpp index f66b4d95b48..82fd16c4ad9 100644 --- a/src/mongo/db/auth/security_key.cpp +++ b/src/mongo/db/auth/security_key.cpp @@ -24,6 +24,7 @@ #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/privilege.h" +#include "mongo/db/auth/user.h" #include "mongo/client/sasl_client_authenticate.h" static bool authParamsSet = false; @@ -129,16 +130,19 @@ namespace mongo { LOG(1) << "security key: " << str << endl; - internalSecurity.pwd = DBClientWithCommands::createPasswordDigest( - internalSecurity.user.getUser().toString(), str); + User::CredentialData credentials; + credentials.password = DBClientWithCommands::createPasswordDigest( + internalSecurity.user->getName().getUser().toString(), str); + internalSecurity.user->setCredentials(credentials); if (cmdLine.clusterAuthMode == "keyfile" || cmdLine.clusterAuthMode == "sendKeyfile") { - setInternalUserAuthParams(BSON(saslCommandMechanismFieldName << "MONGODB-CR" << - saslCommandUserSourceFieldName << - internalSecurity.user.getDB() << - saslCommandUserFieldName << internalSecurity.user.getUser() << - saslCommandPasswordFieldName << internalSecurity.pwd << - saslCommandDigestPasswordFieldName << false)); + setInternalUserAuthParams( + BSON(saslCommandMechanismFieldName << "MONGODB-CR" << + saslCommandUserSourceFieldName << + internalSecurity.user->getName().getDB() << + saslCommandUserFieldName << internalSecurity.user->getName().getUser() << + saslCommandPasswordFieldName << credentials.password << + saslCommandDigestPasswordFieldName << false)); } return true; } -- cgit v1.2.1