Skip to content

Commit a527c84

Browse files
committed
CXX-621 Backport server r3.0.4..r3.0.5 changes
Server SHAs cherry-picked (with modifications) into this commit: c0313e0 27d655f
1 parent 47f0003 commit a527c84

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

SConstruct

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ add_option("runtime-library-search-path",
197197
1, False)
198198

199199
add_option( "ssl" , "Enable SSL" , 0 , True )
200-
add_option( "ssl-fips-capability", "Enable the ability to activate FIPS 140-2 mode", 0, True );
201200

202201
# library choices
203202
add_option( "libc++", "use libc++ (experimental, requires clang)", 0, True )
@@ -930,8 +929,6 @@ if has_option( "ssl" ):
930929
else:
931930
env.Append( LIBS=["ssl"] )
932931
env.Append( LIBS=["crypto"] )
933-
if has_option("ssl-fips-capability"):
934-
env.Append( CPPDEFINES=["MONGO_SSL_FIPS"] )
935932
else:
936933
env["MONGO_SSL"] = False
937934

@@ -1806,6 +1803,41 @@ def doConfigure(myenv):
18061803
if conf.CheckDeclaration('strnlen', includes="#include <string.h>", language='C'):
18071804
conf.env['MONGO_HAVE_STRNLEN'] = True
18081805

1806+
def CheckLinkSSL(context):
1807+
test_body = """
1808+
#include <openssl/err.h>
1809+
#include <openssl/ssl.h>
1810+
#include <stdlib.h>
1811+
1812+
int main() {
1813+
SSL_library_init();
1814+
SSL_load_error_strings();
1815+
ERR_load_crypto_strings();
1816+
1817+
OpenSSL_add_all_algorithms();
1818+
ERR_free_strings();
1819+
return EXIT_SUCCESS;
1820+
}
1821+
"""
1822+
context.Message("Checking if OpenSSL is available...")
1823+
ret = context.TryLink(textwrap.dedent(test_body), ".c")
1824+
context.Result(ret)
1825+
return ret
1826+
conf.AddTest("CheckLinkSSL", CheckLinkSSL)
1827+
1828+
if has_option("ssl"):
1829+
if not conf.CheckLinkSSL():
1830+
print "SSL is enabled, but is unavailable"
1831+
Exit(1)
1832+
1833+
if conf.CheckDeclaration(
1834+
"FIPS_mode_set",
1835+
includes="""
1836+
#include <openssl/crypto.h>
1837+
#include <openssl/evp.h>
1838+
"""):
1839+
conf.env.Append(CPPDEFINES=['MONGO_HAVE_FIPS_MODE_SET'])
1840+
18091841
return conf.Finish()
18101842

18111843
env = doConfigure( env )

src/mongo/base/parse_number.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ namespace mongo {
181181
// Definition of the various supported implementations of parseNumberFromStringWithBase.
182182

183183
#define DEFINE_PARSE_NUMBER_FROM_STRING_WITH_BASE(NUMBER_TYPE) \
184-
template MONGO_COMPILER_API_EXPORT Status parseNumberFromStringWithBase<NUMBER_TYPE>(const StringData&, int, NUMBER_TYPE*);
184+
template MONGO_CLIENT_API Status MONGO_CLIENT_FUNC parseNumberFromStringWithBase<NUMBER_TYPE>(const StringData&, int, NUMBER_TYPE*);
185185

186186
DEFINE_PARSE_NUMBER_FROM_STRING_WITH_BASE(long)
187187
DEFINE_PARSE_NUMBER_FROM_STRING_WITH_BASE(long long)

src/mongo/util/net/ssl_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ namespace mongo {
540540
// Turn on FIPS mode if requested.
541541
// OPENSSL_FIPS must be defined by the OpenSSL headers, plus MONGO_SSL_FIPS
542542
// must be defined via a MongoDB build flag.
543-
#if defined(OPENSSL_FIPS) && defined(MONGO_SSL_FIPS)
543+
#if defined(MONGO_HAVE_FIPS_MODE_SET)
544544
int status = FIPS_mode_set(1);
545545
if (!status) {
546546
severe() << "can't activate FIPS mode: " <<

0 commit comments

Comments
 (0)