| commands.h | | commands.h | |
| | | | |
| skipping to change at line 190 | | skipping to change at line 190 | |
| BSONObjBuilder& result, | | BSONObjBuilder& result, | |
| bool fromRepl ); | | bool fromRepl ); | |
| | | | |
| // Helper for setting errmsg and ok field in command result object. | | // Helper for setting errmsg and ok field in command result object. | |
| static void appendCommandStatus(BSONObjBuilder& result, bool ok, co
nst std::string& errmsg); | | static void appendCommandStatus(BSONObjBuilder& result, bool ok, co
nst std::string& errmsg); | |
| | | | |
| // Set by command line. Controls whether or not testing-only comma
nds should be available. | | // Set by command line. Controls whether or not testing-only comma
nds should be available. | |
| static int testCommandsEnabled; | | static int testCommandsEnabled; | |
| }; | | }; | |
| | | | |
|
| // This will be registered instead of the real implementations of any c | | | |
| ommands that don't work | | | |
| // when auth is enabled. | | | |
| class NotWithAuthCmd : public Command { | | | |
| public: | | | |
| NotWithAuthCmd(const char* cmdName) : Command(cmdName) { } | | | |
| virtual bool slaveOk() const { return true; } | | | |
| virtual LockType locktype() const { return NONE; } | | | |
| virtual bool requiresAuth() { return false; } | | | |
| virtual void addRequiredPrivileges(const std::string& dbname, | | | |
| const BSONObj& cmdObj, | | | |
| std::vector<Privilege>* out) {} | | | |
| virtual void help( stringstream &help ) const { | | | |
| help << name << " is not supported when running with authentica | | | |
| tion enabled"; | | | |
| } | | | |
| virtual bool run(const string&, | | | |
| BSONObj& cmdObj, | | | |
| int, | | | |
| string& errmsg, | | | |
| BSONObjBuilder& result, | | | |
| bool fromRepl) { | | | |
| errmsg = name + " is not supported when running with authentica | | | |
| tion enabled"; | | | |
| log() << errmsg << std::endl; | | | |
| return false; | | | |
| } | | | |
| }; | | | |
| | | | |
| class CmdShutdown : public Command { | | class CmdShutdown : public Command { | |
| public: | | public: | |
| virtual bool requiresAuth() { return true; } | | virtual bool requiresAuth() { return true; } | |
| virtual bool adminOnly() const { return true; } | | virtual bool adminOnly() const { return true; } | |
| virtual bool localHostOnlyIfNoAuth(const BSONObj& cmdObj) { return
true; } | | virtual bool localHostOnlyIfNoAuth(const BSONObj& cmdObj) { return
true; } | |
| virtual bool logTheOp() { | | virtual bool logTheOp() { | |
| return false; | | return false; | |
| } | | } | |
| virtual bool slaveOk() const { | | virtual bool slaveOk() const { | |
| return true; | | return true; | |
| | | | |
End of changes. 1 change blocks. |
| 29 lines changed or deleted | | 0 lines changed or added | |
|