diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2018-11-26 18:22:38 -0500 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2018-12-17 12:59:30 -0500 |
commit | f805aa89667e12b16a3dd79d7a6167cace89246f (patch) | |
tree | 8440572aef526751d0902267ac77d5bd682e548e /src/mongo/util/icu.cpp | |
parent | c82cee47c3208a75f928ad3c87cc3db9a23b0f38 (diff) | |
download | mongo-f805aa89667e12b16a3dd79d7a6167cace89246f.tar.gz |
SERVER-37834 Implement RFC 4514 X509 DN parser
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 |