summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Limber/Server')
-rw-r--r--Limber/Server/ServerFromClientSession.cpp2
-rw-r--r--Limber/Server/ServerFromClientSession.h10
-rw-r--r--Limber/Server/ServerSession.h2
-rw-r--r--Limber/Server/ServerStanzaRouter.cpp3
-rw-r--r--Limber/Server/ServerStanzaRouter.h4
-rw-r--r--Limber/Server/SimpleUserRegistry.cpp6
-rw-r--r--Limber/Server/SimpleUserRegistry.h6
-rw-r--r--Limber/Server/UserRegistry.h4
8 files changed, 19 insertions, 18 deletions
diff --git a/Limber/Server/ServerFromClientSession.cpp b/Limber/Server/ServerFromClientSession.cpp
index b51a53f..3a37c65 100644
--- a/Limber/Server/ServerFromClientSession.cpp
+++ b/Limber/Server/ServerFromClientSession.cpp
@@ -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/Limber/Server/ServerFromClientSession.h b/Limber/Server/ServerFromClientSession.h
index 80ef063..1a0e109 100644
--- a/Limber/Server/ServerFromClientSession.h
+++ b/Limber/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/Limber/Server/ServerSession.h b/Limber/Server/ServerSession.h
index bd4ab6d..486ebaa 100644
--- a/Limber/Server/ServerSession.h
+++ b/Limber/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/Limber/Server/ServerStanzaRouter.cpp b/Limber/Server/ServerStanzaRouter.cpp
index fec529f..ea695e3 100644
--- a/Limber/Server/ServerStanzaRouter.cpp
+++ b/Limber/Server/ServerStanzaRouter.cpp
@@ -9,6 +9,7 @@
#include <cassert>
#include <algorithm>
+#include <Swiften/Base/Algorithm.h>
namespace Swift {
@@ -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/Limber/Server/ServerStanzaRouter.h b/Limber/Server/ServerStanzaRouter.h
index 2a1960c..4a9493b 100644
--- a/Limber/Server/ServerStanzaRouter.h
+++ b/Limber/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/Limber/Server/SimpleUserRegistry.cpp b/Limber/Server/SimpleUserRegistry.cpp
index 5b7329a..9ae6fd5 100644
--- a/Limber/Server/SimpleUserRegistry.cpp
+++ b/Limber/Server/SimpleUserRegistry.cpp
@@ -11,13 +11,13 @@ 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/Limber/Server/SimpleUserRegistry.h b/Limber/Server/SimpleUserRegistry.h
index 677d006..280bfce 100644
--- a/Limber/Server/SimpleUserRegistry.h
+++ b/Limber/Server/SimpleUserRegistry.h
@@ -8,7 +8,7 @@
#include <map>
-#include "Swiften/JID/JID.h"
+#include <Swiften/JID/JID.h>
#include <string>
#include "Limber/Server/UserRegistry.h"
@@ -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/Limber/Server/UserRegistry.h b/Limber/Server/UserRegistry.h
index c021fc4..9584a7e 100644
--- a/Limber/Server/UserRegistry.h
+++ b/Limber/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;
};
}