mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03:00
LibTLS: Move Strings when creating RelativeDistinguishedNames
Also cleans up the organizational_unit() helper to use `value_or({})` instead of doing the same thing manually.
This commit is contained in:
parent
f7329f89aa
commit
e1c663ba27
Notes:
sideshowbarker
2024-07-17 05:03:11 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/e1c663ba27 Pull-request: https://github.com/SerenityOS/serenity/pull/23403 Reviewed-by: https://github.com/ADKaster ✅
@ -285,7 +285,7 @@ static ErrorOr<RelativeDistinguishedName> parse_name(Crypto::ASN1::Decoder& deco
|
|||||||
|
|
||||||
auto attribute_type_string = TRY(String::join("."sv, attribute_type_oid));
|
auto attribute_type_string = TRY(String::join("."sv, attribute_type_oid));
|
||||||
auto attribute_value_string = TRY(String::from_utf8(attribute_value));
|
auto attribute_value_string = TRY(String::from_utf8(attribute_value));
|
||||||
TRY(rdn.set(attribute_type_string, attribute_value_string));
|
TRY(rdn.set(move(attribute_type_string), move(attribute_value_string)));
|
||||||
|
|
||||||
EXIT_SCOPE();
|
EXIT_SCOPE();
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ public:
|
|||||||
|
|
||||||
ErrorOr<AK::HashSetResult> set(String key, String value)
|
ErrorOr<AK::HashSetResult> set(String key, String value)
|
||||||
{
|
{
|
||||||
return m_members.try_set(key, value);
|
return m_members.try_set(move(key), move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<String> get(StringView key) const
|
Optional<String> get(StringView key) const
|
||||||
@ -223,14 +223,9 @@ public:
|
|||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
String organizational_unit()
|
String organizational_unit() const
|
||||||
{
|
{
|
||||||
auto entry = get(AttributeType::Ou);
|
return get(AttributeType::Ou).value_or({});
|
||||||
if (entry.has_value()) {
|
|
||||||
return entry.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
return String();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user