diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-05-18 13:45:41 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-05-18 14:24:28 (GMT) |
commit | 23fa0f462ddd0c686c677bfe5d4d743621432b7e (patch) | |
tree | b8f0ea1860640f89eafba2460cc5d45bf28fc77c /Swiften/Elements | |
parent | 2456a8b12163b3249b6b9164b601c36772eb05a1 (diff) | |
download | swift-contrib-23fa0f462ddd0c686c677bfe5d4d743621432b7e.zip swift-contrib-23fa0f462ddd0c686c677bfe5d4d743621432b7e.tar.bz2 |
Introduce safe containers for storing passwords.
Diffstat (limited to 'Swiften/Elements')
-rw-r--r-- | Swiften/Elements/AuthRequest.h | 13 | ||||
-rw-r--r-- | Swiften/Elements/AuthResponse.h | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h index 5e4e4ab..bfc86c2 100644 --- a/Swiften/Elements/AuthRequest.h +++ b/Swiften/Elements/AuthRequest.h @@ -11,6 +11,7 @@ #include <boost/optional.hpp> #include <Swiften/Elements/Element.h> +#include <Swiften/Base/SafeByteArray.h> namespace Swift { class AuthRequest : public Element { @@ -18,20 +19,20 @@ namespace Swift { AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) { } - AuthRequest(const std::string& mechanism, const std::vector<unsigned char>& message) : + AuthRequest(const std::string& mechanism, const SafeByteArray& message) : mechanism_(mechanism), message_(message) { } - AuthRequest(const std::string& mechanism, const boost::optional<std::vector<unsigned char> >& message) : + AuthRequest(const std::string& mechanism, const boost::optional<SafeByteArray>& message) : mechanism_(mechanism), message_(message) { } - const boost::optional<std::vector<unsigned char> >& getMessage() const { + const boost::optional<SafeByteArray>& getMessage() const { return message_; } - void setMessage(const std::vector<unsigned char>& message) { - message_ = boost::optional<std::vector<unsigned char> >(message); + void setMessage(const SafeByteArray& message) { + message_ = boost::optional<SafeByteArray>(message); } const std::string& getMechanism() const { @@ -44,6 +45,6 @@ namespace Swift { private: std::string mechanism_; - boost::optional<std::vector<unsigned char> > message_; + boost::optional<SafeByteArray> message_; }; } diff --git a/Swiften/Elements/AuthResponse.h b/Swiften/Elements/AuthResponse.h index a616005..db2dcea 100644 --- a/Swiften/Elements/AuthResponse.h +++ b/Swiften/Elements/AuthResponse.h @@ -10,6 +10,7 @@ #include <boost/optional.hpp> #include <Swiften/Elements/Element.h> +#include <Swiften/Base/SafeByteArray.h> namespace Swift { class AuthResponse : public Element { @@ -17,21 +18,21 @@ namespace Swift { AuthResponse() { } - AuthResponse(const std::vector<unsigned char>& value) : value(value) { + AuthResponse(const SafeByteArray& value) : value(value) { } - AuthResponse(const boost::optional<std::vector<unsigned char> >& value) : value(value) { + AuthResponse(const boost::optional<SafeByteArray>& value) : value(value) { } - const boost::optional<std::vector<unsigned char> >& getValue() const { + const boost::optional<SafeByteArray>& getValue() const { return value; } - void setValue(const std::vector<unsigned char>& value) { - this->value = boost::optional<std::vector<unsigned char> >(value); + void setValue(const SafeByteArray& value) { + this->value = boost::optional<SafeByteArray>(value); } private: - boost::optional<std::vector<unsigned char> > value; + boost::optional<SafeByteArray> value; }; } |