Merge branch 'master' of git.10gen.com:/data/gitroot/p
This commit is contained in:
@@ -116,12 +116,13 @@ namespace mongo {
|
||||
|
||||
BSONObj getnoncecmdobj = fromjson("{getnonce:1}");
|
||||
|
||||
string DBClientWithCommands::createPasswordDigest( const char * clearTextPassword ){
|
||||
string DBClientWithCommands::createPasswordDigest( const char * username , const char * clearTextPassword ){
|
||||
md5digest d;
|
||||
{
|
||||
md5_state_t st;
|
||||
md5_init(&st);
|
||||
md5_append(&st, (const md5_byte_t *) "mongo", 5 );
|
||||
md5_append(&st, (const md5_byte_t *) username, strlen(username));
|
||||
md5_append(&st, (const md5_byte_t *) ":mongo:", 5 );
|
||||
md5_append(&st, (const md5_byte_t *) clearTextPassword, strlen(clearTextPassword));
|
||||
md5_finish(&st, d);
|
||||
}
|
||||
@@ -133,7 +134,7 @@ namespace mongo {
|
||||
|
||||
string password = password_text;
|
||||
if( digestPassword )
|
||||
password = createPasswordDigest( password_text );
|
||||
password = createPasswordDigest( username , password_text );
|
||||
|
||||
BSONObj info;
|
||||
string nonce;
|
||||
@@ -315,7 +316,7 @@ namespace mongo {
|
||||
bool DBClientConnection::auth(const char *dbname, const char *username, const char *password_text, string& errmsg, bool digestPassword) {
|
||||
string password = password_text;
|
||||
if( digestPassword )
|
||||
password = createPasswordDigest( password_text );
|
||||
password = createPasswordDigest( username , password_text );
|
||||
|
||||
if( autoReconnect ) {
|
||||
/* note we remember the auth info before we attempt to auth -- if the connection is broken, we will
|
||||
|
||||
Reference in New Issue
Block a user