summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2018-09-11 14:06:26 -0400
committerJonathan Reams <jbreams@mongodb.com>2018-09-14 09:38:03 -0400
commit85ba029f0857c21be48bf0b787e1f4c6e070766b (patch)
tree963aae2e7194f5796e25aa06d04ee860da2af136 /src/mongo/db
parent58e6224a7b2ff55f111e1b2fd69218ad43e91cd7 (diff)
downloadmongo-85ba029f0857c21be48bf0b787e1f4c6e070766b.tar.gz
SERVER-34821 Log target connection database separately from username
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/authorization_manager_test.cpp9
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_local.cpp8
-rw-r--r--src/mongo/db/auth/sasl_scram_test.cpp3
3 files changed, 13 insertions, 7 deletions
diff --git a/src/mongo/db/auth/authorization_manager_test.cpp b/src/mongo/db/auth/authorization_manager_test.cpp
index 7e93729aed3..d782ec3567b 100644
--- a/src/mongo/db/auth/authorization_manager_test.cpp
+++ b/src/mongo/db/auth/authorization_manager_test.cpp
@@ -252,9 +252,12 @@ private:
<< userName.getDB()),
userDoc);
if (status == ErrorCodes::NoMatchingDocument) {
- status = Status(ErrorCodes::UserNotFound,
- mongoutils::str::stream() << "Could not find user "
- << userName.getFullName());
+ status =
+ Status(ErrorCodes::UserNotFound,
+ mongoutils::str::stream() << "Could not find user \"" << userName.getUser()
+ << "\" for db \""
+ << userName.getDB()
+ << "\"");
}
return status;
}
diff --git a/src/mongo/db/auth/authz_manager_external_state_local.cpp b/src/mongo/db/auth/authz_manager_external_state_local.cpp
index 1958970f387..4da06238437 100644
--- a/src/mongo/db/auth/authz_manager_external_state_local.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_local.cpp
@@ -290,9 +290,11 @@ Status AuthzManagerExternalStateLocal::_getUserDocument(OperationContext* opCtx,
userDoc);
if (status == ErrorCodes::NoMatchingDocument) {
- status =
- Status(ErrorCodes::UserNotFound,
- mongoutils::str::stream() << "Could not find user " << userName.getFullName());
+ status = Status(ErrorCodes::UserNotFound,
+ mongoutils::str::stream() << "Could not find user \"" << userName.getUser()
+ << "\" for db \""
+ << userName.getDB()
+ << "\"");
}
return status;
}
diff --git a/src/mongo/db/auth/sasl_scram_test.cpp b/src/mongo/db/auth/sasl_scram_test.cpp
index 4520586f0a4..9c75b632428 100644
--- a/src/mongo/db/auth/sasl_scram_test.cpp
+++ b/src/mongo/db/auth/sasl_scram_test.cpp
@@ -499,7 +499,8 @@ TEST_F(SCRAMFixture, testIncorrectUser) {
ASSERT_OK(saslClientSession->initialize());
ASSERT_EQ(SCRAMStepsResult(SaslTestState(SaslTestState::kServer, 1),
- Status(ErrorCodes::UserNotFound, "Could not find user sajack@test")),
+ Status(ErrorCodes::UserNotFound,
+ "Could not find user \"sajack\" for db \"test\"")),
runSteps());
}