diff options
Diffstat (limited to 'Swiften/SASL')
-rw-r--r-- | Swiften/SASL/ClientAuthenticator.cpp | 2 | ||||
-rw-r--r-- | Swiften/SASL/ClientAuthenticator.h | 22 | ||||
-rw-r--r-- | Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp | 20 | ||||
-rw-r--r-- | Swiften/SASL/DIGESTMD5ClientAuthenticator.h | 8 | ||||
-rw-r--r-- | Swiften/SASL/DIGESTMD5Properties.cpp | 12 | ||||
-rw-r--r-- | Swiften/SASL/DIGESTMD5Properties.h | 10 | ||||
-rw-r--r-- | Swiften/SASL/PLAINMessage.cpp | 6 | ||||
-rw-r--r-- | Swiften/SASL/PLAINMessage.h | 16 | ||||
-rw-r--r-- | Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp | 36 | ||||
-rw-r--r-- | Swiften/SASL/SCRAMSHA1ClientAuthenticator.h | 8 | ||||
-rw-r--r-- | Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp | 4 | ||||
-rw-r--r-- | Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp | 8 | ||||
-rw-r--r-- | Swiften/SASL/UnitTest/PLAINMessageTest.cpp | 16 | ||||
-rw-r--r-- | Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp | 18 |
14 files changed, 93 insertions, 93 deletions
diff --git a/Swiften/SASL/ClientAuthenticator.cpp b/Swiften/SASL/ClientAuthenticator.cpp index 4eae2b4..533f172 100644 --- a/Swiften/SASL/ClientAuthenticator.cpp +++ b/Swiften/SASL/ClientAuthenticator.cpp @@ -8,7 +8,7 @@ namespace Swift { -ClientAuthenticator::ClientAuthenticator(const String& name) : name(name) { +ClientAuthenticator::ClientAuthenticator(const std::string& name) : name(name) { } ClientAuthenticator::~ClientAuthenticator() { diff --git a/Swiften/SASL/ClientAuthenticator.h b/Swiften/SASL/ClientAuthenticator.h index 718ccdc..33db75f 100644 --- a/Swiften/SASL/ClientAuthenticator.h +++ b/Swiften/SASL/ClientAuthenticator.h @@ -8,20 +8,20 @@ #include <boost/optional.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" namespace Swift { class ClientAuthenticator { public: - ClientAuthenticator(const String& name); + ClientAuthenticator(const std::string& name); virtual ~ClientAuthenticator(); - const String& getName() const { + const std::string& getName() const { return name; } - void setCredentials(const String& authcid, const String& password, const String& authzid = String()) { + void setCredentials(const std::string& authcid, const std::string& password, const std::string& authzid = std::string()) { this->authcid = authcid; this->password = password; this->authzid = authzid; @@ -30,22 +30,22 @@ namespace Swift { virtual boost::optional<ByteArray> getResponse() const = 0; virtual bool setChallenge(const boost::optional<ByteArray>&) = 0; - const String& getAuthenticationID() const { + const std::string& getAuthenticationID() const { return authcid; } - const String& getAuthorizationID() const { + const std::string& getAuthorizationID() const { return authzid; } - const String& getPassword() const { + const std::string& getPassword() const { return password; } private: - String name; - String authcid; - String password; - String authzid; + std::string name; + std::string authcid; + std::string password; + std::string authzid; }; } diff --git a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp index 050b73b..6892948 100644 --- a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp +++ b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp @@ -13,7 +13,7 @@ namespace Swift { -DIGESTMD5ClientAuthenticator::DIGESTMD5ClientAuthenticator(const String& host, const String& nonce) : ClientAuthenticator("DIGEST-MD5"), step(Initial), host(host), cnonce(nonce) { +DIGESTMD5ClientAuthenticator::DIGESTMD5ClientAuthenticator(const std::string& host, const std::string& nonce) : ClientAuthenticator("DIGEST-MD5"), step(Initial), host(host), cnonce(nonce) { } boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const { @@ -21,29 +21,29 @@ boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const { return boost::optional<ByteArray>(); } else if (step == Response) { - String realm; + std::string realm; if (challenge.getValue("realm")) { realm = *challenge.getValue("realm"); } - String qop = "auth"; - String digestURI = "xmpp/" + host; - String nc = "00000001"; + std::string qop = "auth"; + std::string digestURI = "xmpp/" + host; + std::string nc = "00000001"; // Compute the response value ByteArray A1 = MD5::getHash(getAuthenticationID() + ":" + realm + ":" + getPassword()) + ":" + *challenge.getValue("nonce") + ":" + cnonce; - if (!getAuthorizationID().isEmpty()) { + if (!getAuthorizationID().empty()) { A1 += ":" + getAuthenticationID(); } - String A2 = "AUTHENTICATE:" + digestURI; + std::string A2 = "AUTHENTICATE:" + digestURI; - String responseValue = Hexify::hexify(MD5::getHash( + std::string responseValue = Hexify::hexify(MD5::getHash( Hexify::hexify(MD5::getHash(A1)) + ":" + *challenge.getValue("nonce") + ":" + nc + ":" + cnonce + ":" + qop + ":" + Hexify::hexify(MD5::getHash(A2)))); DIGESTMD5Properties response; response.setValue("username", getAuthenticationID()); - if (!realm.isEmpty()) { + if (!realm.empty()) { response.setValue("realm", realm); } response.setValue("nonce", *challenge.getValue("nonce")); @@ -53,7 +53,7 @@ boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const { response.setValue("digest-uri", digestURI); response.setValue("charset", "utf-8"); response.setValue("response", responseValue); - if (!getAuthorizationID().isEmpty()) { + if (!getAuthorizationID().empty()) { response.setValue("authzid", getAuthorizationID()); } return response.serialize(); diff --git a/Swiften/SASL/DIGESTMD5ClientAuthenticator.h b/Swiften/SASL/DIGESTMD5ClientAuthenticator.h index 457bde9..50dd9aa 100644 --- a/Swiften/SASL/DIGESTMD5ClientAuthenticator.h +++ b/Swiften/SASL/DIGESTMD5ClientAuthenticator.h @@ -8,7 +8,7 @@ #include <map> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/SASL/ClientAuthenticator.h" #include "Swiften/SASL/DIGESTMD5Properties.h" @@ -16,7 +16,7 @@ namespace Swift { class DIGESTMD5ClientAuthenticator : public ClientAuthenticator { public: - DIGESTMD5ClientAuthenticator(const String& host, const String& nonce); + DIGESTMD5ClientAuthenticator(const std::string& host, const std::string& nonce); virtual boost::optional<ByteArray> getResponse() const; virtual bool setChallenge(const boost::optional<ByteArray>&); @@ -27,8 +27,8 @@ namespace Swift { Response, Final, } step; - String host; - String cnonce; + std::string host; + std::string cnonce; DIGESTMD5Properties challenge; }; } diff --git a/Swiften/SASL/DIGESTMD5Properties.cpp b/Swiften/SASL/DIGESTMD5Properties.cpp index 571602b..c7a2474 100644 --- a/Swiften/SASL/DIGESTMD5Properties.cpp +++ b/Swiften/SASL/DIGESTMD5Properties.cpp @@ -58,7 +58,7 @@ DIGESTMD5Properties DIGESTMD5Properties::parse(const ByteArray& data) { } else { if (c == ',' && !insideQuotes(currentValue)) { - String key = currentKey.toString(); + std::string key = currentKey.toString(); if (isQuoted(key)) { result.setValue(key, stripQuotes(currentValue).toString()); } @@ -76,7 +76,7 @@ DIGESTMD5Properties DIGESTMD5Properties::parse(const ByteArray& data) { } if (!currentKey.isEmpty()) { - String key = currentKey.toString(); + std::string key = currentKey.toString(); if (isQuoted(key)) { result.setValue(key, stripQuotes(currentValue).toString()); } @@ -106,21 +106,21 @@ ByteArray DIGESTMD5Properties::serialize() const { return result; } -boost::optional<String> DIGESTMD5Properties::getValue(const String& key) const { +boost::optional<std::string> DIGESTMD5Properties::getValue(const std::string& key) const { DIGESTMD5PropertiesMap::const_iterator i = properties.find(key); if (i != properties.end()) { return i->second.toString(); } else { - return boost::optional<String>(); + return boost::optional<std::string>(); } } -void DIGESTMD5Properties::setValue(const String& key, const String& value) { +void DIGESTMD5Properties::setValue(const std::string& key, const std::string& value) { properties.insert(DIGESTMD5PropertiesMap::value_type(key, ByteArray(value))); } -bool DIGESTMD5Properties::isQuoted(const String& p) { +bool DIGESTMD5Properties::isQuoted(const std::string& p) { return p == "authzid" || p == "cnonce" || p == "digest-uri" || p == "nonce" || p == "realm" || p == "username"; } diff --git a/Swiften/SASL/DIGESTMD5Properties.h b/Swiften/SASL/DIGESTMD5Properties.h index 3afd369..6e2e592 100644 --- a/Swiften/SASL/DIGESTMD5Properties.h +++ b/Swiften/SASL/DIGESTMD5Properties.h @@ -9,7 +9,7 @@ #include <map> #include <boost/optional.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" namespace Swift { @@ -17,19 +17,19 @@ namespace Swift { public: DIGESTMD5Properties(); - boost::optional<String> getValue(const String& key) const; + boost::optional<std::string> getValue(const std::string& key) const; - void setValue(const String& key, const String& value); + void setValue(const std::string& key, const std::string& value); ByteArray serialize() const; static DIGESTMD5Properties parse(const ByteArray&); private: - static bool isQuoted(const String& property); + static bool isQuoted(const std::string& property); private: - typedef std::multimap<String, ByteArray> DIGESTMD5PropertiesMap; + typedef std::multimap<std::string, ByteArray> DIGESTMD5PropertiesMap; DIGESTMD5PropertiesMap properties; }; } diff --git a/Swiften/SASL/PLAINMessage.cpp b/Swiften/SASL/PLAINMessage.cpp index c2621a3..3728b39 100644 --- a/Swiften/SASL/PLAINMessage.cpp +++ b/Swiften/SASL/PLAINMessage.cpp @@ -8,7 +8,7 @@ namespace Swift { -PLAINMessage::PLAINMessage(const String& authcid, const String& password, const String& authzid) : authcid(authcid), authzid(authzid), password(password) { +PLAINMessage::PLAINMessage(const std::string& authcid, const std::string& password, const std::string& authzid) : authcid(authcid), authzid(authzid), password(password) { } PLAINMessage::PLAINMessage(const ByteArray& value) { @@ -37,8 +37,8 @@ PLAINMessage::PLAINMessage(const ByteArray& value) { } ByteArray PLAINMessage::getValue() const { - String s = authzid + '\0' + authcid + '\0' + password; - return ByteArray(s.getUTF8Data(), s.getUTF8Size()); + std::string s = authzid + '\0' + authcid + '\0' + password; + return ByteArray(s.c_str(), s.size()); } } diff --git a/Swiften/SASL/PLAINMessage.h b/Swiften/SASL/PLAINMessage.h index 3624c6e..d08d70d 100644 --- a/Swiften/SASL/PLAINMessage.h +++ b/Swiften/SASL/PLAINMessage.h @@ -8,32 +8,32 @@ // #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" namespace Swift { class PLAINMessage { public: - PLAINMessage(const String& authcid, const String& password, const String& authzid = ""); + PLAINMessage(const std::string& authcid, const std::string& password, const std::string& authzid = ""); PLAINMessage(const ByteArray& value); ByteArray getValue() const; - const String& getAuthenticationID() const { + const std::string& getAuthenticationID() const { return authcid; } - const String& getPassword() const { + const std::string& getPassword() const { return password; } - const String& getAuthorizationID() const { + const std::string& getAuthorizationID() const { return authzid; } private: - String authcid; - String authzid; - String password; + std::string authcid; + std::string authzid; + std::string password; }; } diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp index b8c89c6..72d535a 100644 --- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp +++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp @@ -18,9 +18,9 @@ namespace Swift { -static String escape(const String& s) { - String result; - for (size_t i = 0; i < s.getUTF8Size(); ++i) { +static std::string escape(const std::string& s) { + std::string result; + for (size_t i = 0; i < s.size(); ++i) { if (s[i] == ',') { result += "=2C"; } @@ -35,7 +35,7 @@ static String escape(const String& s) { } -SCRAMSHA1ClientAuthenticator::SCRAMSHA1ClientAuthenticator(const String& nonce, bool useChannelBinding) : ClientAuthenticator(useChannelBinding ? "SCRAM-SHA-1-PLUS" : "SCRAM-SHA-1"), step(Initial), clientnonce(nonce), useChannelBinding(useChannelBinding) { +SCRAMSHA1ClientAuthenticator::SCRAMSHA1ClientAuthenticator(const std::string& nonce, bool useChannelBinding) : ClientAuthenticator(useChannelBinding ? "SCRAM-SHA-1-PLUS" : "SCRAM-SHA-1"), step(Initial), clientnonce(nonce), useChannelBinding(useChannelBinding) { } boost::optional<ByteArray> SCRAMSHA1ClientAuthenticator::getResponse() const { @@ -65,26 +65,26 @@ bool SCRAMSHA1ClientAuthenticator::setChallenge(const boost::optional<ByteArray> } initialServerMessage = *challenge; - std::map<char, String> keys = parseMap(String(initialServerMessage.getData(), initialServerMessage.getSize())); + std::map<char, std::string> keys = parseMap(std::string(initialServerMessage.getData(), initialServerMessage.getSize())); // Extract the salt ByteArray salt = Base64::decode(keys['s']); // Extract the server nonce - String clientServerNonce = keys['r']; - if (clientServerNonce.getUTF8Size() <= clientnonce.getUTF8Size()) { + std::string clientServerNonce = keys['r']; + if (clientServerNonce.size() <= clientnonce.size()) { return false; } - String receivedClientNonce = clientServerNonce.getSubstring(0, clientnonce.getUTF8Size()); + std::string receivedClientNonce = clientServerNonce.substr(0, clientnonce.size()); if (receivedClientNonce != clientnonce) { return false; } - serverNonce = clientServerNonce.getSubstring(clientnonce.getUTF8Size(), clientServerNonce.npos()); + serverNonce = clientServerNonce.substr(clientnonce.size(), clientServerNonce.npos); // Extract the number of iterations int iterations = 0; try { - iterations = boost::lexical_cast<int>(keys['i'].getUTF8String()); + iterations = boost::lexical_cast<int>(keys['i']); } catch (const boost::bad_lexical_cast&) { return false; @@ -117,14 +117,14 @@ bool SCRAMSHA1ClientAuthenticator::setChallenge(const boost::optional<ByteArray> } } -std::map<char, String> SCRAMSHA1ClientAuthenticator::parseMap(const String& s) { - std::map<char, String> result; - if (s.getUTF8Size() > 0) { +std::map<char, std::string> SCRAMSHA1ClientAuthenticator::parseMap(const std::string& s) { + std::map<char, std::string> result; + if (s.size() > 0) { char key = 0; - String value; + std::string value; size_t i = 0; bool expectKey = true; - while (i < s.getUTF8Size()) { + while (i < s.size()) { if (expectKey) { key = s[i]; expectKey = false; @@ -146,8 +146,8 @@ std::map<char, String> SCRAMSHA1ClientAuthenticator::parseMap(const String& s) { } ByteArray SCRAMSHA1ClientAuthenticator::getInitialBareClientMessage() const { - String authenticationID = StringPrep::getPrepared(getAuthenticationID(), StringPrep::SASLPrep); - return ByteArray(String("n=" + escape(authenticationID) + ",r=" + clientnonce)); + std::string authenticationID = StringPrep::getPrepared(getAuthenticationID(), StringPrep::SASLPrep); + return ByteArray(std::string("n=" + escape(authenticationID) + ",r=" + clientnonce)); } ByteArray SCRAMSHA1ClientAuthenticator::getGS2Header() const { @@ -160,7 +160,7 @@ ByteArray SCRAMSHA1ClientAuthenticator::getGS2Header() const { channelBindingHeader = ByteArray("y"); } } - return channelBindingHeader + ByteArray(",") + (getAuthorizationID().isEmpty() ? "" : "a=" + escape(getAuthorizationID())) + ","; + return channelBindingHeader + ByteArray(",") + (getAuthorizationID().empty() ? "" : "a=" + escape(getAuthorizationID())) + ","; } void SCRAMSHA1ClientAuthenticator::setTLSChannelBindingData(const ByteArray& channelBindingData) { diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h index 2cf3cc7..602fc94 100644 --- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h +++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h @@ -9,14 +9,14 @@ #include <map> #include <boost/optional.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/SASL/ClientAuthenticator.h" namespace Swift { class SCRAMSHA1ClientAuthenticator : public ClientAuthenticator { public: - SCRAMSHA1ClientAuthenticator(const String& nonce, bool useChannelBinding = false); + SCRAMSHA1ClientAuthenticator(const std::string& nonce, bool useChannelBinding = false); void setTLSChannelBindingData(const ByteArray& channelBindingData); @@ -28,7 +28,7 @@ namespace Swift { ByteArray getGS2Header() const; ByteArray getFinalMessageWithoutProof() const; - static std::map<char, String> parseMap(const String&); + static std::map<char, std::string> parseMap(const std::string&); private: enum Step { @@ -36,7 +36,7 @@ namespace Swift { Proof, Final } step; - String clientnonce; + std::string clientnonce; ByteArray initialServerMessage; ByteArray serverNonce; ByteArray authMessage; diff --git a/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp index 72c2b64..54f0571 100644 --- a/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp +++ b/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp @@ -38,7 +38,7 @@ class DIGESTMD5ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("charset=utf-8,cnonce=\"abcdefgh\",digest-uri=\"xmpp/xmpp.example.com\",nc=00000001,nonce=\"O6skKPuaCZEny3hteI19qXMBXSadoWs840MchORo\",qop=auth,realm=\"example.com\",response=088891c800ecff1b842159ad6459104a,username=\"user\""), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("charset=utf-8,cnonce=\"abcdefgh\",digest-uri=\"xmpp/xmpp.example.com\",nc=00000001,nonce=\"O6skKPuaCZEny3hteI19qXMBXSadoWs840MchORo\",qop=auth,realm=\"example.com\",response=088891c800ecff1b842159ad6459104a,username=\"user\""), response.toString()); } void testGetResponse_WithAuthorizationID() { @@ -52,7 +52,7 @@ class DIGESTMD5ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("authzid=\"myauthzid\",charset=utf-8,cnonce=\"abcdefgh\",digest-uri=\"xmpp/xmpp.example.com\",nc=00000001,nonce=\"O6skKPuaCZEny3hteI19qXMBXSadoWs840MchORo\",qop=auth,realm=\"example.com\",response=4293834432b6e7889a2dee7e8fe7dd06,username=\"user\""), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("authzid=\"myauthzid\",charset=utf-8,cnonce=\"abcdefgh\",digest-uri=\"xmpp/xmpp.example.com\",nc=00000001,nonce=\"O6skKPuaCZEny3hteI19qXMBXSadoWs840MchORo\",qop=auth,realm=\"example.com\",response=4293834432b6e7889a2dee7e8fe7dd06,username=\"user\""), response.toString()); } }; diff --git a/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp b/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp index 1b2c121..152a41e 100644 --- a/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp +++ b/Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp @@ -24,13 +24,13 @@ class DIGESTMD5PropertiesTest : public CppUnit::TestFixture { "algorithm=md5-sess,charset=utf-8")); CPPUNIT_ASSERT(properties.getValue("realm")); - CPPUNIT_ASSERT_EQUAL(String("myrealm1"), *properties.getValue("realm")); + CPPUNIT_ASSERT_EQUAL(std::string("myrealm1"), *properties.getValue("realm")); CPPUNIT_ASSERT(properties.getValue("nonce")); - CPPUNIT_ASSERT_EQUAL(String("mynonce"), *properties.getValue("nonce")); + CPPUNIT_ASSERT_EQUAL(std::string("mynonce"), *properties.getValue("nonce")); CPPUNIT_ASSERT(properties.getValue("algorithm")); - CPPUNIT_ASSERT_EQUAL(String("md5-sess"), *properties.getValue("algorithm")); + CPPUNIT_ASSERT_EQUAL(std::string("md5-sess"), *properties.getValue("algorithm")); CPPUNIT_ASSERT(properties.getValue("charset")); - CPPUNIT_ASSERT_EQUAL(String("utf-8"), *properties.getValue("charset")); + CPPUNIT_ASSERT_EQUAL(std::string("utf-8"), *properties.getValue("charset")); } void testSerialize() { diff --git a/Swiften/SASL/UnitTest/PLAINMessageTest.cpp b/Swiften/SASL/UnitTest/PLAINMessageTest.cpp index 142d09e..d517f0d 100644 --- a/Swiften/SASL/UnitTest/PLAINMessageTest.cpp +++ b/Swiften/SASL/UnitTest/PLAINMessageTest.cpp @@ -40,29 +40,29 @@ class PLAINMessageTest : public CppUnit::TestFixture void testConstructor_WithoutAuthzID() { PLAINMessage message(ByteArray("\0user\0pass", 10)); - CPPUNIT_ASSERT_EQUAL(String(""), message.getAuthorizationID()); - CPPUNIT_ASSERT_EQUAL(String("user"), message.getAuthenticationID()); - CPPUNIT_ASSERT_EQUAL(String("pass"), message.getPassword()); + CPPUNIT_ASSERT_EQUAL(std::string(""), message.getAuthorizationID()); + CPPUNIT_ASSERT_EQUAL(std::string("user"), message.getAuthenticationID()); + CPPUNIT_ASSERT_EQUAL(std::string("pass"), message.getPassword()); } void testConstructor_WithAuthzID() { PLAINMessage message(ByteArray("authz\0user\0pass", 15)); - CPPUNIT_ASSERT_EQUAL(String("authz"), message.getAuthorizationID()); - CPPUNIT_ASSERT_EQUAL(String("user"), message.getAuthenticationID()); - CPPUNIT_ASSERT_EQUAL(String("pass"), message.getPassword()); + CPPUNIT_ASSERT_EQUAL(std::string("authz"), message.getAuthorizationID()); + CPPUNIT_ASSERT_EQUAL(std::string("user"), message.getAuthenticationID()); + CPPUNIT_ASSERT_EQUAL(std::string("pass"), message.getPassword()); } void testConstructor_NoAuthcid() { PLAINMessage message(ByteArray("authzid", 7)); - CPPUNIT_ASSERT_EQUAL(String(""), message.getAuthenticationID()); + CPPUNIT_ASSERT_EQUAL(std::string(""), message.getAuthenticationID()); } void testConstructor_NoPassword() { PLAINMessage message(ByteArray("authzid\0authcid", 15)); - CPPUNIT_ASSERT_EQUAL(String(""), message.getAuthenticationID()); + CPPUNIT_ASSERT_EQUAL(std::string(""), message.getAuthenticationID()); } }; diff --git a/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp index 0e42f38..5d0edbd 100644 --- a/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp +++ b/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp @@ -45,7 +45,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("n,,n=user,r=abcdefghABCDEFGH"), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("n,,n=user,r=abcdefghABCDEFGH"), response.toString()); } void testGetInitialResponse_UsernameHasSpecialChars() { @@ -54,7 +54,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("n,,n==2Cus=3D=2Cer=3D,r=abcdefghABCDEFGH"), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("n,,n==2Cus=3D=2Cer=3D,r=abcdefghABCDEFGH"), response.toString()); } void testGetInitialResponse_WithAuthorizationID() { @@ -63,7 +63,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("n,a=auth,n=user,r=abcdefghABCDEFGH"), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("n,a=auth,n=user,r=abcdefghABCDEFGH"), response.toString()); } void testGetInitialResponse_WithAuthorizationIDWithSpecialChars() { @@ -72,7 +72,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("n,a=a=3Du=2Cth,n=user,r=abcdefghABCDEFGH"), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("n,a=a=3Du=2Cth,n=user,r=abcdefghABCDEFGH"), response.toString()); } void testGetInitialResponse_WithoutChannelBindingWithTLSChannelBindingData() { @@ -82,7 +82,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("y,,n=user,r=abcdefghABCDEFGH"), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("y,,n=user,r=abcdefghABCDEFGH"), response.toString()); } void testGetInitialResponse_WithChannelBindingWithTLSChannelBindingData() { @@ -92,7 +92,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("p=tls-unique,,n=user,r=abcdefghABCDEFGH"), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("p=tls-unique,,n=user,r=abcdefghABCDEFGH"), response.toString()); } void testGetFinalResponse() { @@ -102,7 +102,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("c=biws,r=abcdefghABCDEFGH,p=CZbjGDpIteIJwQNBgO0P8pKkMGY="), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("c=biws,r=abcdefghABCDEFGH,p=CZbjGDpIteIJwQNBgO0P8pKkMGY="), response.toString()); } void testGetFinalResponse_WithoutChannelBindingWithTLSChannelBindingData() { @@ -113,7 +113,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("c=eSws,r=abcdefghABCDEFGH,p=JNpsiFEcxZvNZ1+FFBBqrYvYxMk="), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("c=eSws,r=abcdefghABCDEFGH,p=JNpsiFEcxZvNZ1+FFBBqrYvYxMk="), response.toString()); } void testGetFinalResponse_WithChannelBindingWithTLSChannelBindingData() { @@ -124,7 +124,7 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { ByteArray response = *testling.getResponse(); - CPPUNIT_ASSERT_EQUAL(String("c=cD10bHMtdW5pcXVlLCx4eXph,r=abcdefghABCDEFGH,p=i6Rghite81P1ype8XxaVAa5l7v0="), response.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("c=cD10bHMtdW5pcXVlLCx4eXph,r=abcdefghABCDEFGH,p=i6Rghite81P1ype8XxaVAa5l7v0="), response.toString()); } void testSetFinalChallenge() { |