summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/ClientSession.cpp13
-rw-r--r--Swiften/Client/ClientSession.h3
-rw-r--r--Swiften/Elements/AuthSuccess.h5
-rw-r--r--Swiften/LinkLocal/IncomingLinkLocalSession.cpp1
-rw-r--r--Swiften/SASL/ClientAuthenticator.cpp11
-rw-r--r--Swiften/SASL/ClientAuthenticator.h43
-rw-r--r--Swiften/SASL/PLAINClientAuthenticator.cpp16
-rw-r--r--Swiften/SASL/PLAINClientAuthenticator.h13
-rw-r--r--Swiften/SASL/PLAINMessage.h2
-rw-r--r--Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp12
-rw-r--r--Swiften/SASL/SCRAMSHA1ClientAuthenticator.h11
-rw-r--r--Swiften/SASL/UnitTest/PLAINClientAuthenticatorTest.cpp35
-rw-r--r--Swiften/SConscript3
13 files changed, 149 insertions, 19 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index a95c058..06a7617 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -1,225 +1,232 @@
#include "Swiften/Client/ClientSession.h"
#include <boost/bind.hpp>
#include "Swiften/Elements/ProtocolHeader.h"
#include "Swiften/Elements/StreamFeatures.h"
#include "Swiften/Elements/StartTLSRequest.h"
#include "Swiften/Elements/StartTLSFailure.h"
#include "Swiften/Elements/TLSProceed.h"
#include "Swiften/Elements/AuthRequest.h"
#include "Swiften/Elements/AuthSuccess.h"
#include "Swiften/Elements/AuthFailure.h"
#include "Swiften/Elements/StartSession.h"
#include "Swiften/Elements/IQ.h"
#include "Swiften/Elements/ResourceBind.h"
-#include "Swiften/SASL/PLAINMessage.h"
+#include "Swiften/SASL/PLAINClientAuthenticator.h"
#include "Swiften/Session/SessionStream.h"
namespace Swift {
ClientSession::ClientSession(
const JID& jid,
boost::shared_ptr<SessionStream> stream) :
localJID(jid),
state(Initial),
stream(stream),
- needSessionStart(false) {
+ needSessionStart(false),
+ authenticator(NULL) {
}
void ClientSession::start() {
stream->onStreamStartReceived.connect(boost::bind(&ClientSession::handleStreamStart, shared_from_this(), _1));
stream->onElementReceived.connect(boost::bind(&ClientSession::handleElement, shared_from_this(), _1));
stream->onError.connect(boost::bind(&ClientSession::handleStreamError, shared_from_this(), _1));
stream->onTLSEncrypted.connect(boost::bind(&ClientSession::handleTLSEncrypted, shared_from_this()));
assert(state == Initial);
state = WaitingForStreamStart;
sendStreamHeader();
}
void ClientSession::sendStreamHeader() {
ProtocolHeader header;
header.setTo(getRemoteJID());
stream->writeHeader(header);
}
void ClientSession::sendElement(boost::shared_ptr<Element> element) {
stream->writeElement(element);
}
void ClientSession::handleStreamStart(const ProtocolHeader&) {
checkState(WaitingForStreamStart);
state = Negotiating;
}
void ClientSession::handleElement(boost::shared_ptr<Element> element) {
if (getState() == Initialized) {
onElementReceived(element);
}
else if (StreamFeatures* streamFeatures = dynamic_cast<StreamFeatures*>(element.get())) {
if (!checkState(Negotiating)) {
return;
}
if (streamFeatures->hasStartTLS() && stream->supportsTLSEncryption()) {
state = WaitingForEncrypt;
stream->writeElement(boost::shared_ptr<StartTLSRequest>(new StartTLSRequest()));
}
else if (streamFeatures->hasAuthenticationMechanisms()) {
if (stream->hasTLSCertificate()) {
if (streamFeatures->hasAuthenticationMechanism("EXTERNAL")) {
state = Authenticating;
stream->writeElement(boost::shared_ptr<Element>(new AuthRequest("EXTERNAL", "")));
}
else {
finishSession(Error::TLSClientCertificateError);
}
}
else if (streamFeatures->hasAuthenticationMechanism("PLAIN")) {
+ authenticator = new PLAINClientAuthenticator();
state = WaitingForCredentials;
onNeedCredentials();
}
else {
finishSession(Error::NoSupportedAuthMechanismsError);
}
}
else {
// Start the session
stream->setWhitespacePingEnabled(true);
if (streamFeatures->hasSession()) {
needSessionStart = true;
}
if (streamFeatures->hasResourceBind()) {
state = BindingResource;
boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind());
if (!localJID.getResource().isEmpty()) {
resourceBind->setResource(localJID.getResource());
}
stream->writeElement(IQ::createRequest(IQ::Set, JID(), "session-bind", resourceBind));
}
else if (needSessionStart) {
sendSessionStart();
}
else {
state = Initialized;
onInitialized();
}
}
}
else if (dynamic_cast<AuthSuccess*>(element.get())) {
checkState(Authenticating);
state = WaitingForStreamStart;
+ delete authenticator;
+ authenticator = NULL;
stream->resetXMPPParser();
sendStreamHeader();
}
else if (dynamic_cast<AuthFailure*>(element.get())) {
+ delete authenticator;
+ authenticator = NULL;
finishSession(Error::AuthenticationFailedError);
}
else if (dynamic_cast<TLSProceed*>(element.get())) {
checkState(WaitingForEncrypt);
state = Encrypting;
stream->addTLSEncryption();
}
else if (dynamic_cast<StartTLSFailure*>(element.get())) {
finishSession(Error::TLSError);
}
else if (IQ* iq = dynamic_cast<IQ*>(element.get())) {
if (state == BindingResource) {
boost::shared_ptr<ResourceBind> resourceBind(iq->getPayload<ResourceBind>());
if (iq->getType() == IQ::Error && iq->getID() == "session-bind") {
finishSession(Error::ResourceBindError);
}
else if (!resourceBind) {
finishSession(Error::UnexpectedElementError);
}
else if (iq->getType() == IQ::Result) {
localJID = resourceBind->getJID();
if (!localJID.isValid()) {
finishSession(Error::ResourceBindError);
}
if (needSessionStart) {
sendSessionStart();
}
else {
state = Initialized;
}
}
else {
finishSession(Error::UnexpectedElementError);
}
}
else if (state == StartingSession) {
if (iq->getType() == IQ::Result) {
state = Initialized;
onInitialized();
}
else if (iq->getType() == IQ::Error) {
finishSession(Error::SessionStartError);
}
else {
finishSession(Error::UnexpectedElementError);
}
}
else {
finishSession(Error::UnexpectedElementError);
}
}
else {
// FIXME Not correct?
state = Initialized;
onInitialized();
}
}
void ClientSession::sendSessionStart() {
state = StartingSession;
stream->writeElement(IQ::createRequest(IQ::Set, JID(), "session-start", boost::shared_ptr<StartSession>(new StartSession())));
}
bool ClientSession::checkState(State state) {
if (state != state) {
finishSession(Error::UnexpectedElementError);
return false;
}
return true;
}
void ClientSession::sendCredentials(const String& password) {
assert(WaitingForCredentials);
state = Authenticating;
- stream->writeElement(boost::shared_ptr<Element>(new AuthRequest("PLAIN", PLAINMessage(localJID.getNode(), password).getValue())));
+ authenticator->setCredentials(localJID.getNode(), password);
+ stream->writeElement(boost::shared_ptr<AuthRequest>(new AuthRequest(authenticator->getName(), authenticator->getResponse())));
}
void ClientSession::handleTLSEncrypted() {
checkState(WaitingForEncrypt);
state = WaitingForStreamStart;
stream->resetXMPPParser();
sendStreamHeader();
}
void ClientSession::handleStreamError(boost::shared_ptr<Swift::Error> error) {
finishSession(error);
}
void ClientSession::finish() {
if (stream->isAvailable()) {
stream->writeFooter();
}
finishSession(boost::shared_ptr<Error>());
}
void ClientSession::finishSession(Error::Type error) {
finishSession(boost::shared_ptr<Swift::ClientSession::Error>(new Swift::ClientSession::Error(error)));
}
void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) {
state = Finished;
stream->setWhitespacePingEnabled(false);
onFinished(error);
}
}
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index f980a9e..f3bc119 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.h
@@ -1,94 +1,97 @@
#pragma once
#include <boost/signal.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include "Swiften/Base/Error.h"
#include "Swiften/Session/SessionStream.h"
#include "Swiften/Session/BasicSessionStream.h"
#include "Swiften/Base/String.h"
#include "Swiften/JID/JID.h"
#include "Swiften/Elements/Element.h"
namespace Swift {
+ class ClientAuthenticator;
+
class ClientSession : public boost::enable_shared_from_this<ClientSession> {
public:
enum State {
Initial,
WaitingForStreamStart,
Negotiating,
Compressing,
WaitingForEncrypt,
Encrypting,
WaitingForCredentials,
Authenticating,
BindingResource,
StartingSession,
Initialized,
Finished
};
struct Error : public Swift::Error {
enum Type {
AuthenticationFailedError,
NoSupportedAuthMechanismsError,
UnexpectedElementError,
ResourceBindError,
SessionStartError,
TLSClientCertificateError,
TLSError,
} type;
Error(Type type) : type(type) {}
};
static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream) {
return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream));
}
State getState() const {
return state;
}
void start();
void finish();
void sendCredentials(const String& password);
void sendElement(boost::shared_ptr<Element> element);
public:
boost::signal<void ()> onNeedCredentials;
boost::signal<void ()> onInitialized;
boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
private:
ClientSession(
const JID& jid,
boost::shared_ptr<SessionStream>);
void finishSession(Error::Type error);
void finishSession(boost::shared_ptr<Swift::Error> error);
JID getRemoteJID() const {
return JID("", localJID.getDomain());
}
void sendStreamHeader();
void sendSessionStart();
void handleElement(boost::shared_ptr<Element>);
void handleStreamStart(const ProtocolHeader&);
void handleStreamError(boost::shared_ptr<Swift::Error>);
void handleTLSEncrypted();
bool checkState(State);
private:
JID localJID;
State state;
boost::shared_ptr<SessionStream> stream;
bool needSessionStart;
+ ClientAuthenticator* authenticator;
};
}
diff --git a/Swiften/Elements/AuthSuccess.h b/Swiften/Elements/AuthSuccess.h
index f63d0a8..da4d798 100644
--- a/Swiften/Elements/AuthSuccess.h
+++ b/Swiften/Elements/AuthSuccess.h
@@ -1,13 +1,10 @@
-#ifndef SWIFTEN_AuthSuccess_H
-#define SWIFTEN_AuthSuccess_H
+#pragma once
#include "Swiften/Elements/Element.h"
namespace Swift {
class AuthSuccess : public Element {
public:
AuthSuccess() {}
};
}
-
-#endif
diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp
index 4c3a681..77910e6 100644
--- a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp
+++ b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp
@@ -1,60 +1,59 @@
#include "Swiften/LinkLocal/IncomingLinkLocalSession.h"
#include <boost/bind.hpp>
#include "Swiften/Elements/ProtocolHeader.h"
#include "Swiften/Network/Connection.h"
#include "Swiften/StreamStack/StreamStack.h"
#include "Swiften/StreamStack/ConnectionLayer.h"
#include "Swiften/StreamStack/XMPPLayer.h"
#include "Swiften/Elements/StreamFeatures.h"
#include "Swiften/Elements/IQ.h"
-#include "Swiften/SASL/PLAINMessage.h"
namespace Swift {
IncomingLinkLocalSession::IncomingLinkLocalSession(
const JID& localJID,
boost::shared_ptr<Connection> connection,
PayloadParserFactoryCollection* payloadParserFactories,
PayloadSerializerCollection* payloadSerializers) :
Session(connection, payloadParserFactories, payloadSerializers),
initialized(false) {
setLocalJID(localJID);
}
void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingHeader) {
setRemoteJID(JID(incomingHeader.getFrom()));
if (!getRemoteJID().isValid()) {
finishSession();
return;
}
ProtocolHeader header;
header.setFrom(getLocalJID());
getXMPPLayer()->writeHeader(header);
if (incomingHeader.getVersion() == "1.0") {
getXMPPLayer()->writeElement(boost::shared_ptr<StreamFeatures>(new StreamFeatures()));
}
else {
setInitialized();
}
}
void IncomingLinkLocalSession::handleElement(boost::shared_ptr<Element> element) {
boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element);
// If we get our first stanza before streamfeatures, our session is implicitly
// initialized
if (stanza && !isInitialized()) {
setInitialized();
}
onElementReceived(element);
}
void IncomingLinkLocalSession::setInitialized() {
initialized = true;
onSessionStarted();
}
diff --git a/Swiften/SASL/ClientAuthenticator.cpp b/Swiften/SASL/ClientAuthenticator.cpp
new file mode 100644
index 0000000..5fc9e85
--- /dev/null
+++ b/Swiften/SASL/ClientAuthenticator.cpp
@@ -0,0 +1,11 @@
+#include "Swiften/SASL/ClientAuthenticator.h"
+
+namespace Swift {
+
+ClientAuthenticator::ClientAuthenticator(const String& name) : name(name) {
+}
+
+ClientAuthenticator::~ClientAuthenticator() {
+}
+
+}
diff --git a/Swiften/SASL/ClientAuthenticator.h b/Swiften/SASL/ClientAuthenticator.h
new file mode 100644
index 0000000..f42a51e
--- /dev/null
+++ b/Swiften/SASL/ClientAuthenticator.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "Swiften/Base/String.h"
+#include "Swiften/Base/ByteArray.h"
+
+namespace Swift {
+ class ClientAuthenticator {
+ public:
+ ClientAuthenticator(const String& name);
+ virtual ~ClientAuthenticator();
+
+ const String& getName() const {
+ return name;
+ }
+
+ void setCredentials(const String& authcid, const String& password, const String& authzid = String()) {
+ this->authcid = authcid;
+ this->password = password;
+ this->authzid = authzid;
+ }
+
+ virtual ByteArray getResponse() const = 0;
+ virtual bool setChallenge(const ByteArray&) = 0;
+
+ const String& getAuthenticationID() const {
+ return authcid;
+ }
+
+ const String& getAuthorizationID() const {
+ return authzid;
+ }
+
+ const String& getPassword() const {
+ return password;
+ }
+
+ private:
+ String name;
+ String authcid;
+ String password;
+ String authzid;
+ };
+}
diff --git a/Swiften/SASL/PLAINClientAuthenticator.cpp b/Swiften/SASL/PLAINClientAuthenticator.cpp
new file mode 100644
index 0000000..8f88c3c
--- /dev/null
+++ b/Swiften/SASL/PLAINClientAuthenticator.cpp
@@ -0,0 +1,16 @@
+#include "Swiften/SASL/PLAINClientAuthenticator.h"
+
+namespace Swift {
+
+PLAINClientAuthenticator::PLAINClientAuthenticator() : ClientAuthenticator("PLAIN") {
+}
+
+ByteArray PLAINClientAuthenticator::getResponse() const {
+ return ByteArray(getAuthorizationID()) + '\0' + ByteArray(getAuthenticationID()) + '\0' + ByteArray(getPassword());
+}
+
+bool PLAINClientAuthenticator::setChallenge(const ByteArray&) {
+ return true;
+}
+
+}
diff --git a/Swiften/SASL/PLAINClientAuthenticator.h b/Swiften/SASL/PLAINClientAuthenticator.h
new file mode 100644
index 0000000..854eb30
--- /dev/null
+++ b/Swiften/SASL/PLAINClientAuthenticator.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "Swiften/SASL/ClientAuthenticator.h"
+
+namespace Swift {
+ class PLAINClientAuthenticator : public ClientAuthenticator {
+ public:
+ PLAINClientAuthenticator();
+
+ virtual ByteArray getResponse() const;
+ virtual bool setChallenge(const ByteArray&);
+ };
+}
diff --git a/Swiften/SASL/PLAINMessage.h b/Swiften/SASL/PLAINMessage.h
index 76de4f5..dd5e2ee 100644
--- a/Swiften/SASL/PLAINMessage.h
+++ b/Swiften/SASL/PLAINMessage.h
@@ -1,31 +1,33 @@
+// TODO: Get rid of this
+//
#pragma once
#include "Swiften/Base/String.h"
#include "Swiften/Base/ByteArray.h"
namespace Swift {
class PLAINMessage {
public:
PLAINMessage(const String& authcid, const String& password, const String& authzid = "");
PLAINMessage(const ByteArray& value);
ByteArray getValue() const;
const String& getAuthenticationID() const {
return authcid;
}
const String& getPassword() const {
return password;
}
const String& getAuthorizationID() const {
return authzid;
}
private:
String authcid;
String authzid;
String password;
};
}
diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
index b2e85e9..3109f56 100644
--- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
+++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
@@ -1,56 +1,56 @@
#include "Swiften/SASL/SCRAMSHA1ClientAuthenticator.h"
#include <cassert>
#include "Swiften/StringCodecs/SHA1.h"
#include "Swiften/StringCodecs/HMACSHA1.h"
namespace Swift {
-SCRAMSHA1ClientAuthenticator::SCRAMSHA1ClientAuthenticator(const String& authcid, const String& password, const String& authzid, const ByteArray& nonce) : step(Initial), authcid(authcid), password(password), authzid(authzid), clientnonce(nonce) {
+SCRAMSHA1ClientAuthenticator::SCRAMSHA1ClientAuthenticator(const ByteArray& nonce) : ClientAuthenticator("SCRAM-SHA1"), step(Initial), clientnonce(nonce) {
}
-ByteArray SCRAMSHA1ClientAuthenticator::getMessage() const {
+ByteArray SCRAMSHA1ClientAuthenticator::getResponse() const {
if (step == Initial) {
return getInitialClientMessage();
}
else {
ByteArray mask = HMACSHA1::getResult(getClientVerifier(), initialServerMessage + getInitialClientMessage());
- ByteArray p = SHA1::getBinaryHash(password);
+ ByteArray p = SHA1::getBinaryHash(getPassword());
for (unsigned int i = 0; i < p.getSize(); ++i) {
p[i] ^= mask[i];
}
return p;
}
}
-bool SCRAMSHA1ClientAuthenticator::setResponse(const ByteArray& response) {
+bool SCRAMSHA1ClientAuthenticator::setChallenge(const ByteArray& response) {
if (step == Initial) {
initialServerMessage = response;
step = Proof;
return getSalt().getSize() > 0;
}
else {
return response == HMACSHA1::getResult(getClientVerifier(), getInitialClientMessage() + initialServerMessage);
}
}
ByteArray SCRAMSHA1ClientAuthenticator::getSalt() const {
if (initialServerMessage.getSize() < 8) {
std::cerr << "ERROR: SCRAM-SHA1: Invalid server response" << std::endl;
return ByteArray();
}
else {
return ByteArray(initialServerMessage.getData(), 8);
}
}
ByteArray SCRAMSHA1ClientAuthenticator::getClientVerifier() const {
- return HMACSHA1::getResult(SHA1::getBinaryHash(password), getSalt());
+ return HMACSHA1::getResult(SHA1::getBinaryHash(getPassword()), getSalt());
}
ByteArray SCRAMSHA1ClientAuthenticator::getInitialClientMessage() const {
- return ByteArray(authzid) + '\0' + ByteArray(authcid) + '\0' + ByteArray(clientnonce);
+ return ByteArray(getAuthorizationID()) + '\0' + ByteArray(getAuthenticationID()) + '\0' + ByteArray(clientnonce);
}
}
diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h
index d129468..161afd1 100644
--- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h
+++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.h
@@ -1,30 +1,31 @@
#pragma once
#include "Swiften/Base/String.h"
#include "Swiften/Base/ByteArray.h"
+#include "Swiften/SASL/ClientAuthenticator.h"
namespace Swift {
- class SCRAMSHA1ClientAuthenticator {
+ class SCRAMSHA1ClientAuthenticator : public ClientAuthenticator {
public:
- SCRAMSHA1ClientAuthenticator(const String& authcid, const String& password, const String& authzid, const ByteArray& nonce);
-
- ByteArray getMessage() const;
- bool setResponse(const ByteArray&);
+ SCRAMSHA1ClientAuthenticator(const ByteArray& nonce);
+
+ ByteArray getResponse() const;
+ bool setChallenge(const ByteArray&);
private:
ByteArray getInitialClientMessage() const;
ByteArray getSalt() const;
ByteArray getClientVerifier() const;
private:
enum Step {
Initial,
Proof
} step;
String authcid;
String password;
String authzid;
ByteArray clientnonce;
ByteArray initialServerMessage;
};
}
diff --git a/Swiften/SASL/UnitTest/PLAINClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/PLAINClientAuthenticatorTest.cpp
new file mode 100644
index 0000000..b83e1f5
--- /dev/null
+++ b/Swiften/SASL/UnitTest/PLAINClientAuthenticatorTest.cpp
@@ -0,0 +1,35 @@
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include "Swiften/SASL/PLAINClientAuthenticator.h"
+
+using namespace Swift;
+
+class PLAINClientAuthenticatorTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(PLAINClientAuthenticatorTest);
+ CPPUNIT_TEST(testGetResponse_WithoutAuthzID);
+ CPPUNIT_TEST(testGetResponse_WithAuthzID);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ PLAINClientAuthenticatorTest() {}
+
+ void testGetResponse_WithoutAuthzID() {
+ PLAINClientAuthenticator testling;
+
+ testling.setCredentials("user", "pass");
+
+ CPPUNIT_ASSERT_EQUAL(testling.getResponse(), ByteArray("\0user\0pass", 10));
+ }
+
+ void testGetResponse_WithAuthzID() {
+ PLAINClientAuthenticator testling;
+
+ testling.setCredentials("user", "pass", "authz");
+
+ CPPUNIT_ASSERT_EQUAL(testling.getResponse(), ByteArray("authz\0user\0pass", 15));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PLAINClientAuthenticatorTest);
diff --git a/Swiften/SConscript b/Swiften/SConscript
index be0af24..a5ef56d 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -1,92 +1,94 @@
Import("env")
env["SWIFTEN_FLAGS"] = {
"LIBPATH": [Dir(".")],
"LIBS": ["Swiften"]
}
swiften_env = env.Clone()
swiften_env.MergeFlags(swiften_env["BOOST_FLAGS"])
Export("swiften_env")
# TODO: Move all this to a submodule SConscript
myenv = swiften_env.Clone()
myenv.MergeFlags(myenv["ZLIB_FLAGS"])
myenv.MergeFlags(myenv["OPENSSL_FLAGS"])
sources = [
"Avatars/AvatarFileStorage.cpp",
"Avatars/AvatarManager.cpp",
"Avatars/AvatarStorage.cpp",
"Client/Client.cpp",
"Client/ClientSession.cpp",
"Compress/ZLibCodecompressor.cpp",
"Disco/CapsInfoGenerator.cpp",
"Elements/DiscoInfo.cpp",
"Elements/Element.cpp",
"Elements/IQ.cpp",
"Elements/MUCPayload.cpp",
"Elements/Payload.cpp",
"Elements/RosterPayload.cpp",
"Elements/Stanza.cpp",
"MUC/MUC.cpp",
"MUC/MUCOccupant.cpp",
"MUC/MUCRegistry.cpp",
"Notifier/Notifier.cpp",
"Presence/PresenceOracle.cpp",
"Queries/IQChannel.cpp",
"Queries/IQHandler.cpp",
"Queries/IQRouter.cpp",
"Queries/Request.cpp",
"Queries/Responders/DiscoInfoResponder.cpp",
"Queries/Responders/SoftwareVersionResponder.cpp",
"Roster/ContactRosterItem.cpp",
"Roster/Roster.cpp",
"Roster/XMPPRoster.cpp",
+ "SASL/ClientAuthenticator.cpp",
+ "SASL/PLAINClientAuthenticator.cpp",
"SASL/PLAINMessage.cpp",
"SASL/SCRAMSHA1ClientAuthenticator.cpp",
"Serializer/AuthRequestSerializer.cpp",
"Serializer/CompressRequestSerializer.cpp",
"Serializer/ElementSerializer.cpp",
"Serializer/MessageSerializer.cpp",
"Serializer/PayloadSerializer.cpp",
"Serializer/PayloadSerializerCollection.cpp",
"Serializer/PayloadSerializers/CapsInfoSerializer.cpp",
"Serializer/PayloadSerializers/DiscoInfoSerializer.cpp",
"Serializer/PayloadSerializers/ErrorSerializer.cpp",
"Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp",
"Serializer/PayloadSerializers/MUCPayloadSerializer.cpp",
"Serializer/PayloadSerializers/ResourceBindSerializer.cpp",
"Serializer/PayloadSerializers/RosterSerializer.cpp",
"Serializer/PayloadSerializers/SecurityLabelSerializer.cpp",
"Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp",
"Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp",
"Serializer/PayloadSerializers/VCardSerializer.cpp",
"Serializer/PayloadSerializers/VCardUpdateSerializer.cpp",
"Serializer/PayloadSerializers/StorageSerializer.cpp",
"Serializer/PayloadSerializers/PrivateStorageSerializer.cpp",
"Serializer/PresenceSerializer.cpp",
"Serializer/StanzaSerializer.cpp",
"Serializer/StreamFeaturesSerializer.cpp",
"Serializer/XML/XMLElement.cpp",
"Serializer/XML/XMLNode.cpp",
"Serializer/XMPPSerializer.cpp",
"Server/ServerFromClientSession.cpp",
"Server/ServerSession.cpp",
"Server/ServerStanzaRouter.cpp",
"Server/SimpleUserRegistry.cpp",
"Server/UserRegistry.cpp",
"Session/Session.cpp",
"Session/SessionStream.cpp",
"Session/BasicSessionStream.cpp",
"StringCodecs/Base64.cpp",
"StringCodecs/SHA1.cpp",
"StringCodecs/HMACSHA1.cpp",
]
# "Notifier/GrowlNotifier.cpp",
if myenv.get("HAVE_OPENSSL", 0) :
sources += ["TLS/OpenSSL/OpenSSLContext.cpp"]
SConscript(dirs = [
"Base",
"Application",
@@ -114,72 +116,73 @@ env.Append(UNITTEST_SOURCES = [
File("Elements/UnitTest/IQTest.cpp"),
File("Elements/UnitTest/StanzaTest.cpp"),
File("Elements/UnitTest/StanzasTest.cpp"),
File("EventLoop/UnitTest/EventLoopTest.cpp"),
File("EventLoop/UnitTest/SimpleEventLoopTest.cpp"),
File("History/UnitTest/SQLiteHistoryManagerTest.cpp"),
File("JID/UnitTest/JIDTest.cpp"),
File("LinkLocal/UnitTest/LinkLocalConnectorTest.cpp"),
File("LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp"),
File("LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp"),
File("LinkLocal/UnitTest/LinkLocalServiceTest.cpp"),
File("Network/UnitTest/HostAddressTest.cpp"),
File("Network/UnitTest/ConnectorTest.cpp"),
File("Parser/PayloadParsers/UnitTest/BodyParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/RosterParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/StatusParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/VCardParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/StorageParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp"),
File("Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp"),
File("Parser/UnitTest/AttributeMapTest.cpp"),
File("Parser/UnitTest/IQParserTest.cpp"),
File("Parser/UnitTest/MessageParserTest.cpp"),
File("Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp"),
File("Parser/UnitTest/PresenceParserTest.cpp"),
File("Parser/UnitTest/SerializingParserTest.cpp"),
File("Parser/UnitTest/StanzaParserTest.cpp"),
File("Parser/UnitTest/StreamFeaturesParserTest.cpp"),
File("Parser/UnitTest/XMLParserTest.cpp"),
File("Parser/UnitTest/XMPPParserTest.cpp"),
File("Presence/UnitTest/PresenceOracleTest.cpp"),
File("Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp"),
File("Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp"),
File("Queries/UnitTest/IQRouterTest.cpp"),
File("Queries/UnitTest/RequestTest.cpp"),
File("Queries/UnitTest/ResponderTest.cpp"),
File("Roster/UnitTest/OfflineRosterFilterTest.cpp"),
File("Roster/UnitTest/RosterTest.cpp"),
File("SASL/UnitTest/PLAINMessageTest.cpp"),
+ File("SASL/UnitTest/PLAINClientAuthenticatorTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp"),
File("Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp"),
File("Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp"),
File("Serializer/UnitTest/StreamFeaturesSerializerTest.cpp"),
File("Serializer/XML/UnitTest/XMLElementTest.cpp"),
File("Server/UnitTest/ServerStanzaRouterTest.cpp"),
File("StreamStack/UnitTest/StreamStackTest.cpp"),
File("StreamStack/UnitTest/XMPPLayerTest.cpp"),
File("StringCodecs/UnitTest/Base64Test.cpp"),
File("StringCodecs/UnitTest/SHA1Test.cpp"),
File("StringCodecs/UnitTest/HMACSHA1Test.cpp"),
])