コード例 #1
0
 void unlockFsync(const char *ns, Message& m, DbResponse &dbresponse) {
     BSONObj obj;
     if ( ! cc().isAdmin() ) { // checks auth
         obj = fromjson("{\"err\":\"unauthorized\"}");
     }
     else if (strncmp(ns, "admin.", 6) != 0 ) {
         obj = fromjson("{\"err\":\"unauthorized - this command must be run against the admin DB\"}");
     }
     else {
         log() << "command: unlock requested" << endl;
         if( _unlockFsync() ) {
             obj = fromjson("{ok:1,\"info\":\"unlock completed\"}");
         }
         else {
             obj = fromjson("{ok:0,\"errmsg\":\"not locked\"}");
         }
     }
     replyToQuery(0, m, dbresponse, obj);
 }
コード例 #2
0
ファイル: instance.cpp プロジェクト: Thor1Khan/mongo
 void unlockFsync(const char *ns, Message& m, DbResponse &dbresponse) {
     BSONObj obj;
     if (!cc().getAuthorizationManager()->checkAuthorization(
             AuthorizationManager::SERVER_RESOURCE_NAME, ActionType::unlock)) {
         obj = fromjson("{\"err\":\"unauthorized\"}");
     }
     else if (strncmp(ns, "admin.", 6) != 0 ) {
         obj = fromjson("{\"err\":\"unauthorized - this command must be run against the admin DB\"}");
     }
     else {
         log() << "command: unlock requested" << endl;
         if( _unlockFsync() ) {
             obj = fromjson("{ok:1,\"info\":\"unlock completed\"}");
         }
         else {
             obj = fromjson("{ok:0,\"errmsg\":\"not locked\"}");
         }
     }
     replyToQuery(0, m, dbresponse, obj);
 }