Skip to content

Commit 0eddda9

Browse files
committed
CXX-370 Backport server r2.7.7..r2.7.8
1 parent fcdc0c5 commit 0eddda9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+543
-213
lines changed

SConstruct

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,8 @@ if has_option( "ssl" ):
810810
env.Append( LIBS=["crypto"] )
811811
if has_option("ssl-fips-capability"):
812812
env.Append( CPPDEFINES=["MONGO_SSL_FIPS"] )
813+
else:
814+
env["MONGO_SSL"] = False
813815

814816
try:
815817
umask = os.umask(022)
@@ -1585,6 +1587,10 @@ def doConfigure(myenv):
15851587

15861588
conf.env['MONGO_SASL'] = bool(has_option("use-sasl-client"))
15871589

1590+
if conf.env['MONGO_SASL'] and not conf.env['MONGO_SSL']:
1591+
print("SASL support requires --ssl")
1592+
Exit(1)
1593+
15881594
if conf.env['MONGO_SASL'] and not conf.CheckLibWithHeader(
15891595
"sasl2",
15901596
["stddef.h","sasl/sasl.h"],

src/SConscript.client

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,18 @@ clientSourceBasic = [
102102
'mongo/client/index_spec.cpp',
103103
'mongo/client/init.cpp',
104104
'mongo/client/insert_write_operation.cpp',
105-
'mongo/client/native_sasl_client_session.cpp',
106105
'mongo/client/options.cpp',
107106
'mongo/client/replica_set_monitor.cpp',
108107
'mongo/client/sasl_client_authenticate.cpp',
109108
'mongo/client/sasl_client_authenticate_impl.cpp',
110109
'mongo/client/sasl_client_conversation.cpp',
111110
'mongo/client/sasl_client_session.cpp',
112111
'mongo/client/sasl_plain_client_conversation.cpp',
113-
'mongo/client/sasl_scramsha1_client_conversation.cpp',
114112
'mongo/client/update_write_operation.cpp',
115113
'mongo/client/wire_protocol_writer.cpp',
116114
'mongo/client/write_concern.cpp',
117115
'mongo/client/write_operation_base.cpp',
118116
'mongo/client/write_result.cpp',
119-
'mongo/crypto/mechanism_scram.cpp',
120117
'mongo/db/dbmessage.cpp',
121118
'mongo/db/json.cpp',
122119
'mongo/geo/coordinates2d.cpp',
@@ -159,14 +156,26 @@ clientSourceBasic = [
159156

160157
clientSourceTz = [] if (clientEnv['MONGO_HAVE_TIMEGM'] or windows) else ['third_party/tz/timegm.c']
161158

159+
clientSourceSSL = [
160+
'mongo/client/sasl_scramsha1_client_conversation.cpp',
161+
'mongo/crypto/crypto_openssl.cpp',
162+
'mongo/crypto/mechanism_scram.cpp',
163+
]
164+
162165
clientSourceSasl = [
163166
'mongo/client/cyrus_sasl_client_session.cpp',
167+
'mongo/client/native_sasl_client_session.cpp',
164168
'mongo/client/sasl_sspi.cpp',
165169
]
166170

167-
usingSasl = libEnv['MONGO_SASL']
168-
169171
clientSource = clientSourceBasic + clientSourceTz
172+
173+
usingSsl = libEnv['MONGO_SSL']
174+
if usingSsl:
175+
clientSource += clientSourceSSL
176+
177+
178+
usingSasl = libEnv['MONGO_SASL']
170179
if usingSasl:
171180
clientSource += clientSourceSasl
172181

src/mongo/SConscript

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,17 @@ unittests = [
5858
'platform/atomic_word_test',
5959
'platform/process_id_test',
6060
'platform/random_test',
61+
'util/mongoutils/str_test',
6162
'util/net/hostandport_test',
6263
'util/net/sock_test',
6364
'util/string_map_test',
6465
'util/stringutils_test',
6566
'util/time_support_test',
6667
]
6768

69+
if env['MONGO_SSL']:
70+
unittests += ['crypto/crypto_test']
71+
6872
gtestEnv = staticClientEnv.Clone()
6973
gtestEnv.PrependUnique(
7074
# On windows, we need this odd flag to make the linker
@@ -93,8 +97,11 @@ integration_tests = [
9397
'dbclient_test',
9498
'dbclient_writer_test',
9599
'gridfs_test',
96-
'sasl_test'
97100
]
101+
102+
if env['MONGO_SASL']:
103+
integration_tests += ['sasl_test']
104+
98105
integrationTestEnv = gtestEnv.Clone()
99106
integrationTestEnv.PrependUnique(
100107
LIBS=[

src/mongo/base/error_codes.err

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ error_code("IncompatibleAuditMetadata", 102)
105105
error_code("NewReplicaSetConfigurationIncompatible", 103)
106106
error_code("NodeNotElectable", 104)
107107
error_code("IncompatibleShardingMetadata", 105)
108+
error_code("DistributedClockSkewed", 106)
109+
error_code("LockFailed", 107)
110+
error_code("InconsistentReplicaSetNames", 108)
111+
error_code("ConfigurationInProgress", 109)
112+
error_code("CannotInitializeNodeWithData", 110)
113+
error_code("NotExactValueField", 111)
114+
error_code("DeadLock", 112)
108115

109116
# Non-sequential error codes (for compatibility only)
110117
error_code("NotMaster", 10107) #this comes from assert_util.h
@@ -117,6 +124,7 @@ error_code("BackgroundOperationInProgressForDatabase", 12586);
117124
error_code("BackgroundOperationInProgressForNamespace", 12587);
118125
error_code("NotMasterOrSecondaryCode", 13436);
119126
error_code("NotMasterNoSlaveOkCode", 13435);
127+
error_code("ShardKeyTooBig", 13334);
120128

121129
error_class("NetworkError", ["HostUnreachable", "HostNotFound", "NetworkTimeout"])
122130
error_class("Interruption", ["Interrupted", "InterruptedAtShutdown", "ExceededTimeLimit"])

src/mongo/bson/bson_validate_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16+
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
17+
1618
#include <boost/scoped_array.hpp>
1719

1820
#include "mongo/base/data_view.h"

src/mongo/bson/bsonelement.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16+
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
17+
1618
#include "mongo/bson/bsonelement.h"
1719

1820
#include "mongo/base/data_cursor.h"

src/mongo/bson/bsonobj.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16+
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
17+
1618
#include "mongo/db/jsobj.h"
1719

1820
#include "mongo/bson/bson_validate.h"

src/mongo/bson/bsonobjbuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* limitations under the License.
1414
*/
1515

16+
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
17+
1618
#include "mongo/db/jsobj.h"
1719

1820
#include <boost/lexical_cast.hpp>

src/mongo/bson/inline_decls.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,39 +33,3 @@
3333
#define PACKED_DECL
3434

3535
#endif
36-
37-
namespace mongo {
38-
39-
/* Note: do not clutter code with these -- ONLY use in hot spots / significant loops. */
40-
41-
#if !defined(__GNUC__)
42-
43-
// branch prediction. indicate we expect to be true
44-
# define MONGO_likely(x) ((bool)(x))
45-
46-
// branch prediction. indicate we expect to be false
47-
# define MONGO_unlikely(x) ((bool)(x))
48-
49-
# if defined(_WIN32)
50-
// prefetch data from memory
51-
inline void prefetch(const void *p) {
52-
#if defined(_MM_HINT_T0)
53-
_mm_prefetch((char *) p, _MM_HINT_T0);
54-
#endif
55-
}
56-
#else
57-
inline void prefetch(void *p) { }
58-
#endif
59-
60-
#else
61-
62-
# define MONGO_likely(x) ( __builtin_expect((bool)(x), 1) )
63-
# define MONGO_unlikely(x) ( __builtin_expect((bool)(x), 0) )
64-
65-
inline void prefetch(void *p) {
66-
__builtin_prefetch(p);
67-
}
68-
69-
#endif
70-
71-
}

src/mongo/bson/util/builder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "mongo/base/data_view.h"
3030
#include "mongo/base/string_data.h"
31+
#include "mongo/bson/inline_decls.h"
3132
#include "mongo/util/assert_util.h"
3233

3334
namespace mongo {

0 commit comments

Comments
 (0)