diff options
author | Eric Milkie <milkie@10gen.com> | 2013-09-16 14:21:27 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2013-09-16 14:21:36 -0400 |
commit | dd0114c4085d488469d595c07af66e89a5a0626c (patch) | |
tree | 2617d09c4cbd655b749d41b91c24735a791720db /src/mongo/client/sasl_sspi.cpp | |
parent | 007a551ccffa23908c5dfb1c7291281916f2371a (diff) | |
download | mongo-dd0114c4085d488469d595c07af66e89a5a0626c.tar.gz |
SERVER-10156 initialize CRAMMD5 and PLAIN client plugins using MONGO_INITIALIZER
Diffstat (limited to 'src/mongo/client/sasl_sspi.cpp')
-rw-r--r-- | src/mongo/client/sasl_sspi.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mongo/client/sasl_sspi.cpp b/src/mongo/client/sasl_sspi.cpp index 9aace66be6c..d3391f1f9db 100644 --- a/src/mongo/client/sasl_sspi.cpp +++ b/src/mongo/client/sasl_sspi.cpp @@ -31,6 +31,18 @@ #include "mongo/util/scopeguard.h" #include "mongo/util/text.h" +extern "C" int plain_client_plug_init(const sasl_utils_t *utils, + int maxversion, + int *out_version, + sasl_client_plug_t **pluglist, + int *plugcount); + +extern "C" int crammd5_client_plug_init(const sasl_utils_t *utils, + int maxversion, + int *out_version, + sasl_client_plug_t **pluglist, + int *plugcount); + namespace mongo { namespace { /* @@ -495,6 +507,35 @@ namespace { return Status::OK(); } + MONGO_INITIALIZER_WITH_PREREQUISITES(SaslCramClientPlugin, + ("CyrusSaslAllocatorsAndMutexes", + "SaslClientContext")) + (InitializerContext*) { + int ret = sasl_client_add_plugin("CRAMMD5", + crammd5_client_plug_init); + if (SASL_OK != ret) { + return Status(ErrorCodes::UnknownError, + mongoutils::str::stream() << "Could not add SASL Client CRAM-MD5 plugin " + << sspiPluginName << ": " << sasl_errstring(ret, NULL, NULL)); + } + + return Status::OK(); + } + + MONGO_INITIALIZER_WITH_PREREQUISITES(SaslPlainClientPlugin, + ("CyrusSaslAllocatorsAndMutexes", + "SaslClientContext")) + (InitializerContext*) { + int ret = sasl_client_add_plugin("PLAIN", + plain_client_plug_init); + if (SASL_OK != ret) { + return Status(ErrorCodes::UnknownError, + mongoutils::str::stream() << "Could not add SASL Client PLAIN plugin " + << sspiPluginName << ": " << sasl_errstring(ret, NULL, NULL)); + } + + return Status::OK(); + } } // namespace } // namespace mongo |