diff options
author | Spencer T Brody <spencer@mongodb.com> | 2014-02-14 13:52:02 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2014-03-03 09:24:06 -0800 |
commit | 803ae07cb3eb9cb9051995e9b2ac48958131fb3a (patch) | |
tree | bf40563ce77706682d78dbc505c1a827a3f16f37 /src/mongo/db/auth/auth_index_d.cpp | |
parent | 1ffdd358b9fa048794a09bbc644f6043dde15eeb (diff) | |
download | mongo-803ae07cb3eb9cb9051995e9b2ac48958131fb3a.tar.gz |
SERVER-12116 Return better messages to the user when the authz version field is the wrong type
Diffstat (limited to 'src/mongo/db/auth/auth_index_d.cpp')
-rw-r--r-- | src/mongo/db/auth/auth_index_d.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/db/auth/auth_index_d.cpp b/src/mongo/db/auth/auth_index_d.cpp index 5834b7d53c7..8c59f8e9ca3 100644 --- a/src/mongo/db/auth/auth_index_d.cpp +++ b/src/mongo/db/auth/auth_index_d.cpp @@ -29,6 +29,7 @@ #include "mongo/db/auth/auth_index_d.h" #include "mongo/base/init.h" +#include "mongo/base/status.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" #include "mongo/db/client.h" @@ -72,8 +73,13 @@ namespace { } // namespace void configureSystemIndexes(const StringData& dbname) { - if (dbname == "admin" && getGlobalAuthorizationManager()->getAuthorizationVersion() == - AuthorizationManager::schemaVersion26Final) { + int authzVersion; + Status status = getGlobalAuthorizationManager()->getAuthorizationVersion(&authzVersion); + if (!status.isOK()) { + return; + } + + if (dbname == "admin" && authzVersion == AuthorizationManager::schemaVersion26Final) { NamespaceString systemUsers(dbname, "system.users"); // Make sure the old unique index from v2.4 on system.users doesn't exist. |