Skip to content

Conversation

ShaneHarvey
Copy link
Member

No description provided.

Copy link
Contributor

@juliusgeo juliusgeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

elif sock_info.max_wire_version >= 3:
return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
else:
return _authenticate_mongo_cr(credentials, sock_info)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like MONGODB-CR is still supported in 3.6, so I don't think you can remove it here.
https://docs.mongodb.com/v4.0/core/security-scram/

Copy link
Member Author

@ShaneHarvey ShaneHarvey Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still supported by pymongo if you explicitly add authMechanism=MONGODB-CR. What I've removed here is the default auth path used for MongoDB 2.6 servers.

flags, cursor_id, _, number_returned = cls.UNPACK_FROM(msg)

documents = bytes(msg[20:])
documents = msg[20:]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this taking a slice of a memoryview, or are we making a copy?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the memoryview created in network._receive_data_on_socket().

raise ProtocolError("Unsupported OP_MSG reply: >1 section")

payload_document = bytes(msg[5:])
payload_document = msg[5:]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the memoryview created in network._receive_data_on_socket().

}


def _first_batch(sock_info, db, coll, query, ntoreturn,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good riddance!

self._raise_if_not_writable(not with_last_error)

self._raise_if_not_writable(True)
self.send_message(msg, max_doc_size)
Copy link
Member

@behackett behackett Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs for this say msg is an OP_OPTYPE message. Do the docs just need to be updated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always OP_MSG, the docs were out of date. Updated.

func=func)

def check_auth_with_sharding(self, func):
"""Skip a test when connected to mongos < 2.0 and running with auth."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. This could have been removed ages ago.

Copy link
Member Author

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to remove the unused OP_KILL_CURSORS code path.

elif sock_info.max_wire_version >= 3:
return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
else:
return _authenticate_mongo_cr(credentials, sock_info)
Copy link
Member Author

@ShaneHarvey ShaneHarvey Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still supported by pymongo if you explicitly add authMechanism=MONGODB-CR. What I've removed here is the default auth path used for MongoDB 2.6 servers.

self._raise_if_not_writable(not with_last_error)

self._raise_if_not_writable(True)
self.send_message(msg, max_doc_size)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always OP_MSG, the docs were out of date. Updated.

flags, cursor_id, _, number_returned = cls.UNPACK_FROM(msg)

documents = bytes(msg[20:])
documents = msg[20:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the memoryview created in network._receive_data_on_socket().

raise ProtocolError("Unsupported OP_MSG reply: >1 section")

payload_document = bytes(msg[5:])
payload_document = msg[5:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the memoryview created in network._receive_data_on_socket().

Copy link
Member

@behackett behackett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! No going back now.

@ShaneHarvey ShaneHarvey merged commit 11752ed into mongodb:master Sep 16, 2021
@ShaneHarvey ShaneHarvey deleted the PYTHON-2899 branch September 17, 2021 00:03
juliusgeo pushed a commit to juliusgeo/mongo-python-driver that referenced this pull request Oct 1, 2021
Remove unneeded memoryview to bytes conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants