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 | |||
stringutils.h | stringutils.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
namespace mongo { | namespace mongo { | |||
// see also mongoutils/str.h - perhaps move these there? | // see also mongoutils/str.h - perhaps move these there? | |||
// see also text.h | // see also text.h | |||
void splitStringDelim( const std::string& str , std::vector<std::string >* res , char delim ); | void splitStringDelim( const std::string& str , std::vector<std::string >* res , char delim ); | |||
void joinStringDelim( const std::vector<std::string>& strs , std::strin g* res , char delim ); | void joinStringDelim( const std::vector<std::string>& strs , std::strin g* res , char delim ); | |||
inline std::string tolowerString( const std::string& input ) { | inline std::string tolowerString( StringData input ) { | |||
std::string::size_type sz = input.size(); | std::string::size_type sz = input.size(); | |||
boost::scoped_array<char> line(new char[sz+1]); | boost::scoped_array<char> line(new char[sz+1]); | |||
char * copy = line.get(); | char * copy = line.get(); | |||
for ( std::string::size_type i=0; i<sz; i++ ) { | for ( std::string::size_type i=0; i<sz; i++ ) { | |||
char c = input[i]; | char c = input[i]; | |||
copy[i] = (char)tolower( (int)c ); | copy[i] = (char)tolower( (int)c ); | |||
} | } | |||
copy[sz] = 0; | copy[sz] = 0; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||