diff options
Diffstat (limited to 'Swiften/Server')
-rw-r--r-- | Swiften/Server/ServerFromClientSession.cpp | 28 | ||||
-rw-r--r-- | Swiften/Server/ServerFromClientSession.h | 10 | ||||
-rw-r--r-- | Swiften/Server/ServerSession.cpp | 2 | ||||
-rw-r--r-- | Swiften/Server/ServerSession.h | 2 | ||||
-rw-r--r-- | Swiften/Server/ServerStanzaRouter.cpp | 7 | ||||
-rw-r--r-- | Swiften/Server/ServerStanzaRouter.h | 4 | ||||
-rw-r--r-- | Swiften/Server/SimpleUserRegistry.cpp | 8 | ||||
-rw-r--r-- | Swiften/Server/SimpleUserRegistry.h | 8 | ||||
-rw-r--r-- | Swiften/Server/UnitTest/ServerStanzaRouterTest.cpp | 6 | ||||
-rw-r--r-- | Swiften/Server/UserRegistry.cpp | 2 | ||||
-rw-r--r-- | Swiften/Server/UserRegistry.h | 4 |
11 files changed, 41 insertions, 40 deletions
diff --git a/Swiften/Server/ServerFromClientSession.cpp b/Swiften/Server/ServerFromClientSession.cpp index 18da7e8..dbe9745 100644 --- a/Swiften/Server/ServerFromClientSession.cpp +++ b/Swiften/Server/ServerFromClientSession.cpp @@ -4,22 +4,22 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Server/ServerFromClientSession.h" +#include <Swiften/Server/ServerFromClientSession.h> #include <boost/bind.hpp> -#include "Swiften/Elements/ProtocolHeader.h" -#include "Swiften/Server/UserRegistry.h" -#include "Swiften/Network/Connection.h" -#include "Swiften/StreamStack/XMPPLayer.h" -#include "Swiften/Elements/StreamFeatures.h" -#include "Swiften/Elements/ResourceBind.h" -#include "Swiften/Elements/StartSession.h" -#include "Swiften/Elements/IQ.h" -#include "Swiften/Elements/AuthSuccess.h" -#include "Swiften/Elements/AuthFailure.h" -#include "Swiften/Elements/AuthRequest.h" -#include "Swiften/SASL/PLAINMessage.h" +#include <Swiften/Elements/ProtocolHeader.h> +#include <Swiften/Server/UserRegistry.h> +#include <Swiften/Network/Connection.h> +#include <Swiften/StreamStack/XMPPLayer.h> +#include <Swiften/Elements/StreamFeatures.h> +#include <Swiften/Elements/ResourceBind.h> +#include <Swiften/Elements/StartSession.h> +#include <Swiften/Elements/IQ.h> +#include <Swiften/Elements/AuthSuccess.h> +#include <Swiften/Elements/AuthFailure.h> +#include <Swiften/Elements/AuthRequest.h> +#include <Swiften/SASL/PLAINMessage.h> namespace Swift { @@ -51,7 +51,7 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) getXMPPLayer()->resetParser(); } else { - PLAINMessage plainMessage(authRequest->getMessage() ? *authRequest->getMessage() : ""); + PLAINMessage plainMessage(authRequest->getMessage() ? *authRequest->getMessage() : createSafeByteArray("")); if (userRegistry_->isValidUserPassword(JID(plainMessage.getAuthenticationID(), getLocalJID().getDomain()), plainMessage.getPassword())) { getXMPPLayer()->writeElement(boost::shared_ptr<AuthSuccess>(new AuthSuccess())); user_ = plainMessage.getAuthenticationID(); diff --git a/Swiften/Server/ServerFromClientSession.h b/Swiften/Server/ServerFromClientSession.h index 80ef063..1a0e109 100644 --- a/Swiften/Server/ServerFromClientSession.h +++ b/Swiften/Server/ServerFromClientSession.h @@ -7,13 +7,14 @@ #pragma once #include <boost/shared_ptr.hpp> -#include "Swiften/Base/boost_bsignals.h" +#include <Swiften/Base/boost_bsignals.h> #include <boost/enable_shared_from_this.hpp> #include <string> -#include "Swiften/Session/Session.h" -#include "Swiften/JID/JID.h" -#include "Swiften/Network/Connection.h" +#include <Swiften/Session/Session.h> +#include <Swiften/JID/JID.h> +#include <Swiften/Network/Connection.h> +#include <Swiften/Base/ByteArray.h> namespace Swift { class ProtocolHeader; @@ -26,7 +27,6 @@ namespace Swift { class XMPPLayer; class ConnectionLayer; class Connection; - class ByteArray; class ServerFromClientSession : public Session { public: diff --git a/Swiften/Server/ServerSession.cpp b/Swiften/Server/ServerSession.cpp index 10d642d..eb031f2 100644 --- a/Swiften/Server/ServerSession.cpp +++ b/Swiften/Server/ServerSession.cpp @@ -4,7 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Server/ServerSession.h" +#include <Swiften/Server/ServerSession.h> namespace Swift { diff --git a/Swiften/Server/ServerSession.h b/Swiften/Server/ServerSession.h index bd4ab6d..486ebaa 100644 --- a/Swiften/Server/ServerSession.h +++ b/Swiften/Server/ServerSession.h @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Elements/Stanza.h" +#include <Swiften/Elements/Stanza.h> namespace Swift { class ServerSession { diff --git a/Swiften/Server/ServerStanzaRouter.cpp b/Swiften/Server/ServerStanzaRouter.cpp index b4d230a..1725359 100644 --- a/Swiften/Server/ServerStanzaRouter.cpp +++ b/Swiften/Server/ServerStanzaRouter.cpp @@ -4,8 +4,9 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Server/ServerStanzaRouter.h" -#include "Swiften/Server/ServerSession.h" +#include <Swiften/Server/ServerStanzaRouter.h> +#include <Swiften/Server/ServerSession.h> +#include <Swiften/Base/Algorithm.h> #include <cassert> #include <algorithm> @@ -67,7 +68,7 @@ void ServerStanzaRouter::addClientSession(ServerSession* clientSession) { } void ServerStanzaRouter::removeClientSession(ServerSession* clientSession) { - clientSessions_.erase(std::remove(clientSessions_.begin(), clientSessions_.end(), clientSession), clientSessions_.end()); + erase(clientSessions_, clientSession); } } diff --git a/Swiften/Server/ServerStanzaRouter.h b/Swiften/Server/ServerStanzaRouter.h index 2a1960c..4a9493b 100644 --- a/Swiften/Server/ServerStanzaRouter.h +++ b/Swiften/Server/ServerStanzaRouter.h @@ -9,8 +9,8 @@ #include <boost/shared_ptr.hpp> #include <map> -#include "Swiften/JID/JID.h" -#include "Swiften/Elements/Stanza.h" +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/Stanza.h> namespace Swift { class ServerSession; diff --git a/Swiften/Server/SimpleUserRegistry.cpp b/Swiften/Server/SimpleUserRegistry.cpp index 2de28fe..a519ac2 100644 --- a/Swiften/Server/SimpleUserRegistry.cpp +++ b/Swiften/Server/SimpleUserRegistry.cpp @@ -4,20 +4,20 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Server/SimpleUserRegistry.h" +#include <Swiften/Server/SimpleUserRegistry.h> namespace Swift { SimpleUserRegistry::SimpleUserRegistry() { } -bool SimpleUserRegistry::isValidUserPassword(const JID& user, const std::string& password) const { - std::map<JID,std::string>::const_iterator i = users.find(user); +bool SimpleUserRegistry::isValidUserPassword(const JID& user, const SafeByteArray& password) const { + std::map<JID,SafeByteArray>::const_iterator i = users.find(user); return i != users.end() ? i->second == password : false; } void SimpleUserRegistry::addUser(const JID& user, const std::string& password) { - users.insert(std::make_pair(user, password)); + users.insert(std::make_pair(user, createSafeByteArray(password))); } } diff --git a/Swiften/Server/SimpleUserRegistry.h b/Swiften/Server/SimpleUserRegistry.h index 5de9f64..324c099 100644 --- a/Swiften/Server/SimpleUserRegistry.h +++ b/Swiften/Server/SimpleUserRegistry.h @@ -8,9 +8,9 @@ #include <map> -#include "Swiften/JID/JID.h" +#include <Swiften/JID/JID.h> #include <string> -#include "Swiften/Server/UserRegistry.h" +#include <Swiften/Server/UserRegistry.h> namespace Swift { @@ -19,10 +19,10 @@ namespace Swift { public: SimpleUserRegistry(); - virtual bool isValidUserPassword(const JID& user, const std::string& password) const; + virtual bool isValidUserPassword(const JID& user, const SafeByteArray& password) const; void addUser(const JID& user, const std::string& password); private: - std::map<JID, std::string> users; + std::map<JID, SafeByteArray> users; }; } diff --git a/Swiften/Server/UnitTest/ServerStanzaRouterTest.cpp b/Swiften/Server/UnitTest/ServerStanzaRouterTest.cpp index 0a5c7c1..0941665 100644 --- a/Swiften/Server/UnitTest/ServerStanzaRouterTest.cpp +++ b/Swiften/Server/UnitTest/ServerStanzaRouterTest.cpp @@ -7,9 +7,9 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include "Swiften/Elements/Message.h" -#include "Swiften/Server/ServerStanzaRouter.h" -#include "Swiften/Server/ServerSession.h" +#include <Swiften/Elements/Message.h> +#include <Swiften/Server/ServerStanzaRouter.h> +#include <Swiften/Server/ServerSession.h> using namespace Swift; diff --git a/Swiften/Server/UserRegistry.cpp b/Swiften/Server/UserRegistry.cpp index 0795f16..60bbb33 100644 --- a/Swiften/Server/UserRegistry.cpp +++ b/Swiften/Server/UserRegistry.cpp @@ -4,7 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Server/UserRegistry.h" +#include <Swiften/Server/UserRegistry.h> namespace Swift { diff --git a/Swiften/Server/UserRegistry.h b/Swiften/Server/UserRegistry.h index c021fc4..9584a7e 100644 --- a/Swiften/Server/UserRegistry.h +++ b/Swiften/Server/UserRegistry.h @@ -7,15 +7,15 @@ #pragma once #include <string> +#include <Swiften/Base/SafeByteArray.h> namespace Swift { - class JID; class UserRegistry { public: virtual ~UserRegistry(); - virtual bool isValidUserPassword(const JID& user, const std::string& password) const = 0; + virtual bool isValidUserPassword(const JID& user, const SafeByteArray& password) const = 0; }; } |