diff options
Diffstat (limited to 'src/mongo/util/icu.cpp')
-rw-r--r-- | src/mongo/util/icu.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/util/icu.cpp b/src/mongo/util/icu.cpp index 4b9d797a5f5..9825da56fde 100644 --- a/src/mongo/util/icu.cpp +++ b/src/mongo/util/icu.cpp @@ -172,11 +172,18 @@ private: }; } // namespace -} // namespace mongo -mongo::StatusWith<std::string> mongo::saslPrep(StringData str, UStringPrepOptions options) try { +StatusWith<std::string> icuSaslPrep(StringData str, UStringPrepOptions options) try { const auto opts = (options == kUStringPrepDefault) ? USPREP_DEFAULT : USPREP_ALLOW_UNASSIGNED; return USPrep(USPREP_RFC4013_SASLPREP).prepare(UString::fromUTF8(str), opts).toUTF8(); } catch (const DBException& e) { return e.toStatus(); } + +StatusWith<std::string> icuX509DNPrep(StringData str) try { + return USPrep(USPREP_RFC4518_LDAP).prepare(UString::fromUTF8(str), USPREP_DEFAULT).toUTF8(); +} catch (const DBException& e) { + return e.toStatus(); +} + +} // namespace mongo |