diff options
Diffstat (limited to 'Swiften/SASL/PLAINMessage.cpp')
| -rw-r--r-- | Swiften/SASL/PLAINMessage.cpp | 24 | 
1 files changed, 12 insertions, 12 deletions
| diff --git a/Swiften/SASL/PLAINMessage.cpp b/Swiften/SASL/PLAINMessage.cpp index 3728b39..20ffea7 100644 --- a/Swiften/SASL/PLAINMessage.cpp +++ b/Swiften/SASL/PLAINMessage.cpp @@ -4,41 +4,41 @@   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swiften/SASL/PLAINMessage.h" +#include <Swiften/SASL/PLAINMessage.h> +#include <Swiften/Base/Concat.h>  namespace Swift { -PLAINMessage::PLAINMessage(const std::string& authcid, const std::string& password, const std::string& authzid) : authcid(authcid), authzid(authzid), password(password) { +PLAINMessage::PLAINMessage(const std::string& authcid, const SafeByteArray& password, const std::string& authzid) : authcid(authcid), authzid(authzid), password(password) {  } -PLAINMessage::PLAINMessage(const ByteArray& value) { +PLAINMessage::PLAINMessage(const SafeByteArray& value) {  	size_t i = 0; -	while (i < value.getSize() && value[i] != '\0') { +	while (i < value.size() && value[i] != '\0') {  		authzid += value[i];  		++i;  	} -	if (i == value.getSize()) { +	if (i == value.size()) {  		return;  	}  	++i; -	while (i < value.getSize() && value[i] != '\0') { +	while (i < value.size() && value[i] != '\0') {  		authcid += value[i];  		++i;  	} -	if (i == value.getSize()) { +	if (i == value.size()) {  		authcid = "";  		return;  	}  	++i; -	while (i < value.getSize()) { -		password += value[i]; +	while (i < value.size()) { +		password.push_back(value[i]);  		++i;  	}  } -ByteArray PLAINMessage::getValue() const { -	std::string s = authzid + '\0' + authcid + '\0' + password; -	return ByteArray(s.c_str(), s.size()); +SafeByteArray PLAINMessage::getValue() const { +	return concat(createSafeByteArray(authzid), createSafeByteArray('\0'), createSafeByteArray(authcid), createSafeByteArray('\0'), password);  }  } | 
 Swift
 Swift