summaryrefslogtreecommitdiff
path: root/src/mongo/client/sasl_client_session.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2013-07-26 13:15:36 -0400
committerEric Milkie <milkie@10gen.com>2013-08-28 15:07:17 -0400
commit3c3ec0774e5d1a8eca63fb4d052c86ea6d2c9d8a (patch)
treef259ee34db18a76815af2f2e7dea615ff84e8189 /src/mongo/client/sasl_client_session.cpp
parentc0e30cdd562359d5f3c9afd78bf77fe35cc439d4 (diff)
downloadmongo-3c3ec0774e5d1a8eca63fb4d052c86ea6d2c9d8a.tar.gz
SERVER-10156 Add a logging callback that does nothing, for the client
This is necessary because on Linux, the default callback goes to syslog, which we don't want, and on Windows, the callback is missing and thus it obscures any real errors with a "callback is missing" message.
Diffstat (limited to 'src/mongo/client/sasl_client_session.cpp')
-rw-r--r--src/mongo/client/sasl_client_session.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/client/sasl_client_session.cpp b/src/mongo/client/sasl_client_session.cpp
index 8a8c1d34ba1..de841d27461 100644
--- a/src/mongo/client/sasl_client_session.cpp
+++ b/src/mongo/client/sasl_client_session.cpp
@@ -36,6 +36,8 @@ namespace {
typedef unsigned long SaslAllocSize;
#endif
+ typedef int(*SaslCallbackFn)();
+
void* saslOurMalloc(SaslAllocSize sz) {
return ourmalloc(sz);
}
@@ -90,6 +92,10 @@ namespace {
return Status::OK();
}
+ int saslClientLogSwallow(void *context, int priority, const char *message) {
+ return SASL_OK; // do nothing
+ }
+
/**
* Initializes the client half of the SASL library, but is effectively a no-op if the client
* application has already done it.
@@ -104,7 +110,9 @@ namespace {
MONGO_INITIALIZER_WITH_PREREQUISITES(SaslClientContext, ("CyrusSaslAllocatorsAndMutexes"))(
InitializerContext* context) {
- static sasl_callback_t saslClientGlobalCallbacks[] = { { SASL_CB_LIST_END } };
+ static sasl_callback_t saslClientGlobalCallbacks[] =
+ { { SASL_CB_LOG, SaslCallbackFn(saslClientLogSwallow), NULL /* context */ },
+ { SASL_CB_LIST_END } };
// If the client application has previously called sasl_client_init(), the callbacks passed
// in here are ignored.
@@ -185,8 +193,6 @@ namespace {
_step(0),
_done(false) {
- typedef int(*SaslCallbackFn)();
-
const sasl_callback_t callbackTemplate[maxCallbacks] = {
{ SASL_CB_AUTHNAME, SaslCallbackFn(saslClientGetSimple), this },
{ SASL_CB_USER, SaslCallbackFn(saslClientGetSimple), this },