Skip to content

Commit 1bf5db8

Browse files
committed
CXX-572 Backport server r3.0.1..r3.0.2 changes
Server SHAs cherry-picked into this commit: 6fa5d19 d9a3c65
1 parent cf28c5e commit 1bf5db8

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/mongo/bson/bsonelement.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,13 @@ namespace mongo {
740740
return true;
741741
}
742742

743+
template<> bool BSONElement::coerce<long long>( long long* out ) const {
744+
if ( !isNumber() )
745+
return false;
746+
*out = numberLong();
747+
return true;
748+
}
749+
743750
template<> bool BSONElement::coerce<double>( double* out ) const {
744751
if ( !isNumber() )
745752
return false;

src/mongo/client/sasl_client_authenticate_impl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ namespace {
159159
if (status.isOK()) {
160160
session->setParameter(SaslClientSession::parameterPassword, value);
161161
}
162-
else if (status != ErrorCodes::NoSuchKey) {
162+
else if (!(status == ErrorCodes::NoSuchKey && targetDatabase == "$external")) {
163+
// $external users do not have passwords, hence NoSuchKey is expected
163164
return status;
164165
}
165166

src/mongo/client/sasl_scramsha1_client_conversation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ namespace mongo {
7878
* n,a=authzid,n=encoded-username,r=client-nonce
7979
*/
8080
StatusWith<bool> SaslSCRAMSHA1ClientConversation::_firstStep(std::string* outputData) {
81+
if (_saslClientSession->getParameter(SaslClientSession::parameterPassword).empty()) {
82+
return StatusWith<bool>(ErrorCodes::BadValue, mongoutils::str::stream() <<
83+
"Empty client password provided");
84+
}
8185

8286
// Create text-based nonce as base64 encoding of a binary blob of length multiple of 3
8387
const int nonceLenQWords = 3;

0 commit comments

Comments
 (0)