summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/SConscript1
-rw-r--r--src/mongo/db/audit.cpp82
-rw-r--r--src/mongo/db/audit.h79
-rw-r--r--src/mongo/db/auth/auth_decorations.cpp18
-rw-r--r--src/mongo/db/auth/authentication_session.h6
-rw-r--r--src/mongo/db/auth/authorization_session.cpp2
-rw-r--r--src/mongo/db/auth/authorization_session.h14
-rw-r--r--src/mongo/db/auth/authz_session_external_state_server_common.cpp4
-rw-r--r--src/mongo/db/auth/sasl_commands.cpp12
-rw-r--r--src/mongo/db/client.cpp5
-rw-r--r--src/mongo/db/client.h47
-rw-r--r--src/mongo/db/client_basic.cpp40
-rw-r--r--src/mongo/db/client_basic.h94
-rw-r--r--src/mongo/db/clientlistplugin.cpp2
-rw-r--r--src/mongo/db/commands.cpp4
-rw-r--r--src/mongo/db/commands.h18
-rw-r--r--src/mongo/db/commands/authentication_commands.cpp15
-rw-r--r--src/mongo/db/commands/clone.cpp2
-rw-r--r--src/mongo/db/commands/clone_collection.cpp2
-rw-r--r--src/mongo/db/commands/connection_status.cpp2
-rw-r--r--src/mongo/db/commands/copydb.cpp2
-rw-r--r--src/mongo/db/commands/copydb.h6
-rw-r--r--src/mongo/db/commands/copydb_common.cpp6
-rw-r--r--src/mongo/db/commands/copydb_start_commands.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp2
-rw-r--r--src/mongo/db/commands/current_op.cpp2
-rw-r--r--src/mongo/db/commands/dbcommands.cpp6
-rw-r--r--src/mongo/db/commands/explain_cmd.cpp2
-rw-r--r--src/mongo/db/commands/find_cmd.cpp2
-rw-r--r--src/mongo/db/commands/fsync.cpp2
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp2
-rw-r--r--src/mongo/db/commands/group_cmd.cpp2
-rw-r--r--src/mongo/db/commands/index_filter_commands.cpp2
-rw-r--r--src/mongo/db/commands/index_filter_commands.h2
-rw-r--r--src/mongo/db/commands/kill_op.cpp4
-rw-r--r--src/mongo/db/commands/killcursors_common.cpp2
-rw-r--r--src/mongo/db/commands/killcursors_common.h2
-rw-r--r--src/mongo/db/commands/list_collections.cpp2
-rw-r--r--src/mongo/db/commands/list_indexes.cpp2
-rw-r--r--src/mongo/db/commands/lock_info.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp2
-rw-r--r--src/mongo/db/commands/oplog_note.cpp2
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp2
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp2
-rw-r--r--src/mongo/db/commands/plan_cache_commands.cpp2
-rw-r--r--src/mongo/db/commands/plan_cache_commands.h2
-rw-r--r--src/mongo/db/commands/rename_collection.h4
-rw-r--r--src/mongo/db/commands/rename_collection_cmd.cpp2
-rw-r--r--src/mongo/db/commands/rename_collection_common.cpp4
-rw-r--r--src/mongo/db/commands/repair_cursor.cpp2
-rw-r--r--src/mongo/db/commands/server_status.cpp4
-rw-r--r--src/mongo/db/commands/snapshot_management.cpp4
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp80
-rw-r--r--src/mongo/db/commands/user_management_commands.h42
-rw-r--r--src/mongo/db/commands/user_management_commands_common.cpp40
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.cpp8
-rw-r--r--src/mongo/db/exec/group.cpp4
-rw-r--r--src/mongo/db/ftdc/ftdc_commands.cpp2
-rw-r--r--src/mongo/db/matcher/expression_where.cpp2
-rw-r--r--src/mongo/db/pipeline/pipeline.cpp4
-rw-r--r--src/mongo/db/pipeline/pipeline.h4
-rw-r--r--src/mongo/db/repl/repl_set_command.cpp2
-rw-r--r--src/mongo/db/repl/repl_set_command.h4
-rw-r--r--src/mongo/db/repl/replset_commands.cpp2
-rw-r--r--src/mongo/db/repl/sync_tail.cpp4
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp2
-rw-r--r--src/mongo/db/s/cleanup_orphaned_cmd.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_command.cpp4
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_control_balancer_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_move_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp2
-rw-r--r--src/mongo/db/s/get_shard_version_command.cpp2
-rw-r--r--src/mongo/db/s/merge_chunks_command.cpp2
-rw-r--r--src/mongo/db/s/move_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/split_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/split_vector_command.cpp2
-rw-r--r--src/mongo/db/server_extra_log_context.cpp10
-rw-r--r--src/mongo/rpc/metadata/client_metadata.h1
-rw-r--r--src/mongo/rpc/metadata/client_metadata_ismaster.cpp4
-rw-r--r--src/mongo/rpc/metadata/client_metadata_ismaster.h3
-rw-r--r--src/mongo/s/cluster_last_error_info.cpp4
-rw-r--r--src/mongo/s/cluster_last_error_info.h4
-rw-r--r--src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_control_balancer_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_current_op.cpp2
-rw-r--r--src/mongo/s/commands/cluster_enable_sharding_cmd.cpp6
-rw-r--r--src/mongo/s/commands/cluster_explain_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_find_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_ftdc_commands.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_shard_version_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_getmore_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_index_filter_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_kill_op.cpp2
-rw-r--r--src/mongo/s/commands/cluster_merge_chunks_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_move_chunk_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_move_primary_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_pipeline_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_plan_cache_cmd.cpp6
-rw-r--r--src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_shard_collection_cmd.cpp7
-rw-r--r--src/mongo/s/commands/cluster_split_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_user_management_commands.cpp38
-rw-r--r--src/mongo/s/commands/cluster_write_cmd.cpp4
-rw-r--r--src/mongo/s/commands/commands_public.cpp14
-rw-r--r--src/mongo/s/commands/strategy.cpp4
-rw-r--r--src/mongo/s/s_only.cpp15
-rw-r--r--src/mongo/s/server.cpp2
112 files changed, 403 insertions, 524 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 84a77cbc835..14eadcbecba 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -472,7 +472,6 @@ env.Library(
target='service_context',
source=[
'client.cpp',
- 'client_basic.cpp',
'operation_context.cpp',
'service_context.cpp',
'service_context_noop.cpp',
diff --git a/src/mongo/db/audit.cpp b/src/mongo/db/audit.cpp
index 715e9023c15..a7108d3ee3f 100644
--- a/src/mongo/db/audit.cpp
+++ b/src/mongo/db/audit.cpp
@@ -38,43 +38,43 @@
namespace mongo {
namespace audit {
-void logAuthentication(ClientBasic* client,
+void logAuthentication(Client* client,
StringData mechanism,
const UserName& user,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logCommandAuthzCheck(ClientBasic* client,
+ void logCommandAuthzCheck(Client* client,
const std::string& dbname,
const BSONObj& cmdObj,
Command* command,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logDeleteAuthzCheck(ClientBasic* client,
+ void logDeleteAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& pattern,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logGetMoreAuthzCheck(ClientBasic* client,
+ void logGetMoreAuthzCheck(Client* client,
const NamespaceString& ns,
long long cursorId,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logInsertAuthzCheck(ClientBasic* client,
+ void logInsertAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& insertedObj,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logKillCursorsAuthzCheck(ClientBasic* client,
+ void logKillCursorsAuthzCheck(Client* client,
const NamespaceString& ns,
long long cursorId,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logQueryAuthzCheck(ClientBasic* client,
+ void logQueryAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& query,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logUpdateAuthzCheck(ClientBasic* client,
+ void logUpdateAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& query,
const BSONObj& updateObj,
@@ -82,101 +82,95 @@ void logAuthentication(ClientBasic* client,
bool isMulti,
ErrorCodes::Error result) MONGO_AUDIT_STUB
- void logCreateUser(ClientBasic* client,
+ void logCreateUser(Client* client,
const UserName& username,
bool password,
const BSONObj* customData,
const std::vector<RoleName>& roles) MONGO_AUDIT_STUB
- void logDropUser(ClientBasic* client, const UserName& username) MONGO_AUDIT_STUB
+ void logDropUser(Client* client, const UserName& username) MONGO_AUDIT_STUB
- void logDropAllUsersFromDatabase(ClientBasic* client, StringData dbname) MONGO_AUDIT_STUB
+ void logDropAllUsersFromDatabase(Client* client, StringData dbname) MONGO_AUDIT_STUB
- void logUpdateUser(ClientBasic* client,
+ void logUpdateUser(Client* client,
const UserName& username,
bool password,
const BSONObj* customData,
const std::vector<RoleName>* roles) MONGO_AUDIT_STUB
- void logGrantRolesToUser(ClientBasic* client,
+ void logGrantRolesToUser(Client* client,
const UserName& username,
const std::vector<RoleName>& roles) MONGO_AUDIT_STUB
- void logRevokeRolesFromUser(ClientBasic* client,
+ void logRevokeRolesFromUser(Client* client,
const UserName& username,
const std::vector<RoleName>& roles) MONGO_AUDIT_STUB
- void logCreateRole(ClientBasic* client,
+ void logCreateRole(Client* client,
const RoleName& role,
const std::vector<RoleName>& roles,
const PrivilegeVector& privileges) MONGO_AUDIT_STUB
- void logUpdateRole(ClientBasic* client,
+ void logUpdateRole(Client* client,
const RoleName& role,
const std::vector<RoleName>* roles,
const PrivilegeVector* privileges) MONGO_AUDIT_STUB
- void logDropRole(ClientBasic* client, const RoleName& role) MONGO_AUDIT_STUB
+ void logDropRole(Client* client, const RoleName& role) MONGO_AUDIT_STUB
- void logDropAllRolesFromDatabase(ClientBasic* client, StringData dbname) MONGO_AUDIT_STUB
+ void logDropAllRolesFromDatabase(Client* client, StringData dbname) MONGO_AUDIT_STUB
- void logGrantRolesToRole(ClientBasic* client,
+ void logGrantRolesToRole(Client* client,
const RoleName& role,
const std::vector<RoleName>& roles) MONGO_AUDIT_STUB
- void logRevokeRolesFromRole(ClientBasic* client,
+ void logRevokeRolesFromRole(Client* client,
const RoleName& role,
const std::vector<RoleName>& roles) MONGO_AUDIT_STUB
- void logGrantPrivilegesToRole(ClientBasic* client,
+ void logGrantPrivilegesToRole(Client* client,
const RoleName& role,
const PrivilegeVector& privileges) MONGO_AUDIT_STUB
- void logRevokePrivilegesFromRole(ClientBasic* client,
+ void logRevokePrivilegesFromRole(Client* client,
const RoleName& role,
const PrivilegeVector& privileges) MONGO_AUDIT_STUB
- void logReplSetReconfig(ClientBasic* client,
+ void logReplSetReconfig(Client* client,
const BSONObj* oldConfig,
const BSONObj* newConfig) MONGO_AUDIT_STUB
- void logApplicationMessage(ClientBasic* client, StringData msg) MONGO_AUDIT_STUB
+ void logApplicationMessage(Client* client, StringData msg) MONGO_AUDIT_STUB
- void logShutdown(ClientBasic* client) MONGO_AUDIT_STUB
+ void logShutdown(Client* client) MONGO_AUDIT_STUB
- void logCreateIndex(ClientBasic* client,
+ void logCreateIndex(Client* client,
const BSONObj* indexSpec,
StringData indexname,
StringData nsname) MONGO_AUDIT_STUB
- void logCreateCollection(ClientBasic* client, StringData nsname) MONGO_AUDIT_STUB
+ void logCreateCollection(Client* client, StringData nsname) MONGO_AUDIT_STUB
- void logCreateDatabase(ClientBasic* client, StringData dbname) MONGO_AUDIT_STUB
+ void logCreateDatabase(Client* client, StringData dbname) MONGO_AUDIT_STUB
- void logDropIndex(ClientBasic* client, StringData indexname, StringData nsname) MONGO_AUDIT_STUB
+ void logDropIndex(Client* client, StringData indexname, StringData nsname) MONGO_AUDIT_STUB
- void logDropCollection(ClientBasic* client, StringData nsname) MONGO_AUDIT_STUB
+ void logDropCollection(Client* client, StringData nsname) MONGO_AUDIT_STUB
- void logDropDatabase(ClientBasic* client, StringData dbname) MONGO_AUDIT_STUB
+ void logDropDatabase(Client* client, StringData dbname) MONGO_AUDIT_STUB
- void logRenameCollection(ClientBasic* client,
- StringData source,
- StringData target) MONGO_AUDIT_STUB
+ void logRenameCollection(Client* client, StringData source, StringData target) MONGO_AUDIT_STUB
- void logEnableSharding(ClientBasic* client, StringData dbname) MONGO_AUDIT_STUB
+ void logEnableSharding(Client* client, StringData dbname) MONGO_AUDIT_STUB
- void logAddShard(ClientBasic* client,
- StringData name,
- const std::string& servers,
- long long maxSize) MONGO_AUDIT_STUB
+ void logAddShard(Client* client, StringData name, const std::string& servers, long long maxSize)
+ MONGO_AUDIT_STUB
- void logRemoveShard(ClientBasic* client, StringData shardname) MONGO_AUDIT_STUB
+ void logRemoveShard(Client* client, StringData shardname) MONGO_AUDIT_STUB
- void logShardCollection(ClientBasic* client,
- StringData ns,
- const BSONObj& keyPattern,
- bool unique) MONGO_AUDIT_STUB
+ void logShardCollection(Client* client, StringData ns, const BSONObj& keyPattern, bool unique)
+ MONGO_AUDIT_STUB
void writeImpersonatedUsersToMetadata(OperationContext* txn,
BSONObjBuilder* metadata) MONGO_AUDIT_STUB
diff --git a/src/mongo/db/audit.h b/src/mongo/db/audit.h
index 54c07aa1d77..26f27ea8a8e 100644
--- a/src/mongo/db/audit.h
+++ b/src/mongo/db/audit.h
@@ -41,7 +41,7 @@ namespace mongo {
class AuthorizationSession;
class BSONObj;
-class ClientBasic;
+class Client;
class Command;
class NamespaceString;
class OperationContext;
@@ -54,7 +54,7 @@ namespace audit {
/**
* Logs the result of an authentication attempt.
*/
-void logAuthentication(ClientBasic* client,
+void logAuthentication(Client* client,
StringData mechanism,
const UserName& user,
ErrorCodes::Error result);
@@ -69,7 +69,7 @@ void logAuthentication(ClientBasic* client,
/**
* Logs the result of a command authorization check.
*/
-void logCommandAuthzCheck(ClientBasic* client,
+void logCommandAuthzCheck(Client* client,
const std::string& dbname,
const BSONObj& cmdObj,
Command* command,
@@ -78,7 +78,7 @@ void logCommandAuthzCheck(ClientBasic* client,
/**
* Logs the result of an authorization check for an OP_DELETE wire protocol message.
*/
-void logDeleteAuthzCheck(ClientBasic* client,
+void logDeleteAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& pattern,
ErrorCodes::Error result);
@@ -86,7 +86,7 @@ void logDeleteAuthzCheck(ClientBasic* client,
/**
* Logs the result of an authorization check for an OP_GET_MORE wire protocol message.
*/
-void logGetMoreAuthzCheck(ClientBasic* client,
+void logGetMoreAuthzCheck(Client* client,
const NamespaceString& ns,
long long cursorId,
ErrorCodes::Error result);
@@ -94,7 +94,7 @@ void logGetMoreAuthzCheck(ClientBasic* client,
/**
* Logs the result of an authorization check for an OP_INSERT wire protocol message.
*/
-void logInsertAuthzCheck(ClientBasic* client,
+void logInsertAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& insertedObj,
ErrorCodes::Error result);
@@ -102,7 +102,7 @@ void logInsertAuthzCheck(ClientBasic* client,
/**
* Logs the result of an authorization check for an OP_KILL_CURSORS wire protocol message.
*/
-void logKillCursorsAuthzCheck(ClientBasic* client,
+void logKillCursorsAuthzCheck(Client* client,
const NamespaceString& ns,
long long cursorId,
ErrorCodes::Error result);
@@ -110,7 +110,7 @@ void logKillCursorsAuthzCheck(ClientBasic* client,
/**
* Logs the result of an authorization check for an OP_QUERY wire protocol message.
*/
-void logQueryAuthzCheck(ClientBasic* client,
+void logQueryAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& query,
ErrorCodes::Error result);
@@ -118,7 +118,7 @@ void logQueryAuthzCheck(ClientBasic* client,
/**
* Logs the result of an authorization check for an OP_UPDATE wire protocol message.
*/
-void logUpdateAuthzCheck(ClientBasic* client,
+void logUpdateAuthzCheck(Client* client,
const NamespaceString& ns,
const BSONObj& query,
const BSONObj& updateObj,
@@ -129,7 +129,7 @@ void logUpdateAuthzCheck(ClientBasic* client,
/**
* Logs the result of a createUser command.
*/
-void logCreateUser(ClientBasic* client,
+void logCreateUser(Client* client,
const UserName& username,
bool password,
const BSONObj* customData,
@@ -138,17 +138,17 @@ void logCreateUser(ClientBasic* client,
/**
* Logs the result of a dropUser command.
*/
-void logDropUser(ClientBasic* client, const UserName& username);
+void logDropUser(Client* client, const UserName& username);
/**
* Logs the result of a dropAllUsersFromDatabase command.
*/
-void logDropAllUsersFromDatabase(ClientBasic* client, StringData dbname);
+void logDropAllUsersFromDatabase(Client* client, StringData dbname);
/**
* Logs the result of a updateUser command.
*/
-void logUpdateUser(ClientBasic* client,
+void logUpdateUser(Client* client,
const UserName& username,
bool password,
const BSONObj* customData,
@@ -157,21 +157,21 @@ void logUpdateUser(ClientBasic* client,
/**
* Logs the result of a grantRolesToUser command.
*/
-void logGrantRolesToUser(ClientBasic* client,
+void logGrantRolesToUser(Client* client,
const UserName& username,
const std::vector<RoleName>& roles);
/**
* Logs the result of a revokeRolesFromUser command.
*/
-void logRevokeRolesFromUser(ClientBasic* client,
+void logRevokeRolesFromUser(Client* client,
const UserName& username,
const std::vector<RoleName>& roles);
/**
* Logs the result of a createRole command.
*/
-void logCreateRole(ClientBasic* client,
+void logCreateRole(Client* client,
const RoleName& role,
const std::vector<RoleName>& roles,
const PrivilegeVector& privileges);
@@ -179,7 +179,7 @@ void logCreateRole(ClientBasic* client,
/**
* Logs the result of a updateRole command.
*/
-void logUpdateRole(ClientBasic* client,
+void logUpdateRole(Client* client,
const RoleName& role,
const std::vector<RoleName>* roles,
const PrivilegeVector* privileges);
@@ -187,60 +187,58 @@ void logUpdateRole(ClientBasic* client,
/**
* Logs the result of a dropRole command.
*/
-void logDropRole(ClientBasic* client, const RoleName& role);
+void logDropRole(Client* client, const RoleName& role);
/**
* Logs the result of a dropAllRolesForDatabase command.
*/
-void logDropAllRolesFromDatabase(ClientBasic* client, StringData dbname);
+void logDropAllRolesFromDatabase(Client* client, StringData dbname);
/**
* Logs the result of a grantRolesToRole command.
*/
-void logGrantRolesToRole(ClientBasic* client,
- const RoleName& role,
- const std::vector<RoleName>& roles);
+void logGrantRolesToRole(Client* client, const RoleName& role, const std::vector<RoleName>& roles);
/**
* Logs the result of a revokeRolesFromRole command.
*/
-void logRevokeRolesFromRole(ClientBasic* client,
+void logRevokeRolesFromRole(Client* client,
const RoleName& role,
const std::vector<RoleName>& roles);
/**
* Logs the result of a grantPrivilegesToRole command.
*/
-void logGrantPrivilegesToRole(ClientBasic* client,
+void logGrantPrivilegesToRole(Client* client,
const RoleName& role,
const PrivilegeVector& privileges);
/**
* Logs the result of a revokePrivilegesFromRole command.
*/
-void logRevokePrivilegesFromRole(ClientBasic* client,
+void logRevokePrivilegesFromRole(Client* client,
const RoleName& role,
const PrivilegeVector& privileges);
/**
* Logs the result of a replSet(Re)config command.
*/
-void logReplSetReconfig(ClientBasic* client, const BSONObj* oldConfig, const BSONObj* newConfig);
+void logReplSetReconfig(Client* client, const BSONObj* oldConfig, const BSONObj* newConfig);
/**
* Logs the result of an ApplicationMessage command.
*/
-void logApplicationMessage(ClientBasic* client, StringData msg);
+void logApplicationMessage(Client* client, StringData msg);
/**
* Logs the result of a shutdown command.
*/
-void logShutdown(ClientBasic* client);
+void logShutdown(Client* client);
/**
* Logs the result of a createIndex command.
*/
-void logCreateIndex(ClientBasic* client,
+void logCreateIndex(Client* client,
const BSONObj* indexSpec,
StringData indexname,
StringData nsname);
@@ -248,56 +246,53 @@ void logCreateIndex(ClientBasic* client,
/**
* Logs the result of a createCollection command.
*/
-void logCreateCollection(ClientBasic* client, StringData nsname);
+void logCreateCollection(Client* client, StringData nsname);
/**
* Logs the result of a createDatabase command.
*/
-void logCreateDatabase(ClientBasic* client, StringData dbname);
+void logCreateDatabase(Client* client, StringData dbname);
/**
* Logs the result of a dropIndex command.
*/
-void logDropIndex(ClientBasic* client, StringData indexname, StringData nsname);
+void logDropIndex(Client* client, StringData indexname, StringData nsname);
/**
* Logs the result of a dropCollection command.
*/
-void logDropCollection(ClientBasic* client, StringData nsname);
+void logDropCollection(Client* client, StringData nsname);
/**
* Logs the result of a dropDatabase command.
*/
-void logDropDatabase(ClientBasic* client, StringData dbname);
+void logDropDatabase(Client* client, StringData dbname);
/**
* Logs a collection rename event.
*/
-void logRenameCollection(ClientBasic* client, StringData source, StringData target);
+void logRenameCollection(Client* client, StringData source, StringData target);
/**
* Logs the result of a enableSharding command.
*/
-void logEnableSharding(ClientBasic* client, StringData dbname);
+void logEnableSharding(Client* client, StringData dbname);
/**
* Logs the result of a addShard command.
*/
-void logAddShard(ClientBasic* client,
- StringData name,
- const std::string& servers,
- long long maxSize);
+void logAddShard(Client* client, StringData name, const std::string& servers, long long maxSize);
/**
* Logs the result of a removeShard command.
*/
-void logRemoveShard(ClientBasic* client, StringData shardname);
+void logRemoveShard(Client* client, StringData shardname);
/**
* Logs the result of a shardCollection command.
*/
-void logShardCollection(ClientBasic* client, StringData ns, const BSONObj& keyPattern, bool unique);
+void logShardCollection(Client* client, StringData ns, const BSONObj& keyPattern, bool unique);
/*
diff --git a/src/mongo/db/auth/auth_decorations.cpp b/src/mongo/db/auth/auth_decorations.cpp
index 558f3f9ba3c..bf1b31ca148 100644
--- a/src/mongo/db/auth/auth_decorations.cpp
+++ b/src/mongo/db/auth/auth_decorations.cpp
@@ -43,13 +43,13 @@ namespace mongo {
namespace {
const auto getAuthenticationSession =
- ClientBasic::declareDecoration<std::unique_ptr<AuthenticationSession>>();
+ Client::declareDecoration<std::unique_ptr<AuthenticationSession>>();
const auto getAuthorizationManager =
ServiceContext::declareDecoration<std::unique_ptr<AuthorizationManager>>();
const auto getAuthorizationSession =
- ClientBasic::declareDecoration<std::unique_ptr<AuthorizationSession>>();
+ Client::declareDecoration<std::unique_ptr<AuthorizationSession>>();
class AuthzClientObserver final : public ServiceContext::ClientObserver {
public:
@@ -67,13 +67,11 @@ public:
} // namespace
-void AuthenticationSession::set(ClientBasic* client,
- std::unique_ptr<AuthenticationSession> newSession) {
+void AuthenticationSession::set(Client* client, std::unique_ptr<AuthenticationSession> newSession) {
getAuthenticationSession(client) = std::move(newSession);
}
-void AuthenticationSession::swap(ClientBasic* client,
- std::unique_ptr<AuthenticationSession>& other) {
+void AuthenticationSession::swap(Client* client, std::unique_ptr<AuthenticationSession>& other) {
using std::swap;
swap(getAuthenticationSession(client), other);
}
@@ -95,21 +93,21 @@ void AuthorizationManager::set(ServiceContext* service,
service->registerClientObserver(stdx::make_unique<AuthzClientObserver>());
}
-AuthorizationSession* AuthorizationSession::get(ClientBasic* client) {
+AuthorizationSession* AuthorizationSession::get(Client* client) {
return get(*client);
}
-AuthorizationSession* AuthorizationSession::get(ClientBasic& client) {
+AuthorizationSession* AuthorizationSession::get(Client& client) {
AuthorizationSession* retval = getAuthorizationSession(client).get();
massert(16481, "No AuthorizationManager has been set up for this connection", retval);
return retval;
}
-bool AuthorizationSession::exists(ClientBasic* client) {
+bool AuthorizationSession::exists(Client* client) {
return getAuthorizationSession(client).get();
}
-void AuthorizationSession::set(ClientBasic* client,
+void AuthorizationSession::set(Client* client,
std::unique_ptr<AuthorizationSession> authorizationSession) {
auto& authzSession = getAuthorizationSession(client);
invariant(authorizationSession);
diff --git a/src/mongo/db/auth/authentication_session.h b/src/mongo/db/auth/authentication_session.h
index 1c3b34b16ee..52ee521e298 100644
--- a/src/mongo/db/auth/authentication_session.h
+++ b/src/mongo/db/auth/authentication_session.h
@@ -33,7 +33,7 @@
namespace mongo {
-class ClientBasic;
+class Client;
/**
* Abstract type representing an ongoing authentication session.
@@ -52,12 +52,12 @@ public:
/**
* Sets the authentication session for the given "client" to "newSession".
*/
- static void set(ClientBasic* client, std::unique_ptr<AuthenticationSession> newSession);
+ static void set(Client* client, std::unique_ptr<AuthenticationSession> newSession);
/**
* Swaps "client"'s current authentication session with "other".
*/
- static void swap(ClientBasic* client, std::unique_ptr<AuthenticationSession>& other);
+ static void swap(Client* client, std::unique_ptr<AuthenticationSession>& other);
virtual ~AuthenticationSession() = default;
diff --git a/src/mongo/db/auth/authorization_session.cpp b/src/mongo/db/auth/authorization_session.cpp
index 8981f758fc8..379ca78bd7c 100644
--- a/src/mongo/db/auth/authorization_session.cpp
+++ b/src/mongo/db/auth/authorization_session.cpp
@@ -624,7 +624,7 @@ void AuthorizationSession::setImpersonatedUserData(std::vector<UserName> usernam
_impersonationFlag = true;
}
-bool AuthorizationSession::isCoauthorizedWithClient(ClientBasic* opClient) {
+bool AuthorizationSession::isCoauthorizedWithClient(Client* opClient) {
auto getUserNames = [](AuthorizationSession* authSession) {
if (authSession->isImpersonating()) {
return authSession->getImpersonatedUserNames();
diff --git a/src/mongo/db/auth/authorization_session.h b/src/mongo/db/auth/authorization_session.h
index 31b64a7b1c8..f2e6fd0c91c 100644
--- a/src/mongo/db/auth/authorization_session.h
+++ b/src/mongo/db/auth/authorization_session.h
@@ -49,14 +49,14 @@ namespace auth {
struct CreateOrUpdateRoleArgs;
}
-class ClientBasic;
+class Client;
/**
* Contains all the authorization logic for a single client connection. It contains a set of
* the users which have been authenticated, as well as a set of privileges that have been
* granted to those users to perform various actions.
*
- * An AuthorizationSession object is present within every mongo::ClientBasic object.
+ * An AuthorizationSession object is present within every mongo::Client object.
*
* Users in the _authenticatedUsers cache may get marked as invalid by the AuthorizationManager,
* for instance if their privileges are changed by a user or role modification command. At the
@@ -74,19 +74,19 @@ public:
*
* The "client" object continues to own the returned AuthorizationSession.
*/
- static AuthorizationSession* get(ClientBasic* client);
+ static AuthorizationSession* get(Client* client);
/**
* Gets the AuthorizationSession associated with the given "client", or nullptr.
*
* The "client" object continues to own the returned AuthorizationSession.
*/
- static AuthorizationSession* get(ClientBasic& client);
+ static AuthorizationSession* get(Client& client);
/**
* Returns false if AuthorizationSession::get(client) would return nullptr.
*/
- static bool exists(ClientBasic* client);
+ static bool exists(Client* client);
/**
* Sets the AuthorizationSession associated with "client" to "session".
@@ -94,7 +94,7 @@ public:
* "session" must not be NULL, and it is only legal to call this function once
* on each instance of "client".
*/
- static void set(ClientBasic* client, std::unique_ptr<AuthorizationSession> session);
+ static void set(Client* client, std::unique_ptr<AuthorizationSession> session);
// Takes ownership of the externalState.
explicit AuthorizationSession(std::unique_ptr<AuthzSessionExternalState> externalState);
@@ -252,7 +252,7 @@ public:
// those users will be considered as 'authenticated' for the purpose of this check.
//
// The existence of 'opClient' must be guaranteed through locks taken by the caller.
- bool isCoauthorizedWithClient(ClientBasic* opClient);
+ bool isCoauthorizedWithClient(Client* opClient);
// Tells whether impersonation is active or not. This state is set when
// setImpersonatedUserData is called and cleared when clearImpersonatedUserData is
diff --git a/src/mongo/db/auth/authz_session_external_state_server_common.cpp b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
index 16fb107f2f3..e2416596c4b 100644
--- a/src/mongo/db/auth/authz_session_external_state_server_common.cpp
+++ b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
@@ -60,7 +60,7 @@ void AuthzSessionExternalStateServerCommon::_checkShouldAllowLocalhost(Operation
if (!_allowLocalhost)
return;
// Don't bother checking if we're not on a localhost connection
- if (!ClientBasic::getCurrent()->getIsLocalHostConnection()) {
+ if (!Client::getCurrent()->getIsLocalHostConnection()) {
_allowLocalhost = false;
return;
}
@@ -80,7 +80,7 @@ bool AuthzSessionExternalStateServerCommon::serverIsArbiter() const {
}
bool AuthzSessionExternalStateServerCommon::shouldAllowLocalhost() const {
- ClientBasic* client = ClientBasic::getCurrent();
+ Client* client = Client::getCurrent();
return _allowLocalhost && client->getIsLocalHostConnection();
}
diff --git a/src/mongo/db/auth/sasl_commands.cpp b/src/mongo/db/auth/sasl_commands.cpp
index 183049b5c11..37cc1984923 100644
--- a/src/mongo/db/auth/sasl_commands.cpp
+++ b/src/mongo/db/auth/sasl_commands.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/auth/mongo_authentication_session.h"
#include "mongo/db/auth/sasl_authentication_session.h"
#include "mongo/db/auth/sasl_options.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/authentication_commands.h"
#include "mongo/db/server_options.h"
@@ -172,7 +172,7 @@ void addStatus(const Status& status, BSONObjBuilder* builder) {
builder->append(saslCommandErrmsgFieldName, status.reason());
}
-Status doSaslStep(const ClientBasic* client,
+Status doSaslStep(const Client* client,
SaslAuthenticationSession* session,
const BSONObj& cmdObj,
BSONObjBuilder* result) {
@@ -217,7 +217,7 @@ Status doSaslStep(const ClientBasic* client,
return Status::OK();
}
-Status doSaslStart(const ClientBasic* client,
+Status doSaslStart(const Client* client,
SaslAuthenticationSession* session,
const std::string& db,
const BSONObj& cmdObj,
@@ -251,7 +251,7 @@ Status doSaslStart(const ClientBasic* client,
return doSaslStep(client, session, cmdObj, result);
}
-Status doSaslContinue(const ClientBasic* client,
+Status doSaslContinue(const Client* client,
SaslAuthenticationSession* session,
const BSONObj& cmdObj,
BSONObjBuilder* result) {
@@ -285,7 +285,7 @@ bool CmdSaslStart::run(OperationContext* txn,
int options,
std::string& ignored,
BSONObjBuilder& result) {
- ClientBasic* client = ClientBasic::getCurrent();
+ Client* client = Client::getCurrent();
AuthenticationSession::set(client, std::unique_ptr<AuthenticationSession>());
std::string mechanism;
@@ -327,7 +327,7 @@ bool CmdSaslContinue::run(OperationContext* txn,
int options,
std::string& ignored,
BSONObjBuilder& result) {
- ClientBasic* client = ClientBasic::getCurrent();
+ Client* client = Client::getCurrent();
std::unique_ptr<AuthenticationSession> sessionGuard;
AuthenticationSession::swap(client, sessionGuard);
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index 6776239f036..179b0938d5b 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -100,7 +100,8 @@ int64_t generateSeed(const std::string& desc) {
} // namespace
Client::Client(std::string desc, ServiceContext* serviceContext, transport::Session* session)
- : ClientBasic(serviceContext, session),
+ : _serviceContext(serviceContext),
+ _session(session),
_desc(std::move(desc)),
_threadId(stdx::this_thread::get_id()),
_connectionId(session ? session->id() : 0),
@@ -147,7 +148,7 @@ std::string Client::clientAddress(bool includePort) const {
return getRemote().host();
}
-ClientBasic* ClientBasic::getCurrent() {
+Client* Client::getCurrent() {
return currentClient.getMake()->get();
}
diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h
index ca9a159d579..8e313379b9c 100644
--- a/src/mongo/db/client.h
+++ b/src/mongo/db/client.h
@@ -36,14 +36,19 @@
#pragma once
-#include "mongo/db/client_basic.h"
+#include "mongo/base/disallow_copying.h"
+#include "mongo/db/client.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/service_context.h"
#include "mongo/platform/random.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/stdx/thread.h"
+#include "mongo/transport/session.h"
#include "mongo/util/concurrency/spin_lock.h"
#include "mongo/util/concurrency/threadlocal.h"
+#include "mongo/util/decorable.h"
+#include "mongo/util/net/abstract_message_port.h"
+#include "mongo/util/net/hostandport.h"
namespace mongo {
@@ -57,8 +62,10 @@ class Session;
typedef long long ConnectionId;
-/** the database's concept of an outside "client" */
-class Client : public ClientBasic {
+/**
+ * The database's concept of an outside "client".
+ * */
+class Client final : public Decorable<Client> {
public:
/**
* Creates a Client object and stores it in TLS for the current thread.
@@ -74,6 +81,38 @@ public:
ServiceContext* serviceContext,
transport::Session* session);
+ static Client* getCurrent();
+
+ bool getIsLocalHostConnection() {
+ if (!hasRemote()) {
+ return false;
+ }
+ return getRemote().isLocalHost();
+ }
+
+ bool hasRemote() const {
+ return _session;
+ }
+
+ HostAndPort getRemote() const {
+ verify(_session);
+ return _session->remote();
+ }
+
+ /**
+ * Returns the ServiceContext that owns this client session context.
+ */
+ ServiceContext* getServiceContext() const {
+ return _serviceContext;
+ }
+
+ /**
+ * Returns the Session to which this client is bound, if any.
+ */
+ transport::Session* session() const {
+ return _session;
+ }
+
/**
* Inits a thread if that thread has not already been init'd, setting the thread name to
* "desc".
@@ -165,6 +204,8 @@ private:
friend class ServiceContext;
Client(std::string desc, ServiceContext* serviceContext, transport::Session* session = nullptr);
+ ServiceContext* const _serviceContext;
+ transport::Session* const _session;
// Description for the client (e.g. conn8)
const std::string _desc;
diff --git a/src/mongo/db/client_basic.cpp b/src/mongo/db/client_basic.cpp
deleted file mode 100644
index 578ebdf668d..00000000000
--- a/src/mongo/db/client_basic.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
-* Copyright (C) 2008 10gen Inc.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License, version 3,
-* as published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* As a special exception, the copyright holders give permission to link the
-* code of portions of this program with the OpenSSL library under certain
-* conditions as described in each individual source file and distribute
-* linked combinations including the program with the OpenSSL library. You
-* must comply with the GNU Affero General Public License in all respects for
-* all of the code used other than as permitted herein. If you modify file(s)
-* with this exception, you may extend this exception to your version of the
-* file(s), but you are not obligated to do so. If you do not wish to do so,
-* delete this exception statement from your version. If you delete this
-* exception statement from all source files in the program, then also delete
-* it in the license file.
-*/
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/client_basic.h"
-
-namespace mongo {
-
-ClientBasic::ClientBasic(ServiceContext* serviceContext, transport::Session* session)
- : _serviceContext(serviceContext), _session(session) {}
-
-ClientBasic::~ClientBasic() = default;
-
-} // namespace mongo
diff --git a/src/mongo/db/client_basic.h b/src/mongo/db/client_basic.h
deleted file mode 100644
index 09f31b5da42..00000000000
--- a/src/mongo/db/client_basic.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
-* Copyright (C) 2008 10gen Inc.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License, version 3,
-* as published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* As a special exception, the copyright holders give permission to link the
-* code of portions of this program with the OpenSSL library under certain
-* conditions as described in each individual source file and distribute
-* linked combinations including the program with the OpenSSL library. You
-* must comply with the GNU Affero General Public License in all respects for
-* all of the code used other than as permitted herein. If you modify file(s)
-* with this exception, you may extend this exception to your version of the
-* file(s), but you are not obligated to do so. If you do not wish to do so,
-* delete this exception statement from your version. If you delete this
-* exception statement from all source files in the program, then also delete
-* it in the license file.
-*/
-
-#pragma once
-
-#include <memory>
-
-#include "mongo/base/disallow_copying.h"
-#include "mongo/transport/session.h"
-#include "mongo/util/decorable.h"
-#include "mongo/util/net/abstract_message_port.h"
-#include "mongo/util/net/hostandport.h"
-
-namespace mongo {
-
-class ServiceContext;
-
-/**
- * this is the base class for Client and ClientInfo
- * Client is for mongod
- * ClientInfo is for mongos
- * They should converge slowly
- * The idea is this has the basic api so that not all code has to be duplicated
- */
-class ClientBasic : public Decorable<ClientBasic> {
- MONGO_DISALLOW_COPYING(ClientBasic);
-
-public:
- bool getIsLocalHostConnection() {
- if (!hasRemote()) {
- return false;
- }
- return getRemote().isLocalHost();
- }
-
- bool hasRemote() const {
- return _session;
- }
-
- HostAndPort getRemote() const {
- verify(_session);
- return _session->remote();
- }
-
- /**
- * Returns the ServiceContext that owns this client session context.
- */
- ServiceContext* getServiceContext() const {
- return _serviceContext;
- }
-
- /**
- * Returns the Session to which this client is bound, if any.
- */
- transport::Session* session() const {
- return _session;
- }
-
- static ClientBasic* getCurrent();
-
-protected:
- ClientBasic(ServiceContext* serviceContext, transport::Session* session);
- ~ClientBasic();
-
-private:
- ServiceContext* const _serviceContext;
- transport::Session* const _session;
-};
-}
diff --git a/src/mongo/db/clientlistplugin.cpp b/src/mongo/db/clientlistplugin.cpp
index 8204eeb74a9..48fdb84ea4b 100644
--- a/src/mongo/db/clientlistplugin.cpp
+++ b/src/mongo/db/clientlistplugin.cpp
@@ -152,7 +152,7 @@ public:
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index cbc8f89764c..70989b0db9f 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -204,7 +204,7 @@ void Command::appendCommandWCStatus(BSONObjBuilder& result,
}
}
-Status Command::checkAuthForCommand(ClientBasic* client,
+Status Command::checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
std::vector<Privilege> privileges;
@@ -226,7 +226,7 @@ BSONObj Command::getRedactedCopyForLogging(const BSONObj& cmdObj) {
}
static Status _checkAuthorizationImpl(Command* c,
- ClientBasic* client,
+ Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
namespace mmb = mutablebson;
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h
index ef808084454..1e16dc77238 100644
--- a/src/mongo/db/commands.h
+++ b/src/mongo/db/commands.h
@@ -36,7 +36,7 @@
#include "mongo/base/status_with.h"
#include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/resource_pattern.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/query/explain.h"
@@ -219,7 +219,7 @@ public:
* Checks if the given client is authorized to run this command on database "dbname"
* with the invocation described by "cmdObj".
*/
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
@@ -325,14 +325,14 @@ public:
rpc::ReplyBuilderInterface* replyBuilder);
// For mongos
- // TODO: remove this entirely now that all instances of ClientBasic are instances
+ // TODO: remove this entirely now that all instances of Client are instances
// of Client. This will happen as part of SERVER-18292
- static void execCommandClientBasic(OperationContext* txn,
- Command* c,
- int queryOptions,
- const char* ns,
- BSONObj& cmdObj,
- BSONObjBuilder& result);
+ static void execCommandClient(OperationContext* txn,
+ Command* c,
+ int queryOptions,
+ const char* ns,
+ BSONObj& cmdObj,
+ BSONObjBuilder& result);
// Helper for setting errmsg and ok field in command result object.
static void appendCommandStatus(BSONObjBuilder& result, bool ok, const std::string& errmsg);
diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp
index 2f05971ef56..e5b50fec80d 100644
--- a/src/mongo/db/commands/authentication_commands.cpp
+++ b/src/mongo/db/commands/authentication_commands.cpp
@@ -50,7 +50,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/sasl_options.h"
#include "mongo/db/auth/security_key.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/server_options.h"
@@ -122,7 +122,7 @@ public:
stringstream ss;
ss << hex << n;
result.append("nonce", ss.str());
- AuthenticationSession::set(ClientBasic::getCurrent(),
+ AuthenticationSession::set(Client::getCurrent(),
stdx::make_unique<MongoAuthenticationSession>(n));
return true;
}
@@ -176,7 +176,7 @@ bool CmdAuthenticate::run(OperationContext* txn,
mechanism = "MONGODB-CR";
}
Status status = _authenticate(txn, mechanism, user, cmdObj);
- audit::logAuthentication(ClientBasic::getCurrent(), mechanism, user, status.code());
+ audit::logAuthentication(Client::getCurrent(), mechanism, user, status.code());
if (!status.isOK()) {
if (!serverGlobalParams.quiet) {
log() << "Failed to authenticate " << user << " with mechanism " << mechanism << ": "
@@ -241,7 +241,7 @@ Status CmdAuthenticate::_authenticateCR(OperationContext* txn,
stringstream digestBuilder;
{
- ClientBasic* client = ClientBasic::getCurrent();
+ Client* client = Client::getCurrent();
std::unique_ptr<AuthenticationSession> session;
AuthenticationSession::swap(client, session);
if (!session || session->getType() != AuthenticationSession::SESSION_TYPE_MONGO) {
@@ -290,8 +290,7 @@ Status CmdAuthenticate::_authenticateCR(OperationContext* txn,
return Status(ErrorCodes::AuthenticationFailed, "key mismatch");
}
- AuthorizationSession* authorizationSession =
- AuthorizationSession::get(ClientBasic::getCurrent());
+ AuthorizationSession* authorizationSession = AuthorizationSession::get(Client::getCurrent());
status = authorizationSession->addAndAuthorizeUser(txn, user);
if (!status.isOK()) {
return status;
@@ -313,7 +312,7 @@ Status CmdAuthenticate::_authenticateX509(OperationContext* txn,
"X.509 authentication must always use the $external database.");
}
- ClientBasic* client = ClientBasic::getCurrent();
+ Client* client = Client::getCurrent();
AuthorizationSession* authorizationSession = AuthorizationSession::get(client);
auto clientName = client->session()->getX509SubjectName();
@@ -374,7 +373,7 @@ public:
int options,
string& errmsg,
BSONObjBuilder& result) {
- AuthorizationSession* authSession = AuthorizationSession::get(ClientBasic::getCurrent());
+ AuthorizationSession* authSession = AuthorizationSession::get(Client::getCurrent());
authSession->logoutDatabase(dbname);
if (Command::testCommandsEnabled && dbname == "admin") {
// Allows logging out as the internal user against the admin database, however
diff --git a/src/mongo/db/commands/clone.cpp b/src/mongo/db/commands/clone.cpp
index 5367bdb1a82..60b9d031dc1 100644
--- a/src/mongo/db/commands/clone.cpp
+++ b/src/mongo/db/commands/clone.cpp
@@ -69,7 +69,7 @@ public:
help << "{clone: \"host13\"[, slaveOk: <bool>]}";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
ActionSet actions;
diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp
index a6539a5c179..3cc202bcae8 100644
--- a/src/mongo/db/commands/clone_collection.cpp
+++ b/src/mongo/db/commands/clone_collection.cpp
@@ -77,7 +77,7 @@ public:
return parseNsFullyQualified(dbname, cmdObj);
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
std::string ns = parseNs(dbname, cmdObj);
diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp
index 8cf1a94ebd6..e26e6b9d192 100644
--- a/src/mongo/db/commands/connection_status.cpp
+++ b/src/mongo/db/commands/connection_status.cpp
@@ -61,7 +61,7 @@ public:
int,
string& errmsg,
BSONObjBuilder& result) {
- AuthorizationSession* authSession = AuthorizationSession::get(ClientBasic::getCurrent());
+ AuthorizationSession* authSession = AuthorizationSession::get(Client::getCurrent());
bool showPrivileges;
Status status =
diff --git a/src/mongo/db/commands/copydb.cpp b/src/mongo/db/commands/copydb.cpp
index 9bfbde8d67a..2e80deab625 100644
--- a/src/mongo/db/commands/copydb.cpp
+++ b/src/mongo/db/commands/copydb.cpp
@@ -102,7 +102,7 @@ public:
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return copydb::checkAuthForCopydbCommand(client, dbname, cmdObj);
diff --git a/src/mongo/db/commands/copydb.h b/src/mongo/db/commands/copydb.h
index 3da70ccd01a..0f2cec12a72 100644
--- a/src/mongo/db/commands/copydb.h
+++ b/src/mongo/db/commands/copydb.h
@@ -36,13 +36,11 @@
namespace mongo {
-class ClientBasic;
+class Client;
namespace copydb {
-Status checkAuthForCopydbCommand(ClientBasic* client,
- const std::string& dbname,
- const BSONObj& cmdObj);
+Status checkAuthForCopydbCommand(Client* client, const std::string& dbname, const BSONObj& cmdObj);
} // namespace copydb
} // namespace mongo
diff --git a/src/mongo/db/commands/copydb_common.cpp b/src/mongo/db/commands/copydb_common.cpp
index 2a690ae0a17..ab6f5078429 100644
--- a/src/mongo/db/commands/copydb_common.cpp
+++ b/src/mongo/db/commands/copydb_common.cpp
@@ -36,16 +36,14 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/privilege.h"
#include "mongo/db/catalog/document_validation.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
namespace mongo {
namespace copydb {
-Status checkAuthForCopydbCommand(ClientBasic* client,
- const std::string& dbname,
- const BSONObj& cmdObj) {
+Status checkAuthForCopydbCommand(Client* client, const std::string& dbname, const BSONObj& cmdObj) {
bool fromSelf = StringData(cmdObj.getStringField("fromhost")).empty();
StringData fromdb = cmdObj.getStringField("fromdb");
StringData todb = cmdObj.getStringField("todb");
diff --git a/src/mongo/db/commands/copydb_start_commands.cpp b/src/mongo/db/commands/copydb_start_commands.cpp
index 1af5e4be983..3e7f0ee7e60 100644
--- a/src/mongo/db/commands/copydb_start_commands.cpp
+++ b/src/mongo/db/commands/copydb_start_commands.cpp
@@ -158,7 +158,7 @@ public:
return false;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
// No auth required
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index a3dcd815ebb..eb50818d63e 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -70,7 +70,7 @@ public:
return false;
} // TODO: this could be made true...
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
ActionSet actions;
diff --git a/src/mongo/db/commands/current_op.cpp b/src/mongo/db/commands/current_op.cpp
index 555fbd1efe5..69f042ecafe 100644
--- a/src/mongo/db/commands/current_op.cpp
+++ b/src/mongo/db/commands/current_op.cpp
@@ -68,7 +68,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index ee9a4fe1082..8fd2617062a 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -311,7 +311,7 @@ public:
return false;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -517,7 +517,7 @@ public:
help << "create a collection explicitly\n"
"{ create: <ns>[, capped: <bool>, size: <collSizeInBytes>, max: <nDocs>] }";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -1160,7 +1160,7 @@ public:
virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
return false;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp
index b0c8f1baec3..09ff0b1d44c 100644
--- a/src/mongo/db/commands/explain_cmd.cpp
+++ b/src/mongo/db/commands/explain_cmd.cpp
@@ -89,7 +89,7 @@ public:
* the command that you are explaining. The auth check is performed recursively
* on the nested command.
*/
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (Object != cmdObj.firstElement().type()) {
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 0d3b0d4381b..c83080a2d70 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -120,7 +120,7 @@ public:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp
index 0cb5f32f83f..2536a2f6f8e 100644
--- a/src/mongo/db/commands/fsync.cpp
+++ b/src/mongo/db/commands/fsync.cpp
@@ -199,7 +199,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
bool isAuthorized = AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index ac11e131c77..2fcf53e8e82 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -132,7 +132,7 @@ public:
return GetMoreRequest::parseNs(dbname, cmdObj);
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
StatusWith<GetMoreRequest> parseStatus = GetMoreRequest::parseFromBSON(dbname, cmdObj);
diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp
index c721a2d0266..e490febe4fb 100644
--- a/src/mongo/db/commands/group_cmd.cpp
+++ b/src/mongo/db/commands/group_cmd.cpp
@@ -94,7 +94,7 @@ private:
help << "http://dochub.mongodb.org/core/aggregation";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
std::string ns = parseNs(dbname, cmdObj);
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp
index 95725ee7702..5f8695713de 100644
--- a/src/mongo/db/commands/index_filter_commands.cpp
+++ b/src/mongo/db/commands/index_filter_commands.cpp
@@ -163,7 +163,7 @@ void IndexFilterCommand::help(stringstream& ss) const {
ss << helpText;
}
-Status IndexFilterCommand::checkAuthForCommand(ClientBasic* client,
+Status IndexFilterCommand::checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
diff --git a/src/mongo/db/commands/index_filter_commands.h b/src/mongo/db/commands/index_filter_commands.h
index 80fed645c5e..c34494b19d8 100644
--- a/src/mongo/db/commands/index_filter_commands.h
+++ b/src/mongo/db/commands/index_filter_commands.h
@@ -82,7 +82,7 @@ public:
* One action type defined for index filter commands:
* - planCacheIndexFilter
*/
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
diff --git a/src/mongo/db/commands/kill_op.cpp b/src/mongo/db/commands/kill_op.cpp
index 36e773bfaa8..f96f3692ecd 100644
--- a/src/mongo/db/commands/kill_op.cpp
+++ b/src/mongo/db/commands/kill_op.cpp
@@ -82,7 +82,7 @@ public:
}
static StatusWith<std::tuple<stdx::unique_lock<Client>, OperationContext*>> _findOp(
- ClientBasic* client, unsigned int opId) {
+ Client* client, unsigned int opId) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
for (ServiceContext::LockedClientsCursor cursor(client->getServiceContext());
@@ -103,7 +103,7 @@ public:
return Status(ErrorCodes::NoSuchKey, str::stream() << "Could not access opID: " << opId);
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
diff --git a/src/mongo/db/commands/killcursors_common.cpp b/src/mongo/db/commands/killcursors_common.cpp
index 879867e3690..194882feee2 100644
--- a/src/mongo/db/commands/killcursors_common.cpp
+++ b/src/mongo/db/commands/killcursors_common.cpp
@@ -39,7 +39,7 @@
namespace mongo {
-Status KillCursorsCmdBase::checkAuthForCommand(ClientBasic* client,
+Status KillCursorsCmdBase::checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
auto statusWithRequest = KillCursorsRequest::parseFromBSON(dbname, cmdObj);
diff --git a/src/mongo/db/commands/killcursors_common.h b/src/mongo/db/commands/killcursors_common.h
index db92c7ab21b..3f66f845ef0 100644
--- a/src/mongo/db/commands/killcursors_common.h
+++ b/src/mongo/db/commands/killcursors_common.h
@@ -66,7 +66,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final;
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index 23cd2ff6845..a597484666c 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -178,7 +178,7 @@ public:
help << "list collections for this db";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index e8f64630240..fb32aad5a25 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -91,7 +91,7 @@ public:
help << "list indexes for a collection";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp
index 68121448678..950533ae333 100644
--- a/src/mongo/db/commands/lock_info.cpp
+++ b/src/mongo/db/commands/lock_info.cpp
@@ -69,7 +69,7 @@ public:
help << "show all lock info on the server";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
bool isAuthorized = AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 423cfeeec29..9e61b381969 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -814,7 +814,7 @@ State::~State() {
void State::init() {
// setup js
const string userToken =
- AuthorizationSession::get(ClientBasic::getCurrent())->getAuthenticatedUserNamesToken();
+ AuthorizationSession::get(Client::getCurrent())->getAuthenticatedUserNamesToken();
_scope.reset(globalScriptEngine->newScopeForCurrentThread());
_scope->registerOperation(_txn);
_scope->setLocalDB(_config.dbname);
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index 784781405b4..35062313941 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -60,7 +60,7 @@ public:
virtual void help(stringstream& help) const {
help << "Adds a no-op entry to the oplog";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 97463f6cef5..77dcfefaa26 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -73,7 +73,7 @@ public:
return ReadWriteType::kCommand;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
ActionSet actions;
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 372cf203166..5cb7b6ac887 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -229,7 +229,7 @@ public:
<< "See http://dochub.mongodb.org/core/aggregation for more details.";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
return Pipeline::checkAuthForCommand(client, dbname, cmdObj);
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp
index 9d347b7b6a4..dd51739de13 100644
--- a/src/mongo/db/commands/plan_cache_commands.cpp
+++ b/src/mongo/db/commands/plan_cache_commands.cpp
@@ -157,7 +157,7 @@ void PlanCacheCommand::help(stringstream& ss) const {
ss << helpText;
}
-Status PlanCacheCommand::checkAuthForCommand(ClientBasic* client,
+Status PlanCacheCommand::checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
diff --git a/src/mongo/db/commands/plan_cache_commands.h b/src/mongo/db/commands/plan_cache_commands.h
index 87316b84178..1b6afaf2171 100644
--- a/src/mongo/db/commands/plan_cache_commands.h
+++ b/src/mongo/db/commands/plan_cache_commands.h
@@ -77,7 +77,7 @@ public:
* - planCacheRead
* - planCacheWrite
*/
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
/**
diff --git a/src/mongo/db/commands/rename_collection.h b/src/mongo/db/commands/rename_collection.h
index a7e3c6beed4..5fd3e867cb2 100644
--- a/src/mongo/db/commands/rename_collection.h
+++ b/src/mongo/db/commands/rename_collection.h
@@ -36,11 +36,11 @@
namespace mongo {
-class ClientBasic;
+class Client;
namespace rename_collection {
-Status checkAuthForRenameCollectionCommand(ClientBasic* client,
+Status checkAuthForRenameCollectionCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp
index 746aeb49db1..1b213898805 100644
--- a/src/mongo/db/commands/rename_collection_cmd.cpp
+++ b/src/mongo/db/commands/rename_collection_cmd.cpp
@@ -68,7 +68,7 @@ public:
virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return rename_collection::checkAuthForRenameCollectionCommand(client, dbname, cmdObj);
diff --git a/src/mongo/db/commands/rename_collection_common.cpp b/src/mongo/db/commands/rename_collection_common.cpp
index d9818962cc3..7bfadbf779f 100644
--- a/src/mongo/db/commands/rename_collection_common.cpp
+++ b/src/mongo/db/commands/rename_collection_common.cpp
@@ -35,14 +35,14 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/privilege.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
namespace mongo {
namespace rename_collection {
-Status checkAuthForRenameCollectionCommand(ClientBasic* client,
+Status checkAuthForRenameCollectionCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
NamespaceString sourceNS = NamespaceString(cmdObj.getStringField("renameCollection"));
diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp
index ad8afe526bb..1e04075ab58 100644
--- a/src/mongo/db/commands/repair_cursor.cpp
+++ b/src/mongo/db/commands/repair_cursor.cpp
@@ -55,7 +55,7 @@ public:
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
ActionSet actions;
diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp
index e567a15b18b..1872745bf24 100644
--- a/src/mongo/db/commands/server_status.cpp
+++ b/src/mongo/db/commands/server_status.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/privilege.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/server_status.h"
#include "mongo/db/commands/server_status_internal.h"
@@ -97,7 +97,7 @@ public:
const auto runStart = clock->now();
BSONObjBuilder timeBuilder(256);
- const auto authSession = AuthorizationSession::get(ClientBasic::getCurrent());
+ const auto authSession = AuthorizationSession::get(Client::getCurrent());
auto canonicalizer = HostnameCanonicalizationWorker::get(service);
// --- basic fields that are global
diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp
index 9eec705e4af..5c215c4c6f4 100644
--- a/src/mongo/db/commands/snapshot_management.cpp
+++ b/src/mongo/db/commands/snapshot_management.cpp
@@ -53,7 +53,7 @@ public:
}
// No auth needed because it only works when enabled via command line.
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
@@ -103,7 +103,7 @@ public:
}
// No auth needed because it only works when enabled via command line.
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index 6574e3cd8e0..5dc5bba8138 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -607,7 +607,7 @@ public:
ss << "Adds a user to the system" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForCreateUserCommand(client, dbname, cmdObj);
@@ -721,7 +721,7 @@ public:
}
}
- audit::logCreateUser(ClientBasic::getCurrent(),
+ audit::logCreateUser(Client::getCurrent(),
args.userName,
args.hasHashedPassword,
args.hasCustomData ? &args.customData : NULL,
@@ -752,7 +752,7 @@ public:
ss << "Used to update a user, for example to change its password" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForUpdateUserCommand(client, dbname, cmdObj);
@@ -834,7 +834,7 @@ public:
}
}
- audit::logUpdateUser(ClientBasic::getCurrent(),
+ audit::logUpdateUser(Client::getCurrent(),
args.userName,
args.hasHashedPassword,
args.hasCustomData ? &args.customData : NULL,
@@ -869,7 +869,7 @@ public:
ss << "Drops a single user." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropUserCommand(client, dbname, cmdObj);
@@ -895,7 +895,7 @@ public:
return appendCommandStatus(result, status);
}
- audit::logDropUser(ClientBasic::getCurrent(), userName);
+ audit::logDropUser(Client::getCurrent(), userName);
long long nMatched;
status = removePrivilegeDocuments(txn,
@@ -938,7 +938,7 @@ public:
ss << "Drops all users for a single database." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropAllUsersFromDatabaseCommand(client, dbname);
@@ -963,7 +963,7 @@ public:
return appendCommandStatus(result, status);
}
- audit::logDropAllUsersFromDatabase(ClientBasic::getCurrent(), dbname);
+ audit::logDropAllUsersFromDatabase(Client::getCurrent(), dbname);
long long numRemoved;
status = removePrivilegeDocuments(
@@ -996,7 +996,7 @@ public:
ss << "Grants roles to a user." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGrantRolesToUserCommand(client, dbname, cmdObj);
@@ -1043,7 +1043,7 @@ public:
userRoles.insert(roleName);
}
- audit::logGrantRolesToUser(ClientBasic::getCurrent(), userName, roles);
+ audit::logGrantRolesToUser(Client::getCurrent(), userName, roles);
BSONArray newRolesBSONArray = roleSetToBSONArray(userRoles);
status = updatePrivilegeDocument(
txn, userName, BSON("$set" << BSON("roles" << newRolesBSONArray)));
@@ -1070,7 +1070,7 @@ public:
ss << "Revokes roles from a user." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRevokeRolesFromUserCommand(client, dbname, cmdObj);
@@ -1117,7 +1117,7 @@ public:
userRoles.erase(roleName);
}
- audit::logRevokeRolesFromUser(ClientBasic::getCurrent(), userName, roles);
+ audit::logRevokeRolesFromUser(Client::getCurrent(), userName, roles);
BSONArray newRolesBSONArray = roleSetToBSONArray(userRoles);
status = updatePrivilegeDocument(
txn, userName, BSON("$set" << BSON("roles" << newRolesBSONArray)));
@@ -1148,7 +1148,7 @@ public:
ss << "Returns information about users." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForUsersInfoCommand(client, dbname, cmdObj);
@@ -1259,7 +1259,7 @@ public:
ss << "Adds a role to the system" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForCreateRoleCommand(client, dbname, cmdObj);
@@ -1349,7 +1349,7 @@ public:
return appendCommandStatus(result, status);
}
- audit::logCreateRole(ClientBasic::getCurrent(), args.roleName, args.roles, args.privileges);
+ audit::logCreateRole(Client::getCurrent(), args.roleName, args.roles, args.privileges);
status = insertRoleDocument(txn, roleObjBuilder.done());
return appendCommandStatus(result, status);
@@ -1373,7 +1373,7 @@ public:
ss << "Used to update a role" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForUpdateRoleCommand(client, dbname, cmdObj);
@@ -1443,7 +1443,7 @@ public:
}
}
- audit::logUpdateRole(ClientBasic::getCurrent(),
+ audit::logUpdateRole(Client::getCurrent(),
args.roleName,
args.hasRoles ? &args.roles : NULL,
args.hasPrivileges ? &args.privileges : NULL);
@@ -1471,7 +1471,7 @@ public:
ss << "Grants privileges to a role" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGrantPrivilegesToRoleCommand(client, dbname, cmdObj);
@@ -1552,7 +1552,7 @@ public:
BSONObjBuilder updateBSONBuilder;
updateObj.writeTo(&updateBSONBuilder);
- audit::logGrantPrivilegesToRole(ClientBasic::getCurrent(), roleName, privilegesToAdd);
+ audit::logGrantPrivilegesToRole(Client::getCurrent(), roleName, privilegesToAdd);
status = updateRoleDocument(txn, roleName, updateBSONBuilder.done());
// Must invalidate even on bad status - what if the write succeeded but the GLE failed?
@@ -1578,7 +1578,7 @@ public:
ss << "Revokes privileges from a role" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRevokePrivilegesFromRoleCommand(client, dbname, cmdObj);
@@ -1660,7 +1660,7 @@ public:
return appendCommandStatus(result, status);
}
- audit::logRevokePrivilegesFromRole(ClientBasic::getCurrent(), roleName, privilegesToRemove);
+ audit::logRevokePrivilegesFromRole(Client::getCurrent(), roleName, privilegesToRemove);
BSONObjBuilder updateBSONBuilder;
updateObj.writeTo(&updateBSONBuilder);
@@ -1688,7 +1688,7 @@ public:
ss << "Grants roles to another role." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGrantRolesToRoleCommand(client, dbname, cmdObj);
@@ -1752,7 +1752,7 @@ public:
directRoles.push_back(*it);
}
- audit::logGrantRolesToRole(ClientBasic::getCurrent(), roleName, rolesToAdd);
+ audit::logGrantRolesToRole(Client::getCurrent(), roleName, rolesToAdd);
status = updateRoleDocument(
txn, roleName, BSON("$set" << BSON("roles" << rolesVectorToBSONArray(directRoles))));
@@ -1779,7 +1779,7 @@ public:
ss << "Revokes roles from another role." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRevokeRolesFromRoleCommand(client, dbname, cmdObj);
@@ -1838,7 +1838,7 @@ public:
}
}
- audit::logRevokeRolesFromRole(ClientBasic::getCurrent(), roleName, rolesToRemove);
+ audit::logRevokeRolesFromRole(Client::getCurrent(), roleName, rolesToRemove);
status = updateRoleDocument(
txn, roleName, BSON("$set" << BSON("roles" << rolesVectorToBSONArray(roles))));
@@ -1869,7 +1869,7 @@ public:
<< endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropRoleCommand(client, dbname, cmdObj);
@@ -1969,7 +1969,7 @@ public:
<< status.reason()));
}
- audit::logDropRole(ClientBasic::getCurrent(), roleName);
+ audit::logDropRole(Client::getCurrent(), roleName);
// Finally, remove the actual role document
status = removeRoleDocuments(txn,
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
@@ -2023,7 +2023,7 @@ public:
<< endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropAllRolesFromDatabaseCommand(client, dbname);
@@ -2100,7 +2100,7 @@ public:
<< status.reason()));
}
- audit::logDropAllRolesFromDatabase(ClientBasic::getCurrent(), dbname);
+ audit::logDropAllRolesFromDatabase(Client::getCurrent(), dbname);
// Finally, remove the actual role documents
status = removeRoleDocuments(
txn, BSON(AuthorizationManager::ROLE_DB_FIELD_NAME << dbname), &nMatched);
@@ -2144,7 +2144,7 @@ public:
ss << "Returns information about roles." << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRolesInfoCommand(client, dbname, cmdObj);
@@ -2219,7 +2219,7 @@ public:
ss << "Invalidates the in-memory cache of user information" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForInvalidateUserCacheCommand(client);
@@ -2258,7 +2258,7 @@ public:
ss << "internal" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGetUserCacheGenerationCommand(client);
@@ -2307,7 +2307,7 @@ public:
ss << "Internal command used by mongorestore for updating user/role data" << endl;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForMergeAuthzCollectionsCommand(client, cmdObj);
@@ -2373,13 +2373,13 @@ public:
}
if (create) {
- audit::logCreateUser(ClientBasic::getCurrent(),
+ audit::logCreateUser(Client::getCurrent(),
userName,
userObj["credentials"].Obj().hasField("MONGODB-CR"),
userObj.hasField("customData") ? &customData : NULL,
roles);
} else {
- audit::logUpdateUser(ClientBasic::getCurrent(),
+ audit::logUpdateUser(Client::getCurrent(),
userName,
userObj["credentials"].Obj().hasField("MONGODB-CR"),
userObj.hasField("customData") ? &customData : NULL,
@@ -2399,9 +2399,9 @@ public:
uassertStatusOK(auth::parseAndValidatePrivilegeArray(BSONArray(roleObj["privileges"].Obj()),
&privileges));
if (create) {
- audit::logCreateRole(ClientBasic::getCurrent(), roleName, roles, privileges);
+ audit::logCreateRole(Client::getCurrent(), roleName, roles, privileges);
} else {
- audit::logUpdateRole(ClientBasic::getCurrent(), roleName, &roles, &privileges);
+ audit::logUpdateRole(Client::getCurrent(), roleName, &roles, &privileges);
}
}
@@ -2545,7 +2545,7 @@ public:
it != usersToDrop.end();
++it) {
const UserName& userName = *it;
- audit::logDropUser(ClientBasic::getCurrent(), userName);
+ audit::logDropUser(Client::getCurrent(), userName);
status = removePrivilegeDocuments(txn,
BSON(AuthorizationManager::USER_NAME_FIELD_NAME
<< userName.getUser().toString()
@@ -2625,7 +2625,7 @@ public:
it != rolesToDrop.end();
++it) {
const RoleName& roleName = *it;
- audit::logDropRole(ClientBasic::getCurrent(), roleName);
+ audit::logDropRole(Client::getCurrent(), roleName);
status = removeRoleDocuments(txn,
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
<< roleName.getRole().toString()
@@ -2874,7 +2874,7 @@ public:
ss << "Upgrades the auth data storage schema";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForAuthSchemaUpgradeCommand(client);
diff --git a/src/mongo/db/commands/user_management_commands.h b/src/mongo/db/commands/user_management_commands.h
index 8ae4e233db9..60c833505d6 100644
--- a/src/mongo/db/commands/user_management_commands.h
+++ b/src/mongo/db/commands/user_management_commands.h
@@ -42,7 +42,7 @@ class AuthorizationManager;
class AuthorizationSession;
struct BSONArray;
class BSONObj;
-class ClientBasic;
+class Client;
class OperationContext;
namespace auth {
@@ -74,74 +74,74 @@ Status checkAuthorizedToRevokePrivileges(AuthorizationSession* authzSession,
// checkAuthFor*Command methods
//
-Status checkAuthForCreateUserCommand(ClientBasic* client,
+Status checkAuthForCreateUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForUpdateUserCommand(ClientBasic* client,
+Status checkAuthForUpdateUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForGrantRolesToUserCommand(ClientBasic* client,
+Status checkAuthForGrantRolesToUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForCreateRoleCommand(ClientBasic* client,
+Status checkAuthForCreateRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForUpdateRoleCommand(ClientBasic* client,
+Status checkAuthForUpdateRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForGrantRolesToRoleCommand(ClientBasic* client,
+Status checkAuthForGrantRolesToRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForGrantPrivilegesToRoleCommand(ClientBasic* client,
+Status checkAuthForGrantPrivilegesToRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForDropAllUsersFromDatabaseCommand(ClientBasic* client, const std::string& dbname);
+Status checkAuthForDropAllUsersFromDatabaseCommand(Client* client, const std::string& dbname);
-Status checkAuthForRevokeRolesFromUserCommand(ClientBasic* client,
+Status checkAuthForRevokeRolesFromUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForRevokeRolesFromRoleCommand(ClientBasic* client,
+Status checkAuthForRevokeRolesFromRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForDropUserCommand(ClientBasic* client,
+Status checkAuthForDropUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForDropRoleCommand(ClientBasic* client,
+Status checkAuthForDropRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForUsersInfoCommand(ClientBasic* client,
+Status checkAuthForUsersInfoCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForRevokePrivilegesFromRoleCommand(ClientBasic* client,
+Status checkAuthForRevokePrivilegesFromRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForDropAllRolesFromDatabaseCommand(ClientBasic* client, const std::string& dbname);
+Status checkAuthForDropAllRolesFromDatabaseCommand(Client* client, const std::string& dbname);
-Status checkAuthForRolesInfoCommand(ClientBasic* client,
+Status checkAuthForRolesInfoCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
-Status checkAuthForInvalidateUserCacheCommand(ClientBasic* client);
+Status checkAuthForInvalidateUserCacheCommand(Client* client);
-Status checkAuthForGetUserCacheGenerationCommand(ClientBasic* client);
+Status checkAuthForGetUserCacheGenerationCommand(Client* client);
-Status checkAuthForMergeAuthzCollectionsCommand(ClientBasic* client, const BSONObj& cmdObj);
+Status checkAuthForMergeAuthzCollectionsCommand(Client* client, const BSONObj& cmdObj);
-Status checkAuthForAuthSchemaUpgradeCommand(ClientBasic* client);
+Status checkAuthForAuthSchemaUpgradeCommand(Client* client);
} // namespace auth
} // namespace mongo
diff --git a/src/mongo/db/commands/user_management_commands_common.cpp b/src/mongo/db/commands/user_management_commands_common.cpp
index 72ef7f1d033..6b3fc2f4b19 100644
--- a/src/mongo/db/commands/user_management_commands_common.cpp
+++ b/src/mongo/db/commands/user_management_commands_common.cpp
@@ -110,7 +110,7 @@ Status checkAuthorizedToRevokePrivileges(AuthorizationSession* authzSession,
return Status::OK();
}
-Status checkAuthForCreateUserCommand(ClientBasic* client,
+Status checkAuthForCreateUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -130,7 +130,7 @@ Status checkAuthForCreateUserCommand(ClientBasic* client,
return checkAuthorizedToGrantRoles(authzSession, args.roles);
}
-Status checkAuthForUpdateUserCommand(ClientBasic* client,
+Status checkAuthForUpdateUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -178,7 +178,7 @@ Status checkAuthForUpdateUserCommand(ClientBasic* client,
return Status::OK();
}
-Status checkAuthForGrantRolesToUserCommand(ClientBasic* client,
+Status checkAuthForGrantRolesToUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -193,7 +193,7 @@ Status checkAuthForGrantRolesToUserCommand(ClientBasic* client,
return checkAuthorizedToGrantRoles(authzSession, roles);
}
-Status checkAuthForCreateRoleCommand(ClientBasic* client,
+Status checkAuthForCreateRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -217,7 +217,7 @@ Status checkAuthForCreateRoleCommand(ClientBasic* client,
return checkAuthorizedToGrantPrivileges(authzSession, args.privileges);
}
-Status checkAuthForUpdateRoleCommand(ClientBasic* client,
+Status checkAuthForUpdateRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -244,7 +244,7 @@ Status checkAuthForUpdateRoleCommand(ClientBasic* client,
return checkAuthorizedToGrantPrivileges(authzSession, args.privileges);
}
-Status checkAuthForGrantRolesToRoleCommand(ClientBasic* client,
+Status checkAuthForGrantRolesToRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -259,7 +259,7 @@ Status checkAuthForGrantRolesToRoleCommand(ClientBasic* client,
return checkAuthorizedToGrantRoles(authzSession, roles);
}
-Status checkAuthForGrantPrivilegesToRoleCommand(ClientBasic* client,
+Status checkAuthForGrantPrivilegesToRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -274,7 +274,7 @@ Status checkAuthForGrantPrivilegesToRoleCommand(ClientBasic* client,
return checkAuthorizedToGrantPrivileges(authzSession, privileges);
}
-Status checkAuthForDropUserCommand(ClientBasic* client,
+Status checkAuthForDropUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -293,7 +293,7 @@ Status checkAuthForDropUserCommand(ClientBasic* client,
return Status::OK();
}
-Status checkAuthForDropRoleCommand(ClientBasic* client,
+Status checkAuthForDropRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -312,7 +312,7 @@ Status checkAuthForDropRoleCommand(ClientBasic* client,
return Status::OK();
}
-Status checkAuthForDropAllUsersFromDatabaseCommand(ClientBasic* client, const std::string& dbname) {
+Status checkAuthForDropAllUsersFromDatabaseCommand(Client* client, const std::string& dbname) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forDatabaseName(dbname),
ActionType::dropUser)) {
@@ -323,7 +323,7 @@ Status checkAuthForDropAllUsersFromDatabaseCommand(ClientBasic* client, const st
return Status::OK();
}
-Status checkAuthForRevokeRolesFromUserCommand(ClientBasic* client,
+Status checkAuthForRevokeRolesFromUserCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -338,7 +338,7 @@ Status checkAuthForRevokeRolesFromUserCommand(ClientBasic* client,
return checkAuthorizedToRevokeRoles(authzSession, roles);
}
-Status checkAuthForRevokeRolesFromRoleCommand(ClientBasic* client,
+Status checkAuthForRevokeRolesFromRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -353,7 +353,7 @@ Status checkAuthForRevokeRolesFromRoleCommand(ClientBasic* client,
return checkAuthorizedToRevokeRoles(authzSession, roles);
}
-Status checkAuthForUsersInfoCommand(ClientBasic* client,
+Status checkAuthForUsersInfoCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -387,7 +387,7 @@ Status checkAuthForUsersInfoCommand(ClientBasic* client,
return Status::OK();
}
-Status checkAuthForRevokePrivilegesFromRoleCommand(ClientBasic* client,
+Status checkAuthForRevokePrivilegesFromRoleCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -402,7 +402,7 @@ Status checkAuthForRevokePrivilegesFromRoleCommand(ClientBasic* client,
return checkAuthorizedToRevokePrivileges(authzSession, privileges);
}
-Status checkAuthForDropAllRolesFromDatabaseCommand(ClientBasic* client, const std::string& dbname) {
+Status checkAuthForDropAllRolesFromDatabaseCommand(Client* client, const std::string& dbname) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forDatabaseName(dbname),
ActionType::dropRole)) {
@@ -413,7 +413,7 @@ Status checkAuthForDropAllRolesFromDatabaseCommand(ClientBasic* client, const st
return Status::OK();
}
-Status checkAuthForRolesInfoCommand(ClientBasic* client,
+Status checkAuthForRolesInfoCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -450,7 +450,7 @@ Status checkAuthForRolesInfoCommand(ClientBasic* client,
return Status::OK();
}
-Status checkAuthForInvalidateUserCacheCommand(ClientBasic* client) {
+Status checkAuthForInvalidateUserCacheCommand(Client* client) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
ActionType::invalidateUserCache)) {
@@ -459,7 +459,7 @@ Status checkAuthForInvalidateUserCacheCommand(ClientBasic* client) {
return Status::OK();
}
-Status checkAuthForGetUserCacheGenerationCommand(ClientBasic* client) {
+Status checkAuthForGetUserCacheGenerationCommand(Client* client) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
ActionType::internal)) {
@@ -468,7 +468,7 @@ Status checkAuthForGetUserCacheGenerationCommand(ClientBasic* client) {
return Status::OK();
}
-Status checkAuthForMergeAuthzCollectionsCommand(ClientBasic* client, const BSONObj& cmdObj) {
+Status checkAuthForMergeAuthzCollectionsCommand(Client* client, const BSONObj& cmdObj) {
auth::MergeAuthzCollectionsArgs args;
Status status = auth::parseMergeAuthzCollectionsCommand(cmdObj, &args);
if (!status.isOK()) {
@@ -508,7 +508,7 @@ Status checkAuthForMergeAuthzCollectionsCommand(ClientBasic* client, const BSONO
return Status::OK();
}
-Status checkAuthForAuthSchemaUpgradeCommand(ClientBasic* client) {
+Status checkAuthForAuthSchemaUpgradeCommand(Client* client) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
ActionType::authSchemaUpgrade)) {
diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp
index 97f2996baad..506709096b8 100644
--- a/src/mongo/db/commands/write_commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands/write_commands.cpp
@@ -75,7 +75,7 @@ void redactTooLongLog(mutablebson::Document* cmdObj, StringData fieldName) {
}
}
-Status checkAuthForWriteCommand(ClientBasic* client,
+Status checkAuthForWriteCommand(Client* client,
BatchedCommandRequest::BatchType batchType,
NamespaceString ns,
const BSONObj& cmdObj) {
@@ -242,7 +242,7 @@ public:
help << "insert documents";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
return checkAuthForWriteCommand(client,
@@ -278,7 +278,7 @@ public:
help << "update documents";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
return checkAuthForWriteCommand(client,
@@ -346,7 +346,7 @@ public:
help << "delete documents";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
return checkAuthForWriteCommand(client,
diff --git a/src/mongo/db/exec/group.cpp b/src/mongo/db/exec/group.cpp
index ccd2cea6991..7acaebdf7fa 100644
--- a/src/mongo/db/exec/group.cpp
+++ b/src/mongo/db/exec/group.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/bson/dotted_path_support.h"
#include "mongo/db/catalog/collection.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/exec/scoped_timer.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/stdx/memory.h"
@@ -93,7 +93,7 @@ GroupStage::GroupStage(OperationContext* txn,
Status GroupStage::initGroupScripting() {
// Initialize _scope.
const std::string userToken =
- AuthorizationSession::get(ClientBasic::getCurrent())->getAuthenticatedUserNamesToken();
+ AuthorizationSession::get(Client::getCurrent())->getAuthenticatedUserNamesToken();
const NamespaceString nss(_request.ns);
_scope =
diff --git a/src/mongo/db/ftdc/ftdc_commands.cpp b/src/mongo/db/ftdc/ftdc_commands.cpp
index 8fea20ee1da..e9205b1b5ab 100644
--- a/src/mongo/db/ftdc/ftdc_commands.cpp
+++ b/src/mongo/db/ftdc/ftdc_commands.cpp
@@ -65,7 +65,7 @@ public:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
diff --git a/src/mongo/db/matcher/expression_where.cpp b/src/mongo/db/matcher/expression_where.cpp
index 1e24dbc2501..91c7feb1a03 100644
--- a/src/mongo/db/matcher/expression_where.cpp
+++ b/src/mongo/db/matcher/expression_where.cpp
@@ -69,7 +69,7 @@ Status WhereMatchExpression::init(StringData dbName) {
_dbName = dbName.toString();
const string userToken =
- AuthorizationSession::get(ClientBasic::getCurrent())->getAuthenticatedUserNamesToken();
+ AuthorizationSession::get(Client::getCurrent())->getAuthenticatedUserNamesToken();
try {
_scope = globalScriptEngine->getPooledScope(_txn, _dbName, "where" + userToken);
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index d8c388eff73..a4f1325933f 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -182,9 +182,7 @@ void addPrivilegesForStage(const std::string& db,
} // namespace
-Status Pipeline::checkAuthForCommand(ClientBasic* client,
- const std::string& db,
- const BSONObj& cmdObj) {
+Status Pipeline::checkAuthForCommand(Client* client, const std::string& db, const BSONObj& cmdObj) {
NamespaceString inputNs(db, cmdObj.firstElement().str());
auto inputResource = ResourcePattern::forExactNamespace(inputNs);
uassert(17138,
diff --git a/src/mongo/db/pipeline/pipeline.h b/src/mongo/db/pipeline/pipeline.h
index 531411fae60..2b4cb3faacd 100644
--- a/src/mongo/db/pipeline/pipeline.h
+++ b/src/mongo/db/pipeline/pipeline.h
@@ -42,7 +42,7 @@
namespace mongo {
class BSONObj;
class BSONObjBuilder;
-class ClientBasic;
+class Client;
class CollatorInterface;
class DocumentSource;
struct ExpressionContext;
@@ -77,7 +77,7 @@ public:
/**
* Helper to implement Command::checkAuthForCommand.
*/
- static Status checkAuthForCommand(ClientBasic* client,
+ static Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj);
diff --git a/src/mongo/db/repl/repl_set_command.cpp b/src/mongo/db/repl/repl_set_command.cpp
index 3d987c6d176..4bf96c23df2 100644
--- a/src/mongo/db/repl/repl_set_command.cpp
+++ b/src/mongo/db/repl/repl_set_command.cpp
@@ -35,7 +35,7 @@
namespace mongo {
namespace repl {
-Status ReplSetCommand::checkAuthForCommand(ClientBasic* client,
+Status ReplSetCommand::checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/repl/repl_set_command.h b/src/mongo/db/repl/repl_set_command.h
index 6c4d1bd620f..3eb2275a064 100644
--- a/src/mongo/db/repl/repl_set_command.h
+++ b/src/mongo/db/repl/repl_set_command.h
@@ -35,7 +35,7 @@
namespace mongo {
class Status;
-class ClientBasic;
+class Client;
class BSONObj;
namespace repl {
@@ -59,7 +59,7 @@ protected:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override;
diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp
index 4c65ce87776..7011b1e9b9e 100644
--- a/src/mongo/db/repl/replset_commands.cpp
+++ b/src/mongo/db/repl/replset_commands.cpp
@@ -87,7 +87,7 @@ public:
help << "Just for tests.\n";
}
// No auth needed because it only works when enabled via command line.
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index a642140b72c..e1540ee4c04 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -144,7 +144,7 @@ static TimerStats applyBatchStats;
static ServerStatusMetricField<TimerStats> displayOpBatchesApplied("repl.apply.batches",
&applyBatchStats);
void initializePrefetchThread() {
- if (!ClientBasic::getCurrent()) {
+ if (!Client::getCurrent()) {
Client::initThreadIfNotAlready();
AuthorizationSession::get(cc())->grantInternalAuthorization();
}
@@ -489,7 +489,7 @@ void applyOps(std::vector<MultiApplier::OperationPtrs>* writerVectors,
void initializeWriterThread() {
// Only do this once per thread
- if (!ClientBasic::getCurrent()) {
+ if (!Client::getCurrent()) {
Client::initThreadIfNotAlready();
AuthorizationSession::get(cc())->grantInternalAuthorization();
}
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index 0d6dd7ee627..d4f591e92f9 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -35,7 +35,7 @@
#include <limits>
#include "mongo/db/audit.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/heartbeat_response_action.h"
#include "mongo/db/repl/is_master_response.h"
diff --git a/src/mongo/db/s/cleanup_orphaned_cmd.cpp b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
index ee08330962d..37b90be8211 100644
--- a/src/mongo/db/s/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
@@ -181,7 +181,7 @@ public:
return false;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/config/configsvr_add_shard_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
index 3bc7e2eeeb0..50d6f975a7c 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
@@ -76,7 +76,7 @@ public:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
@@ -113,7 +113,7 @@ public:
return appendCommandStatus(result, validationStatus);
}
- audit::logAddShard(ClientBasic::getCurrent(),
+ audit::logAddShard(Client::getCurrent(),
parsedRequest.hasName() ? parsedRequest.getName() : "",
parsedRequest.getConnString().toString(),
parsedRequest.hasMaxSize() ? parsedRequest.getMaxSize()
diff --git a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp
index bf1bfd86db3..1b0a3db4148 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp
@@ -77,7 +77,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp
index 72760cdda65..98f026ef202 100644
--- a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp
+++ b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp
@@ -97,7 +97,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp
index eaf4223e4c0..3128023f7d6 100644
--- a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp
+++ b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp
@@ -62,7 +62,7 @@ public:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/config/configsvr_move_chunk_command.cpp b/src/mongo/db/s/config/configsvr_move_chunk_command.cpp
index d85f29b7417..89e4a8b4a86 100644
--- a/src/mongo/db/s/config/configsvr_move_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_move_chunk_command.cpp
@@ -68,7 +68,7 @@ public:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp
index 5b5f4a79c05..376bf5cfd5f 100644
--- a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp
+++ b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp
@@ -77,7 +77,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp
index 8ec850654a0..09ff5f8bf74 100644
--- a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp
+++ b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp
@@ -79,7 +79,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/get_shard_version_command.cpp b/src/mongo/db/s/get_shard_version_command.cpp
index 4420a064fae..a14732867d7 100644
--- a/src/mongo/db/s/get_shard_version_command.cpp
+++ b/src/mongo/db/s/get_shard_version_command.cpp
@@ -67,7 +67,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/merge_chunks_command.cpp b/src/mongo/db/s/merge_chunks_command.cpp
index 510f816d56e..a309f77cb47 100644
--- a/src/mongo/db/s/merge_chunks_command.cpp
+++ b/src/mongo/db/s/merge_chunks_command.cpp
@@ -367,7 +367,7 @@ public:
<< " (opt) shardName : <shard name> }";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp
index 493bf35ad3d..64b5d2081d4 100644
--- a/src/mongo/db/s/move_chunk_command.cpp
+++ b/src/mongo/db/s/move_chunk_command.cpp
@@ -119,7 +119,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/split_chunk_command.cpp b/src/mongo/db/s/split_chunk_command.cpp
index 54cf2e4bb83..059f1634168 100644
--- a/src/mongo/db/s/split_chunk_command.cpp
+++ b/src/mongo/db/s/split_chunk_command.cpp
@@ -125,7 +125,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/s/split_vector_command.cpp b/src/mongo/db/s/split_vector_command.cpp
index 5ee14dc09cf..5ed698daad1 100644
--- a/src/mongo/db/s/split_vector_command.cpp
+++ b/src/mongo/db/s/split_vector_command.cpp
@@ -92,7 +92,7 @@ public:
" 'force' will produce one split point even if data is small; defaults to false\n"
"NOTE: This command may take a while to run";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/db/server_extra_log_context.cpp b/src/mongo/db/server_extra_log_context.cpp
index c056651b0cb..bce96112075 100644
--- a/src/mongo/db/server_extra_log_context.cpp
+++ b/src/mongo/db/server_extra_log_context.cpp
@@ -34,7 +34,7 @@
#include "mongo/bson/util/builder.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/user_set.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/server_parameters.h"
#include "mongo/util/log.h"
@@ -49,13 +49,13 @@ MONGO_EXPORT_STARTUP_SERVER_PARAMETER(logUserIds, bool, false);
* includeEndingNull parameter.
*/
void appendServerExtraLogContext(BufBuilder& builder) {
- ClientBasic* clientBasic = ClientBasic::getCurrent();
- if (!clientBasic)
+ Client* client = Client::getCurrent();
+ if (!client)
return;
- if (!AuthorizationSession::exists(clientBasic))
+ if (!AuthorizationSession::exists(client))
return;
- UserNameIterator users = AuthorizationSession::get(clientBasic)->getAuthenticatedUserNames();
+ UserNameIterator users = AuthorizationSession::get(client)->getAuthenticatedUserNames();
if (!users.more())
return;
diff --git a/src/mongo/rpc/metadata/client_metadata.h b/src/mongo/rpc/metadata/client_metadata.h
index a809484e20d..48966f529db 100644
--- a/src/mongo/rpc/metadata/client_metadata.h
+++ b/src/mongo/rpc/metadata/client_metadata.h
@@ -40,7 +40,6 @@
namespace mongo {
class Client;
-class ClientBasic;
class OperationContext;
constexpr auto kMetadataDocumentName = "client"_sd;
diff --git a/src/mongo/rpc/metadata/client_metadata_ismaster.cpp b/src/mongo/rpc/metadata/client_metadata_ismaster.cpp
index 2df2461dfa3..234f61c78e8 100644
--- a/src/mongo/rpc/metadata/client_metadata_ismaster.cpp
+++ b/src/mongo/rpc/metadata/client_metadata_ismaster.cpp
@@ -44,11 +44,11 @@ namespace mongo {
namespace {
const auto getClientMetadataIsMasterState =
- ClientBasic::declareDecoration<ClientMetadataIsMasterState>();
+ Client::declareDecoration<ClientMetadataIsMasterState>();
} // namespace
-ClientMetadataIsMasterState& ClientMetadataIsMasterState::get(ClientBasic* client) {
+ClientMetadataIsMasterState& ClientMetadataIsMasterState::get(Client* client) {
return getClientMetadataIsMasterState(*client);
}
diff --git a/src/mongo/rpc/metadata/client_metadata_ismaster.h b/src/mongo/rpc/metadata/client_metadata_ismaster.h
index eb1f92e5033..305018343d0 100644
--- a/src/mongo/rpc/metadata/client_metadata_ismaster.h
+++ b/src/mongo/rpc/metadata/client_metadata_ismaster.h
@@ -38,7 +38,6 @@
namespace mongo {
class Client;
-class ClientBasic;
/**
* ClientMetadataIsMasterState is responsible for tracking whether the client metadata document has
@@ -50,7 +49,7 @@ class ClientMetadataIsMasterState {
public:
ClientMetadataIsMasterState() = default;
- static ClientMetadataIsMasterState& get(ClientBasic* client);
+ static ClientMetadataIsMasterState& get(Client* client);
/**
* Get the optional client metadata object.
diff --git a/src/mongo/s/cluster_last_error_info.cpp b/src/mongo/s/cluster_last_error_info.cpp
index 6ff23456c6c..b474574f35b 100644
--- a/src/mongo/s/cluster_last_error_info.cpp
+++ b/src/mongo/s/cluster_last_error_info.cpp
@@ -34,8 +34,8 @@
namespace mongo {
-const ClientBasic::Decoration<ClusterLastErrorInfo> ClusterLastErrorInfo::get =
- ClientBasic::declareDecoration<ClusterLastErrorInfo>();
+const Client::Decoration<ClusterLastErrorInfo> ClusterLastErrorInfo::get =
+ Client::declareDecoration<ClusterLastErrorInfo>();
void ClusterLastErrorInfo::addShardHost(const std::string& shardHost) {
_cur->shardHostsWritten.insert(shardHost);
diff --git a/src/mongo/s/cluster_last_error_info.h b/src/mongo/s/cluster_last_error_info.h
index 0fc317c660b..648ae12b8b5 100644
--- a/src/mongo/s/cluster_last_error_info.h
+++ b/src/mongo/s/cluster_last_error_info.h
@@ -29,7 +29,7 @@
#include <set>
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/s/write_ops/batch_write_exec.h"
namespace mongo {
@@ -40,7 +40,7 @@ namespace mongo {
*/
class ClusterLastErrorInfo {
public:
- static const ClientBasic::Decoration<ClusterLastErrorInfo> get;
+ static const Client::Decoration<ClusterLastErrorInfo> get;
/** new request not associated (yet or ever) with a client */
void newRequest();
diff --git a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
index 381328fcd91..36d504c276d 100644
--- a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
+++ b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
@@ -85,7 +85,7 @@ public:
help << "adds a shard to zone";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
index 50fbf6ba6eb..d7a1337aed0 100644
--- a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
+++ b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
@@ -66,7 +66,7 @@ public:
help << "Starts or stops the sharding balancer.";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_current_op.cpp b/src/mongo/s/commands/cluster_current_op.cpp
index dd200b08dd8..c9a307c4c39 100644
--- a/src/mongo/s/commands/cluster_current_op.cpp
+++ b/src/mongo/s/commands/cluster_current_op.cpp
@@ -62,7 +62,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
bool isAuthorized = AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
index ff11011a59d..e6352a95fa1 100644
--- a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
+++ b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
@@ -37,7 +37,7 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/s/catalog/catalog_cache.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
@@ -71,7 +71,7 @@ public:
<< " { enablesharding : \"<dbname>\" }\n";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
@@ -107,7 +107,7 @@ public:
Status status = grid.catalogClient(txn)->enableSharding(txn, dbname);
if (status.isOK()) {
- audit::logEnableSharding(ClientBasic::getCurrent(), dbname);
+ audit::logEnableSharding(Client::getCurrent(), dbname);
}
// Make sure to force update of any stale metadata
diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp
index eddac77e971..0218e257b36 100644
--- a/src/mongo/s/commands/cluster_explain_cmd.cpp
+++ b/src/mongo/s/commands/cluster_explain_cmd.cpp
@@ -87,7 +87,7 @@ public:
* the command that you are explaining. The auth check is performed recursively
* on the nested command.
*/
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (Object != cmdObj.firstElement().type()) {
diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp
index 9a742c979e6..b9488073a2f 100644
--- a/src/mongo/s/commands/cluster_find_cmd.cpp
+++ b/src/mongo/s/commands/cluster_find_cmd.cpp
@@ -92,7 +92,7 @@ public:
* In order to run the find command, you must be authorized for the "find" action
* type on the collection.
*/
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/s/commands/cluster_ftdc_commands.cpp b/src/mongo/s/commands/cluster_ftdc_commands.cpp
index bfe339198c4..23903e92984 100644
--- a/src/mongo/s/commands/cluster_ftdc_commands.cpp
+++ b/src/mongo/s/commands/cluster_ftdc_commands.cpp
@@ -64,7 +64,7 @@ public:
return false;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
return Status::OK();
diff --git a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
index 5cb36e28f93..eb603d27cb3 100644
--- a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
@@ -66,7 +66,7 @@ public:
help << " example: { getShardVersion : 'alleyinsider.foo' } ";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_getmore_cmd.cpp b/src/mongo/s/commands/cluster_getmore_cmd.cpp
index 270100a2b47..dff5c9c7e4a 100644
--- a/src/mongo/s/commands/cluster_getmore_cmd.cpp
+++ b/src/mongo/s/commands/cluster_getmore_cmd.cpp
@@ -78,7 +78,7 @@ public:
help << "retrieve more documents for a cursor id";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
StatusWith<GetMoreRequest> parseStatus = GetMoreRequest::parseFromBSON(dbname, cmdObj);
diff --git a/src/mongo/s/commands/cluster_index_filter_cmd.cpp b/src/mongo/s/commands/cluster_index_filter_cmd.cpp
index bbd7de10711..3a0824cddbf 100644
--- a/src/mongo/s/commands/cluster_index_filter_cmd.cpp
+++ b/src/mongo/s/commands/cluster_index_filter_cmd.cpp
@@ -78,9 +78,7 @@ public:
ss << _helpText;
}
- Status checkAuthForCommand(ClientBasic* client,
- const std::string& dbname,
- const BSONObj& cmdObj) {
+ Status checkAuthForCommand(Client* client, const std::string& dbname, const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
ResourcePattern pattern = parseResourcePattern(dbname, cmdObj);
diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp
index caa46351279..ba698426fcc 100644
--- a/src/mongo/s/commands/cluster_kill_op.cpp
+++ b/src/mongo/s/commands/cluster_kill_op.cpp
@@ -68,7 +68,7 @@ public:
return true;
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
bool isAuthorized = AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp
index c935feedc3a..d534c29aadd 100644
--- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp
+++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp
@@ -64,7 +64,7 @@ public:
<< "usage: { mergeChunks : <ns>, bounds : [ <min key>, <max key> ] }";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
index 0afc654b245..282667dd6eb 100644
--- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
+++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/s/balancer/balancer_configuration.h"
@@ -82,7 +82,7 @@ public:
<< " , to : 'shard001' }\n";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp
index 028a15179fe..5db4f4aa666 100644
--- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp
+++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/catalog/document_validation.h"
#include "mongo/db/client.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/operation_context.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -81,7 +81,7 @@ public:
help << " example: { moveprimary : 'foo' , to : 'localhost:9999' }";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp
index 2a34bd623ad..919fd3116f5 100644
--- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp
+++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp
@@ -96,7 +96,7 @@ public:
}
// virtuals from Command
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
return Pipeline::checkAuthForCommand(client, dbname, cmdObj);
diff --git a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp
index 65c3035d993..bb053e15f26 100644
--- a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp
+++ b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp
@@ -29,7 +29,7 @@
#include "mongo/base/error_codes.h"
#include "mongo/base/init.h"
#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/query/collation/collation_spec.h"
#include "mongo/s/commands/strategy.h"
@@ -74,9 +74,7 @@ public:
return parseNsCollectionRequired(dbname, cmdObj).ns();
}
- Status checkAuthForCommand(ClientBasic* client,
- const std::string& dbname,
- const BSONObj& cmdObj) {
+ Status checkAuthForCommand(Client* client, const std::string& dbname, const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
ResourcePattern pattern = parseResourcePattern(dbname, cmdObj);
diff --git a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
index 40dda76c987..a24c7a63e3b 100644
--- a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
+++ b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
@@ -85,7 +85,7 @@ public:
help << "removes a shard from the zone";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp
index f019370818f..5c342b14489 100644
--- a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp
+++ b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp
@@ -57,7 +57,7 @@ public:
help << "Not supported through mongos";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
// Require no auth since this command isn't supported in mongos
diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
index 6ce23736609..25d74323b5c 100644
--- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
+++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/hasher.h"
#include "mongo/db/operation_context.h"
@@ -92,7 +92,7 @@ public:
<< " { enablesharding : \"<dbname>\" }\n";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
@@ -475,8 +475,7 @@ public:
LOG(0) << "CMD: shardcollection: " << cmdObj;
- audit::logShardCollection(
- ClientBasic::getCurrent(), nss.ns(), proposedKey, careAboutUnique);
+ audit::logShardCollection(Client::getCurrent(), nss.ns(), proposedKey, careAboutUnique);
Status status = grid.catalogClient(txn)->shardCollection(txn,
nss.ns(),
diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp
index ebae1fd1e07..719ea3b5aaf 100644
--- a/src/mongo/s/commands/cluster_split_cmd.cpp
+++ b/src/mongo/s/commands/cluster_split_cmd.cpp
@@ -81,7 +81,7 @@ public:
<< " NOTE: this does not move the chunks, it just creates a logical separation.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
index c50d92f576d..a08e0d32677 100644
--- a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
+++ b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
@@ -88,7 +88,7 @@ public:
help << "assigns/remove a range of a sharded collection to a zone";
}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
diff --git a/src/mongo/s/commands/cluster_user_management_commands.cpp b/src/mongo/s/commands/cluster_user_management_commands.cpp
index 93e344c766c..1a200ce6c9c 100644
--- a/src/mongo/s/commands/cluster_user_management_commands.cpp
+++ b/src/mongo/s/commands/cluster_user_management_commands.cpp
@@ -73,7 +73,7 @@ public:
ss << "Adds a user to the system";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForCreateUserCommand(client, dbname, cmdObj);
@@ -112,7 +112,7 @@ public:
ss << "Used to update a user, for example to change its password";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForUpdateUserCommand(client, dbname, cmdObj);
@@ -162,7 +162,7 @@ public:
ss << "Drops a single user.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropUserCommand(client, dbname, cmdObj);
@@ -208,7 +208,7 @@ public:
ss << "Drops all users for a single database.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropAllUsersFromDatabaseCommand(client, dbname);
@@ -249,7 +249,7 @@ public:
ss << "Grants roles to a user.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGrantRolesToUserCommand(client, dbname, cmdObj);
@@ -297,7 +297,7 @@ public:
ss << "Revokes roles from a user.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRevokeRolesFromUserCommand(client, dbname, cmdObj);
@@ -349,7 +349,7 @@ public:
ss << "Returns information about users.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForUsersInfoCommand(client, dbname, cmdObj);
@@ -383,7 +383,7 @@ public:
ss << "Adds a role to the system";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForCreateRoleCommand(client, dbname, cmdObj);
@@ -418,7 +418,7 @@ public:
ss << "Used to update a role";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForUpdateRoleCommand(client, dbname, cmdObj);
@@ -459,7 +459,7 @@ public:
ss << "Grants privileges to a role";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGrantPrivilegesToRoleCommand(client, dbname, cmdObj);
@@ -500,7 +500,7 @@ public:
ss << "Revokes privileges from a role";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRevokePrivilegesFromRoleCommand(client, dbname, cmdObj);
@@ -541,7 +541,7 @@ public:
ss << "Grants roles to another role.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForGrantRolesToRoleCommand(client, dbname, cmdObj);
@@ -582,7 +582,7 @@ public:
ss << "Revokes roles from another role.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRevokeRolesFromRoleCommand(client, dbname, cmdObj);
@@ -626,7 +626,7 @@ public:
"removed from some user/roles but otherwise still exists.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropRoleCommand(client, dbname, cmdObj);
@@ -671,7 +671,7 @@ public:
"exist.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForDropAllRolesFromDatabaseCommand(client, dbname);
@@ -716,7 +716,7 @@ public:
ss << "Returns information about roles.";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForRolesInfoCommand(client, dbname, cmdObj);
@@ -754,7 +754,7 @@ public:
ss << "Invalidates the in-memory cache of user information";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForInvalidateUserCacheCommand(client);
@@ -805,7 +805,7 @@ public:
ss << "Internal command used by mongorestore for updating user/role data";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForMergeAuthzCollectionsCommand(client, cmdObj);
@@ -903,7 +903,7 @@ public:
ss << "Upgrades the auth data storage schema";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return auth::checkAuthForAuthSchemaUpgradeCommand(client);
diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp
index 19a9969de6c..317019abb01 100644
--- a/src/mongo/s/commands/cluster_write_cmd.cpp
+++ b/src/mongo/s/commands/cluster_write_cmd.cpp
@@ -32,7 +32,7 @@
#include "mongo/base/owned_pointer_vector.h"
#include "mongo/client/remote_command_targeter.h"
#include "mongo/db/client.h"
-#include "mongo/db/client_basic.h"
+#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/write_commands/write_commands_common.h"
#include "mongo/db/lasterror.h"
@@ -78,7 +78,7 @@ public:
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
Status status = auth::checkAuthForWriteCommand(AuthorizationSession::get(client),
diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp
index ef395f11d35..3b2fc9630ad 100644
--- a/src/mongo/s/commands/commands_public.cpp
+++ b/src/mongo/s/commands/commands_public.cpp
@@ -501,7 +501,7 @@ public:
class CreateCmd : public PublicGridCommand {
public:
CreateCmd() : PublicGridCommand("create") {}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -594,7 +594,7 @@ public:
class RenameCollectionCmd : public PublicGridCommand {
public:
RenameCollectionCmd() : PublicGridCommand("renameCollection") {}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return rename_collection::checkAuthForRenameCollectionCommand(client, dbname, cmdObj);
@@ -639,7 +639,7 @@ public:
virtual bool adminOnly() const {
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return copydb::checkAuthForCopydbCommand(client, dbname, cmdObj);
@@ -1081,7 +1081,7 @@ public:
virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
return false;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
@@ -1694,7 +1694,7 @@ class CmdListCollections final : public PublicGridCommand {
public:
CmdListCollections() : PublicGridCommand("listCollections") {}
- Status checkAuthForCommand(ClientBasic* client,
+ Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) final {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -1735,7 +1735,7 @@ public:
class CmdListIndexes final : public PublicGridCommand {
public:
CmdListIndexes() : PublicGridCommand("listIndexes") {}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
AuthorizationSession* authzSession = AuthorizationSession::get(client);
@@ -1783,7 +1783,7 @@ public:
virtual bool slaveOk() const {
return true;
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) {
return Status::OK();
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index dbd551c908e..6deb049d7ad 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -108,7 +108,7 @@ void runAgainstRegistered(OperationContext* txn,
return;
}
- Command::execCommandClientBasic(txn, c, queryOptions, ns, jsobj, anObjBuilder);
+ Command::execCommandClient(txn, c, queryOptions, ns, jsobj, anObjBuilder);
}
/**
@@ -159,7 +159,7 @@ void Strategy::queryOp(OperationContext* txn, Request& request) {
QueryMessage q(request.d());
NamespaceString ns(q.ns);
- ClientBasic* client = txn->getClient();
+ Client* client = txn->getClient();
AuthorizationSession* authSession = AuthorizationSession::get(client);
Status status = authSession->checkAuthForFind(ns, false);
audit::logQueryAuthzCheck(client, ns, q.query, status.code());
diff --git a/src/mongo/s/s_only.cpp b/src/mongo/s/s_only.cpp
index d29eb7de7a4..18db1dd374e 100644
--- a/src/mongo/s/s_only.cpp
+++ b/src/mongo/s/s_only.cpp
@@ -82,18 +82,17 @@ void Command::execCommand(OperationContext* txn,
std::string db = request.getDatabase().rawData();
BSONObjBuilder result;
- execCommandClientBasic(
- txn, command, queryFlags, request.getDatabase().rawData(), cmdObj, result);
+ execCommandClient(txn, command, queryFlags, request.getDatabase().rawData(), cmdObj, result);
replyBuilder->setCommandReply(result.done()).setMetadata(rpc::makeEmptyMetadata());
}
-void Command::execCommandClientBasic(OperationContext* txn,
- Command* c,
- int queryOptions,
- const char* ns,
- BSONObj& cmdObj,
- BSONObjBuilder& result) {
+void Command::execCommandClient(OperationContext* txn,
+ Command* c,
+ int queryOptions,
+ const char* ns,
+ BSONObj& cmdObj,
+ BSONObjBuilder& result) {
std::string dbname = nsToDatabase(ns);
if (cmdObj.getBoolField("help")) {
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index 155deb809c5..809164b6e04 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -147,7 +147,7 @@ static void cleanupTask() {
grid.catalogClient(txn)->shutDown(txn);
}
- audit::logShutdown(ClientBasic::getCurrent());
+ audit::logShutdown(Client::getCurrent());
}
static BSONObj buildErrReply(const DBException& ex) {