[SERVER-5033] Database with auth turned on and profile = 2 on the command line does not allow "show dbs" to be run from driver Created: 22/Feb/12  Updated: 11/Jul/16  Resolved: 01/Mar/12

Status: Closed
Project: Core Server
Component/s: Security
Affects Version/s: 2.0.2
Fix Version/s: 2.1.1

Type: Bug Priority: Major - P3
Reporter: Sridhar Nanjundeswaran Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mongod standalone on win7 x64.


Attachments: File logs.7z    
Issue Links:
Duplicate
is duplicated by SERVER-5121 while profile level is 2, auth using ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Start mongod with auth turned on and --profile set to 2

mongod.exe --auth --dbpath c:\mongo\data\db  --profile 2 -logpath c:\mongo\logs -vvvvv

now from the shell login to the admin db and create 1 admin user.
The following code in pymongo 2.1.1 throws and exception

>>> conn = pymongo.Connection("mongodb://admin:admin@localhost/?safe=true")

Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
conn = pymongo.Connection("mongodb://admin:admin@localhost/?safe=true")
File "C:\Python27\lib\site-packages\pymongo\connection.py", line 381, in _init_
self.__find_node()
File "C:\Python27\lib\site-packages\pymongo\connection.py", line 659, in __find_node
raise AutoReconnect(', '.join(errors))
AutoReconnect: connection closed

Also the following code from the c# driver 1.3.1 throws an exception

            var server = MongoServer.Create("mongodb://admin:admin@localhost/?safe=true");
            foreach (var databaseName in server.GetDatabaseNames())
            {
                Console.WriteLine(databaseName);
            }

c:\Users\Sridhar\Documents\Visual Studio 2010\Projects\ConsoleApplication5\bin\Debug>ConsoleApplication5.exe
MongoDB.Driver.MongoConnectionException: Unable to connect to server localhost:27017: Attempted to read past the end of the stream.. ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream, Int32 count) in C:\source\mongo-csharp-driver\Bson\IO\BsonBuffer.cs:line 297
at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream) in C:\source\mongo-csharp-driver\Bson\IO\BsonBuffer.cs:line 267
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions) in C:\source\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 435
at MongoDB.Driver.Internal.MongoConnection.RunCommand(String collectionName, QueryFlags queryFlags, CommandDocument command, Boolean throwOnError) in C:\source\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 393
at MongoDB.Driver.MongoServerInstance.VerifyState(MongoConnection connection) in C:\source\mongo-csharp-driver\Driver\Core\MongoServerInstance.cs:line 417



 Comments   
Comment by auto [ 01/Mar/12 ]

Author:

{u'login': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-5033: Do not require auth in the context in which db profiles are captured.

By virtue of being enabled, the mongod query profiler ought to be authorized to write to profile
data collections. This change makes that so, rather than depending on the authorization state of
the connection. This will also allow queries by read-only users to be profiled.
Branch: master
https://github.com/mongodb/mongo/commit/06d2438c122d1a20750f2bf3197df735367e22c4

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