aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-02 22:07:57 -0400
committerJack Lloyd <[email protected]>2017-10-02 22:45:20 -0400
commit34868d4c4b91227db472aa294dfeb6d9075ec056 (patch)
tree6e43fb977b89de43de246c52d18eeb1442081018 /src
parent40ec27f8a12e18e7eb17df4ff5874f3bb66987c5 (diff)
Make kv in TLS_Text_Policy private, add protected setter
Diffstat (limited to 'src')
-rw-r--r--src/lib/tls/tls_policy.h3
-rw-r--r--src/lib/tls/tls_text_policy.cpp11
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/tls/tls_policy.h b/src/lib/tls/tls_policy.h
index 463f1c6d6..333cf0ee1 100644
--- a/src/lib/tls/tls_policy.h
+++ b/src/lib/tls/tls_policy.h
@@ -519,6 +519,9 @@ class BOTAN_PUBLIC_API(2,0) Text_Policy : public Policy
std::string get_str(const std::string& key, const std::string& def = "") const;
+ bool set_value(const std::string& key, const std::string& val, bool overwrite);
+
+ private:
std::map<std::string, std::string> m_kv;
};
diff --git a/src/lib/tls/tls_text_policy.cpp b/src/lib/tls/tls_text_policy.cpp
index 6b3b5af1d..ef5799339 100644
--- a/src/lib/tls/tls_text_policy.cpp
+++ b/src/lib/tls/tls_text_policy.cpp
@@ -252,6 +252,17 @@ std::string Text_Policy::get_str(const std::string& key, const std::string& def)
return i->second;
}
+bool Text_Policy::set_value(const std::string& key, const std::string& val, bool overwrite)
+ {
+ auto i = m_kv.find(key);
+
+ if(overwrite == false && i != m_kv.end())
+ return false;
+
+ m_kv.insert(i, std::make_pair(key, val));
+ return true;
+ }
+
}
}