summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2020-03-04 15:00:32 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-02 15:11:44 +0000
commit4c55ec710f38c0cb6c1b8577f7afc53ed303f176 (patch)
treecb20aa46a3a3d762ca51514eed8d0308bc79575a
parent848c60bcb8257981615bbb0e29894da5f7f912ec (diff)
downloadmongo-4c55ec710f38c0cb6c1b8577f7afc53ed303f176.tar.gz
SERVER-44096 Prevent killAllSessionsByPattern and killSessions from being killed by variants of the killSessions command
(cherry picked from commit 0487d9f93e2c9e30485f41c5c68a78d8d713e60a)
-rw-r--r--src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp7
-rw-r--r--src/mongo/db/commands/kill_sessions_command.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp
index 73ebc9cc609..67b779b2fe3 100644
--- a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp
+++ b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp
@@ -82,6 +82,13 @@ public:
return Status::OK();
}
+ /**
+ * Should ignore the lsid attached to this command in order to prevent it from killing itself.
+ */
+ bool attachLogicalSessionsToOpCtx() const override {
+ return false;
+ }
+
virtual bool run(OperationContext* opCtx,
const std::string& db,
const BSONObj& cmdObj,
diff --git a/src/mongo/db/commands/kill_sessions_command.cpp b/src/mongo/db/commands/kill_sessions_command.cpp
index 8d4c2293aa9..8bb0e2be302 100644
--- a/src/mongo/db/commands/kill_sessions_command.cpp
+++ b/src/mongo/db/commands/kill_sessions_command.cpp
@@ -105,6 +105,13 @@ public:
return Status::OK();
}
+ /**
+ * Should ignore the lsid attached to this command in order to prevent it from killing itself.
+ */
+ bool attachLogicalSessionsToOpCtx() const override {
+ return false;
+ }
+
virtual bool run(OperationContext* opCtx,
const std::string& db,
const BSONObj& cmdObj,