Exemple #1
0
char *
_mongoc_sasl_prep (const char *name,
                   const char *in_utf8,
                   int in_utf8_len,
                   bson_error_t *err)
{
#ifdef MONGOC_ENABLE_ICU
   return _mongoc_sasl_prep_impl (name, in_utf8, in_utf8_len, err);
#else
   fprintf (stderr, "sasl_prep is not enabled.");
   BSON_ASSERT (false);
#endif
}
char *
_mongoc_sasl_prep (const char *in_utf8, int in_utf8_len, bson_error_t *err)
{
#ifdef MONGOC_ENABLE_ICU
   return _mongoc_sasl_prep_impl ("password", in_utf8, in_utf8_len, err);
#else
   if (_mongoc_sasl_prep_required (in_utf8)) {
      bson_set_error (err,
                      MONGOC_ERROR_SCRAM,
                      MONGOC_ERROR_SCRAM_PROTOCOL_ERROR,
                      "SCRAM Failure: ICU required to SASLPrep password");
      return NULL;
   }
   return bson_strdup (in_utf8);
#endif
}