#include <sys_defs.h>
#include <msg.h>
#include <xsasl_cyrus_common.h>
#if defined(USE_SASL_AUTH) && defined(USE_CYRUS_SASL)
#include <sasl.h>
#include <saslutil.h>
int xsasl_cyrus_log(void *unused_context, int priority,
const char *message)
{
switch (priority) {
case SASL_LOG_ERR:
#ifdef SASL_LOG_WARN
case SASL_LOG_WARN:
#endif
#ifdef SASL_LOG_WARNING
case SASL_LOG_WARNING:
#endif
msg_warn("SASL authentication problem: %s", message);
break;
#ifdef SASL_LOG_INFO
case SASL_LOG_INFO:
if (msg_verbose)
msg_info("SASL authentication info: %s", message);
break;
#endif
#ifdef SASL_LOG_NOTE
case SASL_LOG_NOTE:
if (msg_verbose)
msg_info("SASL authentication info: %s", message);
break;
#endif
#ifdef SASL_LOG_FAIL
case SASL_LOG_FAIL:
msg_warn("SASL authentication failure: %s", message);
break;
#endif
#ifdef SASL_LOG_DEBUG
case SASL_LOG_DEBUG:
if (msg_verbose > 1)
msg_info("SASL authentication debug: %s", message);
break;
#endif
#ifdef SASL_LOG_TRACE
case SASL_LOG_TRACE:
if (msg_verbose > 1)
msg_info("SASL authentication trace: %s", message);
break;
#endif
#ifdef SASL_LOG_PASS
case SASL_LOG_PASS:
if (msg_verbose > 1)
msg_info("SASL authentication pass: %s", message);
break;
#endif
}
return (SASL_OK);
}
#endif