[SERVER-4241] Shell connections don't re-authenticate on reconnect Created: 09/Nov/11  Updated: 11/Jul/16  Resolved: 14/Nov/11

Status: Closed
Project: Core Server
Component/s: Security, Shell
Affects Version/s: None
Fix Version/s: 2.1.0

Type: Bug Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-4237 Enable the full js test suite to run ... Closed
Operating System: ALL
Participants:

 Description   

> mongo
MongoDB shell version: 2.0.1
connecting to: test
test[17:27:54]> db.foo.find()
error:

{ "$err" : "unauthorized db:test lock type:-1 client:127.0.0.1", "code" : 10057 } test[17:27:59]> db.auth('spencer','password') 1 test[17:28:12]> db.foo.find() { "_id" : ObjectId("4ebafe6909b6ffecbd780b6b"), "a" : 1 }

// RESTART MONGOD SERVER

test[17:28:19]> db.foo.find()
Wed Nov 9 17:30:04 DBClientCursor::init call() failed
Wed Nov 9 17:30:04 query failed : test.foo {} to: 127.0.0.1
Error: error doing query: failed
Wed Nov 9 17:30:04 trying reconnect to 127.0.0.1
Wed Nov 9 17:30:04 reconnect 127.0.0.1 ok
test[17:30:4]> db.foo.find()
error: {
"$err" : "unauthorized db:test lock type:-1 client:127.0.0.1",
"code" : 10057
}



 Comments   
Comment by auto [ 15/Nov/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: SERVER-4241: v8 needs method too
Branch: master
https://github.com/mongodb/mongo/commit/377c4e96f74d3a9fed2adf8fda8e8e6bdfe8bf38

Comment by auto [ 14/Nov/11 ]

Author:

{u'login': u'kchodorow', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: Handle auth in C++, not JS SERVER-4241
Branch: master
https://github.com/mongodb/mongo/commit/200956560469c1a25ed7078cc541ffa45f3e0c40

Comment by Eliot Horowitz (Inactive) [ 14/Nov/11 ]

Having the shell call the c++ methods is probably the way to go.

Comment by Kristina Chodorow (Inactive) [ 14/Nov/11 ]

I'm not sure how to actually fix this, as reconnection is handled by C++ and auth is handled by JS. I could move DB.prototype.auth to C++, I guess.

Anyone have other suggestions how this should be done?

Comment by auto [ 11/Nov/11 ]

Author:

{u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: Make test use rslib's reconnect function as it has logic to work around SERVER-4241.
Branch: master
https://github.com/mongodb/mongo/commit/658b5ca30f20f469f68b2613399da66f88743bec

Comment by auto [ 11/Nov/11 ]

Author:

{u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: Add re-authentication logic to rslib reconnect to work-around SERVER-4241.
Branch: master
https://github.com/mongodb/mongo/commit/2442d4c6ce6288677171e81dd869441692326d80

Generated at Thu Feb 08 03:05:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.